Minor update

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-widgetx@102178 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2014-12-22 10:57:10 +00:00 committed by Giancarlo Panichi
parent 04a227ad6c
commit a212ad3b69
3 changed files with 34 additions and 29 deletions

View File

@ -834,6 +834,7 @@ public class TabularDataXGridPanel extends ContentPanel {
// TODO we need to manually reset the sort // TODO we need to manually reset the sort
sm.onChangeNumberOfRows(); sm.onChangeNumberOfRows();
tdxLiveToolItem.setNoSelected(); tdxLiveToolItem.setNoSelected();
loader.clearSortInfo(); loader.clearSortInfo();
reader.setDefinition(tableDefinition); reader.setDefinition(tableDefinition);
grid.reconfigure(store, columnModel); grid.reconfigure(store, columnModel);

View File

@ -29,8 +29,8 @@ public class GridAndCellSelectionModel<M> extends GridSelectionModel<M> {
private CellSelection<M> cellSelected; private CellSelection<M> cellSelected;
private boolean focusCellCalled; private boolean focusCellCalled;
private int indexOnSelectNoShift; private int indexOnSelectNoShift;
//private List<M> totalSelected = new ArrayList<M>();
// private List<M> totalSelected = new ArrayList<M>();
public GridAndCellSelectionModel() { public GridAndCellSelectionModel() {
super(); super();
@ -234,65 +234,68 @@ public class GridAndCellSelectionModel<M> extends GridSelectionModel<M> {
Log.debug("Selection Model Called Refresh()"); Log.debug("Selection Model Called Refresh()");
} }
@Override @Override
protected void onClear(StoreClearEvent<M> event) { protected void onClear(StoreClearEvent<M> event) {
Log.debug("Selection Model Called OnClear()"); Log.debug("Selection Model Called OnClear()");
} }
@Override @Override
protected void onRemove(M model) { protected void onRemove(M model) {
Log.debug("Selection Model Called OnRemove(): "); Log.debug("Selection Model Called OnRemove(): ");
} }
@Override @Override
protected void onAdd(List<? extends M> models) { protected void onAdd(List<? extends M> models) {
super.onAdd(models); super.onAdd(models);
ModelKeyProvider<? super M> mod = grid.getStore().getKeyProvider(); ModelKeyProvider<? super M> mod = grid.getStore().getKeyProvider();
for(M item: selected){ for (M item : selected) {
Log.debug("Selected: "+mod.getKey(item)); Log.debug("Selected: " + mod.getKey(item));
} }
ExtendedLiveGridView<M> gridView = (ExtendedLiveGridView<M>) grid ExtendedLiveGridView<M> gridView = (ExtendedLiveGridView<M>) grid
.getView(); .getView();
boolean notChanged; boolean notChanged;
for (M model : gridView.getCacheStore().getAll()) { for (M model : gridView.getCacheStore().getAll()) {
notChanged=true; notChanged = true;
for (M item : selected) { for (M item : selected) {
if (mod.getKey(model).compareTo(mod.getKey(item)) == 0) { if (mod.getKey(model).compareTo(mod.getKey(item)) == 0) {
onSelectChange(model, true); onSelectChange(model, true);
notChanged=false; notChanged = false;
break; break;
} }
} }
if(notChanged){ if (notChanged) {
onSelectChange(model, false); onSelectChange(model, false);
} }
} }
} }
public void onChangeNumberOfRows(){ public void onChangeNumberOfRows() {
Log.debug("Selection Model Called OnChangeNumberOfRows()"); Log.debug("Selection Model Called OnChangeNumberOfRows()");
if(selected!=null){ if (selected != null) {
Log.debug("Rows Selected: "+selected.size()); Log.debug("Rows Selected: " + selected.size());
} }
deselectAll(); int oldSize = selected.size();
fireSelectionChange(); selected.clear();
lastSelected = null;
if(selected!=null){ setLastFocused(null);
Log.debug("After deselect Rows Selected: "+selected.size()); if (oldSize > 0)
} else{ fireSelectionChange();
//deselectAll();
//fireSelectionChange();
if (selected != null) {
Log.debug("After deselect Rows Selected: " + selected.size());
} else {
Log.debug("After deselect No Rows Selected"); Log.debug("After deselect No Rows Selected");
} }
} }
} }

View File

@ -81,6 +81,7 @@ public class TDXLiveToolItem extends LiveToolItem {
@Override @Override
public String displayNoSelectedMessage() { public String displayNoSelectedMessage() {
totalSelected=0;
String msg = new String("<span>Displaying " + start String msg = new String("<span>Displaying " + start
+ " - " + end + " of " + total + "</span>"); + " - " + end + " of " + total + "</span>");
return msg; return msg;