Mercurial > dive4elements > river
annotate gwt-client/src/main/java/org/dive4elements/river/client/client/ui/PanelHelper.java @ 9118:431f1c269be5
Veg-Zone Table improved, State change data recovery;
author | gernotbelger |
---|---|
date | Mon, 04 Jun 2018 19:38:59 +0200 |
parents | 41f4bc83aa7a |
children | 972e10522ed6 |
rev | line source |
---|---|
9066 | 1 /** Copyright (C) 2017 by Bundesanstalt für Gewässerkunde |
2 * Software engineering by | |
3 * Björnsen Beratende Ingenieure GmbH | |
4 * Dr. Schumacher Ingenieurbüro für Wasser und Umwelt | |
5 * | |
6 * This file is Free Software under the GNU AGPL (>=v3) | |
7 * and comes with ABSOLUTELY NO WARRANTY! Check out the | |
8 * documentation coming with Dive4Elements River for details. | |
9 */ | |
10 package org.dive4elements.river.client.client.ui; | |
11 | |
9107 | 12 import com.smartgwt.client.widgets.form.fields.IntegerItem; |
9066 | 13 import com.smartgwt.client.widgets.form.fields.TextItem; |
9079 | 14 import com.smartgwt.client.widgets.form.validator.IsIntegerValidator; |
9066 | 15 import com.smartgwt.client.widgets.form.validator.Validator; |
16 import com.smartgwt.client.widgets.layout.VLayout; | |
17 | |
18 /** | |
19 * @author Domenico Nardi Tironi | |
20 * | |
21 */ | |
22 public class PanelHelper { | |
23 | |
24 public PanelHelper() { | |
25 | |
26 } | |
27 | |
9118
431f1c269be5
Veg-Zone Table improved, State change data recovery;
gernotbelger
parents:
9107
diff
changeset
|
28 public static final TextItem createItem(final String identifier, final String title, final String width, final Validator... validator) { |
9066 | 29 final TextItem item = new TextItem(identifier, title); |
30 item.setWidth(width); | |
31 item.setWrapTitle(false); | |
32 item.setValidators(validator); | |
33 return item; | |
34 } | |
35 | |
9118
431f1c269be5
Veg-Zone Table improved, State change data recovery;
gernotbelger
parents:
9107
diff
changeset
|
36 public static final IntegerItem createIntegerItem(final String identifier, final String title, final String width, final Validator... validator) { |
9107 | 37 final IntegerItem item = new IntegerItem(identifier, title); |
38 item.setWidth(width); | |
39 item.setWrapTitle(false); | |
40 item.setValidators(validator); | |
41 return item; | |
42 } | |
43 | |
9066 | 44 public static VLayout getSpacer(final int height) { |
45 final VLayout spacer = new VLayout(); | |
46 spacer.setHeight(height); | |
47 return spacer; | |
48 } | |
9079 | 49 |
50 public static TextItem createItem(final String title) { | |
51 final TextItem inputItem = new TextItem(title); | |
52 | |
53 final boolean hideTitle = title == null || title.isEmpty(); | |
54 inputItem.setShowTitle(!hideTitle); | |
55 // final CustomValidator validator = new CustomValidator() { | |
56 // @Override | |
57 // protected boolean condition(final Object value) { | |
58 // return validate().size() > 0 ? false : true; | |
59 // } | |
60 // }; | |
61 inputItem.setValidators(new IsIntegerValidator()); // Validator hat keinen sichtbaren Effekt. | |
62 inputItem.setWidth(60); | |
63 return inputItem; | |
64 | |
65 } | |
9066 | 66 } |