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