Mercurial > dive4elements > river
changeset 2919:0173b4498054
FixA: Limit the number of displayed selected fixings to 5.
flys-client/trunk@4759 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Fri, 22 Jun 2012 15:59:47 +0000 (2012-06-22) |
parents | d92770527b0f |
children | aad006178c39 |
files | flys-client/ChangeLog flys-client/src/main/java/de/intevation/flys/client/client/ui/fixation/FixEventSelect.java |
diffstat | 2 files changed, 30 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/flys-client/ChangeLog Thu Jun 21 13:22:11 2012 +0000 +++ b/flys-client/ChangeLog Fri Jun 22 15:59:47 2012 +0000 @@ -1,3 +1,9 @@ +2012-06-21 Sascha L. Teichmann <sascha.teichmann@intevation.de> + + * src/main/java/de/intevation/flys/client/client/ui/fixation/FixEventSelect.java: + Usability: Limit the number of displayed old items to 5. Use label "..." as + a placeholder there are more. + 2012-06-21 Raimund Renkert <raimund.renkert@intevation.de> * src/main/java/de/intevation/flys/client/client/ui/chart/NaviChartOutputTab.java:
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/fixation/FixEventSelect.java Thu Jun 21 13:22:11 2012 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/fixation/FixEventSelect.java Fri Jun 22 15:59:47 2012 +0000 @@ -34,6 +34,8 @@ /** The message class that provides i18n strings. */ protected FLYSConstants MESSAGES = GWT.create(FLYSConstants.class); + public static final int MAX_DISPLAYED_ITEMS = 5; + protected FixingsOverviewServiceAsync overviewService = GWT.create(FixingsOverviewService.class); @@ -64,11 +66,28 @@ VLayout dataLayout = new VLayout(); dataLayout.setWidth(130); + DataItem[] items = data.getItems(); - for (int i = 0; i < items.length; i++) { - Label l = new Label(items[i].getLabel()); + + if (items.length > MAX_DISPLAYED_ITEMS) { + for (int i = 0; i < MAX_DISPLAYED_ITEMS-2; ++i) { + Label l = new Label(items[i].getLabel()); + l.setHeight(25); + dataLayout.addMember(l); + } + Label l = new Label("..."); l.setHeight(25); dataLayout.addMember(l); + l = new Label(items[items.length-1].getLabel()); + l.setHeight(25); + dataLayout.addMember(l); + } + else { + for (int i = 0; i < items.length; i++) { + Label l = new Label(items[i].getLabel()); + l.setHeight(25); + dataLayout.addMember(l); + } } HLayout layout = new HLayout(); @@ -97,7 +116,7 @@ if (events.size() > 0) { IntDataItem[] arr = new IntDataItem[events.size()]; - for (int i = 0; i < events.size(); i++) { + for (int i = 0, E = events.size(); i < E; i++) { try { Integer v = new Integer(events.get(i)); arr[i] = new IntDataItem("id", "id", v.intValue()); @@ -137,9 +156,8 @@ public void success() { - List<FixEvent> fe = fixInfo.getEvents(); - for (int i = 0; i < fe.size(); i++) { - events.add (fe.get(i).getCId()); + for (FixEvent fe: fixInfo.getEvents()) { + events.add(fe.getCId()); } }