svn-gvsig-desktop / trunk / applications / appgvSIG / src / com / iver / cit / gvsig / gui / styling / SymbolSelector.java @ 2984
History | View | Annotate | Download (6.98 KB)
1 |
/*
|
---|---|
2 |
* Created on 26-abr-2005
|
3 |
*
|
4 |
* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
5 |
*
|
6 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
7 |
*
|
8 |
* This program is free software; you can redistribute it and/or
|
9 |
* modify it under the terms of the GNU General Public License
|
10 |
* as published by the Free Software Foundation; either version 2
|
11 |
* of the License, or (at your option) any later version.
|
12 |
*
|
13 |
* This program is distributed in the hope that it will be useful,
|
14 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16 |
* GNU General Public License for more details.
|
17 |
*
|
18 |
* You should have received a copy of the GNU General Public License
|
19 |
* along with this program; if not, write to the Free Software
|
20 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
21 |
*
|
22 |
* For more information, contact:
|
23 |
*
|
24 |
* Generalitat Valenciana
|
25 |
* Conselleria d'Infraestructures i Transport
|
26 |
* Av. Blasco Ib??ez, 50
|
27 |
* 46010 VALENCIA
|
28 |
* SPAIN
|
29 |
*
|
30 |
* +34 963862235
|
31 |
* gvsig@gva.es
|
32 |
* www.gvsig.gva.es
|
33 |
*
|
34 |
* or
|
35 |
*
|
36 |
* IVER T.I. S.A
|
37 |
* Salamanca 50
|
38 |
* 46005 Valencia
|
39 |
* Spain
|
40 |
*
|
41 |
* +34 963163400
|
42 |
* dac@iver.es
|
43 |
*/
|
44 |
package com.iver.cit.gvsig.gui.styling; |
45 |
|
46 |
import java.awt.BorderLayout; |
47 |
import java.awt.Dimension; |
48 |
|
49 |
import javax.swing.DefaultListModel; |
50 |
import javax.swing.JList; |
51 |
import javax.swing.JPanel; |
52 |
import javax.swing.JScrollPane; |
53 |
|
54 |
/**
|
55 |
* @author FJP
|
56 |
*
|
57 |
* TODO To change the template for this generated type comment go to
|
58 |
* Window - Preferences - Java - Code Generation - Code and Comments
|
59 |
*/
|
60 |
public class SymbolSelector extends JPanel { |
61 |
|
62 |
private JList jListFav = null; // @jve:decl-index=0:visual-constraint="83,408" |
63 |
private JList jListSymbols = null; |
64 |
private JPanel jPanel = null; |
65 |
private JScrollPane jScrollPane = null; |
66 |
private JScrollPane jScrollPane1 = null; |
67 |
private JPanel jPanelPreview = null; |
68 |
private JPanel jPanelOptions = null; |
69 |
/**
|
70 |
* This method initializes
|
71 |
*
|
72 |
*/
|
73 |
public SymbolSelector() {
|
74 |
super();
|
75 |
initialize(); |
76 |
|
77 |
// TODO: Poner la funci?n para que el modelo
|
78 |
// sea un directorio con s?mbolos, etc.
|
79 |
DefaultListModel listModel = new DefaultListModel(); |
80 |
listModel.addElement("D:/java/eclipse30/eclipse/workspace/FMap 03_SLD/docs/fill4.svg");
|
81 |
listModel.addElement("D:/java/eclipse30/eclipse/workspace/FMap 03_SLD/docs/batikYin.svg");
|
82 |
listModel.addElement("D:/java/eclipse30/eclipse/workspace/FMap 03_SLD/docs/gradients.svg");
|
83 |
listModel.addElement("D:/java/eclipse30/eclipse/workspace/FMap 03_SLD/docs/batikYin.svg");
|
84 |
listModel.addElement("D:/java/eclipse30/eclipse/workspace/FMap 03_SLD/docs/stroke1.svg");
|
85 |
listModel.addElement("D:/java/eclipse30/eclipse/workspace/FMap 03_SLD/docs/fill3.svg");
|
86 |
listModel.addElement("D:/java/eclipse30/eclipse/workspace/FMap 03_SLD/docs/fill1.svg");
|
87 |
listModel.addElement("D:/java/eclipse30/eclipse/workspace/FMap 03_SLD/docs/fill2.svg");
|
88 |
listModel.addElement("D:/java/eclipse30/eclipse/workspace/FMap 03_SLD/docs/batikLogo.svg");
|
89 |
|
90 |
getJListSymbols().setModel(listModel); |
91 |
|
92 |
SLDListBoxCellRenderer renderer = new SLDListBoxCellRenderer();
|
93 |
renderer.setPreferredSize(new Dimension(60, 50)); |
94 |
getJListSymbols().setCellRenderer(renderer); |
95 |
// petList.setMaximumRowCount(3);
|
96 |
|
97 |
|
98 |
|
99 |
} |
100 |
|
101 |
/**
|
102 |
* This method initializes this
|
103 |
*
|
104 |
*/
|
105 |
private void initialize() { |
106 |
this.setLayout(new BorderLayout()); |
107 |
this.setSize(400, 221); |
108 |
this.add(getJScrollPane1(), java.awt.BorderLayout.CENTER);
|
109 |
this.add(getJScrollPane(), java.awt.BorderLayout.WEST);
|
110 |
this.add(getJPanel(), java.awt.BorderLayout.EAST);
|
111 |
|
112 |
} |
113 |
|
114 |
/**
|
115 |
* This method initializes jList
|
116 |
*
|
117 |
* @return javax.swing.JList
|
118 |
*/
|
119 |
private JList getJListFav() { |
120 |
if (jListFav == null) { |
121 |
jListFav = new JList(); |
122 |
jListFav.setPreferredSize(new java.awt.Dimension(70,100)); |
123 |
} |
124 |
return jListFav;
|
125 |
} |
126 |
|
127 |
/**
|
128 |
* This method initializes jList
|
129 |
*
|
130 |
* @return javax.swing.JList
|
131 |
*/
|
132 |
private JList getJListSymbols() { |
133 |
if (jListSymbols == null) { |
134 |
jListSymbols = new JList(); |
135 |
jListSymbols.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); |
136 |
jListSymbols.setLayoutOrientation(JList.HORIZONTAL_WRAP);
|
137 |
jListSymbols.setVisibleRowCount(-1);
|
138 |
|
139 |
jListSymbols.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
|
140 |
public void valueChanged(javax.swing.event.ListSelectionEvent e) { |
141 |
System.out.println("valueChanged()"); // TODO Auto-generated Event stub valueChanged() |
142 |
// TODO: Aqu? hay que extraer el Paint, el Stroke
|
143 |
// o lo que necesitemos del svg para generar nuestro propio
|
144 |
// s?mbolo.
|
145 |
} |
146 |
}); |
147 |
} |
148 |
return jListSymbols;
|
149 |
} |
150 |
|
151 |
/**
|
152 |
* This method initializes jPanel
|
153 |
*
|
154 |
* @return javax.swing.JPanel
|
155 |
*/
|
156 |
private JPanel getJPanel() { |
157 |
if (jPanel == null) { |
158 |
jPanel = new JPanel(); |
159 |
jPanel.setLayout(new BorderLayout()); |
160 |
jPanel.setPreferredSize(new java.awt.Dimension(100,10)); |
161 |
jPanel.add(getJPanelOptions(), java.awt.BorderLayout.CENTER); |
162 |
jPanel.add(getJPanelPreview(), java.awt.BorderLayout.NORTH); |
163 |
} |
164 |
return jPanel;
|
165 |
} |
166 |
|
167 |
/**
|
168 |
* This method initializes jScrollPane
|
169 |
*
|
170 |
* @return javax.swing.JScrollPane
|
171 |
*/
|
172 |
private JScrollPane getJScrollPane() { |
173 |
if (jScrollPane == null) { |
174 |
jScrollPane = new JScrollPane(); |
175 |
jScrollPane.setPreferredSize(new java.awt.Dimension(80,130)); |
176 |
jScrollPane.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); |
177 |
jScrollPane.setViewportView(getJListFav()); |
178 |
} |
179 |
return jScrollPane;
|
180 |
} |
181 |
|
182 |
/**
|
183 |
* This method initializes jScrollPane1
|
184 |
*
|
185 |
* @return javax.swing.JScrollPane
|
186 |
*/
|
187 |
private JScrollPane getJScrollPane1() { |
188 |
if (jScrollPane1 == null) { |
189 |
jScrollPane1 = new JScrollPane(); |
190 |
jScrollPane1.setViewportView(getJListSymbols()); |
191 |
} |
192 |
return jScrollPane1;
|
193 |
} |
194 |
|
195 |
/**
|
196 |
* This method initializes jPanel1
|
197 |
*
|
198 |
* @return javax.swing.JPanel
|
199 |
*/
|
200 |
private JPanel getJPanelPreview() { |
201 |
if (jPanelPreview == null) { |
202 |
jPanelPreview = new JPanel(); |
203 |
jPanelPreview.setPreferredSize(new java.awt.Dimension(80,70)); |
204 |
jPanelPreview.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED)); |
205 |
} |
206 |
return jPanelPreview;
|
207 |
} |
208 |
|
209 |
/**
|
210 |
* This method initializes jPanel1
|
211 |
*
|
212 |
* @return javax.swing.JPanel
|
213 |
*/
|
214 |
private JPanel getJPanelOptions() { |
215 |
if (jPanelOptions == null) { |
216 |
jPanelOptions = new JPanel(); |
217 |
} |
218 |
return jPanelOptions;
|
219 |
} |
220 |
|
221 |
} // @jve:decl-index=0:visual-constraint="10,10"
|