Revision 2438 trunk/applications/appgvSIG/src/com/iver/cit/gvsig/gui/thememanager/legendmanager/panels/FPanelLegendValues.java
FPanelLegendValues.java | ||
---|---|---|
62 | 62 |
|
63 | 63 |
import com.hardcode.gdbms.engine.data.DataSource; |
64 | 64 |
import com.hardcode.gdbms.engine.data.driver.DriverException; |
65 |
import com.hardcode.gdbms.engine.values.NullValue; |
|
65 | 66 |
import com.hardcode.gdbms.engine.values.Value; |
66 | 67 |
import com.hardcode.gdbms.engine.values.ValueFactory; |
67 | 68 |
import com.iver.andami.PluginServices; |
... | ... | |
71 | 72 |
import com.iver.cit.gvsig.fmap.layers.layerOperations.ClassifiableVectorial; |
72 | 73 |
import com.iver.cit.gvsig.fmap.rendering.Legend; |
73 | 74 |
import com.iver.cit.gvsig.fmap.rendering.LegendFactory; |
75 |
import com.iver.cit.gvsig.fmap.rendering.NullUniqueValue; |
|
74 | 76 |
import com.iver.cit.gvsig.fmap.rendering.VectorialUniqueValueLegend; |
77 |
import javax.swing.JCheckBox; |
|
75 | 78 |
|
76 | 79 |
/** |
77 | 80 |
* @author fjp |
... | ... | |
85 | 88 |
// private TOC m_TOC; |
86 | 89 |
private VectorialUniqueValueLegend m_Renderer; |
87 | 90 |
private ClassifiableVectorial m_lyr; |
88 |
private boolean m_bCacheDirty = true; |
|
91 |
//private boolean m_bCacheDirty = true;
|
|
89 | 92 |
|
90 | 93 |
private FSymbolTable m_symbolTable = new FSymbolTable("values"); |
91 | 94 |
|
... | ... | |
93 | 96 |
|
94 | 97 |
private JButton quitartodo; |
95 | 98 |
private JButton quitar; |
99 |
private JCheckBox chbUseDefault = null; |
|
100 |
private VectorialUniqueValueLegend auxLegend; |
|
96 | 101 |
|
97 | 102 |
|
98 | 103 |
|
... | ... | |
117 | 122 |
System.out.println("Nombre del campo: " + fieldName); |
118 | 123 |
m_symbolTable.removeAllItems(); |
119 | 124 |
if (fieldName != m_Renderer.getFieldName()) |
120 |
m_bCacheDirty = true; |
|
125 |
//m_bCacheDirty = true;
|
|
121 | 126 |
m_Renderer.setFieldName(fieldName); |
122 | 127 |
} |
123 | 128 |
|
... | ... | |
219 | 224 |
this.add(pAux1, BorderLayout.NORTH); |
220 | 225 |
this.add(ptabla, BorderLayout.CENTER); |
221 | 226 |
this.add(botonestabla, BorderLayout.SOUTH); |
227 |
pAux1.add(getChbUseDefault(), null); |
|
222 | 228 |
} |
223 | 229 |
private void fillTableValues() |
224 | 230 |
{ |
... | ... | |
232 | 238 |
System.out.println("Nombre del campo: " + fieldName); |
233 | 239 |
idField = elRs.getFieldIndexByName(fieldName); |
234 | 240 |
m_Renderer.setFieldName(fieldName); |
235 |
long numReg = elRs.getRowCount(); |
|
241 |
//long numReg = elRs.getRowCount();
|
|
236 | 242 |
|
237 | 243 |
if (idField == -1) |
238 | 244 |
{ |
... | ... | |
244 | 250 |
int numSymbols = 0; |
245 | 251 |
FSymbol theSymbol = null; |
246 | 252 |
|
247 |
VectorialUniqueValueLegend auxLegend; |
|
253 |
|
|
254 |
//auxLegend=(VectorialUniqueValueLegend)m_lyr.getLegend(); |
|
248 | 255 |
auxLegend = LegendFactory.createVectorialUniqueValueLegend(m_lyr.getShapeType()); |
249 | 256 |
Value clave; |
250 |
Object resul; |
|
251 |
|
|
257 |
//Object resul; |
|
258 |
if (chbUseDefault.isSelected()){ |
|
259 |
auxLegend.getDefaultSymbol().setDescription("Default"); |
|
260 |
auxLegend.addSymbol(new NullUniqueValue(),auxLegend.getDefaultSymbol()); |
|
261 |
|
|
262 |
} |
|
252 | 263 |
for (int j = 0; j < elRs.getRowCount(); j++) |
253 | 264 |
{ |
254 | 265 |
clave = elRs.getFieldValue(j,idField); |
266 |
if (clave instanceof NullValue) |
|
267 |
continue; |
|
255 | 268 |
////Comprobar que no esta repetido y no hace falta introducir en el hashtable el campo junto con el simbolo. |
256 | 269 |
if (auxLegend.getSymbolByValue(clave) == null) { |
257 | 270 |
//si no esta creado el simbolo se crea |
... | ... | |
283 | 296 |
quitartodo.setEnabled(true); |
284 | 297 |
quitar.setEnabled(true); |
285 | 298 |
|
286 |
m_bCacheDirty = false; |
|
299 |
//m_bCacheDirty = false;
|
|
287 | 300 |
|
288 | 301 |
|
289 | 302 |
} |
... | ... | |
383 | 396 |
*/ |
384 | 397 |
public Legend getLegend() { |
385 | 398 |
fillSymbolListFromTable(); |
399 |
if (auxLegend != null){ |
|
400 |
m_Renderer.setDefaultSymbol(auxLegend.getDefaultSymbol()); |
|
401 |
m_Renderer.useDefaultSymbol(chbUseDefault.isSelected()); |
|
402 |
} |
|
386 | 403 |
return m_Renderer; |
387 | 404 |
} |
405 |
/** |
|
406 |
* This method initializes chbUseDefault |
|
407 |
* |
|
408 |
* @return javax.swing.JCheckBox |
|
409 |
*/ |
|
410 |
private JCheckBox getChbUseDefault() { |
|
411 |
if (chbUseDefault == null) { |
|
412 |
chbUseDefault = new JCheckBox(); |
|
413 |
chbUseDefault.setSelected(true); |
|
414 |
chbUseDefault.addActionListener(new java.awt.event.ActionListener() { |
|
415 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
|
416 |
fillTableValues(); |
|
417 |
} |
|
418 |
}); |
|
419 |
chbUseDefault.setText(PluginServices.getText(this,"resto_valores")); |
|
420 |
} |
|
421 |
return chbUseDefault; |
|
422 |
} |
|
388 | 423 |
|
389 | 424 |
} |
Also available in: Unified diff