root / trunk / applications / appgvSIG / src / com / iver / cit / gvsig / gui / panels / ProjChooserPanel.java @ 7738
History | View | Annotate | Download (3.21 KB)
1 |
/*
|
---|---|
2 |
* Created on 30-ene-2005
|
3 |
*/
|
4 |
package com.iver.cit.gvsig.gui.panels; |
5 |
|
6 |
import java.awt.FlowLayout; |
7 |
import java.awt.event.ActionListener; |
8 |
|
9 |
import javax.swing.JLabel; |
10 |
import javax.swing.JPanel; |
11 |
|
12 |
import org.cresques.cts.IProjection; |
13 |
import org.gvsig.gui.beans.swing.JButton; |
14 |
|
15 |
import com.iver.andami.PluginServices; |
16 |
import com.iver.cit.gvsig.project.documents.view.info.gui.CSSelectionDialog; |
17 |
|
18 |
/**
|
19 |
* @author Luis W. Sevilla (sevilla_lui@gva.es)
|
20 |
*/
|
21 |
public class ProjChooserPanel extends JPanel { |
22 |
private IProjection curProj=null; |
23 |
private JLabel jLblProj = null; |
24 |
private JLabel jLblProjName = null; |
25 |
private JButton jBtnChangeProj = null; |
26 |
private JPanel jPanelProj = null; |
27 |
private boolean okPressed = false; |
28 |
|
29 |
private ActionListener actionListener = null; |
30 |
|
31 |
/**
|
32 |
*
|
33 |
*/
|
34 |
public ProjChooserPanel(IProjection proj) {
|
35 |
super();
|
36 |
setCurProj(proj); |
37 |
initialize(); |
38 |
} |
39 |
|
40 |
/**
|
41 |
* This method initializes this
|
42 |
*
|
43 |
* @return void
|
44 |
*/
|
45 |
private void initialize() { |
46 |
this.setLayout(new FlowLayout(FlowLayout.LEFT, 15, 0)); |
47 |
setPreferredSize(new java.awt.Dimension(330,35)); |
48 |
this.setSize(new java.awt.Dimension(330,23)); |
49 |
this.add(getJLblProjName(), null); |
50 |
this.add(getJLblProj(), null); |
51 |
this.add(getJBtnChangeProj(), null); |
52 |
initBtnChangeProj(); |
53 |
} |
54 |
|
55 |
private void initBtnChangeProj() { |
56 |
getJBtnChangeProj().addActionListener(new java.awt.event.ActionListener() {
|
57 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
58 |
okPressed = false;
|
59 |
CSSelectionDialog csSelect = new CSSelectionDialog();
|
60 |
csSelect.setProjection(curProj); |
61 |
|
62 |
PluginServices.getMDIManager().addWindow(csSelect); |
63 |
|
64 |
if (csSelect.isOkPressed()) {
|
65 |
curProj = csSelect.getProjection(); |
66 |
jLblProj.setText(curProj.getAbrev()); |
67 |
okPressed = true;
|
68 |
if (actionListener != null) { |
69 |
actionListener.actionPerformed(e); |
70 |
} |
71 |
} |
72 |
} |
73 |
}); |
74 |
} |
75 |
|
76 |
public JLabel getJLblProjName() { |
77 |
if (jLblProjName == null) { |
78 |
jLblProjName = new JLabel("Proyeccion actual"); |
79 |
jLblProjName.setText(PluginServices.getText(this,"__proyeccion_actual")); //$NON-NLS-1$ |
80 |
} |
81 |
return jLblProjName;
|
82 |
} |
83 |
|
84 |
public JLabel getJLblProj() { |
85 |
if (jLblProj == null) { |
86 |
jLblProj = new JLabel(); |
87 |
jLblProj.setText(curProj.getAbrev()); |
88 |
} |
89 |
return jLblProj;
|
90 |
} |
91 |
public void addBtnChangeProjActionListener(java.awt.event.ActionListener al) { |
92 |
jBtnChangeProj.addActionListener(al); |
93 |
} |
94 |
|
95 |
/**
|
96 |
* This method initializes jButton
|
97 |
*
|
98 |
* @return javax.swing.JButton
|
99 |
*/
|
100 |
public JButton getJBtnChangeProj() { |
101 |
if (jBtnChangeProj == null) { |
102 |
jBtnChangeProj = new JButton(); |
103 |
jBtnChangeProj.setText("..."); //$NON-NLS-1$ |
104 |
} |
105 |
return jBtnChangeProj;
|
106 |
} |
107 |
/**
|
108 |
* @return Returns the curProj.
|
109 |
*/
|
110 |
public IProjection getCurProj() {
|
111 |
return curProj;
|
112 |
} |
113 |
/**
|
114 |
* @param curProj The curProj to set.
|
115 |
*/
|
116 |
public void setCurProj(IProjection curProj) { |
117 |
this.curProj = curProj;
|
118 |
} |
119 |
/**
|
120 |
* @return Returns the okPressed.
|
121 |
*/
|
122 |
public boolean isOkPressed() { |
123 |
return okPressed;
|
124 |
} |
125 |
/**
|
126 |
* @param actionListener The actionListener to set.
|
127 |
*/
|
128 |
public void addActionListener(ActionListener actionListener) { |
129 |
this.actionListener = actionListener;
|
130 |
} |
131 |
} // @jve:decl-index=0:visual-constraint="10,10"
|