# HG changeset patch # User Raimund Renkert # Date 1304354495 0 # Node ID cf25f235b7b624e3e6338348a5d69d9913cd6425 # Parent d12078053b594419732ac3245193b2a6e05fa92b Cash the table data and rebuild the location table on distance selection. flys-client/trunk@1796 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r d12078053b59 -r cf25f235b7b6 flys-client/ChangeLog --- 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 + + * 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 * src/main/java/de/intevation/flys/client/client/ui/WQInputPanel.java: diff -r d12078053b59 -r cf25f235b7b6 flys-client/src/main/java/de/intevation/flys/client/client/ui/LocationDistancePanel.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); } }