svn-gvsig-desktop / branches / v2_0_0_prep / applications / appgvSIG / src / org / gvsig / app / gui / panels / ProjChooserPanel.java @ 34002
History | View | Annotate | Download (3.21 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 | 29596 | jpiera | 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 | 6119 | jaume | import org.gvsig.gui.beans.swing.JButton; |
17 | 6117 | jaume | |
18 | 7304 | caballero | |
19 | 6117 | jaume | /**
|
20 | * @author Luis W. Sevilla (sevilla_lui@gva.es)
|
||
21 | */
|
||
22 | 8120 | jmvivo | public class ProjChooserPanel extends CRSSelectPanel { |
23 | 6117 | jaume | 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 | 6119 | jaume | |
30 | 6117 | jaume | /**
|
31 | 6119 | jaume | *
|
32 | 6117 | jaume | */
|
33 | public ProjChooserPanel(IProjection proj) {
|
||
34 | 8120 | jmvivo | super(proj);
|
35 | 6117 | jaume | setCurProj(proj); |
36 | initialize(); |
||
37 | } |
||
38 | |||
39 | /**
|
||
40 | * This method initializes this
|
||
41 | 6119 | jaume | *
|
42 | 6117 | jaume | * @return void
|
43 | */
|
||
44 | private void initialize() { |
||
45 | 6119 | jaume | this.setLayout(new FlowLayout(FlowLayout.LEFT, 15, 0)); |
46 | 6117 | jaume | setPreferredSize(new java.awt.Dimension(330,35)); |
47 | 6119 | jaume | this.setSize(new java.awt.Dimension(330,23)); |
48 | this.add(getJLblProjName(), null); |
||
49 | this.add(getJLblProj(), null); |
||
50 | this.add(getJBtnChangeProj(), null); |
||
51 | 6117 | jaume | initBtnChangeProj(); |
52 | } |
||
53 | 6119 | jaume | |
54 | 6117 | jaume | private void initBtnChangeProj() { |
55 | 6119 | jaume | getJBtnChangeProj().addActionListener(new java.awt.event.ActionListener() {
|
56 | 6117 | jaume | public void actionPerformed(java.awt.event.ActionEvent e) { |
57 | okPressed = false;
|
||
58 | 28999 | cmartinez | |
59 | ISelectCrsPanel csSelect = getUIFactory().getSelectCrsPanel(curProj, true);
|
||
60 | 6119 | jaume | |
61 | 6880 | cesar | PluginServices.getMDIManager().addWindow(csSelect); |
62 | 6119 | jaume | |
63 | 6117 | jaume | 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 | 13039 | caballero | |
83 | 10557 | azabala | public JLabel getJLabel() { |
84 | return getJLblProjName();
|
||
85 | } |
||
86 | 6117 | jaume | |
87 | public JLabel getJLblProj() { |
||
88 | if (jLblProj == null) { |
||
89 | jLblProj = new JLabel(); |
||
90 | 13039 | caballero | if (curProj!=null) |
91 | jLblProj.setText(curProj.getAbrev()); |
||
92 | 6117 | jaume | } |
93 | return jLblProj;
|
||
94 | } |
||
95 | public void addBtnChangeProjActionListener(java.awt.event.ActionListener al) { |
||
96 | jBtnChangeProj.addActionListener(al); |
||
97 | } |
||
98 | 6119 | jaume | |
99 | 6117 | jaume | /**
|
100 | 6119 | jaume | * This method initializes jButton
|
101 | *
|
||
102 | * @return javax.swing.JButton
|
||
103 | */
|
||
104 | 6117 | jaume | public JButton getJBtnChangeProj() { |
105 | if (jBtnChangeProj == null) { |
||
106 | jBtnChangeProj = new JButton(); |
||
107 | jBtnChangeProj.setText("..."); //$NON-NLS-1$ |
||
108 | 8276 | caballero | jBtnChangeProj.setPreferredSize(new java.awt.Dimension(26,26)); |
109 | 6117 | jaume | } |
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 | 6119 | jaume | } // @jve:decl-index=0:visual-constraint="10,10" |