Mercurial > dive4elements > river
changeset 237:cf25f235b7b6
Cash the table data and rebuild the location table on distance selection.
flys-client/trunk@1796 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Mon, 02 May 2011 16:41:35 +0000 |
parents | d12078053b59 |
children | 234c78a91c15 |
files | flys-client/ChangeLog flys-client/src/main/java/de/intevation/flys/client/client/ui/LocationDistancePanel.java |
diffstat | 2 files changed, 24 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/flys-client/ChangeLog Mon May 02 14:54:11 2011 +0000 +++ b/flys-client/ChangeLog Mon May 02 16:41:35 2011 +0000 @@ -1,3 +1,9 @@ +2011-05-02 Raimund Renkert <rrenkert@intevation.de> + + * src/main/java/de/intevation/flys/client/client/ui/LocationDistancePanel.java: + The table data is cached in a new variable. The location table for + distance input is rebuild on distance selection. + 2011-05-02 Ingo Weinzierl <ingo@intevation.de> * src/main/java/de/intevation/flys/client/client/ui/WQInputPanel.java:
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/LocationDistancePanel.java Mon May 02 14:54:11 2011 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/LocationDistancePanel.java Mon May 02 16:41:35 2011 +0000 @@ -134,6 +134,9 @@ /** The locations table for distance input. */ protected ListGrid locationDistanceTable; + /** The table data. */ + protected DistanceInfoObject[] tableData; + /** * Creates a new LocationDistancePanel instance. */ @@ -166,6 +169,7 @@ createDistanceTable(); createLocationTable(); + createLocationTableDistance (); widget.setHeight(50); label.setHeight(25); @@ -292,6 +296,8 @@ * This method creates a table that contains the location values. */ protected void createLocationTableDistance (){ + locationDistanceTable = null; + locationDistanceTable = new ListGrid (); locationDistanceTable.setWidth100(); locationDistanceTable.setShowRecordComponents(true); locationDistanceTable.setShowRecordComponentsByCell(true); @@ -437,7 +443,6 @@ layout.addMember(checkboxPanel); layout.addMember(container); - createDistanceInputPanel(); container.setMembersMargin(30); inputTables = new TabSet(); @@ -610,7 +615,6 @@ if (value == null) { return; } - createDistanceInputPanel(); if (value.equals(FIELD_LOCATION)) { locationPanel = new DoubleArrayPanel( MESSAGES.unitLocation(), @@ -619,8 +623,9 @@ container.removeMembers(container.getMembers()); container.addMember(locationPanel); - inputTables.removeTab(1); - inputTables.removeTab(0); + while (inputTables.getNumTabs() > 0) { + inputTables.removeTab(0); + } Tab t1 = new Tab (MESSAGES.location()); createLocationTable(); t1.setPane(locationsTable); @@ -629,6 +634,8 @@ Tab t2 = new Tab (MESSAGES.distance()); t2.setPane(distanceTable); inputTables.addTab(t2); + updateDistanceInfo(tableData); + container.addMember(inputTables); inputTables.selectTab(0); } @@ -641,8 +648,9 @@ container.removeMembers(container.getMembers()); container.addMember(distancePanel); - inputTables.removeTab(1); - inputTables.removeTab(0); + while (inputTables.getNumTabs () > 0) { + inputTables.removeTab(0); + } Tab t1 = new Tab(MESSAGES.location ()); createLocationTableDistance (); t1.setPane(locationDistanceTable); @@ -651,6 +659,8 @@ Tab t2 = new Tab(MESSAGES.distance ()); t2.setPane(distanceTable); inputTables.addTab(t2); + updateDistanceInfo(tableData); + container.addMember(inputTables); inputTables.selectTab(1); } @@ -806,10 +816,12 @@ public void onSuccess(DistanceInfoObject[] di) { int num = di != null ? di.length :0; + GWT.log("Recieved " + num + " distance informations."); if (num == 0) { return; } + tableData = di; updateDistanceInfo(di); } }