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 |
|
12 import com.smartgwt.client.widgets.form.fields.TextItem; |
9079
|
13 import com.smartgwt.client.widgets.form.validator.IsIntegerValidator; |
9066
|
14 import com.smartgwt.client.widgets.form.validator.Validator; |
|
15 import com.smartgwt.client.widgets.layout.VLayout; |
|
16 |
|
17 /** |
|
18 * @author Domenico Nardi Tironi |
|
19 * |
|
20 */ |
|
21 public class PanelHelper { |
|
22 |
|
23 public PanelHelper() { |
|
24 |
|
25 } |
|
26 |
|
27 public static final TextItem createItem(final String identifier, final String title, final int width, final Validator... validator) { |
|
28 final TextItem item = new TextItem(identifier, title); |
|
29 item.setWidth(width); |
|
30 item.setWrapTitle(false); |
|
31 item.setValidators(validator); |
|
32 return item; |
|
33 } |
|
34 |
|
35 public static VLayout getSpacer(final int height) { |
|
36 final VLayout spacer = new VLayout(); |
|
37 spacer.setHeight(height); |
|
38 return spacer; |
|
39 } |
9079
|
40 |
|
41 public static TextItem createItem(final String title) { |
|
42 final TextItem inputItem = new TextItem(title); |
|
43 |
|
44 final boolean hideTitle = title == null || title.isEmpty(); |
|
45 inputItem.setShowTitle(!hideTitle); |
|
46 // final CustomValidator validator = new CustomValidator() { |
|
47 // @Override |
|
48 // protected boolean condition(final Object value) { |
|
49 // return validate().size() > 0 ? false : true; |
|
50 // } |
|
51 // }; |
|
52 inputItem.setValidators(new IsIntegerValidator()); // Validator hat keinen sichtbaren Effekt. |
|
53 inputItem.setWidth(60); |
|
54 return inputItem; |
|
55 |
|
56 } |
9066
|
57 } |