Statistics
| Revision:

svn-gvsig-desktop / trunk / libraries / libJCRS / src / org / gvsig / crs / ui / WithoutTranformation.java @ 7020

History | View | Annotate | Download (3.98 KB)

1
package org.gvsig.crs.ui;
2

    
3
import java.awt.Component;
4
import java.awt.Dimension;
5
import java.awt.FlowLayout;
6
import java.awt.GridLayout;
7
import java.awt.event.ActionEvent;
8

    
9
import javax.swing.BorderFactory;
10
import javax.swing.JButton;
11
import javax.swing.JLabel;
12
import javax.swing.JPanel;
13
import javax.swing.JScrollPane;
14
import javax.swing.JTextArea;
15

    
16
import org.cresques.ui.DefaultDialogPanel;
17

    
18
import com.iver.andami.PluginServices;
19
import com.iver.andami.ui.mdiManager.IWindow;
20
import com.iver.andami.ui.mdiManager.WindowInfo;
21

    
22
public class WithoutTranformation extends DefaultDialogPanel implements IWindow {
23
        
24
        /**
25
         * 
26
         */
27
        private static final long serialVersionUID = 1L;
28
        String crsWkt;
29
        int crs_code;
30
        
31
        private JLabel wkt;
32
        private JTextArea info;
33
        private JScrollPane areaScrollPane;
34
        
35
        private JPanel panel;        
36
        private JPanel buttonPane;
37
        private JButton accept;
38
        private JButton cancel;
39

    
40
        public WithoutTranformation(String cad, int code) {
41
                super();
42
                crsWkt = cad;
43
                crs_code = code;
44
                init();                
45
        }
46
        
47
        private void init() {
48
                this.add(getJPanel(), null);
49
                this.add(getButtonPane(), null);                
50
        }
51
        
52
        private JPanel getJPanel(){
53
                if (panel == null) {
54
                        panel = new JPanel();
55
                        panel.setLayout(new GridLayout(1,2));
56
                        panel.setLayout(new FlowLayout(FlowLayout.LEADING,5,10));
57
                        panel.setPreferredSize(new Dimension(525, 110));
58
                        panel.add(getLabel());
59
                        panel.add(getScrollPanelArea());
60
                }
61
                return panel;
62
        }
63
        
64
        private JScrollPane getScrollPanelArea() {
65
                if(areaScrollPane == null) {
66
                        areaScrollPane = new JScrollPane(getInfo());
67
                        areaScrollPane.setVerticalScrollBarPolicy(
68
                                        JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
69
                        areaScrollPane.setPreferredSize(new Dimension(420, 100));
70
                        areaScrollPane.setBorder(
71
                            BorderFactory.createCompoundBorder(
72
                                BorderFactory.createCompoundBorder(
73
                                                BorderFactory.createTitledBorder("Wkt"),
74
                                                BorderFactory.createEmptyBorder(2,2,2,2)),
75
                                areaScrollPane.getBorder()));
76
                }
77
                return areaScrollPane;
78
        }
79

    
80
        private Component getLabel() {
81
                if (wkt == null){
82
                        wkt = new JLabel();
83
                        wkt.setPreferredSize(new Dimension(90, 80));
84
                        wkt.setText("Cadena WKT: ");
85
                }                
86
                return wkt;
87
        }
88
        
89
        private Component getInfo() {
90
                if (info == null){
91
                        info = new JTextArea();
92
                        info.setLineWrap(true);
93
                        info.setWrapStyleWord(true);
94
                        info.setPreferredSize(new Dimension(400, 240));
95
                        info.setEditable(false);
96
                        info.setText(crsWkt);
97
                }
98
                return info;
99
        }
100
        
101
        private JPanel getButtonPane() {
102
                if(buttonPane == null) {
103
                        buttonPane = new JPanel();
104
                        buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
105
                        buttonPane.setPreferredSize(new Dimension(525,50));
106
                        buttonPane.add(getButtonAccept(),null);
107
                        buttonPane.add(getButtonCancel(),null);
108
                }
109
                return buttonPane;
110
        }
111
        
112
        private JButton getButtonCancel() {
113
                if(cancel == null) {
114
                        cancel = new JButton();
115
                        cancel.setText("Cancelar");
116
                        cancel.setPreferredSize(new Dimension(100,25));
117
                        cancel.setMnemonic('C');
118
                        cancel.setToolTipText("Cancel");
119
                        cancel.addActionListener(new java.awt.event.ActionListener() { 
120
                                public void actionPerformed(java.awt.event.ActionEvent e) {    
121
                                        cancelButton_actionPerformed(e);                
122
                                }        
123
                        });
124
                }
125
                return cancel;
126
        }
127
        
128
        public void cancelButton_actionPerformed(ActionEvent e) {
129
                PluginServices.getMDIManager().closeWindow(this);
130
        }
131
        
132
        private JButton getButtonAccept() {
133
                if(accept == null) {
134
                        accept = new JButton();
135
                        accept.setText("Aceptar");
136
                        accept.setPreferredSize(new Dimension(100,25));
137
                        accept.setMnemonic('A');
138
                        accept.setToolTipText("Accept");
139
                        accept.addActionListener(new java.awt.event.ActionListener() { 
140
                                public void actionPerformed(java.awt.event.ActionEvent e) {    
141
                                        acceptButton_actionPerformed(e);                
142
                                }        
143
                        });
144
                }
145
                return accept;
146
        }
147
        
148
        public void acceptButton_actionPerformed(ActionEvent e) {
149
                PluginServices.getMDIManager().closeWindow(this);
150
        }
151

    
152
        public WindowInfo getWindowInfo() {
153
                WindowInfo m_viewinfo=new WindowInfo(WindowInfo.MODALDIALOG);
154
                   m_viewinfo.setTitle(PluginServices.getText(this,"Sin Transformacion"));
155
                return m_viewinfo;
156
        }
157

    
158

    
159
}