Package org.zkoss.zk.ui.event
Class InputEvent
java.lang.Object
org.zkoss.zk.ui.event.Event
org.zkoss.zk.ui.event.InputEvent
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
ErrorEvent
Represents an event cause by user's input something at the client.
- Author:
- tomyeh
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionInputEvent(String name, Component target, String val, Object oldValue) Constructs a input-relevant event.InputEvent(String name, Component target, String val, Object oldValue, boolean selbk, int start) Constructs an input event -
Method Summary
Modifier and TypeMethodDescriptionstatic final InputEventgetInputEvent(AuRequest request, Object oldValue) Converts an AU request to an input event.Returns the previous value before user's input.intgetStart()Returns the start position of the cursor from the input element.final StringgetValue()Returns the value that user input.final booleanReturns whether this event isonChanging, and caused by user's selecting a list of predefined values (a.k.a., items).Methods inherited from class org.zkoss.zk.ui.event.Event
getData, getEvent, getName, getPage, getTarget, isPropagatable, stopPropagation, toString
-
Constructor Details
-
InputEvent
Constructs a input-relevant event.- Parameters:
name- the name of the eventtarget- the component to receive this event, or null to indicate broadcasting the event to all root components.val- the new valueoldValue- the previous value- Since:
- 5.0.4
-
InputEvent
public InputEvent(String name, Component target, String val, Object oldValue, boolean selbk, int start) Constructs an input event- Parameters:
name- the name of the eventtarget- the component to receive this event, or null to indicate broadcasting the event to all root components.val- the new valueoldValue- the previous valueselbk- whether this event is caused by user's selecting a list of items. Currently, only combobox might set it to true for the onChanging event. SeeisChangingBySelectBack()for details.- Since:
- 5.0.4
-
-
Method Details
-
getInputEvent
Converts an AU request to an input event. Notice that this method will convert the value to a string object. If it is not what you want, you have to parse it by yourself.- Parameters:
oldValue- the previous value- Since:
- 5.0.4
-
getValue
Returns the value that user input. -
getPreviousValue
Returns the previous value before user's input. Notice that the class of the return value depends on the component. For example, an instance of Double is returned ifDoubleboxis used.- Since:
- 5.0.4
-
isChangingBySelectBack
public final boolean isChangingBySelectBack()Returns whether this event isonChanging, and caused by user's selecting a list of predefined values (a.k.a., items).It is always false if it is caused by the
onChangeevent.Currently, only combobox might set it to true for the onChanging event. It is useful when you implement autocomplete. To have better response, you usually don't filter out unmatched items if this method returns true. In other words, you simply ignore the
onChangingevent if this method return true, when implementing autocomplete. -
getStart
public int getStart()Returns the start position of the cursor from the input element.Note: In IE browser, we cannot get the position of cursor because
onblurevent of Javascript is always fired beforeonChangeis fired. To get the position of cursor,onChangingevent is suggested since onblur event of Javascript will not be fired.- Returns:
- the start position >= 0
- Since:
- 3.0.1
-