Mercurial > dive4elements > river
comparison flys-client/src/main/java/de/intevation/flys/client/client/ui/LocationDistancePanel.java @ 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 | d3f8d6966c20 |
children | 1bc787eeb556 |
comparison
equal
deleted
inserted
replaced
236:d12078053b59 | 237:cf25f235b7b6 |
---|---|
132 protected ListGrid locationsTable; | 132 protected ListGrid locationsTable; |
133 | 133 |
134 /** The locations table for distance input. */ | 134 /** The locations table for distance input. */ |
135 protected ListGrid locationDistanceTable; | 135 protected ListGrid locationDistanceTable; |
136 | 136 |
137 /** The table data. */ | |
138 protected DistanceInfoObject[] tableData; | |
139 | |
137 /** | 140 /** |
138 * Creates a new LocationDistancePanel instance. | 141 * Creates a new LocationDistancePanel instance. |
139 */ | 142 */ |
140 public LocationDistancePanel() { | 143 public LocationDistancePanel() { |
141 distanceTable = new ListGrid(); | 144 distanceTable = new ListGrid(); |
164 Canvas submit = getNextButton(); | 167 Canvas submit = getNextButton(); |
165 createDistanceInputPanel(); | 168 createDistanceInputPanel(); |
166 | 169 |
167 createDistanceTable(); | 170 createDistanceTable(); |
168 createLocationTable(); | 171 createLocationTable(); |
172 createLocationTableDistance (); | |
169 | 173 |
170 widget.setHeight(50); | 174 widget.setHeight(50); |
171 label.setHeight(25); | 175 label.setHeight(25); |
172 | 176 |
173 layout.addMember(label); | 177 layout.addMember(label); |
290 | 294 |
291 /** | 295 /** |
292 * This method creates a table that contains the location values. | 296 * This method creates a table that contains the location values. |
293 */ | 297 */ |
294 protected void createLocationTableDistance (){ | 298 protected void createLocationTableDistance (){ |
299 locationDistanceTable = null; | |
300 locationDistanceTable = new ListGrid (); | |
295 locationDistanceTable.setWidth100(); | 301 locationDistanceTable.setWidth100(); |
296 locationDistanceTable.setShowRecordComponents(true); | 302 locationDistanceTable.setShowRecordComponents(true); |
297 locationDistanceTable.setShowRecordComponentsByCell(true); | 303 locationDistanceTable.setShowRecordComponentsByCell(true); |
298 locationDistanceTable.setHeight100(); | 304 locationDistanceTable.setHeight100(); |
299 | 305 |
435 container.addMember(locationPanel); | 441 container.addMember(locationPanel); |
436 | 442 |
437 layout.addMember(checkboxPanel); | 443 layout.addMember(checkboxPanel); |
438 layout.addMember(container); | 444 layout.addMember(container); |
439 | 445 |
440 createDistanceInputPanel(); | |
441 container.setMembersMargin(30); | 446 container.setMembersMargin(30); |
442 | 447 |
443 inputTables = new TabSet(); | 448 inputTables = new TabSet(); |
444 Tab locations = new Tab(MESSAGES.location()); | 449 Tab locations = new Tab(MESSAGES.location()); |
445 Tab distances = new Tab(MESSAGES.distance()); | 450 Tab distances = new Tab(MESSAGES.distance()); |
608 String value = (String) event.getValue(); | 613 String value = (String) event.getValue(); |
609 | 614 |
610 if (value == null) { | 615 if (value == null) { |
611 return; | 616 return; |
612 } | 617 } |
613 createDistanceInputPanel(); | |
614 if (value.equals(FIELD_LOCATION)) { | 618 if (value.equals(FIELD_LOCATION)) { |
615 locationPanel = new DoubleArrayPanel( | 619 locationPanel = new DoubleArrayPanel( |
616 MESSAGES.unitLocation(), | 620 MESSAGES.unitLocation(), |
617 getLocationValues(), | 621 getLocationValues(), |
618 this); | 622 this); |
619 | 623 |
620 container.removeMembers(container.getMembers()); | 624 container.removeMembers(container.getMembers()); |
621 container.addMember(locationPanel); | 625 container.addMember(locationPanel); |
622 inputTables.removeTab(1); | 626 while (inputTables.getNumTabs() > 0) { |
623 inputTables.removeTab(0); | 627 inputTables.removeTab(0); |
628 } | |
624 Tab t1 = new Tab (MESSAGES.location()); | 629 Tab t1 = new Tab (MESSAGES.location()); |
625 createLocationTable(); | 630 createLocationTable(); |
626 t1.setPane(locationsTable); | 631 t1.setPane(locationsTable); |
627 inputTables.addTab(t1); | 632 inputTables.addTab(t1); |
628 createDistanceTable(); | 633 createDistanceTable(); |
629 Tab t2 = new Tab (MESSAGES.distance()); | 634 Tab t2 = new Tab (MESSAGES.distance()); |
630 t2.setPane(distanceTable); | 635 t2.setPane(distanceTable); |
631 inputTables.addTab(t2); | 636 inputTables.addTab(t2); |
637 updateDistanceInfo(tableData); | |
638 | |
632 container.addMember(inputTables); | 639 container.addMember(inputTables); |
633 inputTables.selectTab(0); | 640 inputTables.selectTab(0); |
634 } | 641 } |
635 else { | 642 else { |
636 distancePanel = new DoubleRangePanel( | 643 distancePanel = new DoubleRangePanel( |
639 250, | 646 250, |
640 this); | 647 this); |
641 | 648 |
642 container.removeMembers(container.getMembers()); | 649 container.removeMembers(container.getMembers()); |
643 container.addMember(distancePanel); | 650 container.addMember(distancePanel); |
644 inputTables.removeTab(1); | 651 while (inputTables.getNumTabs () > 0) { |
645 inputTables.removeTab(0); | 652 inputTables.removeTab(0); |
653 } | |
646 Tab t1 = new Tab(MESSAGES.location ()); | 654 Tab t1 = new Tab(MESSAGES.location ()); |
647 createLocationTableDistance (); | 655 createLocationTableDistance (); |
648 t1.setPane(locationDistanceTable); | 656 t1.setPane(locationDistanceTable); |
649 inputTables.addTab(t1); | 657 inputTables.addTab(t1); |
650 createDistanceTable (); | 658 createDistanceTable (); |
651 Tab t2 = new Tab(MESSAGES.distance ()); | 659 Tab t2 = new Tab(MESSAGES.distance ()); |
652 t2.setPane(distanceTable); | 660 t2.setPane(distanceTable); |
653 inputTables.addTab(t2); | 661 inputTables.addTab(t2); |
662 updateDistanceInfo(tableData); | |
663 | |
654 container.addMember(inputTables); | 664 container.addMember(inputTables); |
655 inputTables.selectTab(1); | 665 inputTables.selectTab(1); |
656 } | 666 } |
657 } | 667 } |
658 | 668 |
804 GWT.log(caught.getMessage()); | 814 GWT.log(caught.getMessage()); |
805 } | 815 } |
806 | 816 |
807 public void onSuccess(DistanceInfoObject[] di) { | 817 public void onSuccess(DistanceInfoObject[] di) { |
808 int num = di != null ? di.length :0; | 818 int num = di != null ? di.length :0; |
819 GWT.log("Recieved " + num + " distance informations."); | |
809 | 820 |
810 if (num == 0) { | 821 if (num == 0) { |
811 return; | 822 return; |
812 } | 823 } |
824 tableData = di; | |
813 updateDistanceInfo(di); | 825 updateDistanceInfo(di); |
814 } | 826 } |
815 } | 827 } |
816 ); | 828 ); |
817 } | 829 } |