Minor update
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-widgetx@102172 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
6e961ba094
commit
a46239c8f3
|
@ -22,11 +22,11 @@ import com.sencha.gxt.widget.core.client.selection.SelectionChangedEvent.Selecti
|
|||
public class TDXLiveToolItem extends LiveToolItem {
|
||||
|
||||
/**
|
||||
* LiveToolItem messages.
|
||||
* TDXLiveToolItem messages.
|
||||
*/
|
||||
public interface TDXLiveToolItemMessages extends LiveToolItemMessages {
|
||||
|
||||
String displayMessage(int selected);
|
||||
String displayMessage(int totalSelected);
|
||||
|
||||
}
|
||||
|
||||
|
@ -36,10 +36,10 @@ public class TDXLiveToolItem extends LiveToolItem {
|
|||
private int end;
|
||||
private int start;
|
||||
private int total;
|
||||
private int selected;
|
||||
private int totalSelected;
|
||||
|
||||
public String displayMessage(int selected) {
|
||||
this.selected = selected;
|
||||
public String displayMessage(int totalSelected) {
|
||||
this.totalSelected = totalSelected;
|
||||
return buildMessage();
|
||||
}
|
||||
|
||||
|
@ -54,19 +54,26 @@ public class TDXLiveToolItem extends LiveToolItem {
|
|||
|
||||
protected String buildMessage() {
|
||||
String msg = "";
|
||||
if (selected > 0) {
|
||||
if (selected > 1) {
|
||||
msg = new String("Selected " + selected
|
||||
+ " rows, Displaying " + start + " - " + end
|
||||
+ " of " + total);
|
||||
|
||||
if (totalSelected > 0) {
|
||||
if (totalSelected > 1) {
|
||||
msg = new String(
|
||||
"<span>Displaying "
|
||||
+ start + " - " + end + " of " + total
|
||||
+ "</span><span style='margin-left:10px;color:red;'>[ "
|
||||
+ totalSelected
|
||||
+ " rows selected ]</span>");
|
||||
} else {
|
||||
msg = new String("Selected " + selected
|
||||
+ " row, Displaying " + start + " - " + end
|
||||
+ " of " + total);
|
||||
msg = new String(
|
||||
"<span>Displaying "
|
||||
+ start + " - " + end + " of " + total
|
||||
+ "</span><span style='margin-left:10px;color:red;'>[ "
|
||||
+ totalSelected
|
||||
+ " row selected ]</span>");
|
||||
}
|
||||
} else {
|
||||
msg = new String("Displaying " + start + " - " + end + " of "
|
||||
+ total);
|
||||
msg = new String("<span>Displaying " + start
|
||||
+ " - " + end + " of " + total + "</span>");
|
||||
}
|
||||
return msg;
|
||||
}
|
||||
|
@ -127,19 +134,21 @@ public class TDXLiveToolItem extends LiveToolItem {
|
|||
if (grid != null) {
|
||||
ExtendedLiveGridView<?> view = (ExtendedLiveGridView<?>) grid
|
||||
.getView();
|
||||
//final DataRowModelKeyProvider modelKeyProvider = (DataRowModelKeyProvider)grid.getStore().getKeyProvider();
|
||||
|
||||
|
||||
view.addLiveGridViewUpdateHandler(new LiveGridViewUpdateHandler() {
|
||||
@Override
|
||||
public void onUpdate(LiveGridViewUpdateEvent event) {
|
||||
ExtendedLiveGridView<?> source = (ExtendedLiveGridView<?>) event
|
||||
.getSource();
|
||||
Log.debug("CacheStore List Items: " + source.getCacheSize());
|
||||
|
||||
|
||||
TDXLiveToolItem.this.onUpdate(event);
|
||||
}
|
||||
});
|
||||
|
||||
// final DataRowModelKeyProvider modelKeyProvider =
|
||||
// (DataRowModelKeyProvider)grid.getStore().getKeyProvider();
|
||||
|
||||
GridSelectionModel<?> selectionModel = (GridSelectionModel<?>) grid
|
||||
.getSelectionModel();
|
||||
|
||||
|
@ -149,22 +158,23 @@ public class TDXLiveToolItem extends LiveToolItem {
|
|||
@Override
|
||||
public void onSelectionChanged(
|
||||
SelectionChangedEvent event) {
|
||||
|
||||
if (event.getSelection() != null) {
|
||||
Log.debug("Selected List Items: "
|
||||
+ event.getSelection().size());
|
||||
lastSelected = event.getSelection();
|
||||
|
||||
setLabel(getMessages().displayMessage(
|
||||
lastSelected.size()));
|
||||
} else {
|
||||
lastSelected = null;
|
||||
setLabel(getMessages().displayMessage(0));
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue