comparison flys-client/src/main/java/de/intevation/flys/client/client/ui/WQInputPanel.java @ 577:ded285064e43

#118 Added a further radio button to select 'Q at Gauge' to the WQ panel. flys-client/trunk@2145 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Fri, 17 Jun 2011 11:14:02 +0000
parents 55a90afaf513
children bcf1a37223a5
comparison
equal deleted inserted replaced
576:a0884f486711 577:ded285064e43
71 public static final String FIELD_WQ_W = "W"; 71 public static final String FIELD_WQ_W = "W";
72 72
73 /** The constant field value for Q input mode.*/ 73 /** The constant field value for Q input mode.*/
74 public static final String FIELD_WQ_Q = "Q"; 74 public static final String FIELD_WQ_Q = "Q";
75 75
76 /** The constant field value for Q input mode.*/
77 public static final String FIELD_WQ_Q_GAUGE = "Q_GAUGE";
78
76 /** The constant field name for choosing single values or range.*/ 79 /** The constant field name for choosing single values or range.*/
77 public static final String FIELD_MODE = "mode"; 80 public static final String FIELD_MODE = "mode";
78 81
79 /** The constant field value for single input mode.*/ 82 /** The constant field value for single input mode.*/
80 public static final String FIELD_MODE_SINGLE = "single"; 83 public static final String FIELD_MODE_SINGLE = "single";
81 84
82 /** The constant field value for range input mode.*/ 85 /** The constant field value for range input mode.*/
83 public static final String FIELD_MODE_RANGE = "range"; 86 public static final String FIELD_MODE_RANGE = "range";
84 87
85 /** The constant value that determines the width of the left panel.*/ 88 /** The constant value that determines the width of the left panel.*/
86 public static final int WIDTH_LEFT = 200; 89 public static final int WIDTH_LEFT_UPPER = 300;
90
91 public static final int WIDTH_LEFT_LOWER = 238;
87 92
88 93
89 /** The container that manages the w and q panels.*/ 94 /** The container that manages the w and q panels.*/
90 protected HLayout container; 95 protected HLayout container;
91 96
629 */ 634 */
630 protected Canvas createModePanel() { 635 protected Canvas createModePanel() {
631 RadioGroupItem wq = new RadioGroupItem(FIELD_WQ); 636 RadioGroupItem wq = new RadioGroupItem(FIELD_WQ);
632 wq.setShowTitle(false); 637 wq.setShowTitle(false);
633 wq.setVertical(false); 638 wq.setVertical(false);
634 wq.setWidth(WIDTH_LEFT); 639 wq.setWidth(WIDTH_LEFT_UPPER);
635 640
636 RadioGroupItem mode = new RadioGroupItem(FIELD_MODE); 641 RadioGroupItem mode = new RadioGroupItem(FIELD_MODE);
637 mode.setShowTitle(false); 642 mode.setShowTitle(false);
638 mode.setVertical(false); 643 mode.setVertical(false);
639 mode.setWidth(WIDTH_LEFT); 644 mode.setWidth(WIDTH_LEFT_LOWER);
640 645
641 LinkedHashMap wqValues = new LinkedHashMap(); 646 LinkedHashMap wqValues = new LinkedHashMap();
642 wqValues.put(FIELD_WQ_W, MESSAGE.wqW()); 647 wqValues.put(FIELD_WQ_W, MESSAGE.wqW());
643 wqValues.put(FIELD_WQ_Q, MESSAGE.wqQ()); 648 wqValues.put(FIELD_WQ_Q, MESSAGE.wqQ());
649 wqValues.put(FIELD_WQ_Q_GAUGE, MESSAGE.wqQGauge());
644 650
645 LinkedHashMap modeValues = new LinkedHashMap(); 651 LinkedHashMap modeValues = new LinkedHashMap();
646 modeValues.put(FIELD_MODE_SINGLE, MESSAGE.wqSingle()); 652 modeValues.put(FIELD_MODE_SINGLE, MESSAGE.wqSingle());
647 modeValues.put(FIELD_MODE_RANGE, MESSAGE.wqRange()); 653 modeValues.put(FIELD_MODE_RANGE, MESSAGE.wqRange());
648 654
652 wq.addChangeHandler(this); 658 wq.addChangeHandler(this);
653 mode.addChangeHandler(this); 659 mode.addChangeHandler(this);
654 660
655 modes = new DynamicForm(); 661 modes = new DynamicForm();
656 modes.setFields(wq, mode); 662 modes.setFields(wq, mode);
657 modes.setWidth(WIDTH_LEFT); 663 modes.setWidth(WIDTH_LEFT_UPPER);
658 modes.setNumCols(1); 664 modes.setNumCols(1);
659 665
660 LinkedHashMap initial = new LinkedHashMap(); 666 LinkedHashMap initial = new LinkedHashMap();
661 initial.put(FIELD_WQ, FIELD_WQ_Q); 667 initial.put(FIELD_WQ, FIELD_WQ_Q_GAUGE);
662 initial.put(FIELD_MODE, FIELD_MODE_SINGLE); 668 initial.put(FIELD_MODE, FIELD_MODE_SINGLE);
663 modes.setValues(initial); 669 modes.setValues(initial);
664 670
665 return modes; 671 return modes;
666 } 672 }
811 } 817 }
812 } 818 }
813 819
814 return new Data[] { 820 return new Data[] {
815 getDataMode(), 821 getDataMode(),
822 getQMode(),
816 getDataSelectionMode(), 823 getDataSelectionMode(),
817 getDataFrom(), 824 getDataFrom(),
818 getDataTo(), 825 getDataTo(),
819 getDataStep() }; 826 getDataStep() };
820 } 827 }
826 * 833 *
827 * @return the Data object for the 'mode' attribute. 834 * @return the Data object for the 'mode' attribute.
828 */ 835 */
829 protected Data getDataMode() { 836 protected Data getDataMode() {
830 String wqMode = modes.getValueAsString(FIELD_WQ); 837 String wqMode = modes.getValueAsString(FIELD_WQ);
831 DataItem item = new DefaultDataItem("wq_mode", "wq_mode", wqMode); 838
839 String value = null;
840 if (wqMode.equals(FIELD_WQ_Q) || wqMode.equals(FIELD_WQ_Q_GAUGE)) {
841 value = FIELD_WQ_Q;
842 }
843 else {
844 value = FIELD_WQ_W;
845 }
846
847 DataItem item = new DefaultDataItem("wq_mode", "wq_mode", value);
832 return new DefaultData( 848 return new DefaultData(
833 "wq_mode", null, null, new DataItem[] { item }); 849 "wq_mode", null, null, new DataItem[] { item });
850 }
851
852
853 /**
854 * Returns the Q mode. The Q mode can be "true" or "false". True means, the
855 * calculation is not based on a gauge, false means the calculation should
856 * be based on a gauge.
857 *
858 * @return the Data object for the 'wq_free' attribute.
859 */
860 protected Data getQMode() {
861 String value = isQFree() ? "true" : "false";
862
863 DataItem item = new DefaultDataItem("wq_free", "wq_free", value);
864 return new DefaultData(
865 "wq_free", null, null, new DataItem[] { item });
834 } 866 }
835 867
836 868
837 /** 869 /**
838 * Returns the Data object for the 'mode' attribute. 870 * Returns the Data object for the 'mode' attribute.
1005 * 1037 *
1006 * @return true, if the W mode is activated. 1038 * @return true, if the W mode is activated.
1007 */ 1039 */
1008 public boolean isWMode() { 1040 public boolean isWMode() {
1009 String wq = modes.getValueAsString(FIELD_WQ); 1041 String wq = modes.getValueAsString(FIELD_WQ);
1010
1011 return wq.equals(FIELD_WQ_W) ? true : false; 1042 return wq.equals(FIELD_WQ_W) ? true : false;
1043 }
1044
1045
1046 public boolean isQFree() {
1047 String wqMode = modes.getValueAsString(FIELD_WQ);
1048 return wqMode.equals(FIELD_WQ_Q);
1012 } 1049 }
1013 1050
1014 1051
1015 /** 1052 /**
1016 * This method changes the lower panel with the input fields depending on 1053 * This method changes the lower panel with the input fields depending on

http://dive4elements.wald.intevation.org