Revision 41630
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.api/src/main/java/org/gvsig/fmap/dal/feature/paging/FeaturePagingHelper.java | ||
---|---|---|
135 | 135 |
*/ |
136 | 136 |
void setSelectionUp(boolean selectionUp); |
137 | 137 |
|
138 |
boolean isSelectionUp(); |
|
139 |
|
|
138 | 140 |
/** |
139 | 141 |
* Return a List of Fearures with the contents of this PagingHelper |
140 | 142 |
* |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/fmap/dal/feature/paging/impl/FeaturePagingHelperImpl.java | ||
---|---|---|
168 | 168 |
/** |
169 | 169 |
* @return the selectionUp status |
170 | 170 |
*/ |
171 |
protected boolean isSelectionUp() {
|
|
171 |
public boolean isSelectionUp() {
|
|
172 | 172 |
return selectionUp; |
173 | 173 |
} |
174 | 174 |
|
175 | 175 |
public void setSelectionUp(boolean selectionUp) { |
176 | 176 |
this.selectionUp = selectionUp; |
177 | 177 |
try { |
178 |
if (selectionUp) { |
|
179 |
initialSelection = |
|
180 |
(FeatureSelection) getFeatureStore().getFeatureSelection() |
|
181 |
.clone(); |
|
178 |
FeatureSelection currentSelection = getFeatureStore().getFeatureSelection(); |
|
179 |
if (selectionUp && !currentSelection.isEmpty()) { |
|
180 |
initialSelection =(FeatureSelection) currentSelection.clone(); |
|
182 | 181 |
setCalculator(new OneSubsetOneSetPagingCalculator( |
183 | 182 |
new FeatureSetSizeableDelegate(initialSelection), |
184 | 183 |
new FeatureSetSizeableDelegate(getFeatureSet(false)), |
... | ... | |
348 | 347 |
} |
349 | 348 |
|
350 | 349 |
private void loadCurrentPageDataWithSelectionUp(final Feature[] values) |
351 |
throws BaseException { |
|
350 |
throws BaseException {
|
|
352 | 351 |
FeatureSelection selection = initialSelection; |
352 |
if (selection == null) { |
|
353 |
loadCurrentPageDataNoSelection(values); |
|
354 |
} else { |
|
355 |
FeatureSet set = getFeatureSet(false); |
|
356 |
try { |
|
357 |
OneSubsetOneSetPagingCalculator twoSetsCalculator = null; |
|
358 |
if (getCalculator() instanceof OneSubsetOneSetPagingCalculator) { |
|
359 |
twoSetsCalculator |
|
360 |
= (OneSubsetOneSetPagingCalculator) getCalculator(); |
|
361 |
} else { |
|
362 |
twoSetsCalculator |
|
363 |
= new OneSubsetOneSetPagingCalculator( |
|
364 |
new FeatureSetSizeableDelegate(selection), |
|
365 |
new FeatureSetSizeableDelegate(set), |
|
366 |
getMaxPageSize(), getCalculator().getCurrentPage()); |
|
367 |
setCalculator(twoSetsCalculator); |
|
368 |
} |
|
353 | 369 |
|
354 |
FeatureSet set = getFeatureSet(false); |
|
355 |
try { |
|
356 |
OneSubsetOneSetPagingCalculator twoSetsCalculator = null; |
|
357 |
if (getCalculator() instanceof OneSubsetOneSetPagingCalculator) { |
|
358 |
twoSetsCalculator = |
|
359 |
(OneSubsetOneSetPagingCalculator) getCalculator(); |
|
360 |
} else { |
|
361 |
twoSetsCalculator = |
|
362 |
new OneSubsetOneSetPagingCalculator( |
|
363 |
new FeatureSetSizeableDelegate(selection), |
|
364 |
new FeatureSetSizeableDelegate(set), |
|
365 |
getMaxPageSize(), getCalculator().getCurrentPage()); |
|
366 |
setCalculator(twoSetsCalculator); |
|
367 |
} |
|
368 |
|
|
369 | 370 |
// First load values from the selection, if the current page has |
370 |
// elements from it
|
|
371 |
if (twoSetsCalculator.hasCurrentPageAnyValuesInFirstSet()) {
|
|
372 |
loadDataFromFeatureSet(values, 0, selection,
|
|
373 |
twoSetsCalculator.getFirstSetInitialIndex(),
|
|
374 |
twoSetsCalculator.getFirstSetHowMany(), null);
|
|
375 |
}
|
|
371 |
// elements from it
|
|
372 |
if (twoSetsCalculator.hasCurrentPageAnyValuesInFirstSet()) {
|
|
373 |
loadDataFromFeatureSet(values, 0, selection,
|
|
374 |
twoSetsCalculator.getFirstSetInitialIndex(),
|
|
375 |
twoSetsCalculator.getFirstSetHowMany(), null);
|
|
376 |
}
|
|
376 | 377 |
// Next, load values from the FeatureSet if the current page has values |
377 |
// from it |
|
378 |
if (twoSetsCalculator.hasCurrentPageAnyValuesInSecondSet()) { |
|
379 |
loadDataFromFeatureSet( |
|
380 |
values, |
|
381 |
// The cast will work as that size will be <= maxpagesize, |
|
382 |
// which is an int |
|
383 |
(int) twoSetsCalculator.getFirstSetHowMany(), set, |
|
384 |
twoSetsCalculator.getSecondSetInitialIndex(), |
|
385 |
twoSetsCalculator.getSecondSetHowMany(), selection); |
|
386 |
} |
|
387 |
} finally { |
|
388 |
/* |
|
389 |
* This is the feature set |
|
390 |
* we dont want to lose it |
|
391 |
*/ |
|
392 |
// set.dispose(); |
|
378 |
// from it |
|
379 |
if (twoSetsCalculator.hasCurrentPageAnyValuesInSecondSet()) { |
|
380 |
loadDataFromFeatureSet( |
|
381 |
values, |
|
382 |
// The cast will work as that size will be <= maxpagesize, |
|
383 |
// which is an int |
|
384 |
(int) twoSetsCalculator.getFirstSetHowMany(), set, |
|
385 |
twoSetsCalculator.getSecondSetInitialIndex(), |
|
386 |
twoSetsCalculator.getSecondSetHowMany(), selection); |
|
387 |
} |
|
388 |
} finally { |
|
389 |
/* |
|
390 |
* This is the feature set |
|
391 |
* we dont want to lose it |
|
392 |
*/ |
|
393 |
// set.dispose(); |
|
394 |
} |
|
393 | 395 |
} |
394 | 396 |
} |
395 | 397 |
|
... | ... | |
436 | 438 |
// features or the feature is not selected |
437 | 439 |
if (selectedFeaturesToSkip == null |
438 | 440 |
|| !selectedFeaturesToSkip.isSelected(current)) { |
439 |
values[i] = current.getCopy(); |
|
440 |
i++; |
|
441 |
try { |
|
442 |
values[i] = current.getCopy(); |
|
443 |
i++; |
|
444 |
} catch(Exception ex) { |
|
445 |
// Aqui no deberia petar, pero... |
|
446 |
// me he encontrado un caso que tenia una referencia a |
|
447 |
// una feature seleccionada que ya no existia. No se como |
|
448 |
// habia pasado, se habia quedado de antes guardada en el |
|
449 |
// proyecto pero la feature ya no existia, y eso hacia que |
|
450 |
// petase al intentar leer de disco la feature a partir |
|
451 |
// de una referencia no valida. |
|
452 |
} |
|
441 | 453 |
} |
442 | 454 |
} |
443 | 455 |
}, initialIndex); |
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app.document.table.app/org.gvsig.app.document.table.app.mainplugin/src/main/resources-plugin/config.xml | ||
---|---|---|
528 | 528 |
/> |
529 | 529 |
|
530 | 530 |
<action |
531 |
name="selection-disable-move-up" |
|
532 |
label="_Disable_move_up_selection" |
|
533 |
tooltip="_Disable_move_up_selection" |
|
534 |
position="300600000" |
|
535 |
action-command="selection-disable-move-up" |
|
536 |
icon="selection-disable-move-up" |
|
537 |
accelerator="" |
|
538 |
/> |
|
539 |
|
|
540 |
<action |
|
531 | 541 |
name="selection-reverse" |
532 | 542 |
label="_Reverse_selection" |
533 | 543 |
tooltip="_Reverse_selection" |
... | ... | |
542 | 552 |
name="selection-move-up" |
543 | 553 |
text="Selection/_Move_up" |
544 | 554 |
/> |
555 |
<menu |
|
556 |
name="selection-disable-move-up" |
|
557 |
text="Selection/_Disable_move_up" |
|
558 |
/> |
|
545 | 559 |
|
546 | 560 |
<menu |
547 | 561 |
name="selection-reverse" |
... | ... | |
549 | 563 |
/> |
550 | 564 |
|
551 | 565 |
<tool-bar name="selection_actions"> |
552 |
<action-tool
|
|
566 |
<selectable-tool
|
|
553 | 567 |
name="selection-move-up" |
554 | 568 |
/> |
569 |
<selectable-tool |
|
570 |
name="selection-disable-move-up" |
|
571 |
/> |
|
555 | 572 |
<action-tool |
556 | 573 |
name="selection-reverse" |
557 | 574 |
/> |
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app.document.table.app/org.gvsig.app.document.table.app.mainplugin/src/main/java/org/gvsig/app/extension/TableRowsOperations.java | ||
---|---|---|
44 | 44 |
|
45 | 45 |
private void registerIcons() { |
46 | 46 |
IconThemeHelper.registerIcon("action", "selection-move-up", this); |
47 |
IconThemeHelper.registerIcon("action", "selection-disable-move-up", this); |
|
47 | 48 |
IconThemeHelper.registerIcon("action", "selection-reverse", this); |
48 | 49 |
} |
49 | 50 |
|
50 | 51 |
public void execute(String actionCommand) { |
51 | 52 |
FeatureTableDocumentPanel tableDocument = getTableDocument(); |
53 |
if (actionCommand.equalsIgnoreCase("selection-disable-move-up") ) { |
|
54 |
tableDocument.setSelectionUp(false); |
|
55 |
} |
|
52 | 56 |
if (actionCommand.equalsIgnoreCase("selection-move-up") ) { |
53 |
if (thereIsSelection(tableDocument)) { |
|
54 |
showsSelectedRows(tableDocument);
|
|
57 |
// if (thereIsSelection(tableDocument)) {
|
|
58 |
tableDocument.setSelectionUp(true);
|
|
55 | 59 |
tableDocument.getModel().setModified(true); |
56 |
} else { |
|
57 |
JOptionPane.showMessageDialog( |
|
58 |
ApplicationLocator.getManager().getRootComponent(), |
|
59 |
Messages.getText("_There_are_no_selected_rows"), |
|
60 |
Messages.getText("_Move_up_selection"), |
|
61 |
JOptionPane.INFORMATION_MESSAGE); |
|
62 |
} |
|
60 |
// } else {
|
|
61 |
// JOptionPane.showMessageDialog(
|
|
62 |
// ApplicationLocator.getManager().getRootComponent(),
|
|
63 |
// Messages.getText("_There_are_no_selected_rows"),
|
|
64 |
// Messages.getText("_Move_up_selection"),
|
|
65 |
// JOptionPane.INFORMATION_MESSAGE);
|
|
66 |
// }
|
|
63 | 67 |
|
64 | 68 |
} |
65 | 69 |
if (actionCommand.equalsIgnoreCase("selection-reverse") ) { |
... | ... | |
84 | 88 |
} |
85 | 89 |
} |
86 | 90 |
|
87 |
private void showsSelectedRows(FeatureTableDocumentPanel table) { |
|
88 |
table.setSelectionUp(true); |
|
89 |
} |
|
91 |
// private void showsSelectedRows(FeatureTableDocumentPanel table) {
|
|
92 |
// table.setSelectionUp(true);
|
|
93 |
// }
|
|
90 | 94 |
|
91 | 95 |
public boolean isEnabled() { |
92 | 96 |
return getTableDocument() != null; |
trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.fmap.control/src/main/java/org/gvsig/fmap/mapcontrol/dal/feature/swing/table/FeatureTableModel.java | ||
---|---|---|
327 | 327 |
*/ |
328 | 328 |
reloadFeatureType(); |
329 | 329 |
updatePaginHelperWithHiddenColums(); |
330 |
} else if (FeatureStoreNotification.SELECTION_CHANGE.equals(type)) { |
|
331 |
if( this.getHelper().isSelectionUp() ) { |
|
332 |
getHelper().setSelectionUp(true); |
|
333 |
} |
|
330 | 334 |
} |
331 | 335 |
} |
332 | 336 |
} |
Also available in: Unified diff