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 / layer / ILayerPanel.java @ 2613
History | View | Annotate | Download (7.49 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.layer; |
23 |
|
24 |
import java.awt.GridBagConstraints; |
25 |
import java.awt.GridBagLayout; |
26 |
|
27 |
import javax.swing.ButtonGroup; |
28 |
import javax.swing.JButton; |
29 |
import javax.swing.JCheckBox; |
30 |
import javax.swing.JPanel; |
31 |
import javax.swing.JRadioButton; |
32 |
import javax.swing.JScrollPane; |
33 |
|
34 |
import org.gvsig.andami.PluginServices; |
35 |
import org.gvsig.i18n.Messages; |
36 |
|
37 |
/**
|
38 |
* Layer panel
|
39 |
*
|
40 |
* @author Nacho Brodin (nachobrodin@gmail.com)
|
41 |
*/
|
42 |
public class ILayerPanel extends JPanel { |
43 |
private static final long serialVersionUID = 1L; |
44 |
private LayerTree treeLayers = null; |
45 |
private JPanel jPanelViewSelector = null; |
46 |
private JPanel jPanelSelectLayers = null; |
47 |
private JCheckBox chkExtendedNames = null; |
48 |
private JScrollPane jScrollTreeLayers = null; |
49 |
private LayersSelectedPanel layersSelectedPanel = null; |
50 |
private AddDelLayerPanel addDelLayerPanel = null; |
51 |
private JRadioButton themesViewSelection = null; |
52 |
private JRadioButton layerListViewSelection = null; |
53 |
|
54 |
public ILayerPanel() {
|
55 |
init(); |
56 |
} |
57 |
|
58 |
public void init() { |
59 |
setLayout(new GridBagLayout()); |
60 |
|
61 |
ButtonGroup group = new ButtonGroup(); |
62 |
group.add(getLayerListViewSelection()); |
63 |
group.add(getThemesViewSelection()); |
64 |
|
65 |
GridBagConstraints gridBagConstraints1 = new GridBagConstraints(); |
66 |
gridBagConstraints1.fill = GridBagConstraints.HORIZONTAL;
|
67 |
gridBagConstraints1.gridx = 0;
|
68 |
gridBagConstraints1.gridy = 0;
|
69 |
gridBagConstraints1.weightx = 1.0;
|
70 |
gridBagConstraints1.insets = new java.awt.Insets(0, 2, 2, 0); |
71 |
add(getJPanelViewSelection(), gridBagConstraints1); |
72 |
|
73 |
gridBagConstraints1.fill = GridBagConstraints.BOTH;
|
74 |
gridBagConstraints1.gridy = 1;
|
75 |
gridBagConstraints1.weightx = 1.0;
|
76 |
gridBagConstraints1.weighty = 1.0;
|
77 |
add(getJPanelSelectLayers(), gridBagConstraints1); |
78 |
} |
79 |
|
80 |
public JRadioButton getLayerListViewSelection() { |
81 |
if(layerListViewSelection == null) { |
82 |
layerListViewSelection = new JRadioButton(Messages.getText("layerlist_view_selection")); |
83 |
layerListViewSelection.setSelected(true);
|
84 |
} |
85 |
return layerListViewSelection;
|
86 |
} |
87 |
|
88 |
public JRadioButton getThemesViewSelection() { |
89 |
if(themesViewSelection == null) { |
90 |
themesViewSelection = new JRadioButton(Messages.getText("themes_view_selection")); |
91 |
themesViewSelection.setSelected(false);
|
92 |
} |
93 |
return themesViewSelection;
|
94 |
} |
95 |
|
96 |
/**
|
97 |
* This method initializes jPanel4
|
98 |
* @return Panel
|
99 |
*/
|
100 |
private JPanel getJPanelViewSelection() { |
101 |
if (jPanelViewSelector == null) { |
102 |
jPanelViewSelector = new JPanel(); |
103 |
jPanelViewSelector.setLayout(new GridBagLayout()); |
104 |
jPanelViewSelector.setBorder(javax.swing.BorderFactory.createTitledBorder( |
105 |
null, Messages.getText("view_type"), |
106 |
javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, |
107 |
javax.swing.border.TitledBorder.DEFAULT_POSITION, null,
|
108 |
null));
|
109 |
GridBagConstraints gridBagConstraints1 = new GridBagConstraints(); |
110 |
gridBagConstraints1.fill = GridBagConstraints.HORIZONTAL;
|
111 |
gridBagConstraints1.weightx = 1.0;
|
112 |
gridBagConstraints1.insets = new java.awt.Insets(2, 2, 2, 2); |
113 |
|
114 |
jPanelViewSelector.add(getLayerListViewSelection(), gridBagConstraints1); |
115 |
gridBagConstraints1.gridy = 1;
|
116 |
jPanelViewSelector.add(getThemesViewSelection(), gridBagConstraints1); |
117 |
} |
118 |
|
119 |
return jPanelViewSelector;
|
120 |
} |
121 |
|
122 |
/**
|
123 |
* This method initializes LayersSelectedPanel
|
124 |
* @return Panel
|
125 |
*/
|
126 |
private LayersSelectedPanel getLayersSelectedPanel() {
|
127 |
if (layersSelectedPanel == null) { |
128 |
layersSelectedPanel = new LayersSelectedPanel();
|
129 |
} |
130 |
return layersSelectedPanel;
|
131 |
} |
132 |
|
133 |
/**
|
134 |
* This method initializes LayersSelectedPanel
|
135 |
* @return Panel
|
136 |
*/
|
137 |
private AddDelLayerPanel getAddDelLayerPanel() {
|
138 |
if (addDelLayerPanel == null) { |
139 |
addDelLayerPanel = new AddDelLayerPanel();
|
140 |
} |
141 |
return addDelLayerPanel;
|
142 |
} |
143 |
|
144 |
/**
|
145 |
* This method initializes lstSelectedLayers
|
146 |
*
|
147 |
* @return List
|
148 |
*/
|
149 |
public LayerList getLstSelectedLayers() {
|
150 |
return getLayersSelectedPanel().getLstSelectedLayers();
|
151 |
} |
152 |
|
153 |
/**
|
154 |
* This method initializes jPanel2
|
155 |
* @return Panel
|
156 |
*/
|
157 |
private JPanel getJPanelSelectLayers() { |
158 |
if (jPanelSelectLayers == null) { |
159 |
jPanelSelectLayers = new JPanel(); |
160 |
jPanelSelectLayers.setLayout(new GridBagLayout()); |
161 |
jPanelSelectLayers.setBorder(javax.swing.BorderFactory.createTitledBorder( |
162 |
null, Messages.getText("select_layers"), |
163 |
javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, |
164 |
javax.swing.border.TitledBorder.DEFAULT_POSITION, null,
|
165 |
null));
|
166 |
|
167 |
GridBagConstraints gridBagConstraints1 = new GridBagConstraints(); |
168 |
gridBagConstraints1.fill = GridBagConstraints.BOTH;
|
169 |
gridBagConstraints1.weightx = 1.0;
|
170 |
gridBagConstraints1.weighty = 1.0;
|
171 |
gridBagConstraints1.insets = new java.awt.Insets(2, 2, 2, 2); |
172 |
jPanelSelectLayers.add(getJScrollTreeLayers(), gridBagConstraints1); |
173 |
|
174 |
gridBagConstraints1.fill = GridBagConstraints.HORIZONTAL;
|
175 |
gridBagConstraints1.weighty = 0.0;
|
176 |
gridBagConstraints1.gridy = 1;
|
177 |
jPanelSelectLayers.add(getLayersSelectedPanel(), gridBagConstraints1); |
178 |
|
179 |
gridBagConstraints1.gridy = 2;
|
180 |
jPanelSelectLayers.add(getAddDelLayerPanel(), gridBagConstraints1); |
181 |
|
182 |
} |
183 |
return jPanelSelectLayers;
|
184 |
} |
185 |
|
186 |
/**
|
187 |
* This method initializes btnUp
|
188 |
*
|
189 |
* @return Button
|
190 |
*/
|
191 |
public JButton getBtnUp() { |
192 |
return layersSelectedPanel.getBtnUp();
|
193 |
} |
194 |
|
195 |
/**
|
196 |
* This method initializes btnDown
|
197 |
* @return Button
|
198 |
*/
|
199 |
public JButton getBtnDown() { |
200 |
return layersSelectedPanel.getBtnDown();
|
201 |
} |
202 |
|
203 |
/**
|
204 |
* This method initializes btnDel
|
205 |
* @return Button
|
206 |
*/
|
207 |
public JButton getBtnDel() { |
208 |
return getAddDelLayerPanel().getBtnRemove();
|
209 |
} |
210 |
|
211 |
/**
|
212 |
* This method initializes btnAdd
|
213 |
* @return Button
|
214 |
*/
|
215 |
public JButton getBtnAdd() { |
216 |
return getAddDelLayerPanel().getBtnAdd();
|
217 |
} |
218 |
|
219 |
/**
|
220 |
* This method initializes chkExtendedNames
|
221 |
*
|
222 |
* @return CheckBox
|
223 |
*/
|
224 |
public JCheckBox getChkExtendedNames() { |
225 |
if (chkExtendedNames == null) { |
226 |
chkExtendedNames = new JCheckBox(); |
227 |
chkExtendedNames.setText(Messages.getText("show_layer_names"));
|
228 |
} |
229 |
return chkExtendedNames;
|
230 |
} |
231 |
|
232 |
/**
|
233 |
* This method initializes treeLayers
|
234 |
*
|
235 |
* @return Tree
|
236 |
*/
|
237 |
public LayerTree getTreeLayers() {
|
238 |
if (treeLayers == null) { |
239 |
treeLayers = new LayerTree();
|
240 |
treeLayers.setRootVisible(true);
|
241 |
} |
242 |
|
243 |
return treeLayers;
|
244 |
} |
245 |
|
246 |
/**
|
247 |
* This method initializes jScrollTreeLayers
|
248 |
*
|
249 |
* @return ScrollPane
|
250 |
*/
|
251 |
private JScrollPane getJScrollTreeLayers() { |
252 |
if (jScrollTreeLayers == null) { |
253 |
jScrollTreeLayers = new JScrollPane(); |
254 |
jScrollTreeLayers.setViewportView(getTreeLayers()); |
255 |
jScrollTreeLayers.setPreferredSize(new java.awt.Dimension(205, 75)); |
256 |
} |
257 |
|
258 |
return jScrollTreeLayers;
|
259 |
} |
260 |
} |