svn-gvsig-desktop / branches / v2_0_0_prep / applications / appgvSIG / src / org / gvsig / app / gui / panels / ProjChooserPanel.java @ 36443
History | View | Annotate | Download (3.21 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 |
import org.gvsig.andami.PluginServices; |
13 |
import org.gvsig.app.gui.panels.crs.ICrsUIFactory; |
14 |
import org.gvsig.app.gui.panels.crs.ISelectCrsPanel; |
15 |
import org.gvsig.app.project.documents.view.info.gui.CSSelectionDialog; |
16 |
import org.gvsig.gui.beans.swing.JButton; |
17 |
|
18 |
|
19 |
/**
|
20 |
* @author Luis W. Sevilla (sevilla_lui@gva.es)
|
21 |
*/
|
22 |
public class ProjChooserPanel extends CRSSelectPanel { |
23 |
private IProjection curProj=null; |
24 |
private JLabel jLblProj = null; |
25 |
private JLabel jLblProjName = null; |
26 |
private JButton jBtnChangeProj = null; |
27 |
private JPanel jPanelProj = null; |
28 |
private boolean okPressed = false; |
29 |
|
30 |
/**
|
31 |
*
|
32 |
*/
|
33 |
public ProjChooserPanel(IProjection proj) {
|
34 |
super(proj);
|
35 |
setCurProj(proj); |
36 |
initialize(); |
37 |
} |
38 |
|
39 |
/**
|
40 |
* This method initializes this
|
41 |
*
|
42 |
* @return void
|
43 |
*/
|
44 |
private void initialize() { |
45 |
this.setLayout(new FlowLayout(FlowLayout.LEFT, 15, 0)); |
46 |
setPreferredSize(new java.awt.Dimension(330,35)); |
47 |
this.setSize(new java.awt.Dimension(330,23)); |
48 |
this.add(getJLblProjName(), null); |
49 |
this.add(getJLblProj(), null); |
50 |
this.add(getJBtnChangeProj(), null); |
51 |
initBtnChangeProj(); |
52 |
} |
53 |
|
54 |
private void initBtnChangeProj() { |
55 |
getJBtnChangeProj().addActionListener(new java.awt.event.ActionListener() {
|
56 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
57 |
okPressed = false;
|
58 |
|
59 |
ISelectCrsPanel csSelect = 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,"__proyeccion_actual")); //$NON-NLS-1$ |
79 |
} |
80 |
return jLblProjName;
|
81 |
} |
82 |
|
83 |
public JLabel getJLabel() { |
84 |
return getJLblProjName();
|
85 |
} |
86 |
|
87 |
public JLabel getJLblProj() { |
88 |
if (jLblProj == null) { |
89 |
jLblProj = new JLabel(); |
90 |
if (curProj!=null) |
91 |
jLblProj.setText(curProj.getAbrev()); |
92 |
} |
93 |
return jLblProj;
|
94 |
} |
95 |
public void addBtnChangeProjActionListener(java.awt.event.ActionListener al) { |
96 |
jBtnChangeProj.addActionListener(al); |
97 |
} |
98 |
|
99 |
/**
|
100 |
* This method initializes jButton
|
101 |
*
|
102 |
* @return javax.swing.JButton
|
103 |
*/
|
104 |
public JButton getJBtnChangeProj() { |
105 |
if (jBtnChangeProj == null) { |
106 |
jBtnChangeProj = new JButton(); |
107 |
jBtnChangeProj.setText("..."); //$NON-NLS-1$ |
108 |
jBtnChangeProj.setPreferredSize(new java.awt.Dimension(26,26)); |
109 |
} |
110 |
return jBtnChangeProj;
|
111 |
} |
112 |
/**
|
113 |
* @return Returns the curProj.
|
114 |
*/
|
115 |
public IProjection getCurProj() {
|
116 |
return curProj;
|
117 |
} |
118 |
/**
|
119 |
* @param curProj The curProj to set.
|
120 |
*/
|
121 |
public void setCurProj(IProjection curProj) { |
122 |
this.curProj = curProj;
|
123 |
} |
124 |
/**
|
125 |
* @return Returns the okPressed.
|
126 |
*/
|
127 |
public boolean isOkPressed() { |
128 |
return okPressed;
|
129 |
} |
130 |
} // @jve:decl-index=0:visual-constraint="10,10"
|