Revision 25455 trunk/extensions/extSymbology/src/com/iver/cit/gvsig/project/documents/view/legend/gui/VectorFilterExpression.java
VectorFilterExpression.java | ||
---|---|---|
48 | 48 |
import java.io.IOException; |
49 | 49 |
import java.util.ArrayList; |
50 | 50 |
|
51 |
import javax.swing.BoxLayout; |
|
51 | 52 |
import javax.swing.ImageIcon; |
52 | 53 |
import javax.swing.JCheckBox; |
53 | 54 |
import javax.swing.JOptionPane; |
... | ... | |
88 | 89 |
private ClassifiableVectorial layer; |
89 | 90 |
private PictureFillSymbol previewSymbol; |
90 | 91 |
private JPanel pnlCenter; |
92 |
private JPanel pnlMovBut; |
|
91 | 93 |
private SymbolTable symbolTable; |
92 | 94 |
private JButton btnAddExpression; |
93 | 95 |
private JButton btnModExpression; |
94 | 96 |
private JButton btnRemoveExpression; |
97 |
private JButton moveUp; |
|
98 |
private JButton moveDown; |
|
95 | 99 |
private int shapeType; |
96 | 100 |
protected JCheckBox chkdefaultvalues = null; |
97 | 101 |
protected JSymbolPreviewButton defaultSymbolPrev; |
... | ... | |
274 | 278 |
|
275 | 279 |
if (symbolTable != null) |
276 | 280 |
pnlCenter.remove(symbolTable); |
281 |
if (pnlMovBut != null) |
|
282 |
pnlCenter.remove(pnlMovBut); |
|
277 | 283 |
|
278 | 284 |
getDefaultSymbolPrev(shapeType); |
279 | 285 |
|
280 | 286 |
symbolTable = new SymbolTable(this, "expressions", shapeType); |
281 | 287 |
pnlCenter.add(symbolTable, BorderLayout.CENTER); |
288 |
pnlCenter.add(getPnlMovBut(),BorderLayout.EAST); |
|
282 | 289 |
|
290 |
|
|
283 | 291 |
if (legend instanceof VectorFilterExpressionLegend) { |
284 | 292 |
try { |
285 | 293 |
auxLegend = (VectorFilterExpressionLegend) legend.cloneLegend(); |
... | ... | |
296 | 304 |
defaultSymbolPrev.setSymbol(auxLegend.getDefaultSymbol()); |
297 | 305 |
} |
298 | 306 |
|
307 |
private JPanel getPnlMovBut() { |
|
308 |
if(pnlMovBut == null){ |
|
309 |
pnlMovBut = new JPanel(); |
|
310 |
pnlMovBut.setLayout(new BoxLayout(pnlMovBut, BoxLayout.Y_AXIS)); |
|
311 |
pnlMovBut.add(new JBlank(1, 70)); |
|
312 |
pnlMovBut.add(moveUp = new JButton(PluginServices.getIconTheme().get("up-arrow"))); |
|
313 |
moveUp.setSize(new Dimension(15,15)); |
|
314 |
pnlMovBut.add(new JBlank(1,10)); |
|
315 |
pnlMovBut.add(moveDown = new JButton(PluginServices.getIconTheme().get("down-arrow"))); |
|
316 |
pnlMovBut.add(new JBlank(1, 70)); |
|
317 |
moveDown.setActionCommand("MOVE-DOWN"); |
|
318 |
moveUp.setActionCommand("MOVE-UP"); |
|
319 |
moveDown.addActionListener(this); |
|
320 |
moveUp.addActionListener(this); |
|
321 |
} |
|
322 |
return pnlMovBut; |
|
323 |
} |
|
324 |
|
|
299 | 325 |
public void actionPerformed(ActionEvent e) { |
326 |
int[] indices = null; |
|
327 |
|
|
328 |
if(e.getActionCommand() == "MOVE-UP" || e.getActionCommand() == "MOVE-DOWN"){ |
|
329 |
indices = symbolTable.getSelectedRows(); |
|
330 |
} |
|
331 |
|
|
332 |
if(e.getActionCommand() == "MOVE-UP"){ |
|
333 |
if (indices.length>0) { |
|
334 |
int classIndex = indices[0]; |
|
335 |
int targetPos = Math.max(0, classIndex-1); |
|
336 |
symbolTable.moveUpRows(classIndex, targetPos,indices.length); |
|
337 |
} |
|
338 |
} |
|
339 |
|
|
340 |
if(e.getActionCommand() == "MOVE-DOWN"){ |
|
341 |
if (indices.length>0) { |
|
342 |
int classIndex = indices[indices.length-1]; |
|
343 |
int targetPos = Math.min(symbolTable.getRowCount()-1, classIndex+1); |
|
344 |
symbolTable.moveDownRows(classIndex, targetPos,indices.length); |
|
345 |
} |
|
346 |
} |
|
347 |
|
|
348 |
if(e.getActionCommand() == "MOVE-UP" || e.getActionCommand() == "MOVE-DOWN"){ |
|
349 |
ArrayList orders = new ArrayList(); |
|
350 |
|
|
351 |
for (int i = 0; i < symbolTable.getRowCount(); i++) { |
|
352 |
orders.add(symbolTable.getFieldValue(i,1).toString()); |
|
353 |
} |
|
354 |
} |
|
300 | 355 |
if (e.getActionCommand() == "NEW_EXPRESSION") { |
301 | 356 |
ExpressionCreator newExpression = new ExpressionCreator((FLyrVect) this.layer ); |
302 | 357 |
PluginServices.getMDIManager().addWindow((IWindow) newExpression); |
Also available in: Unified diff