Mercurial > dive4elements > river
view gwt-client/src/main/java/org/dive4elements/river/client/client/ui/PanelHelper.java @ 9079:aafae1ab25f0
epoch-panels, single-input-panels
author | gernotbelger |
---|---|
date | Wed, 23 May 2018 17:30:24 +0200 |
parents | b5d7a9d79837 |
children | 41f4bc83aa7a |
line wrap: on
line source
/** Copyright (C) 2017 by Bundesanstalt für Gewässerkunde * Software engineering by * Björnsen Beratende Ingenieure GmbH * Dr. Schumacher Ingenieurbüro für Wasser und Umwelt * * This file is Free Software under the GNU AGPL (>=v3) * and comes with ABSOLUTELY NO WARRANTY! Check out the * documentation coming with Dive4Elements River for details. */ package org.dive4elements.river.client.client.ui; import com.smartgwt.client.widgets.form.fields.TextItem; import com.smartgwt.client.widgets.form.validator.IsIntegerValidator; import com.smartgwt.client.widgets.form.validator.Validator; import com.smartgwt.client.widgets.layout.VLayout; /** * @author Domenico Nardi Tironi * */ public class PanelHelper { public PanelHelper() { } public static final TextItem createItem(final String identifier, final String title, final int width, final Validator... validator) { final TextItem item = new TextItem(identifier, title); item.setWidth(width); item.setWrapTitle(false); item.setValidators(validator); return item; } public static VLayout getSpacer(final int height) { final VLayout spacer = new VLayout(); spacer.setHeight(height); return spacer; } public static TextItem createItem(final String title) { final TextItem inputItem = new TextItem(title); final boolean hideTitle = title == null || title.isEmpty(); inputItem.setShowTitle(!hideTitle); // final CustomValidator validator = new CustomValidator() { // @Override // protected boolean condition(final Object value) { // return validate().size() > 0 ? false : true; // } // }; inputItem.setValidators(new IsIntegerValidator()); // Validator hat keinen sichtbaren Effekt. inputItem.setWidth(60); return inputItem; } }