Mercurial > dive4elements > river
comparison flys-client/src/main/java/de/intevation/flys/client/client/ui/DoubleArrayPanel.java @ 233:137daff2c732
Prepared UI elements for the location and distance input tables.
flys-client/trunk@1777 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Fri, 29 Apr 2011 10:12:02 +0000 |
parents | b92281182c6b |
children | 234c78a91c15 |
comparison
equal
deleted
inserted
replaced
232:bc5f7d8084e2 | 233:137daff2c732 |
---|---|
18 extends DynamicForm | 18 extends DynamicForm |
19 { | 19 { |
20 /** The message class that provides i18n strings.*/ | 20 /** The message class that provides i18n strings.*/ |
21 protected FLYSConstants MESSAGES = GWT.create(FLYSConstants.class); | 21 protected FLYSConstants MESSAGES = GWT.create(FLYSConstants.class); |
22 | 22 |
23 protected TextItem ti; | |
23 | 24 |
24 /** The constant input field name.*/ | 25 /** The constant input field name.*/ |
25 public static final String FIELD_NAME = "doublearray"; | 26 public static final String FIELD_NAME = "doublearray"; |
26 | 27 |
27 | 28 |
37 public DoubleArrayPanel( | 38 public DoubleArrayPanel( |
38 String title, | 39 String title, |
39 double[] values, | 40 double[] values, |
40 BlurHandler handler) | 41 BlurHandler handler) |
41 { | 42 { |
42 TextItem ti = new TextItem(FIELD_NAME); | 43 ti = new TextItem(FIELD_NAME); |
43 StaticTextItem sti = new StaticTextItem("staticarray"); | 44 StaticTextItem sti = new StaticTextItem("staticarray"); |
44 | 45 |
45 ti.setShowTitle(false); | 46 ti.setShowTitle(false); |
46 sti.setShowTitle(false); | 47 sti.setShowTitle(false); |
47 sti.setValue(title); | 48 sti.setValue(title); |
69 text.append(f.format(val)); | 70 text.append(f.format(val)); |
70 | 71 |
71 firstItem = false; | 72 firstItem = false; |
72 } | 73 } |
73 | 74 |
75 ti.setValue(text.toString()); | |
76 } | |
77 | |
78 | |
79 /** | |
80 * This method takes the double array to set the values to the textbox. | |
81 * | |
82 * @param values The double values. | |
83 */ | |
84 public void setValues(double[] values) { | |
85 NumberFormat f = NumberFormat.getDecimalFormat(); | |
86 | |
87 StringBuilder text = new StringBuilder(); | |
88 boolean firstItem = true; | |
89 | |
90 for (double val: values) { | |
91 if (!firstItem) { | |
92 text.append(" "); | |
93 } | |
94 | |
95 text.append(f.format(val)); | |
96 | |
97 firstItem = false; | |
98 } | |
99 | |
100 ti.clearValue(); | |
74 ti.setValue(text.toString()); | 101 ti.setValue(text.toString()); |
75 } | 102 } |
76 | 103 |
77 | 104 |
78 /** | 105 /** |