root / branches / v2_0_0_prep / applications / appgvSIG / src / org / gvsig / app / gui / panels / ProjChooserPanel.java @ 38564
History | View | Annotate | Download (3.52 KB)
1 | 6117 | jaume | /*
|
---|---|---|---|
2 | * Created on 30-ene-2005
|
||
3 | */
|
||
4 | 29596 | jpiera | package org.gvsig.app.gui.panels; |
5 | 6117 | jaume | |
6 | 7738 | jaume | import java.awt.FlowLayout; |
7 | 6117 | jaume | |
8 | import javax.swing.JLabel; |
||
9 | import javax.swing.JPanel; |
||
10 | |||
11 | import org.cresques.cts.IProjection; |
||
12 | 38112 | cordinyana | |
13 | 29596 | jpiera | import org.gvsig.andami.PluginServices; |
14 | import org.gvsig.app.gui.panels.crs.ISelectCrsPanel; |
||
15 | 6119 | jaume | import org.gvsig.gui.beans.swing.JButton; |
16 | 6117 | jaume | |
17 | /**
|
||
18 | * @author Luis W. Sevilla (sevilla_lui@gva.es)
|
||
19 | */
|
||
20 | 8120 | jmvivo | public class ProjChooserPanel extends CRSSelectPanel { |
21 | 6119 | jaume | |
22 | 38112 | cordinyana | 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 | 6119 | jaume | *
|
31 | 6117 | jaume | */
|
32 | 38112 | cordinyana | public ProjChooserPanel(IProjection proj) {
|
33 | super(proj);
|
||
34 | setCurProj(proj); |
||
35 | initialize(); |
||
36 | } |
||
37 | 6117 | jaume | |
38 | 38112 | cordinyana | /**
|
39 | * This method initializes this
|
||
40 | *
|
||
41 | * @return void
|
||
42 | */
|
||
43 | private void initialize() { |
||
44 | 6119 | jaume | this.setLayout(new FlowLayout(FlowLayout.LEFT, 15, 0)); |
45 | 38112 | cordinyana | this.add(getJLblProjName());
|
46 | this.add(getJLblProj());
|
||
47 | this.add(getJBtnChangeProj());
|
||
48 | initBtnChangeProj(); |
||
49 | } |
||
50 | 6119 | jaume | |
51 | 38112 | cordinyana | private void initBtnChangeProj() { |
52 | getJBtnChangeProj().addActionListener( |
||
53 | new java.awt.event.ActionListener() {
|
||
54 | 6119 | jaume | |
55 | 38112 | cordinyana | public void actionPerformed(java.awt.event.ActionEvent e) { |
56 | okPressed = false;
|
||
57 | 6119 | jaume | |
58 | 38112 | cordinyana | ISelectCrsPanel csSelect = |
59 | getUIFactory().getSelectCrsPanel(curProj, true);
|
||
60 | 6117 | jaume | |
61 | 38112 | cordinyana | PluginServices.getMDIManager().addWindow(csSelect); |
62 | 13039 | caballero | |
63 | 38112 | cordinyana | 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 | 6117 | jaume | |
75 | 38112 | cordinyana | 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 | 6119 | jaume | |
84 | 38112 | cordinyana | 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" |