|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objecteu.webtoolkit.jwt.WObject
eu.webtoolkit.jwt.WWidget
eu.webtoolkit.jwt.WWebWidget
eu.webtoolkit.jwt.WInteractWidget
eu.webtoolkit.jwt.WFormWidget
public abstract class WFormWidget
An abstract widget that corresponds to an HTML form element.
A WFormWidget may receive focus, can be disabled, and can have a label that acts as proxy for getting focus. It provides signals which reflect changes to its value, or changes to its focus.
Form widgets also have built-in support for validation, using
setValidator(). If the
validator provide client-side validation, then an invalid validation state is
reflected using the style class "Wt-invalid". All
validators provided by JWt implement client-side validation.
On the server-side, use validate() method to
validate the content using a validator previously set.
| Constructor Summary | |
|---|---|
WFormWidget()
Creates a WFormWidget with an optional parent. |
|
WFormWidget(WContainerWidget parent)
Creates a WFormWidget with an optional parent. |
|
| Method Summary | |
|---|---|
EventSignal |
blurred()
Signal emitted when the widget lost focus. |
EventSignal |
changed()
Signal emitted when the value was changed. |
protected void |
enableAjax()
Progresses to an Ajax-enabled widget. |
EventSignal |
focussed()
Signal emitted when the widget recieved focus. |
WString |
getEmptyText()
Returns the empty text to be shown when the field is empty. |
WLabel |
getLabel()
Returns the label associated with this widget. |
int |
getTabIndex()
Returns the tab index. |
WValidator |
getValidator()
Returns the validator. |
abstract java.lang.String |
getValueText()
Returns the current value. |
boolean |
hasFocus()
Returns whether this widget has focus. |
boolean |
isReadOnly()
Returns whether the form element is read-only. |
protected void |
propagateSetEnabled(boolean enabled)
Propagates that a widget was enabled or disabled through children. |
void |
refresh()
Refresh the widget. |
void |
remove()
Destructor. |
protected void |
render(java.util.EnumSet<RenderFlag> flags)
|
EventSignal |
selected()
Signal emitted when ?? |
void |
setEmptyText(java.lang.CharSequence emptyText)
Sets the empty text to be shown when the field is empty. |
void |
setEnabled(boolean enabled)
Sets whether the widget is enabled. |
void |
setFocus()
Gives focus. |
void |
setFocus(boolean focus)
Changes focus. |
void |
setHidden(boolean hidden,
WAnimation animation)
Sets the hidden state of this widget. |
void |
setReadOnly(boolean readOnly)
Sets the element read-only. |
void |
setTabIndex(int index)
Sets the tab index. |
void |
setValidator(WValidator validator)
Sets a validator for this field. |
abstract void |
setValueText(java.lang.String value)
Sets the value text. |
WValidator.State |
validate()
Validates the field. |
Signal1<WValidator.Result> |
validated()
|
| Methods inherited from class eu.webtoolkit.jwt.WInteractWidget |
|---|
clicked, doubleClicked, enterPressed, escapePressed, gestureChanged, gestureEnded, gestureStarted, isEnabled, keyPressed, keyWentDown, keyWentUp, load, mouseDragged, mouseMoved, mouseWentDown, mouseWentOut, mouseWentOver, mouseWentUp, mouseWheel, setDraggable, setDraggable, setDraggable, setDraggable, touchEnded, touchMoved, touchStarted |
| Methods inherited from class eu.webtoolkit.jwt.WWidget |
|---|
acceptDrops, acceptDrops, addCssRule, addCssRule, addStyleClass, animateHide, animateShow, boxBorder, boxPadding, containsExposed, disable, dropEvent, enable, getDrop, getJsRef, getParent, hide, htmlText, isLayoutSizeAware, layoutSizeChanged, positionAt, positionAt, removeStyleClass, resize, setClearSides, setHeight, setHidden, setLayoutSizeAware, setMargin, setMargin, setMargin, setMargin, setMargin, setOffsets, setOffsets, setOffsets, setOffsets, setOffsets, setToolTip, setVerticalAlignment, setWidth, show, stopAcceptDrops, toggleStyleClass, toggleStyleClass, tr |
| Methods inherited from class eu.webtoolkit.jwt.WObject |
|---|
addChild, getObjectName, setObjectName |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public WFormWidget(WContainerWidget parent)
public WFormWidget()
Calls this((WContainerWidget)null)
| Method Detail |
|---|
public void remove()
If a label was associated with the widget, its buddy is reset to
null.
remove in class WInteractWidgetWContainerWidget.removeWidget(WWidget widget)public WLabel getLabel()
Returns the label (if there is one) that acts as a proxy for this widget.
WLabel.setBuddy(WFormWidget buddy)
public void setHidden(boolean hidden,
WAnimation animation)
If the widget has a label, it is hidden and shown together with this widget.
setHidden in class WWebWidgetpublic abstract java.lang.String getValueText()
This returns the current value as a string.
public abstract void setValueText(java.lang.String value)
This sets the current value from a string value.
public void setValidator(WValidator validator)
The validator is used to validate the current input.
If the validator has no parent yet, then ownership is transferred to the form field, and thus the validator will be deleted together with the form field.
The default value is null.
validate()public WValidator getValidator()
public WValidator.State validate()
public void setEnabled(boolean enabled)
A widget that is disabled cannot receive focus or user interaction.
This is the opposite of WWebWidget#setDisabled().
public void setFocus()
Giving focus to an input element only works when JavaScript is enabled.
public void setFocus(boolean focus)
When using focus = false, you can undo a
previous setFocus() call.
public boolean hasFocus()
public void setTabIndex(int index)
WWidgetFor widgets that receive focus, focus is passed on to the next widget in the tabbing chain based on their tab index. When the user navigates through form widgets using the keyboard, widgets receive focus starting from the element with the lowest tab index to elements with the highest tab index.
A tab index only applies to widgets than can receive focus (which are
WFormWidget, WAnchor, WPushButton), but setting a
tab index on any other type of widget will propagate to its contained
form widgets.
Widgets with a same tab index will receive focus in the same order as they are inserted in the widget tree.
The default tab index is 0.
setTabIndex in class WWebWidgetpublic int getTabIndex()
WWidget
getTabIndex in class WWebWidgetWWidget.setTabIndex(int index)public void setReadOnly(boolean readOnly)
A read-only form element cannot be edited, but the contents can still be selected.
By default, a form element area is not read-only.
setEnabled(boolean enabled)public boolean isReadOnly()
setReadOnly(boolean readOnly)public void setEmptyText(java.lang.CharSequence emptyText)
getEmptyText()public WString getEmptyText()
setEmptyText(CharSequence emptyText)public EventSignal changed()
public EventSignal selected()
public EventSignal blurred()
public EventSignal focussed()
public Signal1<WValidator.Result> validated()
public void refresh()
WWidget
The refresh method is invoked when the locale is changed using
WApplication#setLocale() or
when the user hit the refresh button.
The widget must actualize its contents in response.
refresh in class WWebWidgetprotected void enableAjax()
WWidgetThis method is called when the progressive bootstrap method is used, and support for AJAX has been detected. The default behavior will upgrade the widget's event handling to use AJAX instead of full page reloads, and propagate the call to its children.
You may want to reimplement this method if you want to make changes to widget when AJAX is enabled. You should always call the base implementation.
enableAjax in class WWebWidgetWApplication.enableAjax()protected void render(java.util.EnumSet<RenderFlag> flags)
render in class WWebWidgetprotected void propagateSetEnabled(boolean enabled)
WWidget
When enabling or disabling a widget, you usually also want to disable
contained children. This method is called by
setDisabled() to propagate
its state to all children.
You may want to reimplement this method if they wish to render differently when a widget is disabled. The default implementation will propagate the signal to all children.
propagateSetEnabled in class WInteractWidget
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||