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 / dimension / ValuesDimensionListPanel.java @ 2613
History | View | Annotate | Download (3.83 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.dimension; |
23 |
|
24 |
import java.awt.GridBagConstraints; |
25 |
import java.awt.GridBagLayout; |
26 |
|
27 |
import javax.swing.DefaultListModel; |
28 |
import javax.swing.JLabel; |
29 |
import javax.swing.JList; |
30 |
import javax.swing.JPanel; |
31 |
import javax.swing.JScrollPane; |
32 |
|
33 |
import org.gvsig.i18n.Messages; |
34 |
|
35 |
/**
|
36 |
* Panel for possible values of one dimension
|
37 |
* @author Nacho Brodin (nachobrodin@gmail.com)
|
38 |
*/
|
39 |
public class ValuesDimensionListPanel extends JPanel { |
40 |
private static final long serialVersionUID = 1L; |
41 |
private JList listOfValues = null; |
42 |
private JScrollPane jScrollPane = null; |
43 |
private JPanel jPanelTxt = null; |
44 |
private JLabel lblTitle = null; |
45 |
|
46 |
public ValuesDimensionListPanel() {
|
47 |
init(); |
48 |
} |
49 |
|
50 |
public void init() { |
51 |
setLayout(new GridBagLayout()); |
52 |
|
53 |
GridBagConstraints gridBagConstraints1 = new GridBagConstraints(); |
54 |
gridBagConstraints1.fill = GridBagConstraints.BOTH;
|
55 |
gridBagConstraints1.anchor = GridBagConstraints.WEST;
|
56 |
gridBagConstraints1.gridx = 0;
|
57 |
gridBagConstraints1.gridy = 0;
|
58 |
gridBagConstraints1.weightx = 1.0;
|
59 |
gridBagConstraints1.weighty = 1.0;
|
60 |
gridBagConstraints1.insets = new java.awt.Insets(2,2,2,2); |
61 |
add(getJPanelTxt(), gridBagConstraints1); |
62 |
} |
63 |
|
64 |
private javax.swing.JPanel getJPanelTxt() {
|
65 |
if (jPanelTxt == null) { |
66 |
jPanelTxt = new javax.swing.JPanel();
|
67 |
jPanelTxt.setLayout(new GridBagLayout()); |
68 |
jPanelTxt.setBorder(javax.swing.BorderFactory.createTitledBorder( |
69 |
null, Messages.getText("value_list"), |
70 |
javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, |
71 |
javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null)); |
72 |
GridBagConstraints gridBagConstraints1 = new GridBagConstraints(); |
73 |
gridBagConstraints1.gridx = 0;
|
74 |
gridBagConstraints1.gridy = 0;
|
75 |
gridBagConstraints1.insets = new java.awt.Insets(2,2,2,2); |
76 |
gridBagConstraints1.fill = GridBagConstraints.BOTH;
|
77 |
gridBagConstraints1.anchor = GridBagConstraints.CENTER;
|
78 |
gridBagConstraints1.weightx = 1.0;
|
79 |
gridBagConstraints1.weighty = 1.0;
|
80 |
jPanelTxt.add(getJScrollPane(), gridBagConstraints1); |
81 |
} |
82 |
|
83 |
return jPanelTxt;
|
84 |
} |
85 |
|
86 |
public void addElement(String value) { |
87 |
((DefaultListModel)getListOfValues().getModel()).addElement(value);
|
88 |
} |
89 |
|
90 |
public void clearList() { |
91 |
for (int i = getListOfValues().getModel().getSize() - 1; i >= 0 ; i--) { |
92 |
((DefaultListModel)getListOfValues().getModel()).remove(i);
|
93 |
} |
94 |
} |
95 |
|
96 |
public JList getListOfValues() { |
97 |
if (listOfValues == null) { |
98 |
listOfValues = new JList(new DefaultListModel()); |
99 |
} |
100 |
return listOfValues;
|
101 |
} |
102 |
|
103 |
private javax.swing.JScrollPane getJScrollPane() {
|
104 |
if (jScrollPane == null) { |
105 |
jScrollPane = new javax.swing.JScrollPane();
|
106 |
jScrollPane.setViewportView(getListOfValues()); |
107 |
} |
108 |
|
109 |
return jScrollPane;
|
110 |
} |
111 |
|
112 |
public javax.swing.JLabel getJLabelTitle() {
|
113 |
if (lblTitle == null) { |
114 |
lblTitle = new javax.swing.JLabel();
|
115 |
lblTitle.setText("-");
|
116 |
} |
117 |
|
118 |
return lblTitle;
|
119 |
} |
120 |
} |