public class InputWidget extends Widget
The delay to send the onChanging event is controlled by
onChangingDelay
, which is default to 350.
To change it, you can specify the following in a ZUL file.
<?script content="zk.afterLoad('zul.inp',function(){zul.inp.InputWidget.onChangingDelay=1000;})"?>
Modifier and Type | Field and Description |
---|---|
static int |
onChangingDelay
The delay for sending the onChanging event (unit: milliseconds).
|
static boolean |
onChangingForced
Whether to send at least one the onChanging event if it is listened
and the content is ever changed.
|
$weave, auDelay, autag, bindLevel, className, desktop, effects_, firstChild, id, insertingBefore_, inServer, lastChild, nChildren, nextSibling, parent, previousSibling, uuid, widgetName
Modifier and Type | Method and Description |
---|---|
void |
clearErrorMessage(boolean revalidate,
boolean remainError)
Clears the error message and the error status.
|
protected String |
coerceFromString_(String value)
Coerces the value passed to
setValue(java.lang.Object, boolean) . |
protected String |
coerceToString_(java.lang.Object value)
Coerces the value passed to
setValue(java.lang.Object, boolean) . |
void |
fireOnChange(Map opts)
Fires the onChange event.
|
int |
getCols()
Returns the cols.
|
SimpleConstraint |
getConstraint()
Returns the constraint, or null if no constraint at all.
|
String |
getErrorboxIconSclass()
Returns the custom style icon class name applied to the errorbox, if any.
|
String |
getErrorboxSclass()
Returns the custom style class name applied to the errorbox, if any.
|
String |
getErrorMessage()
Returns the error message that is caused when user entered invalid value,
or null if no error at all.
|
String |
getErrorMesssage()
Deprecated.
use getErrorMessage() instead.
|
String |
getInplaceCSS()
Returns the CSS style of inplace if inplace is not null
|
Map |
getInputAttributes()
Returns the additional attributes which is set by setinputAttributes(inputAttributes).
|
DOMElement |
getInputNode()
Returns the input node of this widget
|
int |
getMaxlength()
Returns the maxlength.
|
String |
getName()
Returns the name of this component.
|
String |
getPlaceholder()
Returns the placeholder text
|
int |
getTabindex()
Returns the tab order of this component.
|
String |
getText()
Returns the text representing the value in the given format,
or an empty etring if value is null
|
String |
getType()
Returns the type.
|
String |
getValue()
Returns the value in the String format.
|
boolean |
inRoundedMold()
Returns whether is in rounded mold or not.
|
boolean |
isDisabled()
Returns whether it is disabled.
|
boolean |
isInplace()
Returns whether enable the inplace-editing.
|
boolean |
isInstant()
Returns whether to send onChange event as soon as user types in the
input.
|
boolean |
isMultiline()
Returns whether it is multiline.
|
boolean |
isReadonly()
Returns whether it is readonly.
|
void |
select(int start,
int end)
Selects the whole text in this input.
|
void |
setCols(int cols)
Sets the cols.
|
void |
setConstraint(String cst)
Sets the constraint.
|
void |
setDisabled(boolean disabled)
Sets whether it is disabled.
|
void |
setErrorboxIconSclass(String errorboxIconSclass)
Sets the custom style icon class name to be applied to the errorbox.
|
void |
setErrorboxSclass(String errorboxSclass)
Sets the custom style class name to be applied to the errorbox.
|
void |
setErrorMessage(String msg)
Marks this widget's value is wrong and show the error message.
|
void |
setInplace(boolean inplace)
Sets to enable the inplace-editing function that the look and feel is
like a label.
|
void |
setInputAttributes(Map inputAttributes)
Sets some additional attributes to the input html tag in the component.
|
void |
setInsertedText(String text)
Inserts the text at the current cursor position.
|
void |
setInstant(boolean instant)
Sets whether to send onChange event as soon as user types in the
input.
|
void |
setMaxlength(int maxlength)
Sets the maxlength.
|
void |
setName(String name)
Sets the name of this component.
|
void |
setPlaceholder(String placeholder)
Sets the placeholder text that is displayed when input is empty.
|
void |
setReadonly(boolean readonly)
Sets whether it is readonly.
|
void |
setTabindex(int tabindex)
Sets the tab order of this component.
|
void |
setText(String txt)
Sets the text representing the value in the given format.
|
void |
setValue(java.lang.Object value,
boolean fromServer)
Sets the value in the String format(assumes no locale issue).
|
protected void |
shallUpdate_(Widget focus)
Returns shall be update or not
|
protected void |
showError_(String msg)
Create a
Errorbox widget, and show the error message |
protected String |
textAttrs_()
Attributes for the text control.
|
protected boolean |
updateChange_()
Updates the change to server by firing onChange if necessary.
|
protected void |
validate_(java.lang.Object val)
Make the
SimpleConstraint calls the validate for val,
if SimpleConstraint is exist |
afterKeyDown_, beforeCtrlKeys_, getContext, getCtrlKeys, getOpenTooltip, getPopup, getTooltip, setContext, setContext, setCtrlKeys, setPopup, setPopup, setTooltip, setTooltip
$, $f, $f, $f, $init, $n, $n, $o, $s, $service, afterAnima_, afterParentChanged_, appendChild, appendChild, beforeParentChanged_, beforeSendAU_, bind_, bind, bindChildren_, bindDoubleTap_, bindMissingAncestors, bindSwipe_, bindTapHold_, canActivate, cleanDrag_, clear, clearCache, cloneDrag_, deferRedraw_, deferRedrawHTML_, detach, doBlur_, doClick_, doDoubleClick_, doFocus_, doKeyDown_, doKeyPress_, doKeyUp_, domAttrs_, domClass_, domListen_, doMouseDown_, doMouseMove_, doMouseOut_, doMouseOver_, doMouseUp_, domStyle_, domTextStyleAttr_, domTooltiptext_, domUnlisten_, doPaste_, doResizeScroll_, doRightClick_, doSelect_, doSwipe_, doTooltipOut_, doTooltipOver_, dropEffect_, extraBind_, fire, fireX, focus_, focus, forcerender, fromPageCoord, get, getAction, getCaveNode, getChildAt, getChildIndex, getClass, getCssflex, getDraggable, getDragMessage_, getDragNode, getDragOptions_, getDrop_, getDroppable, getElementsById, getElementsByName, getFirstNode_, getFloatZIndex_, getHeight, getHflex, getId, getLeft, getMold, getOldWidget_, getPage, getRenderdefer, getSclass, getScrollLeft, getScrollTop, getStyle, getTextNode, getTooltiptext, getTop, getTopWidget, getVflex, getWidth, getZclass, getZIndex, hide, ignoreDescendantFloatUp_, ignoreDrag_, initDrag_, insertBefore, insertChildHTML_, isAutoId, isBinding, isFloating_, isListen, isRealElement, isRealVisible, isRealVisible, isVisible, isVisible, isWatchable_, listen, listenOnFitSize_, mimicMouseDown_, newInstance, nextUuid, onAfterSize, onChildAdded_, onChildRemoved_, onChildRenderDefer_, onChildReplaced_, onChildVisible_, onDrop_, redraw, redrawHTML_, register, removeChild, removeChild, removeChildHTML_, removeHTML_, replaceCavedChildren_, replaceChildHTML_, replaceHTML, replaceWidget, rerender, rerender, rerenderLater_, rerenderNow_, scrollIntoView, sendAU_, set, set, setAction, setChildren, setCssflex, setDomVisible_, setDraggable, setDroppable, setFloating_, setFloatZIndex_, setHeight, setHflex, setId, setLeft, setListener, setListener, setListeners, setMold, setRenderdefer, setSclass, setScrollLeft, setScrollTop, setStyle, setTooltiptext, setTop, setTopmost, setVflex, setVisible, setWidth, setZclass, setZIndex, shallChildROD_, shallFireSizedLaterWhenAddChd_, shallIgnoreClick_, show, smartUpdate, unbind_, unbind, unbindChildren_, unbindDoubleTap_, unbindSwipe_, unbindTapHold_, uncloneDrag_, unlisten, unlistenOnFitSize_, updateDomClass_, updateDomStyle_, uuid, zsync
$init, $instanceof, $super, $super, $supers, $supers, afterInit, isAssignableFrom, isInstance, proxy
public static int onChangingDelay
Default: 350
public static boolean onChangingForced
Default: true
public void setName(String name)
Don't use this method if your application is purely based on ZK's event-driven model.
The name is used only to work with "legacy" Web application that handles user's request by servlets. It works only with HTTP/HTML-based browsers. It doesn't work with other kind of clients.
name
- the name of this component.public String getName()
Default: null.
Don't use this method if your application is purely based on ZK's event-driven model.
The name is used only to work with "legacy" Web application that handles user's request by servlets. It works only with HTTP/HTML-based browsers. It doesn't work with other kind of clients.
public void setDisabled(boolean disabled)
disabled
- public boolean isDisabled()
Default: false.
public void setReadonly(boolean readonly)
readonly
- public boolean isReadonly()
Default: false.
public void setCols(int cols)
cols
- public int getCols()
Default: 0 (non-positive means the same as browser's default).
public void setMaxlength(int maxlength)
maxlength
- public int getMaxlength()
Default: 0 (non-postive means unlimited).
public void setTabindex(int tabindex)
setTabindex
in class Widget
tabindex
- public int getTabindex()
Default: 0 (means the same as browser's default).
getTabindex
in class Widget
public void setInplace(boolean inplace)
inplace
- public boolean isInplace()
default: false.
public void setPlaceholder(String placeholder)
placeholder
- public String getPlaceholder()
public void setInputAttributes(Map inputAttributes)
inputAttributes
- public Map getInputAttributes()
public void setInstant(boolean instant)
instant
- public boolean isInstant()
Default: false.
public void setErrorboxSclass(String errorboxSclass)
errorboxSclass
- public String getErrorboxSclass()
Default: null.
public void setErrorboxIconSclass(String errorboxIconSclass)
errorboxIconSclass
- public String getErrorboxIconSclass()
Default: null.
public String getInplaceCSS()
public void select(int start, int end)
start
- the starting index of the selection rangeend
- the ending index of the selection range (excluding).
In other words, the text between start and (end-1) is selected.public String getType()
Default: text.
public boolean isMultiline()
Default: false.
public boolean inRoundedMold()
Default: false, only combo component are true (@since 7.0.0)
public String getText()
public void setText(String txt)
txt
- the textpublic String getValue()
public void setValue(java.lang.Object value, boolean fromServer)
Notice that the invocation of getValue()
won't fire
the onChange event. To fire it, you have to invoke fireOnChange(_global_.Map)
explicitly.
value
- the value.fromServer
- whether it is called from the server.
The error message will be cleared if trueprotected String textAttrs_()
public void setConstraint(String cst)
Default: null (means no constraint all all).
cst
- public SimpleConstraint getConstraint()
protected void shallUpdate_(Widget focus)
focus
- public String getErrorMesssage()
The error message is set when user has entered a wrong value, or setValue is called with a wrong value. It is cleared once a correct value is assigned.
If the error message is set, we say this input is in the error mode.
public String getErrorMessage()
The error message is set when user has entered a wrong value, or setValue is called with a wrong value. It is cleared once a correct value is assigned.
If the error message is set, we say this input is in the error mode.
public void setErrorMessage(String msg)
It is usually called by AuCmd0.wrongValue(zk.Object...)
(from the sever)
msg
- the error messagepublic void clearErrorMessage(boolean revalidate, boolean remainError)
It is also called by AuCmd0.clearWrongValue(_global_.String...)
(from the server).
revalidate
- whether to re-validate the value next time
onblur occursremainError
- whether the input widget remains in the
error status, if any, after the invocation.protected String coerceFromString_(String value)
setValue(java.lang.Object, boolean)
.
Deriving note:
If you want to store the value in other type, say BigDecimal,
you have to override coerceToString_(java.lang.Object)
and coerceFromString_(_global_.String)
to convert between a string and your targeting type.
Moreover, when Textbox
is called, it calls this method
with value = null. Derives shall handle this case properly.
value
- the string to coerce fromprotected String coerceToString_(java.lang.Object value)
setValue(java.lang.Object, boolean)
.
Default: convert null to an empty string.
Deriving note:
If you want to store the value in other type, say BigDecimal,
you have to override coerceToString_(java.lang.Object)
and coerceFromString_(_global_.String)
to convert between a string and your targeting type.
value
- the value that will be coerced to a stringprotected void validate_(java.lang.Object val)
SimpleConstraint
calls the validate for val,
if SimpleConstraint
is existval
- a String, a number, or a date,the number or name of flag,
such as 'no positive", 0x0001.protected void showError_(String msg)
Errorbox
widget, and show the error messagemsg
- the error messageErrorbox.show()
protected boolean updateChange_()
public void fireOnChange(Map opts)
opts
- [optional] the options. Refer to Event.opts
public void setInsertedText(String text)
text
- the text to be insertedpublic DOMElement getInputNode()
Copyright © 2005-2023 Potix Corporation. All Rights Reserved.