svn-gvsig-desktop / branches / v10 / applications / appgvSIG / src / com / iver / cit / gvsig / gui / panels / ProjChooserPanel.java @ 8900
History | View | Annotate | Download (3.1 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 |
|
10 |
import org.cresques.cts.IProjection; |
11 |
import org.gvsig.gui.beans.swing.JButton; |
12 |
|
13 |
import com.iver.andami.PluginServices; |
14 |
import com.iver.cit.gvsig.project.documents.view.info.gui.CSSelectionDialog; |
15 |
|
16 |
/**
|
17 |
* @author Luis W. Sevilla (sevilla_lui@gva.es)
|
18 |
*/
|
19 |
public class ProjChooserPanel extends CRSSelectPanel { |
20 |
/**
|
21 |
*
|
22 |
*/
|
23 |
private static final long serialVersionUID = 1L; |
24 |
private IProjection curProj=null; |
25 |
private JLabel jLblProj = null; |
26 |
private JLabel jLblProjName = null; |
27 |
private JButton jBtnChangeProj = 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 |
CSSelectionDialog csSelect = new CSSelectionDialog();
|
59 |
csSelect.setProjection(curProj); |
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 |
jLblProj.setText(curProj.getAbrev()); |
91 |
} |
92 |
return jLblProj;
|
93 |
} |
94 |
public void addBtnChangeProjActionListener(java.awt.event.ActionListener al) { |
95 |
jBtnChangeProj.addActionListener(al); |
96 |
} |
97 |
|
98 |
/**
|
99 |
* This method initializes jButton
|
100 |
*
|
101 |
* @return javax.swing.JButton
|
102 |
*/
|
103 |
public JButton getJBtnChangeProj() { |
104 |
if (jBtnChangeProj == null) { |
105 |
jBtnChangeProj = new JButton(); |
106 |
jBtnChangeProj.setText("..."); //$NON-NLS-1$ |
107 |
jBtnChangeProj.setPreferredSize(new java.awt.Dimension(26,26)); |
108 |
} |
109 |
return jBtnChangeProj;
|
110 |
} |
111 |
/**
|
112 |
* @return Returns the curProj.
|
113 |
*/
|
114 |
public IProjection getCurProj() {
|
115 |
return curProj;
|
116 |
} |
117 |
/**
|
118 |
* @param curProj The curProj to set.
|
119 |
*/
|
120 |
public void setCurProj(IProjection curProj) { |
121 |
this.curProj = curProj;
|
122 |
} |
123 |
/**
|
124 |
* @return Returns the okPressed.
|
125 |
*/
|
126 |
public boolean isOkPressed() { |
127 |
return okPressed;
|
128 |
} |
129 |
} // @jve:decl-index=0:visual-constraint="10,10"
|