
com.alkacon.geranium.client.ui.input.I_FormWidget Maven / Gradle / Ivy
Show all versions of geranium-client Show documentation
/*
* This library is part of Geranium -
* an open source UI library for GWT.
*
* Copyright (c) Alkacon Software GmbH (http://www.alkacon.com)-
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* For further information about Alkacon Software, please see the
* company website: http://www.alkacon.com
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package com.alkacon.geranium.client.ui.input;
import com.alkacon.geranium.client.ui.I_AutoHider;
/**
* Basic interface for all widgets that can be used for form fields.
*/
public interface I_FormWidget {
/**
* Field type constants.
*
*/
public enum FieldType {
/** Field type constant for booleans (Java type: Boolean). */
BOOLEAN,
/** Field type constant for dates (Java type: Date). */
DATE,
/** Field type constant for numbers (Java type: Double). */
NUMBER,
/** Field type constant for strings (Java type: String). */
STRING,
/** Field type constant for lists of strings (Java type: List). */
STRING_LIST
}
/**
* Returns the "apparent value", i.e. either the real value if available, or else the ghost value if available, or null otherwise.
*
* @return the apparent value
*/
String getApparentValue();
/**
* Returns the type of data this widget produces.
* @return the data type
*/
FieldType getFieldType();
/**
* Gets the selected/entered value from the widget.
*
* @return the value
*/
Object getFormValue();
/**
* Gets the current value of the widget as a string.
*
* @return the current value of the widget
*/
String getFormValueAsString();
/**
* Returns true
if this widget is enabled.
*
* @return true
if this widget is enabled
*/
boolean isEnabled();
/**
* Resets the widget to its default state.
*/
void reset();
/**
* Call this when auto hiding parents are shown.
*
* @param autoHideParent the auto hide parent
*/
void setAutoHideParent(I_AutoHider autoHideParent);
/**
* Enables or disables the widget.
*
* @param enabled if true, the widget will be enabled, else disabled
*/
void setEnabled(boolean enabled);
/**
* Sets the error message for this widget.
*
* If the error message is null, no error message will be displayed.
*
* @param errorMessage an error message or null
*/
void setErrorMessage(String errorMessage);
/**
* Sets the current value of the widget as a string.
*
* @param value the new value of the widget
*/
void setFormValueAsString(String value);
}