comparison flys-client/src/main/java/de/intevation/flys/client/client/ui/WQInputPanel.java @ 1535:03e82be2aabc

Added UI for "Bezugslinienverfahren" ("W auf freier Strecke"). flys-client/trunk@3751 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Mon, 23 Jan 2012 15:45:20 +0000
parents 07b9404d7170
children 79483ff032bb
comparison
equal deleted inserted replaced
1534:98123d34529b 1535:03e82be2aabc
58 58
59 protected WQInfoServiceAsync wqInfoService = 59 protected WQInfoServiceAsync wqInfoService =
60 GWT.create(WQInfoService.class); 60 GWT.create(WQInfoService.class);
61 61
62 /** The constant field name for choosing w or q mode.*/ 62 /** The constant field name for choosing w or q mode.*/
63 public static final String FIELD_WQ_W_FREE = "WFREE";
64
65 /** The constant field name for choosing w or q mode.*/
63 public static final String FIELD_WQ = "wq"; 66 public static final String FIELD_WQ = "wq";
64 67
65 /** The constant field value for W input mode.*/ 68 /** The constant field value for W input mode.*/
66 public static final String FIELD_WQ_W = "W"; 69 public static final String FIELD_WQ_W = "W";
67 70
419 422
420 if (theMode == null || theMode.length() == 0) { 423 if (theMode == null || theMode.length() == 0) {
421 return; 424 return;
422 } 425 }
423 426
424 boolean isW = theMode.equals(FIELD_WQ_W); 427 boolean isW = theMode.equals(FIELD_WQ_W);
425 boolean isFree = Boolean.valueOf(theFree); 428 boolean isFree = Boolean.valueOf(theFree);
429 boolean isWFree = theMode.equals(FIELD_WQ_W_FREE);
426 430
427 initUserSingleValues(list, theMode); 431 initUserSingleValues(list, theMode);
428 initUserRangeValues(list, theMode); 432 initUserRangeValues(list, theMode);
429 433
430 if (isW) { 434 if (isW || isWFree) {
431 modes.setValue(FIELD_WQ, theMode); 435 modes.setValue(FIELD_WQ, theMode);
432 } 436 }
433 else { 437 else {
434 modes.setValue(FIELD_WQ, isFree ? FIELD_WQ_Q : FIELD_WQ_Q_GAUGE); 438 modes.setValue(FIELD_WQ, isFree ? FIELD_WQ_Q : FIELD_WQ_Q_GAUGE);
435 } 439 }
641 * @return a panel. 645 * @return a panel.
642 */ 646 */
643 protected Canvas createModePanel() { 647 protected Canvas createModePanel() {
644 RadioGroupItem wq = new RadioGroupItem(FIELD_WQ); 648 RadioGroupItem wq = new RadioGroupItem(FIELD_WQ);
645 wq.setShowTitle(false); 649 wq.setShowTitle(false);
646 wq.setVertical(false); 650 wq.setVertical(true);
647 wq.setWidth(WIDTH_LEFT_UPPER); 651 wq.setWidth(WIDTH_LEFT_UPPER);
648 wq.setWrap(false); 652 wq.setWrap(false);
649 653
650 RadioGroupItem mode = new RadioGroupItem(FIELD_MODE); 654 RadioGroupItem mode = new RadioGroupItem(FIELD_MODE);
651 mode.setShowTitle(false); 655 mode.setShowTitle(false);
652 mode.setVertical(false); 656 mode.setVertical(false);
653 mode.setWidth(WIDTH_LEFT_LOWER); 657 mode.setWidth(WIDTH_LEFT_LOWER);
654 658
655 LinkedHashMap wqValues = new LinkedHashMap(); 659 LinkedHashMap wqValues = new LinkedHashMap();
656 wqValues.put(FIELD_WQ_W, MESSAGE.wqW()); 660 wqValues.put(FIELD_WQ_W, MESSAGE.wqW());
661 wqValues.put(FIELD_WQ_W_FREE, MESSAGE.wqWFree());
657 wqValues.put(FIELD_WQ_Q, MESSAGE.wqQ()); 662 wqValues.put(FIELD_WQ_Q, MESSAGE.wqQ());
658 wqValues.put(FIELD_WQ_Q_GAUGE, MESSAGE.wqQGauge()); 663 wqValues.put(FIELD_WQ_Q_GAUGE, MESSAGE.wqQGauge());
659 664
660 LinkedHashMap modeValues = new LinkedHashMap(); 665 LinkedHashMap modeValues = new LinkedHashMap();
661 modeValues.put(FIELD_MODE_SINGLE, MESSAGE.wqSingle()); 666 modeValues.put(FIELD_MODE_SINGLE, MESSAGE.wqSingle());
697 return validateRange(wRangePanel, minW, maxW); 702 return validateRange(wRangePanel, minW, maxW);
698 } 703 }
699 else if (isQFree()) { 704 else if (isQFree()) {
700 return validateRange(qFreeRangePanel, minQFree, maxQFree); 705 return validateRange(qFreeRangePanel, minQFree, maxQFree);
701 } 706 }
707 else if (isWFree()) {
708 return validateRange(wRangePanel, minW, maxW);
709 }
702 else { 710 else {
703 return validateRange(qRangePanel, minQ, maxQ); 711 return validateRange(qRangePanel, minQ, maxQ);
704 } 712 }
705 } 713 }
706
707 714
708 protected List<String> validateSingleValues() { 715 protected List<String> validateSingleValues() {
709 if (isWMode()) { 716 if (isWMode()) {
710 return validateSingle(wArrayPanel, minW, maxW); 717 return validateSingle(wArrayPanel, minW, maxW);
711 } 718 }
712 else if (isQFree()) { 719 else if (isQFree()) {
713 return validateSingle(qFreeArrayPanel, minQFree, maxQFree); 720 return validateSingle(qFreeArrayPanel, minQFree, maxQFree);
721 }
722 else if (isWFree()) {
723 return validateSingle(wArrayPanel, minW, maxW);
714 } 724 }
715 else { 725 else {
716 return validateSingle(qArrayPanel, minQ, maxQ); 726 return validateSingle(qArrayPanel, minQ, maxQ);
717 } 727 }
718 } 728 }
1183 public boolean isQFree() { 1193 public boolean isQFree() {
1184 String wqMode = modes.getValueAsString(FIELD_WQ); 1194 String wqMode = modes.getValueAsString(FIELD_WQ);
1185 return wqMode.equals(FIELD_WQ_Q); 1195 return wqMode.equals(FIELD_WQ_Q);
1186 } 1196 }
1187 1197
1198 protected boolean isWFree() {
1199 String wqMode = modes.getValueAsString(FIELD_WQ);
1200 return wqMode.equals(FIELD_WQ_W_FREE);
1201 }
1202
1188 1203
1189 /** 1204 /**
1190 * This method changes the lower panel with the input fields depending on 1205 * This method changes the lower panel with the input fields depending on
1191 * the combination of the two radio button panels. 1206 * the combination of the two radio button panels.
1192 * 1207 *
1220 1235
1221 1236
1222 protected void updatePanels(String wqMode, String inputMode) { 1237 protected void updatePanels(String wqMode, String inputMode) {
1223 container.removeMembers(container.getMembers()); 1238 container.removeMembers(container.getMembers());
1224 1239
1225 if (wqMode.equals(FIELD_WQ_W)) { 1240 if (wqMode.equals(FIELD_WQ_W) || wqMode.equals(FIELD_WQ_W_FREE)) {
1226 if (inputMode.equals(FIELD_MODE_SINGLE)) { 1241 if (inputMode.equals(FIELD_MODE_SINGLE)) {
1227 // Single W mode 1242 // Single W mode
1228 double[] values = getSingleW(); 1243 double[] values = getSingleW();
1229 1244
1230 wArrayPanel = new DoubleArrayPanel( 1245 wArrayPanel = new DoubleArrayPanel(

http://dive4elements.wald.intevation.org