Statistics
| Revision:

gvsig-raster / org.gvsig.raster.wmts / trunk / org.gvsig.raster.wmts / org.gvsig.raster.wmts.app.wmtsclient / src / main / java / org / gvsig / raster / wmts / app / wmtsclient / gui / panel / main / IServerPanel.java @ 2123

History | View | Annotate | Download (5.15 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.app.wmtsclient.gui.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.andami.PluginServices;
37
import org.gvsig.utils.swing.jcomboServer.JComboServer;
38

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

    
173
        public void actionPerformed(ActionEvent e) {
174
                if(e.getSource() == getChkInvertAxisOrder()) {
175
                        String string = PluginServices.getText(this, "accept");
176
                        Object[] options = {string};
177
                        JOptionPane.showOptionDialog((Component)/*PluginServices.getMainFrame()*/this,
178
                                                "<html>" + PluginServices.getText(this, "cache_refresh").replaceAll("\n", "<br>") + "</html>",
179
                                                PluginServices.getText(this, "confirmacion"),
180
                                                JOptionPane.OK_OPTION,
181
                                                JOptionPane.INFORMATION_MESSAGE,
182
                                                null,
183
                                                options,
184
                                                string);
185
                }
186
        }
187
}