Statistics
| Revision:

gvsig-raster / org.gvsig.raster.wmts / trunk / org.gvsig.raster.wmts / org.gvsig.raster.wmts.swing / org.gvsig.raster.wmts.swing.impl / src / main / java / org / gvsig / raster / wmts / swing / impl / panel / main / IServerPanel.java @ 2613

History | View | Annotate | Download (5.34 KB)

1
/* gvSIG. Geographic Information System of the Valencian Government
2
*
3
* Copyright (C) 2007-2008 Infrastructures and Transports Department
4
* of the Valencian Government (CIT)
5
*
6
* This program is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU General Public License
8
* as published by the Free Software Foundation; either version 2
9
* of the License, or (at your option) any later version.
10
*
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
* GNU General Public License for more details.
15
*
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
* MA  02110-1301, USA.
20
*
21
*/
22
package org.gvsig.raster.wmts.swing.impl.panel.main;
23

    
24
import java.awt.Component;
25
import java.awt.FlowLayout;
26
import java.awt.GridBagConstraints;
27
import java.awt.GridBagLayout;
28
import java.awt.event.ActionEvent;
29
import java.awt.event.ActionListener;
30

    
31
import javax.swing.JButton;
32
import javax.swing.JCheckBox;
33
import javax.swing.JOptionPane;
34
import javax.swing.JPanel;
35

    
36
import org.gvsig.i18n.Messages;
37
import org.gvsig.raster.wmts.swing.AddServerPanel;
38
import org.gvsig.utils.swing.jcomboServer.JComboServer;
39

    
40
/**
41
 * Connect panel
42
 *
43
 * @author Nacho Brodin (nachobrodin@gmail.com)
44
 */
45
public class IServerPanel extends AddServerPanel implements ActionListener {
46
        private static final long   serialVersionUID   = 1L;
47
        private ConnectPanel        connectPanel       = null;
48
        private DescriptionPanel    descPanel          = null;
49
        private JPanel              checkPanel         = null;
50
        private JCheckBox           chkInvertAxisOrder = null;
51
        
52
        public IServerPanel() {
53
                init();
54
        }
55
        
56
        public void init() {
57
                setLayout(new GridBagLayout());
58
                
59
                GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
60
                gridBagConstraints1.fill = GridBagConstraints.HORIZONTAL;
61
                gridBagConstraints1.anchor = GridBagConstraints.CENTER;
62
                gridBagConstraints1.gridx = 0;
63
                gridBagConstraints1.gridy = 0;
64
                gridBagConstraints1.weightx = 1.0;
65
                gridBagConstraints1.weighty = 0.0;
66
                gridBagConstraints1.insets = new java.awt.Insets(10,2,10,2);
67
                add(getConnectPanel(), gridBagConstraints1);
68
                
69
                gridBagConstraints1.insets = new java.awt.Insets(2,2,2,2);
70
                gridBagConstraints1.gridy = 1;
71
                add(getCheckPanel(), gridBagConstraints1);
72
                
73
                gridBagConstraints1.fill = GridBagConstraints.BOTH;
74
                gridBagConstraints1.anchor = GridBagConstraints.CENTER;
75
                gridBagConstraints1.gridx = 0;
76
                gridBagConstraints1.gridy = 2;
77
                gridBagConstraints1.weightx = 1.0;
78
                gridBagConstraints1.weighty = 1.0;
79
                add(getDescriptionPanel(), gridBagConstraints1);
80
        }
81
        
82
        private ConnectPanel getConnectPanel() {
83
                if(connectPanel == null) {
84
                        connectPanel = new ConnectPanel();
85
                }
86
                return connectPanel;
87
        }
88
        
89
        private JPanel getCheckPanel() {
90
                if(checkPanel == null) {
91
                        checkPanel = new JPanel();
92
                        FlowLayout f = new FlowLayout();
93
                        f.setAlignment(FlowLayout.LEFT);
94
                        f.setVgap(0);
95
                        f.setHgap(0);
96
                        checkPanel.setLayout(f);
97
                        checkPanel.add(getChkInvertAxisOrder());
98
                }
99
                return checkPanel;
100
        }
101
        
102
        private DescriptionPanel getDescriptionPanel() {
103
                if(descPanel == null) {
104
                        descPanel = new DescriptionPanel();
105
                }
106
                return descPanel;
107
        }
108
        
109
        /**
110
         * This method initializes chkInvertAxisOrder
111
         * @return CheckBox
112
         */
113
        public JCheckBox getChkInvertAxisOrder() {
114
                if (chkInvertAxisOrder == null) {
115
                        chkInvertAxisOrder = new JCheckBox();
116
                        chkInvertAxisOrder.setText(Messages.getText("invert_axis_order"));
117
                        chkInvertAxisOrder.setSelected(false);
118
                        chkInvertAxisOrder.addActionListener(this);
119
                }
120
                return chkInvertAxisOrder;
121
        }
122
        
123
        /**
124
         * Gets the connect button
125
         * @return javax.swing.JButton
126
         */
127
        public JButton getBtnConnect() {
128
                return getConnectPanel().getBtnConnect();
129
        }
130
        
131
        /**
132
         * Gets the cancel button
133
         * @return javax.swing.JButton
134
         */
135
        public JButton getBtnCancel() {
136
                return getConnectPanel().getBtnCancel();
137
        }
138
        
139
        /**
140
         * Gets the host combo box
141
         *
142
         * @return javax.swing.JTextField
143
         */
144
        public JComboServer getTxtHost() {
145
                return getConnectPanel().getTxtHost();
146
        }
147
        
148
        /**
149
         * Gets the caching check box
150
         *
151
         * @return javax.swing.JCheckBox
152
         */
153
        public JCheckBox getChkCaching() {
154
                return getConnectPanel().getChkCaching();
155
        }
156
        
157
        /**
158
         * Gets the title label
159
         *
160
         * @return javax.swing.JLabel
161
         */
162
        public javax.swing.JLabel getJLabelTitle() {
163
                return getDescriptionPanel().getJLabelTitle();
164
        }
165
        
166
        public void setTitle(String title) {
167
                getDescriptionPanel().getJLabelTitle().setText(title);
168
        }
169
        
170
        public void setTextInfo(String info) {
171
                getDescriptionPanel().getTxtAbstract().setText(info);
172
        }
173
        
174
        /**
175
         * Gets the text box
176
         * @return javax.swing.JTextArea
177
         */
178
        public javax.swing.JTextArea getTxtAbstract() {
179
                return getDescriptionPanel().getTxtAbstract();
180
        }
181

    
182
        public void actionPerformed(ActionEvent e) {
183
                if(e.getSource() == getChkInvertAxisOrder()) {
184
                        String string = Messages.getText("accept");
185
                        Object[] options = {string};
186
                        JOptionPane.showOptionDialog((Component)/*PluginServices.getMainFrame()*/this,
187
                                                "<html>" + Messages.getText("cache_refresh").replaceAll("\n", "<br>") + "</html>",
188
                                                Messages.getText("confirmacion"),
189
                                                JOptionPane.OK_OPTION,
190
                                                JOptionPane.INFORMATION_MESSAGE,
191
                                                null,
192
                                                options,
193
                                                string);
194
                }
195
        }
196
}