From 04a227ad6c5634112c36a00f6151c11bb115ea5e Mon Sep 17 00:00:00 2001 From: Giancarlo Panichi Date: Mon, 22 Dec 2014 09:53:20 +0000 Subject: [PATCH] Fixed Selection on Delete Rows git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-widgetx@102177 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../user/tdwx/client/TabularDataXGridPanel.java | 7 ++++++- .../user/tdwx/client/config/TDXLiveToolItem.java | 13 +++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/gcube/portlets/user/tdwx/client/TabularDataXGridPanel.java b/src/main/java/org/gcube/portlets/user/tdwx/client/TabularDataXGridPanel.java index f050505..775e0e7 100644 --- a/src/main/java/org/gcube/portlets/user/tdwx/client/TabularDataXGridPanel.java +++ b/src/main/java/org/gcube/portlets/user/tdwx/client/TabularDataXGridPanel.java @@ -136,6 +136,8 @@ public class TabularDataXGridPanel extends ContentPanel { private GridAndCellSelectionModel sm; + private TDXLiveToolItem tdxLiveToolItem; + /** * @param eventBus */ @@ -805,7 +807,9 @@ public class TabularDataXGridPanel extends ContentPanel { toolBar = new ToolBar(); // toolBar.add(new LiveToolItem(grid)); - toolBar.add(new TDXLiveToolItem(grid)); + tdxLiveToolItem=new TDXLiveToolItem(grid); + + toolBar.add(tdxLiveToolItem); toolBar.addStyleName(ThemeStyles.get().style().borderTop()); toolBar.getElement().getStyle().setProperty("borderBottom", "none"); @@ -829,6 +833,7 @@ public class TabularDataXGridPanel extends ContentPanel { Log.debug("Setup grid not null"); // TODO we need to manually reset the sort sm.onChangeNumberOfRows(); + tdxLiveToolItem.setNoSelected(); loader.clearSortInfo(); reader.setDefinition(tableDefinition); grid.reconfigure(store, columnModel); diff --git a/src/main/java/org/gcube/portlets/user/tdwx/client/config/TDXLiveToolItem.java b/src/main/java/org/gcube/portlets/user/tdwx/client/config/TDXLiveToolItem.java index e0e4a8d..5a7fa95 100644 --- a/src/main/java/org/gcube/portlets/user/tdwx/client/config/TDXLiveToolItem.java +++ b/src/main/java/org/gcube/portlets/user/tdwx/client/config/TDXLiveToolItem.java @@ -27,6 +27,7 @@ public class TDXLiveToolItem extends LiveToolItem { public interface TDXLiveToolItemMessages extends LiveToolItemMessages { String displayMessage(int totalSelected); + String displayNoSelectedMessage(); } @@ -78,6 +79,13 @@ public class TDXLiveToolItem extends LiveToolItem { return msg; } + @Override + public String displayNoSelectedMessage() { + String msg = new String("Displaying " + start + + " - " + end + " of " + total + ""); + return msg; + } + } private HandlerRegistration handlerRegistration; @@ -123,6 +131,11 @@ public class TDXLiveToolItem extends LiveToolItem { setLabel(getMessages().displayMessage( totalCount == 0 ? 0 : viewIndex + 1, i, (int) totalCount)); } + + + public void setNoSelected(){ + setLabel(getMessages().displayNoSelectedMessage()); + } @SuppressWarnings({ "rawtypes", "unchecked" }) @Override