org.zkoss.zk.ui.event
Class InputEvent

java.lang.Object
  extended by org.zkoss.zk.ui.event.Event
      extended by org.zkoss.zk.ui.event.InputEvent
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
ErrorEvent

public class InputEvent
extends Event

Represents an event cause by user's input something at the client.

Author:
tomyeh
See Also:
Serialized Form

Constructor Summary
InputEvent(java.lang.String name, Component target, java.lang.String val, java.lang.Object oldValue)
          Constructs a input-relevant event.
InputEvent(java.lang.String name, Component target, java.lang.String val, java.lang.Object oldValue, boolean selbk, int start)
          Constructs an input event
 
Method Summary
static InputEvent getInputEvent(AuRequest request)
          Deprecated. As of release 5.0.4, replaced with getInputEvent(AuRequest, Object).
static InputEvent getInputEvent(AuRequest request, java.lang.Object oldValue)
          Converts an AU request to an input event.
 java.lang.Object getPreviousValue()
          Returns the previous value before user's input.
 int getStart()
          Returns the start position of the cursor from the input element.
 java.lang.String getValue()
          Returns the value that user input.
 boolean isChangingBySelectBack()
          Returns whether this event is onChanging, 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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

InputEvent

public InputEvent(java.lang.String name,
                  Component target,
                  java.lang.String val,
                  java.lang.Object oldValue)
Constructs a input-relevant event.

Parameters:
val - the new value
oldValue - the previous value
Since:
5.0.4

InputEvent

public InputEvent(java.lang.String name,
                  Component target,
                  java.lang.String val,
                  java.lang.Object oldValue,
                  boolean selbk,
                  int start)
Constructs an input event

Parameters:
val - the new value
oldValue - the previous value
selbk - 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. See isChangingBySelectBack() for details.
Since:
5.0.4
Method Detail

getInputEvent

public static final InputEvent getInputEvent(AuRequest request,
                                             java.lang.Object oldValue)
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

getInputEvent

public static final InputEvent getInputEvent(AuRequest request)
Deprecated. As of release 5.0.4, replaced with getInputEvent(AuRequest, Object).


getValue

public final java.lang.String getValue()
Returns the value that user input.


getPreviousValue

public java.lang.Object 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 if Doublebox is used.

Since:
5.0.4

isChangingBySelectBack

public final boolean isChangingBySelectBack()
Returns whether this event is onChanging, 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 onChange event.

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 onChanging event 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 onblur event of Javascript is always fired before onChange is fired. To get the position of cursor, onChanging event is suggested since onblur event of Javascript will not be fired.

Returns:
the start position >= 0
Since:
3.0.1


Copyright © 2005-2011 Potix Corporation. All Rights Reserved. SourceForge.net Logo