Statistics
| Revision:

svn-gvsig-desktop / tags / v1_1_Build_1002 / applications / appgvSIG / src / com / iver / cit / gvsig / gui / panels / ProjChooserPanel.java @ 12070

History | View | Annotate | Download (3.1 KB)

1 6117 jaume
/*
2
 * Created on 30-ene-2005
3
 */
4
package com.iver.cit.gvsig.gui.panels;
5
6 7508 luisw2
import java.awt.FlowLayout;
7 6117 jaume
8
import javax.swing.JLabel;
9
10
import org.cresques.cts.IProjection;
11 6119 jaume
import org.gvsig.gui.beans.swing.JButton;
12 6117 jaume
13
import com.iver.andami.PluginServices;
14 8765 jjdelcerro
import com.iver.cit.gvsig.project.documents.view.info.gui.CSSelectionDialog;
15 6117 jaume
16
/**
17
 * @author Luis W. Sevilla (sevilla_lui@gva.es)
18
 */
19 7508 luisw2
public class ProjChooserPanel extends CRSSelectPanel {
20 8900 luisw2
    /**
21
         *
22
         */
23
        private static final long serialVersionUID = 1L;
24
        private IProjection curProj=null;
25 6117 jaume
        private JLabel jLblProj = null;
26
        private JLabel jLblProjName = null;
27
        private JButton jBtnChangeProj = null;
28
        private boolean okPressed = false;
29 6119 jaume
30 6117 jaume
        /**
31 6119 jaume
         *
32 6117 jaume
         */
33
        public ProjChooserPanel(IProjection proj) {
34 7508 luisw2
                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
                                CSSelectionDialog csSelect = new CSSelectionDialog();
59
                                csSelect.setProjection(curProj);
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 8900 luisw2
83
        public JLabel getJLabel() {
84
                return getJLblProjName();
85
        }
86 6117 jaume
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 6119 jaume
98 6117 jaume
        /**
99 6119 jaume
         * This method initializes jButton
100
         *
101
         * @return javax.swing.JButton
102
         */
103 6117 jaume
        public JButton getJBtnChangeProj() {
104
                if (jBtnChangeProj == null) {
105
                        jBtnChangeProj = new JButton();
106
                        jBtnChangeProj.setText("..."); //$NON-NLS-1$
107 8765 jjdelcerro
                        jBtnChangeProj.setPreferredSize(new java.awt.Dimension(26,26));
108 6117 jaume
                }
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 6119 jaume
}  //  @jve:decl-index=0:visual-constraint="10,10"