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