Revision 3099
org.gvsig.complexlegend/tags/org.gvsig.complexlegend-1.0.93/org.gvsig.complexlegend/org.gvsig.complexlegend.swing/org.gvsig.complexlegend.swing.impl/src/test/resources/log4j.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="ISO-8859-1" ?> |
|
2 |
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> |
|
3 |
|
|
4 |
<!-- |
|
5 |
Log4J configuration file for unit tests execution. |
|
6 |
--> |
|
7 |
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"> |
|
8 |
|
|
9 |
<!-- Appender configuration to show logging messages through the console --> |
|
10 |
<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender"> |
|
11 |
<layout class="org.apache.log4j.PatternLayout"> |
|
12 |
<param name="ConversionPattern" value="%d{HH:mm:ss,SSS} %-5p [%c{2}.%M()]\n %m%n" /> |
|
13 |
</layout> |
|
14 |
</appender> |
|
15 |
|
|
16 |
<!-- |
|
17 |
Activate logging messages of DEBUG level of higher only for the |
|
18 |
org.gvsig.tools packages. |
|
19 |
You can put full classes names or packages instead, to configure |
|
20 |
logging for all the classes and subpackages of the package. |
|
21 |
--> |
|
22 |
<category name="org.gvsig.tools"> |
|
23 |
<priority value="DEBUG" /> |
|
24 |
</category> |
|
25 |
<category name="org.gvsig.chart"> |
|
26 |
<priority value="DEBUG" /> |
|
27 |
</category> |
|
28 |
|
|
29 |
<!-- |
|
30 |
By default, show only logging messages of INFO level or higher, |
|
31 |
through the previously configured CONSOLE appender. |
|
32 |
--> |
|
33 |
<root> |
|
34 |
<priority value="INFO" /> |
|
35 |
<appender-ref ref="CONSOLE" /> |
|
36 |
</root> |
|
37 |
</log4j:configuration> |
|
0 | 38 |
org.gvsig.complexlegend/tags/org.gvsig.complexlegend-1.0.93/org.gvsig.complexlegend/org.gvsig.complexlegend.swing/org.gvsig.complexlegend.swing.impl/src/test/resources/README.txt | ||
---|---|---|
1 |
Put into this folder the resources needed by your test classes. |
|
2 |
|
|
3 |
This folder is added to the Tests classpath, so you can load any resources |
|
4 |
through the ClassLoader. |
|
5 |
|
|
6 |
By default, in this folder you can find an example of log4j configuration, |
|
7 |
prepared to log messages through the console, so logging works when you |
|
8 |
run your tests classes. |
|
0 | 9 |
org.gvsig.complexlegend/tags/org.gvsig.complexlegend-1.0.93/org.gvsig.complexlegend/org.gvsig.complexlegend.swing/org.gvsig.complexlegend.swing.impl/src/main/java/package.html | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8" ?> |
|
2 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
|
3 |
<html xmlns="http://www.w3.org/1999/xhtml"> |
|
4 |
<head> |
|
5 |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> |
|
6 |
<title>org.gvsig.landregistryviewer package documentation</title> |
|
7 |
</head> |
|
8 |
<body> |
|
9 |
|
|
10 |
<p>LandRegistryViewer swing library API default implementation.</p> |
|
11 |
|
|
12 |
</body> |
|
13 |
</html> |
|
0 | 14 |
org.gvsig.complexlegend/tags/org.gvsig.complexlegend-1.0.93/org.gvsig.complexlegend/org.gvsig.complexlegend.swing/org.gvsig.complexlegend.swing.impl/src/main/java/org/gvsig/complexlegend/swing/impl/DefaultComplexLegendPanel.java | ||
---|---|---|
1 |
package org.gvsig.complexlegend.swing.impl; |
|
2 |
|
|
3 |
import java.awt.BorderLayout; |
|
4 |
import java.awt.Dimension; |
|
5 |
import java.awt.FlowLayout; |
|
6 |
import java.awt.event.ActionEvent; |
|
7 |
import java.awt.event.ActionListener; |
|
8 |
import java.util.Iterator; |
|
9 |
import java.util.List; |
|
10 |
|
|
11 |
import javax.swing.BorderFactory; |
|
12 |
import javax.swing.DefaultComboBoxModel; |
|
13 |
import javax.swing.ImageIcon; |
|
14 |
import javax.swing.JButton; |
|
15 |
import javax.swing.JCheckBox; |
|
16 |
import javax.swing.JComboBox; |
|
17 |
import javax.swing.JDialog; |
|
18 |
import javax.swing.JLabel; |
|
19 |
import javax.swing.JPanel; |
|
20 |
import javax.swing.event.ListDataEvent; |
|
21 |
import javax.swing.event.ListDataListener; |
|
22 |
|
|
23 |
import org.gvsig.andami.IconThemeHelper; |
|
24 |
import org.gvsig.andami.PluginServices; |
|
25 |
import org.gvsig.app.project.documents.view.legend.gui.AbstractParentPanel; |
|
26 |
import org.gvsig.app.project.documents.view.legend.gui.Features; |
|
27 |
import org.gvsig.app.project.documents.view.legend.gui.ILegendPanel; |
|
28 |
import org.gvsig.complexlegend.ComplexLegendItem; |
|
29 |
import org.gvsig.complexlegend.VectorComplexLegend; |
|
30 |
import org.gvsig.complexlegend.impl.DefaultVectorComplexLegend; |
|
31 |
import org.gvsig.complexlegend.swing.ComplexLegendPanel; |
|
32 |
import org.gvsig.fmap.mapcontext.MapContextLocator; |
|
33 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
|
34 |
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect; |
|
35 |
import org.gvsig.fmap.mapcontext.rendering.legend.ILegend; |
|
36 |
import org.gvsig.symbology.swing.SymbologySwingLocator; |
|
37 |
import org.gvsig.tools.ToolsLocator; |
|
38 |
import org.gvsig.tools.i18n.I18nManager; |
|
39 |
import org.gvsig.tools.observer.Observable; |
|
40 |
import org.gvsig.tools.observer.Observer; |
|
41 |
import org.slf4j.Logger; |
|
42 |
import org.slf4j.LoggerFactory; |
|
43 |
|
|
44 |
public class DefaultComplexLegendPanel extends JPanel implements ComplexLegendPanel, Observer{ |
|
45 |
|
|
46 |
/** |
|
47 |
* |
|
48 |
*/ |
|
49 |
private static final long serialVersionUID = -312336406359200569L; |
|
50 |
private static Logger logger = LoggerFactory.getLogger(DefaultComplexLegendPanel.class); |
|
51 |
private VectorComplexLegend auxLegend; |
|
52 |
private FLayer layer; |
|
53 |
private JComboBox cmbValue; |
|
54 |
private JCheckBox chkAllowOverlap; |
|
55 |
private JPanel symbolPanel; |
|
56 |
private JButton addButton; |
|
57 |
private JButton removeButton; |
|
58 |
private DefaultComboBoxModel model; |
|
59 |
private ILegendPanel legendPanel; |
|
60 |
private JDialog dlg; |
|
61 |
private ComplexLegendItem currentItem; |
|
62 |
private I18nManager i18nManager; |
|
63 |
private int currentIndex; |
|
64 |
|
|
65 |
public DefaultComplexLegendPanel(){ |
|
66 |
super(); |
|
67 |
initialize(); |
|
68 |
refreshButtons(); |
|
69 |
} |
|
70 |
|
|
71 |
private void initialize() { |
|
72 |
this.i18nManager = ToolsLocator.getI18nManager(); |
|
73 |
|
|
74 |
setLayout(new BorderLayout()); |
|
75 |
JPanel aux = new JPanel(new BorderLayout()); |
|
76 |
|
|
77 |
JPanel fieldsPanel = new JPanel(new FlowLayout()); |
|
78 |
fieldsPanel.setBorder(BorderFactory.createTitledBorder(null, |
|
79 |
i18nManager.getTranslation("select_scale"))); |
|
80 |
fieldsPanel.setPreferredSize(new Dimension(300,100)); |
|
81 |
|
|
82 |
fieldsPanel.add(new JLabel()); |
|
83 |
fieldsPanel.add(getComboBox()); |
|
84 |
fieldsPanel.add(getAddButton()); |
|
85 |
fieldsPanel.add(getRemoveButton()); |
|
86 |
|
|
87 |
JPanel fieldsPanelCheck = new JPanel(new FlowLayout()); |
|
88 |
chkAllowOverlap = new JCheckBox(i18nManager.getTranslation("_Allow_overlap_drawing_legends")); |
|
89 |
fieldsPanelCheck.add(chkAllowOverlap); |
|
90 |
fieldsPanel.add(fieldsPanelCheck); |
|
91 |
|
|
92 |
symbolPanel = new JPanel(); |
|
93 |
symbolPanel.setBorder(BorderFactory.createTitledBorder(null, |
|
94 |
i18nManager.getTranslation("legend_definition"))); |
|
95 |
|
|
96 |
|
|
97 |
aux.add(fieldsPanel, BorderLayout.NORTH); |
|
98 |
aux.add(symbolPanel, BorderLayout.CENTER); |
|
99 |
|
|
100 |
this.add(aux, BorderLayout.CENTER); |
|
101 |
} |
|
102 |
|
|
103 |
private JComboBox getComboBox() { |
|
104 |
if(cmbValue == null){ |
|
105 |
cmbValue = new JComboBox(getComboBoxModel()); |
|
106 |
cmbValue.setPreferredSize(new Dimension(350, 20)); |
|
107 |
cmbValue.addActionListener(new ActionListener() { |
|
108 |
public void actionPerformed(ActionEvent e) { |
|
109 |
refreshLegendPanel(); |
|
110 |
} |
|
111 |
}); |
|
112 |
} |
|
113 |
return cmbValue; |
|
114 |
} |
|
115 |
|
|
116 |
private DefaultComboBoxModel getComboBoxModel(){ |
|
117 |
if(this.model == null){ |
|
118 |
this.model = new DefaultComboBoxModel(); |
|
119 |
this.model.addListDataListener(new ListDataListener() { |
|
120 |
public void intervalRemoved(ListDataEvent arg0) { |
|
121 |
} |
|
122 |
|
|
123 |
public void intervalAdded(ListDataEvent arg0) { |
|
124 |
} |
|
125 |
|
|
126 |
public void contentsChanged(ListDataEvent arg0) { |
|
127 |
refreshButtons(); |
|
128 |
} |
|
129 |
}); |
|
130 |
} |
|
131 |
return this.model; |
|
132 |
} |
|
133 |
|
|
134 |
protected void refreshButtons() { |
|
135 |
boolean status = (getComboBoxModel().getSize() != 0); |
|
136 |
getComboBox().setEnabled(status); |
|
137 |
getRemoveButton().setEnabled(status); |
|
138 |
if(legendPanel != null){ |
|
139 |
legendPanel.getPanel().setVisible(status); |
|
140 |
} |
|
141 |
if(auxLegend !=null && auxLegend instanceof DefaultVectorComplexLegend){ |
|
142 |
chkAllowOverlap.setSelected(auxLegend.getAllowOverlap()); |
|
143 |
} |
|
144 |
} |
|
145 |
|
|
146 |
private JButton getAddButton() { |
|
147 |
if(addButton == null){ |
|
148 |
addButton = new JButton(); |
|
149 |
addButton.setIcon(PluginServices.getIconTheme().get("legend-add")); |
|
150 |
addButton.addActionListener(new ActionListener() { |
|
151 |
public void actionPerformed(ActionEvent arg0) { |
|
152 |
createComplexLegendItemWindow(); |
|
153 |
} |
|
154 |
}); |
|
155 |
} |
|
156 |
return addButton; |
|
157 |
} |
|
158 |
|
|
159 |
private JButton getRemoveButton() { |
|
160 |
if(removeButton == null){ |
|
161 |
removeButton = new JButton(); |
|
162 |
removeButton.setIcon(PluginServices.getIconTheme().get("legend-delete")); |
|
163 |
removeButton.addActionListener(new ActionListener() { |
|
164 |
public void actionPerformed(ActionEvent arg0) { |
|
165 |
removeComplexLegendItem(); |
|
166 |
} |
|
167 |
}); |
|
168 |
} |
|
169 |
return removeButton; |
|
170 |
} |
|
171 |
|
|
172 |
protected void removeComplexLegendItem() { |
|
173 |
ComplexLegendItem item = (ComplexLegendItem) getComboBox().getSelectedItem(); |
|
174 |
int index = auxLegend.getLegends().indexOf(item); |
|
175 |
if(index != -1){ |
|
176 |
auxLegend.remove(item); |
|
177 |
getComboBoxModel().removeElementAt(index); |
|
178 |
} |
|
179 |
refreshButtons(); |
|
180 |
} |
|
181 |
|
|
182 |
protected void createComplexLegendItemWindow() { |
|
183 |
if(layer != null){ |
|
184 |
ComplexLegendItemPanel legendItemPanel = |
|
185 |
new ComplexLegendItemPanel(layer, (VectorComplexLegend) getLegend()); |
|
186 |
legendItemPanel.addObserver(this); |
|
187 |
|
|
188 |
dlg = new JDialog(); |
|
189 |
dlg.setTitle( i18nManager.getTranslation("SelectItem")); |
|
190 |
dlg.setResizable(true); |
|
191 |
//legendItemPanel.setParentDialog(dlg); |
|
192 |
dlg.getContentPane().add(legendItemPanel); |
|
193 |
dlg.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); |
|
194 |
|
|
195 |
dlg.setSize(510, 510); |
|
196 |
dlg.setModal(true); |
|
197 |
dlg.pack(); |
|
198 |
dlg.setLocationRelativeTo(null); |
|
199 |
dlg.setVisible(true); |
|
200 |
} |
|
201 |
} |
|
202 |
|
|
203 |
public String getDescription() { |
|
204 |
return i18nManager.getTranslation( |
|
205 |
"legend_by_scale"); |
|
206 |
} |
|
207 |
|
|
208 |
public ImageIcon getIcon() { |
|
209 |
return IconThemeHelper.getImageIcon( |
|
210 |
"scaled-symbols"); |
|
211 |
} |
|
212 |
|
|
213 |
public ILegend getLegend() { |
|
214 |
if (auxLegend == null) { |
|
215 |
auxLegend = (VectorComplexLegend) MapContextLocator.getMapContextManager() |
|
216 |
.createLegend(DefaultVectorComplexLegend.COMPLEX_LEGEND_NAME); |
|
217 |
} |
|
218 |
saveCurrentPanel(); |
|
219 |
auxLegend.setAllowOverlap(this.chkAllowOverlap.isSelected()); |
|
220 |
|
|
221 |
|
|
222 |
// DefaultComplexLegendItem scaleLegend1 = new DefaultComplexLegendItem(); |
|
223 |
// |
|
224 |
// SimpleFillSymbol fillsymbol1 = new SimpleFillSymbol(); |
|
225 |
// fillsymbol1.setFillColor(Color.WHITE); |
|
226 |
// SingleSymbolLegend legend1 = new SingleSymbolLegend(fillsymbol1); |
|
227 |
// scaleLegend1.setLegend(legend1); |
|
228 |
// scaleLegend1.setMinScale(10000000); |
|
229 |
// scaleLegend1.setMaxScale(20000000); |
|
230 |
// |
|
231 |
// DefaultComplexLegendItem scaleLegend2 = new DefaultComplexLegendItem(); |
|
232 |
// SimpleFillSymbol fillsymbol2 = new SimpleFillSymbol(); |
|
233 |
// fillsymbol2.setFillColor(Color.BLACK); |
|
234 |
// SingleSymbolLegend legend2 = new SingleSymbolLegend(fillsymbol2); |
|
235 |
// scaleLegend2.setLegend(legend2); |
|
236 |
// scaleLegend2.setMinScale(0); |
|
237 |
// scaleLegend2.setMaxScale(9999999); |
|
238 |
// |
|
239 |
// auxLegend.add(scaleLegend2); |
|
240 |
// auxLegend.add(scaleLegend1); |
|
241 |
|
|
242 |
return (VectorComplexLegend) auxLegend; |
|
243 |
} |
|
244 |
|
|
245 |
public Class getLegendClass() { |
|
246 |
return DefaultVectorComplexLegend.class; |
|
247 |
} |
|
248 |
|
|
249 |
public JPanel getPanel() { |
|
250 |
return this; |
|
251 |
} |
|
252 |
|
|
253 |
public Class getParentClass() { |
|
254 |
return Features.class; |
|
255 |
} |
|
256 |
|
|
257 |
public String getTitle() { |
|
258 |
return i18nManager.getTranslation("complex_symbology"); |
|
259 |
} |
|
260 |
|
|
261 |
public boolean isSuitableFor(FLayer layer) { |
|
262 |
return (layer instanceof FLyrVect); |
|
263 |
} |
|
264 |
|
|
265 |
public void setData(FLayer layer, ILegend data) { |
|
266 |
this.layer = layer; |
|
267 |
if(data instanceof DefaultVectorComplexLegend){ |
|
268 |
auxLegend = (DefaultVectorComplexLegend) data; |
|
269 |
updateComboModel(); |
|
270 |
chkAllowOverlap.setSelected(auxLegend.getAllowOverlap()); |
|
271 |
} |
|
272 |
|
|
273 |
} |
|
274 |
|
|
275 |
private void saveCurrentPanel(){ |
|
276 |
if(legendPanel != null && currentItem != null){ |
|
277 |
currentItem.setLegend(legendPanel.getLegend()); |
|
278 |
} |
|
279 |
} |
|
280 |
|
|
281 |
|
|
282 |
public void refreshLegendPanel(){ |
|
283 |
ComplexLegendItem item = (ComplexLegendItem) getComboBox().getSelectedItem(); |
|
284 |
if(item != null){ |
|
285 |
ILegendPanel aux = getLegendPanel(item.getLegend()); |
|
286 |
if(aux != null){ |
|
287 |
saveCurrentPanel(); |
|
288 |
|
|
289 |
symbolPanel.removeAll(); |
|
290 |
legendPanel = aux; |
|
291 |
legendPanel.setData(layer, item.getLegend()); |
|
292 |
symbolPanel.add(legendPanel.getPanel()); |
|
293 |
symbolPanel.repaint(); |
|
294 |
symbolPanel.revalidate(); |
|
295 |
|
|
296 |
currentItem = item; |
|
297 |
currentIndex = getComboBox().getSelectedIndex(); |
|
298 |
} |
|
299 |
} |
|
300 |
} |
|
301 |
|
|
302 |
private ILegendPanel getLegendPanel(ILegend legend){ |
|
303 |
List panels = SymbologySwingLocator.getSwingManager().getLegendEditorClasses(); |
|
304 |
Iterator it = panels.iterator(); |
|
305 |
while(it.hasNext()){ |
|
306 |
Class panelClass = (Class) it.next(); |
|
307 |
ILegendPanel panel; |
|
308 |
try { |
|
309 |
panel = (ILegendPanel) panelClass.newInstance(); |
|
310 |
if(!(panel instanceof AbstractParentPanel)){ |
|
311 |
if(panel.getLegendClass().equals(legend.getClass())){ |
|
312 |
panel.setData(layer, legend); |
|
313 |
return panel; |
|
314 |
} |
|
315 |
} |
|
316 |
} catch (Exception e) { |
|
317 |
logger.warn("Error creating ILegendPanel. ", e); |
|
318 |
return null; |
|
319 |
} |
|
320 |
} |
|
321 |
return null; |
|
322 |
} |
|
323 |
|
|
324 |
|
|
325 |
|
|
326 |
public void update(Observable observable, Object isAccepted) { |
|
327 |
if(observable instanceof ComplexLegendItemPanel && isAccepted instanceof Boolean){ |
|
328 |
ComplexLegendItemPanel itemPanel = (ComplexLegendItemPanel) observable; |
|
329 |
boolean acceptForm = (Boolean) isAccepted; |
|
330 |
if(!acceptForm){ |
|
331 |
/* Si se ha pinchado en cancelar, se cierra sin m?s */ |
|
332 |
dlg.dispose(); |
|
333 |
}else{ |
|
334 |
if(itemPanel.validateValues()){ |
|
335 |
ComplexLegendItem item = itemPanel.getLegendItem(); |
|
336 |
|
|
337 |
/* Guardo el panel actual*/ |
|
338 |
saveCurrentPanel(); |
|
339 |
|
|
340 |
/* A?ado y ordeno la nueva entrada */ |
|
341 |
auxLegend.add(item); |
|
342 |
updateComboModel(); |
|
343 |
|
|
344 |
/* Cargo el nuevo panel */ |
|
345 |
symbolPanel.removeAll(); |
|
346 |
legendPanel = itemPanel.getLegendPanel(); |
|
347 |
legendPanel.setData(layer, item.getLegend()); |
|
348 |
symbolPanel.add(legendPanel.getPanel()); |
|
349 |
symbolPanel.repaint(); |
|
350 |
|
|
351 |
/* Selecciono la nueva entrada */ |
|
352 |
currentItem = item; |
|
353 |
getComboBox().setSelectedItem(item); |
|
354 |
currentIndex = getComboBox().getSelectedIndex(); |
|
355 |
|
|
356 |
/* Cierro el di?logo */ |
|
357 |
dlg.dispose(); |
|
358 |
} |
|
359 |
} |
|
360 |
} |
|
361 |
} |
|
362 |
|
|
363 |
private void updateComboModel() { |
|
364 |
getComboBoxModel().removeAllElements(); |
|
365 |
if(auxLegend != null){ |
|
366 |
Iterator<ComplexLegendItem> it = auxLegend.getLegends().iterator(); |
|
367 |
while(it.hasNext()){ |
|
368 |
ComplexLegendItem item = (ComplexLegendItem) it.next(); |
|
369 |
getComboBoxModel().addElement(item); |
|
370 |
} |
|
371 |
|
|
372 |
} |
|
373 |
} |
|
374 |
|
|
375 |
} |
|
0 | 376 |
org.gvsig.complexlegend/tags/org.gvsig.complexlegend-1.0.93/org.gvsig.complexlegend/org.gvsig.complexlegend.swing/org.gvsig.complexlegend.swing.impl/src/main/java/org/gvsig/complexlegend/swing/impl/ComplexLegendItemPanel.java | ||
---|---|---|
1 |
package org.gvsig.complexlegend.swing.impl; |
|
2 |
|
|
3 |
import java.awt.BorderLayout; |
|
4 |
import java.awt.Dimension; |
|
5 |
import java.awt.GridBagConstraints; |
|
6 |
import java.awt.GridBagLayout; |
|
7 |
import java.awt.Insets; |
|
8 |
import java.awt.event.ActionEvent; |
|
9 |
import java.awt.event.ActionListener; |
|
10 |
import java.util.ArrayList; |
|
11 |
import java.util.Iterator; |
|
12 |
import java.util.List; |
|
13 |
|
|
14 |
import javax.swing.ComboBoxModel; |
|
15 |
import javax.swing.DefaultComboBoxModel; |
|
16 |
import javax.swing.JButton; |
|
17 |
import javax.swing.JCheckBox; |
|
18 |
import javax.swing.JComboBox; |
|
19 |
import javax.swing.JLabel; |
|
20 |
import javax.swing.JOptionPane; |
|
21 |
import javax.swing.JPanel; |
|
22 |
import javax.swing.JSpinner; |
|
23 |
import javax.swing.SpinnerModel; |
|
24 |
import javax.swing.SpinnerNumberModel; |
|
25 |
|
|
26 |
import org.gvsig.app.project.documents.view.legend.gui.AbstractParentPanel; |
|
27 |
import org.gvsig.app.project.documents.view.legend.gui.ILegendPanel; |
|
28 |
import org.gvsig.complexlegend.ComplexLegendItem; |
|
29 |
import org.gvsig.complexlegend.VectorComplexLegend; |
|
30 |
import org.gvsig.complexlegend.impl.DefaultComplexLegendItem; |
|
31 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
|
32 |
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect; |
|
33 |
import org.gvsig.fmap.mapcontext.rendering.legend.ILegend; |
|
34 |
import org.gvsig.symbology.swing.SymbologySwingLocator; |
|
35 |
import org.gvsig.tools.ToolsLocator; |
|
36 |
import org.gvsig.tools.i18n.I18nManager; |
|
37 |
import org.gvsig.tools.observer.Observable; |
|
38 |
import org.gvsig.tools.observer.Observer; |
|
39 |
|
|
40 |
public class ComplexLegendItemPanel extends JPanel implements Observable{ |
|
41 |
|
|
42 |
/** |
|
43 |
* |
|
44 |
*/ |
|
45 |
private static final long serialVersionUID = 8565120915575756286L; |
|
46 |
private ComplexLegendItem complexItem; |
|
47 |
private JSpinner maxScaleTXT; |
|
48 |
private JSpinner minScaleTXT; |
|
49 |
private VectorComplexLegend complexLegend; |
|
50 |
private JComboBox legendTypeCB; |
|
51 |
private FLayer layer; |
|
52 |
private DefaultComboBoxModel model; |
|
53 |
private JButton cancelButton; |
|
54 |
private JButton acceptButton; |
|
55 |
private List<Observer> observers; |
|
56 |
private I18nManager i18nManager; |
|
57 |
private JCheckBox minScaleCk; |
|
58 |
private JCheckBox maxScaleCk; |
|
59 |
|
|
60 |
|
|
61 |
public ComplexLegendItemPanel(FLayer layer, VectorComplexLegend vcl){ |
|
62 |
this.i18nManager = ToolsLocator.getI18nManager(); |
|
63 |
this.observers = new ArrayList<Observer>(); |
|
64 |
this.layer = layer; |
|
65 |
this.complexLegend = vcl; |
|
66 |
initialize(); |
|
67 |
} |
|
68 |
|
|
69 |
public ComplexLegendItemPanel(FLayer layer, VectorComplexLegend vcl, ComplexLegendItem cli) { |
|
70 |
this(layer, vcl); |
|
71 |
this.complexItem = cli; |
|
72 |
setData(cli); |
|
73 |
} |
|
74 |
|
|
75 |
private void initialize() { |
|
76 |
setPreferredSize(new Dimension(450, 225)); |
|
77 |
|
|
78 |
JPanel mainPanel = new JPanel(new BorderLayout()); |
|
79 |
mainPanel.setPreferredSize(new Dimension(440, 175)); |
|
80 |
|
|
81 |
JPanel mainDataPanel = new JPanel(); |
|
82 |
mainDataPanel.setPreferredSize(new Dimension(200, 100)); |
|
83 |
GridBagLayout gridBagLayout2 = new GridBagLayout(); |
|
84 |
gridBagLayout2.columnWidths = new int[] { 150, 180, 70 }; |
|
85 |
gridBagLayout2.rowHeights = new int[] { 0, 0, 0, 0, 0, 0 }; |
|
86 |
mainDataPanel.setLayout(gridBagLayout2); |
|
87 |
//mainDataPanel.setBorder(new TitledBorder( i18nManager.getTranslation("Connection_configuration") + ":")); |
|
88 |
|
|
89 |
GridBagConstraints c = new GridBagConstraints(); |
|
90 |
c.fill = GridBagConstraints.HORIZONTAL; |
|
91 |
c.anchor = GridBagConstraints.WEST; |
|
92 |
c.insets = new Insets(3, 0, 3, 0); |
|
93 |
c.ipadx = 10; |
|
94 |
c.gridx = 0; |
|
95 |
c.gridy = 0; |
|
96 |
JLabel labelURL = new JLabel( i18nManager.getTranslation("MinScale")+":"); |
|
97 |
mainDataPanel.add(labelURL, c); |
|
98 |
|
|
99 |
c.gridx = 1; |
|
100 |
c.gridwidth =2; |
|
101 |
mainDataPanel.add(getMinScaleField(), c); |
|
102 |
c.gridy = 1; |
|
103 |
mainDataPanel.add(getWithoutMinScale(), c); |
|
104 |
|
|
105 |
c.gridx = 0; |
|
106 |
c.gridy = 2; |
|
107 |
c.gridwidth =1; |
|
108 |
JLabel labelUser = new JLabel( i18nManager.getTranslation("MaxScale")+":"); |
|
109 |
mainDataPanel.add(labelUser, c); |
|
110 |
|
|
111 |
c.gridx = 1; |
|
112 |
c.gridwidth =2; |
|
113 |
mainDataPanel.add(getMaxScaleField(), c); |
|
114 |
c.gridy = 3; |
|
115 |
mainDataPanel.add(getWithoutMaxScale(), c); |
|
116 |
|
|
117 |
c.gridx = 0; |
|
118 |
c.gridy = 4; |
|
119 |
c.gridwidth =1; |
|
120 |
JLabel labelPassword = new JLabel( i18nManager.getTranslation("LegendType")+":"); |
|
121 |
mainDataPanel.add(labelPassword, c); |
|
122 |
|
|
123 |
c.gridx = 1; |
|
124 |
c.gridwidth =2; |
|
125 |
mainDataPanel.add(getLegendTypes(), c); |
|
126 |
|
|
127 |
mainPanel.add(mainDataPanel, BorderLayout.CENTER); |
|
128 |
add(mainPanel, BorderLayout.CENTER); |
|
129 |
|
|
130 |
add(getButtons(), BorderLayout.SOUTH); |
|
131 |
} |
|
132 |
|
|
133 |
private JCheckBox getWithoutMinScale() { |
|
134 |
if(minScaleCk == null){ |
|
135 |
minScaleCk = new JCheckBox(i18nManager.getTranslation("without_min_scale")); |
|
136 |
minScaleCk.addActionListener(new ActionListener() { |
|
137 |
public void actionPerformed(ActionEvent arg0) { |
|
138 |
getMinScaleField().setEnabled(!minScaleCk.isSelected()); |
|
139 |
} |
|
140 |
}); |
|
141 |
} |
|
142 |
return minScaleCk; |
|
143 |
} |
|
144 |
|
|
145 |
private JCheckBox getWithoutMaxScale() { |
|
146 |
if(maxScaleCk == null){ |
|
147 |
maxScaleCk = new JCheckBox(i18nManager.getTranslation("without_max_scale")); |
|
148 |
maxScaleCk.addActionListener(new ActionListener() { |
|
149 |
public void actionPerformed(ActionEvent arg0) { |
|
150 |
getMaxScaleField().setEnabled(!maxScaleCk.isSelected()); |
|
151 |
} |
|
152 |
}); |
|
153 |
} |
|
154 |
return maxScaleCk; |
|
155 |
} |
|
156 |
|
|
157 |
private JPanel getButtons() { |
|
158 |
JPanel buttons = new JPanel(); |
|
159 |
buttons.add(getAcceptButton()); |
|
160 |
buttons.add(getCancelButton()); |
|
161 |
JPanel aux =new JPanel(new BorderLayout()); |
|
162 |
aux.add(buttons, BorderLayout.EAST); |
|
163 |
return aux; |
|
164 |
} |
|
165 |
|
|
166 |
private JButton getAcceptButton() { |
|
167 |
if(this.acceptButton == null){ |
|
168 |
this.acceptButton = new JButton( i18nManager.getTranslation("accept")); |
|
169 |
this.acceptButton.addActionListener(new ActionListener() { |
|
170 |
public void actionPerformed(ActionEvent arg0) { |
|
171 |
acceptWindow(); |
|
172 |
} |
|
173 |
}); |
|
174 |
} |
|
175 |
return this.acceptButton; |
|
176 |
} |
|
177 |
|
|
178 |
protected void acceptWindow() { |
|
179 |
if(validateValues()){ |
|
180 |
notifyObservers(this, true); |
|
181 |
} |
|
182 |
} |
|
183 |
|
|
184 |
private JButton getCancelButton() { |
|
185 |
if(this.cancelButton == null){ |
|
186 |
this.cancelButton = new JButton( i18nManager.getTranslation("cancel")); |
|
187 |
this.cancelButton.addActionListener(new ActionListener() { |
|
188 |
public void actionPerformed(ActionEvent arg0) { |
|
189 |
hideWindow(); |
|
190 |
} |
|
191 |
}); |
|
192 |
} |
|
193 |
return this.cancelButton; |
|
194 |
} |
|
195 |
|
|
196 |
protected void hideWindow() { |
|
197 |
notifyObservers(this, false); |
|
198 |
} |
|
199 |
|
|
200 |
private JSpinner getMaxScaleField() { |
|
201 |
if(maxScaleTXT == null){ |
|
202 |
SpinnerModel model = |
|
203 |
new SpinnerNumberModel(0, 0, 1000000000, 1000000); |
|
204 |
maxScaleTXT = new JSpinner(model); |
|
205 |
} |
|
206 |
return maxScaleTXT; |
|
207 |
} |
|
208 |
|
|
209 |
private JSpinner getMinScaleField() { |
|
210 |
if(minScaleTXT == null){ |
|
211 |
SpinnerModel model = |
|
212 |
new SpinnerNumberModel(0, 0, 1000000000, 1000000); |
|
213 |
minScaleTXT = new JSpinner(model); |
|
214 |
} |
|
215 |
return minScaleTXT; |
|
216 |
} |
|
217 |
|
|
218 |
private ComboBoxModel getModel(){ |
|
219 |
if(model == null){ |
|
220 |
model = new DefaultComboBoxModel(); |
|
221 |
List<ILegendPanel> legendPanels = |
|
222 |
SymbologySwingLocator.getSwingManager().getLegendEditors(layer); |
|
223 |
Iterator<ILegendPanel> it = legendPanels.iterator(); |
|
224 |
while(it.hasNext()){ |
|
225 |
ILegendPanel legPanel = (ILegendPanel) it.next(); |
|
226 |
if(!((legPanel instanceof AbstractParentPanel) || |
|
227 |
(legPanel instanceof DefaultComplexLegendPanel))){ |
|
228 |
model.addElement(new LegendPanelCombo(legPanel)); |
|
229 |
} |
|
230 |
} |
|
231 |
|
|
232 |
} |
|
233 |
return model; |
|
234 |
} |
|
235 |
|
|
236 |
public class LegendPanelCombo{ |
|
237 |
|
|
238 |
private ILegendPanel legendPanel; |
|
239 |
|
|
240 |
public LegendPanelCombo(ILegendPanel panel){ |
|
241 |
this.legendPanel = panel; |
|
242 |
} |
|
243 |
|
|
244 |
public ILegendPanel getLegendPanel(){ |
|
245 |
return legendPanel; |
|
246 |
} |
|
247 |
|
|
248 |
public String toString(){ |
|
249 |
return this.legendPanel.getTitle(); |
|
250 |
} |
|
251 |
|
|
252 |
} |
|
253 |
|
|
254 |
private JComboBox getLegendTypes() { |
|
255 |
if(legendTypeCB == null){ |
|
256 |
legendTypeCB = new JComboBox(getModel()); |
|
257 |
legendTypeCB.setEditable(false); |
|
258 |
legendTypeCB.addActionListener(new ActionListener() { |
|
259 |
public void actionPerformed(ActionEvent arg0) { |
|
260 |
getLegendPanel(); |
|
261 |
} |
|
262 |
}); |
|
263 |
} |
|
264 |
return legendTypeCB; |
|
265 |
} |
|
266 |
|
|
267 |
public ILegendPanel getLegendPanel() { |
|
268 |
LegendPanelCombo legPanel = (LegendPanelCombo) getLegendTypes().getSelectedItem(); |
|
269 |
return legPanel.getLegendPanel(); |
|
270 |
} |
|
271 |
|
|
272 |
|
|
273 |
private void setData(ComplexLegendItem cli) { |
|
274 |
// TODO Auto-generated method stub |
|
275 |
|
|
276 |
} |
|
277 |
|
|
278 |
public boolean validateValues(){ |
|
279 |
ComplexLegendItem auxLeg = getLegendItem(); |
|
280 |
if(getLegendPanel() == null){ |
|
281 |
createErrorDialog("panel_error_title", "panel_error"); |
|
282 |
return false; |
|
283 |
} |
|
284 |
|
|
285 |
if(getMinScaleField().getValue() == null || |
|
286 |
getMaxScaleField().getValue() == null ){ |
|
287 |
createErrorDialog("min_max_error_title", "min_max_error"); |
|
288 |
return false; |
|
289 |
} |
|
290 |
|
|
291 |
if(auxLeg.getMinScale() > auxLeg.getMaxScale()){ |
|
292 |
if(auxLeg.getMaxScale() >= 0){ |
|
293 |
createErrorDialog("min_greather_than_max_error_title", "min_greather_than_max_error"); |
|
294 |
return false; |
|
295 |
} |
|
296 |
} |
|
297 |
|
|
298 |
if(!complexLegend.getAllowOverlap() && complexLegend.isOverlapped(auxLeg)){ |
|
299 |
createErrorDialog("overlaping_error_title", "overlaping_error"); |
|
300 |
return false; |
|
301 |
} |
|
302 |
|
|
303 |
return true; |
|
304 |
} |
|
305 |
|
|
306 |
private void createErrorDialog(String title, String text){ |
|
307 |
JOptionPane.showMessageDialog(null, |
|
308 |
i18nManager.getTranslation(text), |
|
309 |
i18nManager.getTranslation(title), |
|
310 |
JOptionPane.ERROR_MESSAGE); |
|
311 |
} |
|
312 |
|
|
313 |
|
|
314 |
|
|
315 |
public ComplexLegendItem getLegendItem(){ |
|
316 |
if(complexItem == null){ |
|
317 |
complexItem = new DefaultComplexLegendItem(); |
|
318 |
} |
|
319 |
|
|
320 |
ILegendPanel panelLegend = getLegendPanel(); |
|
321 |
ILegend leg; |
|
322 |
try { |
|
323 |
leg = ((FLyrVect) layer).getLegend(); |
|
324 |
panelLegend.setData(layer, leg); |
|
325 |
ILegend leg2 =panelLegend.getLegend(); |
|
326 |
if(leg2 != null){ |
|
327 |
complexItem.setLegend(leg2); |
|
328 |
} |
|
329 |
} catch (Exception e) { |
|
330 |
e.printStackTrace(); |
|
331 |
} |
|
332 |
|
|
333 |
//complexItem.setLegend(getLegendPanel().getLegend()); |
|
334 |
if(getMinScaleField().getValue() != null && !getWithoutMinScale().isSelected()){ |
|
335 |
double min = Double.parseDouble(getMinScaleField().getValue().toString()); |
|
336 |
complexItem.setMinScale(min); |
|
337 |
}else{ |
|
338 |
complexItem.setMinScale(-1); |
|
339 |
} |
|
340 |
if(getMaxScaleField().getValue() != null && !getWithoutMaxScale().isSelected()){ |
|
341 |
double max = Double.parseDouble(getMaxScaleField().getValue().toString()); |
|
342 |
complexItem.setMaxScale(max); |
|
343 |
}else{ |
|
344 |
complexItem.setMaxScale(-1); |
|
345 |
} |
|
346 |
return complexItem; |
|
347 |
} |
|
348 |
|
|
349 |
|
|
350 |
public void addObserver(Observer o) { |
|
351 |
observers.add(o); |
|
352 |
} |
|
353 |
|
|
354 |
public void deleteObserver(Observer o) { |
|
355 |
observers.remove(o); |
|
356 |
} |
|
357 |
|
|
358 |
public void deleteObservers() { |
|
359 |
observers.clear(); |
|
360 |
} |
|
361 |
|
|
362 |
public synchronized void notifyObservers(Observable observable, Object tableName) { |
|
363 |
for(int i =0; i<this.observers.size(); i++ ) { |
|
364 |
Observer o = (Observer) this.observers.get(i); |
|
365 |
o.update(this, tableName); |
|
366 |
} |
|
367 |
} |
|
368 |
|
|
369 |
|
|
370 |
|
|
371 |
} |
|
0 | 372 |
org.gvsig.complexlegend/tags/org.gvsig.complexlegend-1.0.93/org.gvsig.complexlegend/org.gvsig.complexlegend.swing/org.gvsig.complexlegend.swing.impl/src/main/java/org/gvsig/complexlegend/swing/impl/DefaultComplexLegendSwingLibrary.java | ||
---|---|---|
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.complexlegend.swing.impl; |
|
23 |
|
|
24 |
import org.gvsig.andami.IconThemeHelper; |
|
25 |
import org.gvsig.app.project.documents.view.legend.gui.LegendManager; |
|
26 |
import org.gvsig.complexlegend.swing.ComplexLegendPanel; |
|
27 |
import org.gvsig.complexlegend.swing.ComplexLegendSwingLibrary; |
|
28 |
import org.gvsig.symbology.swing.SymbologySwingLocator; |
|
29 |
import org.gvsig.tools.library.AbstractLibrary; |
|
30 |
import org.gvsig.tools.library.LibraryException; |
|
31 |
|
|
32 |
/** |
|
33 |
* Library for default swing implementation initialization and configuration. |
|
34 |
* |
|
35 |
* @author gvSIG team |
|
36 |
* @version $Id$ |
|
37 |
*/ |
|
38 |
public class DefaultComplexLegendSwingLibrary extends AbstractLibrary { |
|
39 |
|
|
40 |
|
|
41 |
@Override |
|
42 |
public void doRegistration() { |
|
43 |
registerAsImplementationOf(ComplexLegendSwingLibrary.class); |
|
44 |
} |
|
45 |
|
|
46 |
@Override |
|
47 |
protected void doInitialize() throws LibraryException { |
|
48 |
} |
|
49 |
|
|
50 |
@Override |
|
51 |
protected void doPostInitialize() throws LibraryException { |
|
52 |
// IconThemeHelper.registerIcon("chart", "chart-edit-add", this); |
|
53 |
IconThemeHelper.registerIcon("legend", "scaled-symbols", this); |
|
54 |
IconThemeHelper.registerIcon("legend", "legend-add", this); |
|
55 |
IconThemeHelper.registerIcon("legend", "legend-delete", this); |
|
56 |
|
|
57 |
} |
|
58 |
|
|
59 |
} |
|
0 | 60 |
org.gvsig.complexlegend/tags/org.gvsig.complexlegend-1.0.93/org.gvsig.complexlegend/org.gvsig.complexlegend.swing/org.gvsig.complexlegend.swing.impl/src/main/resources/META-INF/services/org.gvsig.tools.library.Library | ||
---|---|---|
1 |
org.gvsig.complexlegend.swing.impl.DefaultComplexLegendSwingLibrary |
org.gvsig.complexlegend/tags/org.gvsig.complexlegend-1.0.93/org.gvsig.complexlegend/org.gvsig.complexlegend.swing/org.gvsig.complexlegend.swing.impl/pom.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="ISO-8859-1"?> |
|
2 |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> |
|
3 |
<modelVersion>4.0.0</modelVersion> |
|
4 |
<artifactId>org.gvsig.complexlegend.swing.impl</artifactId> |
|
5 |
<packaging>jar</packaging> |
|
6 |
<name>org.gvsig.complexlegend.swing.impl</name> |
|
7 |
<parent> |
|
8 |
<groupId>org.gvsig</groupId> |
|
9 |
<artifactId>org.gvsig.complexlegend.swing</artifactId> |
|
10 |
<version>1.0.93</version> |
|
11 |
</parent> |
|
12 |
<dependencies> |
|
13 |
<dependency> |
|
14 |
<groupId>org.gvsig</groupId> |
|
15 |
<artifactId> org.gvsig.app.mainplugin</artifactId> |
|
16 |
<scope>compile</scope> |
|
17 |
</dependency> |
|
18 |
<dependency> |
|
19 |
<groupId>org.gvsig</groupId> |
|
20 |
<artifactId> org.gvsig.andami</artifactId> |
|
21 |
<scope>compile</scope> |
|
22 |
</dependency> |
|
23 |
<dependency> |
|
24 |
<groupId>org.gvsig</groupId> |
|
25 |
<artifactId>org.gvsig.fmap.geometry.api</artifactId> |
|
26 |
<scope>compile</scope> |
|
27 |
</dependency> |
|
28 |
<dependency> |
|
29 |
<groupId>org.gvsig</groupId> |
|
30 |
<artifactId>org.gvsig.complexlegend.lib.api</artifactId> |
|
31 |
</dependency> |
|
32 |
<dependency> |
|
33 |
<groupId>org.gvsig</groupId> |
|
34 |
<artifactId>org.gvsig.complexlegend.lib.impl</artifactId> |
|
35 |
<scope>compile</scope> |
|
36 |
</dependency> |
|
37 |
<dependency> |
|
38 |
<groupId>org.gvsig</groupId> |
|
39 |
<artifactId>org.gvsig.complexlegend.swing.api</artifactId> |
|
40 |
<scope>compile</scope> |
|
41 |
</dependency> |
|
42 |
<dependency> |
|
43 |
<groupId>org.gvsig</groupId> |
|
44 |
<artifactId>org.gvsig.tools.swing.api</artifactId> |
|
45 |
<scope>compile</scope> |
|
46 |
</dependency> |
|
47 |
<dependency> |
|
48 |
<groupId>org.gvsig</groupId> |
|
49 |
<artifactId>org.gvsig.app.mainplugin</artifactId> |
|
50 |
<scope>compile</scope> |
|
51 |
</dependency> |
|
52 |
<dependency> |
|
53 |
<groupId>org.gvsig</groupId> |
|
54 |
<artifactId>org.gvsig.symbology.swing.api</artifactId> |
|
55 |
<scope>compile</scope> |
|
56 |
</dependency> |
|
57 |
<dependency> |
|
58 |
<groupId>org.gvsig</groupId> |
|
59 |
<artifactId>org.gvsig.symbology.swing.impl</artifactId> |
|
60 |
<scope>compile</scope> |
|
61 |
</dependency> |
|
62 |
</dependencies> |
|
63 |
</project> |
|
0 | 64 |
org.gvsig.complexlegend/tags/org.gvsig.complexlegend-1.0.93/org.gvsig.complexlegend/org.gvsig.complexlegend.swing/org.gvsig.complexlegend.swing.api/src/main/resources/META-INF/services/org.gvsig.tools.library.Library | ||
---|---|---|
1 |
org.gvsig.complexlegend.swing.ComplexLegendSwingLibrary |
org.gvsig.complexlegend/tags/org.gvsig.complexlegend-1.0.93/org.gvsig.complexlegend/org.gvsig.complexlegend.swing/org.gvsig.complexlegend.swing.api/src/main/java/org/gvsig/complexlegend/swing/ComplexLegendSwingLibrary.java | ||
---|---|---|
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.complexlegend.swing; |
|
23 |
|
|
24 |
import org.gvsig.app.project.documents.view.legend.gui.LegendManager; |
|
25 |
import org.gvsig.complexlegend.ComplexLegendLibrary; |
|
26 |
import org.gvsig.tools.library.AbstractLibrary; |
|
27 |
import org.gvsig.tools.library.LibraryException; |
|
28 |
|
|
29 |
/** |
|
30 |
* Library for Swing API initialization and configuration. |
|
31 |
* |
|
32 |
* @author gvSIG team |
|
33 |
* @version $Id$ |
|
34 |
*/ |
|
35 |
public class ComplexLegendSwingLibrary extends AbstractLibrary { |
|
36 |
|
|
37 |
@Override |
|
38 |
public void doRegistration() { |
|
39 |
registerAsAPI(ComplexLegendSwingLibrary.class); |
|
40 |
this.require(ComplexLegendLibrary.class); |
|
41 |
} |
|
42 |
|
|
43 |
@Override |
|
44 |
protected void doInitialize() throws LibraryException { |
|
45 |
// Do nothing |
|
46 |
} |
|
47 |
|
|
48 |
@Override |
|
49 |
protected void doPostInitialize() throws LibraryException { |
|
50 |
// IconThemeHelper.registerIcon("legend", |
|
51 |
// "legend-overview-dot-density", this); |
|
52 |
// IconThemeHelper.registerIcon("legend", |
|
53 |
// "legend-dot-density-low-density-sample", this); |
|
54 |
// IconThemeHelper.registerIcon("legend", |
|
55 |
// "legend-dot-density-medium-density-sample", this); |
|
56 |
// IconThemeHelper.registerIcon("legend", |
|
57 |
// "legend-dot-density-high-density-sample", this); |
|
58 |
} |
|
59 |
|
|
60 |
} |
|
0 | 61 |
org.gvsig.complexlegend/tags/org.gvsig.complexlegend-1.0.93/org.gvsig.complexlegend/org.gvsig.complexlegend.swing/org.gvsig.complexlegend.swing.api/src/main/java/org/gvsig/complexlegend/swing/ComplexLegendPanel.java | ||
---|---|---|
1 |
package org.gvsig.complexlegend.swing; |
|
2 |
|
|
3 |
import javax.swing.ImageIcon; |
|
4 |
import javax.swing.JPanel; |
|
5 |
|
|
6 |
import org.gvsig.app.project.documents.view.legend.gui.ILegendPanel; |
|
7 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
|
8 |
import org.gvsig.fmap.mapcontext.rendering.legend.ILegend; |
|
9 |
|
|
10 |
public interface ComplexLegendPanel extends ILegendPanel{ |
|
11 |
|
|
12 |
|
|
13 |
} |
|
0 | 14 |
org.gvsig.complexlegend/tags/org.gvsig.complexlegend-1.0.93/org.gvsig.complexlegend/org.gvsig.complexlegend.swing/org.gvsig.complexlegend.swing.api/src/main/java/package.html | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8" ?> |
|
2 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
|
3 |
<html xmlns="http://www.w3.org/1999/xhtml"> |
|
4 |
<head> |
|
5 |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> |
|
6 |
<title>org.gvsig.landregistryviewer package documentation</title> |
|
7 |
</head> |
|
8 |
<body> |
|
9 |
|
|
10 |
<p>LandRegistryViewer swing library API.</p> |
|
11 |
|
|
12 |
<p> |
|
13 |
It allows to get swing panels to show LandRegistryViewer, and to include them in windows. |
|
14 |
</p> |
|
15 |
|
|
16 |
</body> |
|
17 |
</html> |
|
0 | 18 |
org.gvsig.complexlegend/tags/org.gvsig.complexlegend-1.0.93/org.gvsig.complexlegend/org.gvsig.complexlegend.swing/org.gvsig.complexlegend.swing.api/pom.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="ISO-8859-1"?> |
|
2 |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> |
|
3 |
<modelVersion>4.0.0</modelVersion> |
|
4 |
<artifactId>org.gvsig.complexlegend.swing.api</artifactId> |
|
5 |
<packaging>jar</packaging> |
|
6 |
<name>org.gvsig.complexlegend.swing.api</name> |
|
7 |
<parent> |
|
8 |
<groupId>org.gvsig</groupId> |
|
9 |
<artifactId>org.gvsig.complexlegend.swing</artifactId> |
|
10 |
<version>1.0.93</version> |
|
11 |
</parent> |
|
12 |
<build> |
|
13 |
<plugins> |
|
14 |
<plugin> |
|
15 |
<groupId>org.apache.maven.plugins</groupId> |
|
16 |
<artifactId>maven-jar-plugin</artifactId> |
|
17 |
<configuration> |
|
18 |
</configuration> |
|
19 |
<executions> |
|
20 |
<!-- |
|
21 |
Generates a jar file only with the test classes |
|
22 |
--> |
|
23 |
<execution> |
|
24 |
<goals> |
|
25 |
<goal>test-jar</goal> |
|
26 |
</goals> |
|
27 |
</execution> |
|
28 |
</executions> |
|
29 |
</plugin> |
|
30 |
</plugins> |
|
31 |
</build> |
|
32 |
<dependencies> |
|
33 |
<dependency> |
|
34 |
<groupId>org.gvsig</groupId> |
|
35 |
<artifactId>org.gvsig.complexlegend.lib.api</artifactId> |
|
36 |
</dependency> |
|
37 |
<dependency> |
|
38 |
<groupId>org.gvsig</groupId> |
|
39 |
<artifactId>org.gvsig.app.mainplugin</artifactId> |
|
40 |
</dependency> |
|
41 |
</dependencies> |
|
42 |
</project> |
|
0 | 43 |
org.gvsig.complexlegend/tags/org.gvsig.complexlegend-1.0.93/org.gvsig.complexlegend/org.gvsig.complexlegend.swing/pom.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="ISO-8859-1"?> |
|
2 |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
|
3 |
|
|
4 |
<modelVersion>4.0.0</modelVersion> |
|
5 |
<artifactId>org.gvsig.complexlegend.swing</artifactId> |
|
6 |
<packaging>pom</packaging> |
|
7 |
<name>org.gvsig.complexlegend.swing</name> |
|
8 |
<parent> |
|
9 |
<groupId>org.gvsig</groupId> |
|
10 |
<artifactId>org.gvsig.complexlegend</artifactId> |
|
11 |
<version>1.0.93</version> |
|
12 |
</parent> |
|
13 |
|
|
14 |
<modules> |
|
15 |
<module>org.gvsig.complexlegend.swing.api</module> |
|
16 |
<module>org.gvsig.complexlegend.swing.impl</module> |
|
17 |
</modules> |
|
18 |
</project> |
|
19 |
|
|
0 | 20 |
org.gvsig.complexlegend/tags/org.gvsig.complexlegend-1.0.93/org.gvsig.complexlegend/org.gvsig.complexlegend.app/pom.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="ISO-8859-1"?> |
|
2 |
|
|
3 |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
|
4 |
<modelVersion>4.0.0</modelVersion> |
|
5 |
<artifactId>org.gvsig.complexlegend.app</artifactId> |
|
6 |
<packaging>pom</packaging> |
|
7 |
<name>org.gvsig.complexlegend.app</name> |
|
8 |
<description>complex legend extension</description> |
|
9 |
<parent> |
|
10 |
<groupId>org.gvsig</groupId> |
|
11 |
<artifactId>org.gvsig.complexlegend</artifactId> |
|
12 |
<version>1.0.93</version> |
|
13 |
</parent> |
|
14 |
<dependencyManagement> |
|
15 |
<dependencies> |
|
16 |
</dependencies> |
|
17 |
</dependencyManagement> |
|
18 |
|
|
19 |
<modules> |
|
20 |
<module>org.gvsig.complexlegend.app.mainplugin</module> |
|
21 |
</modules> |
|
22 |
|
|
23 |
</project> |
|
0 | 24 |
org.gvsig.complexlegend/tags/org.gvsig.complexlegend-1.0.93/org.gvsig.complexlegend/org.gvsig.complexlegend.app/org.gvsig.complexlegend.app.mainplugin/buildNumber.properties | ||
---|---|---|
1 |
#Mon Jan 20 09:21:59 CET 2020 |
|
2 |
buildNumber=99 |
|
0 | 3 |
org.gvsig.complexlegend/tags/org.gvsig.complexlegend-1.0.93/org.gvsig.complexlegend/org.gvsig.complexlegend.app/org.gvsig.complexlegend.app.mainplugin/src/main/assembly/gvsig-plugin-package.xml | ||
---|---|---|
1 |
<assembly> |
|
2 |
<id>gvsig-plugin-package</id> |
|
3 |
<formats> |
|
4 |
<format>zip</format> |
|
5 |
</formats> |
|
6 |
<baseDirectory>${project.artifactId}</baseDirectory> |
|
7 |
<includeBaseDirectory>true</includeBaseDirectory> |
|
8 |
<files> |
|
9 |
<file> |
|
10 |
<source>target/${project.artifactId}-${project.version}.jar</source> |
|
11 |
<outputDirectory>lib</outputDirectory> |
|
12 |
</file> |
|
13 |
<file> |
|
14 |
<source>target/package.info</source> |
|
15 |
</file> |
|
16 |
</files> |
|
17 |
|
|
18 |
<fileSets> |
|
19 |
<fileSet> |
|
20 |
<directory>src/main/resources-plugin</directory> |
|
21 |
<outputDirectory>.</outputDirectory> |
|
22 |
</fileSet> |
|
23 |
</fileSets> |
|
24 |
|
|
25 |
<dependencySets> |
|
26 |
<dependencySet> |
|
27 |
<useProjectArtifact>false</useProjectArtifact> |
|
28 |
<useTransitiveDependencies>false</useTransitiveDependencies> |
|
29 |
<outputDirectory>lib</outputDirectory> |
|
30 |
<includes> |
|
31 |
<include>org.gvsig:org.gvsig.complexlegend.lib.api</include> |
|
32 |
<include>org.gvsig:org.gvsig.complexlegend.swing.api</include> |
|
33 |
<include>org.gvsig:org.gvsig.complexlegend.lib.impl</include> |
|
34 |
<include>org.gvsig:org.gvsig.complexlegend.swing.impl</include> |
|
35 |
</includes> |
|
36 |
</dependencySet> |
|
37 |
</dependencySets> |
|
38 |
|
|
39 |
</assembly> |
|
0 | 40 |
org.gvsig.complexlegend/tags/org.gvsig.complexlegend-1.0.93/org.gvsig.complexlegend/org.gvsig.complexlegend.app/org.gvsig.complexlegend.app.mainplugin/src/main/java/org/gvsig/complexlegend/app/mainplugin/ComplexLegendExtension.java | ||
---|---|---|
1 |
/* OSM layers for gvSIG. |
|
2 |
* Geographic Information System of the Valencian Government |
|
3 |
* |
|
4 |
* Copyright (C) 2012 Nacho Brodin |
|
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.complexlegend.app.mainplugin; |
|
23 |
|
|
24 |
import org.gvsig.andami.plugins.Extension; |
|
25 |
import org.gvsig.app.project.documents.view.legend.gui.LegendManager; |
|
26 |
import org.gvsig.complexlabel.app.editor.ComplexLabelClassEditorFactory; |
|
27 |
import org.gvsig.complexlegend.impl.DefaultVectorComplexLegend; |
|
28 |
import org.gvsig.complexlegend.swing.impl.DefaultComplexLegendPanel; |
|
29 |
import org.gvsig.symbology.swing.SymbologySwingLocator; |
|
30 |
import org.gvsig.symbology.swing.SymbologySwingManager; |
|
31 |
|
|
32 |
/** |
|
33 |
* Complex Legend Extension to gvSIG. |
|
34 |
* @author Jose Badia (jbadia@scolab.es) |
|
35 |
*/ |
|
36 |
public class ComplexLegendExtension extends Extension { |
|
37 |
|
|
38 |
public void initialize() { |
|
39 |
SymbologySwingManager manager = SymbologySwingLocator.getSwingManager(); |
|
40 |
manager.registerLegendEditor(DefaultComplexLegendPanel.class); |
|
41 |
manager.registerLabelClassEditor(new ComplexLabelClassEditorFactory()); |
|
42 |
} |
|
43 |
|
|
44 |
@Override |
|
45 |
public void postInitialize() { |
|
46 |
super.postInitialize(); |
|
47 |
|
|
48 |
} |
|
49 |
|
|
50 |
public void execute(String actionCommand) { |
|
51 |
|
|
52 |
} |
|
53 |
|
|
54 |
public boolean isEnabled() { |
|
55 |
return true; |
|
56 |
} |
|
57 |
|
|
58 |
public boolean isVisible() { |
|
59 |
return true; |
|
60 |
} |
|
61 |
} |
|
0 | 62 |
org.gvsig.complexlegend/tags/org.gvsig.complexlegend-1.0.93/org.gvsig.complexlegend/org.gvsig.complexlegend.app/org.gvsig.complexlegend.app.mainplugin/src/main/java/org/gvsig/complexlabel/app/editor/LabelClassScalePanel.java | ||
---|---|---|
1 |
package org.gvsig.complexlabel.app.editor; |
|
2 |
|
|
3 |
import java.awt.BorderLayout; |
|
4 |
import java.awt.Component; |
|
5 |
import java.awt.Dimension; |
|
6 |
import java.awt.GridBagConstraints; |
|
7 |
import java.awt.GridBagLayout; |
|
8 |
import java.awt.Insets; |
|
9 |
import java.awt.event.ActionEvent; |
|
10 |
import java.awt.event.ActionListener; |
|
11 |
|
|
12 |
import javax.swing.JCheckBox; |
|
13 |
import javax.swing.JLabel; |
|
14 |
import javax.swing.JPanel; |
|
15 |
import javax.swing.JSpinner; |
|
16 |
import javax.swing.SpinnerModel; |
|
17 |
import javax.swing.SpinnerNumberModel; |
|
18 |
|
|
19 |
import org.gvsig.complexlabel.impl.DefaultComplexLabelClass; |
|
20 |
import org.gvsig.tools.ToolsLocator; |
|
21 |
import org.gvsig.tools.i18n.I18nManager; |
Also available in: Unified diff