Statistics
| Revision:

root / trunk / applications / appgvSIG / src / com / iver / cit / gvsig / gui / panels / ProjChooserPanel.java @ 9828

History | View | Annotate | Download (3.04 KB)

1 6117 jaume
/*
2
 * Created on 30-ene-2005
3
 */
4
package com.iver.cit.gvsig.gui.panels;
5
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 6119 jaume
import org.gvsig.gui.beans.swing.JButton;
13 6117 jaume
14
import com.iver.andami.PluginServices;
15 7304 caballero
import com.iver.cit.gvsig.project.documents.view.info.gui.CSSelectionDialog;
16
17 6117 jaume
/**
18
 * @author Luis W. Sevilla (sevilla_lui@gva.es)
19
 */
20 8120 jmvivo
public class ProjChooserPanel extends CRSSelectPanel {
21 6117 jaume
    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 6119 jaume
28 6117 jaume
        /**
29 6119 jaume
         *
30 6117 jaume
         */
31
        public ProjChooserPanel(IProjection proj) {
32 8120 jmvivo
                super(proj);
33 6117 jaume
                setCurProj(proj);
34
                initialize();
35
        }
36
37
        /**
38
         * This method initializes this
39 6119 jaume
         *
40 6117 jaume
         * @return void
41
         */
42
        private void initialize() {
43 6119 jaume
        this.setLayout(new FlowLayout(FlowLayout.LEFT, 15, 0));
44 6117 jaume
        setPreferredSize(new java.awt.Dimension(330,35));
45 6119 jaume
        this.setSize(new java.awt.Dimension(330,23));
46
        this.add(getJLblProjName(), null);
47
        this.add(getJLblProj(), null);
48
        this.add(getJBtnChangeProj(), null);
49 6117 jaume
                initBtnChangeProj();
50
        }
51 6119 jaume
52 6117 jaume
        private void initBtnChangeProj() {
53 6119 jaume
                getJBtnChangeProj().addActionListener(new java.awt.event.ActionListener() {
54 6117 jaume
                        public void actionPerformed(java.awt.event.ActionEvent e) {
55
                                okPressed = false;
56
                                CSSelectionDialog csSelect = new CSSelectionDialog();
57
                                csSelect.setProjection(curProj);
58 6119 jaume
59 6880 cesar
                        PluginServices.getMDIManager().addWindow(csSelect);
60 6119 jaume
61 6117 jaume
                        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 6119 jaume
92 6117 jaume
        /**
93 6119 jaume
         * This method initializes jButton
94
         *
95
         * @return javax.swing.JButton
96
         */
97 6117 jaume
        public JButton getJBtnChangeProj() {
98
                if (jBtnChangeProj == null) {
99
                        jBtnChangeProj = new JButton();
100
                        jBtnChangeProj.setText("..."); //$NON-NLS-1$
101 8276 caballero
                        jBtnChangeProj.setPreferredSize(new java.awt.Dimension(26,26));
102 6117 jaume
                }
103
                return jBtnChangeProj;
104
        }
105
        /**
106
         * @return Returns the curProj.
107
         */
108
        public IProjection getCurProj() {
109
                return curProj;
110
        }
111
        /**
112
         * @param curProj The curProj to set.
113
         */
114
        public void setCurProj(IProjection curProj) {
115
                this.curProj = curProj;
116
        }
117
        /**
118
         * @return Returns the okPressed.
119
         */
120
        public boolean isOkPressed() {
121
                return okPressed;
122
        }
123 6119 jaume
}  //  @jve:decl-index=0:visual-constraint="10,10"