org.zkoss.zk.ui.event
Class SelectEvent<T extends Component,E>

java.lang.Object
  extended by org.zkoss.zk.ui.event.Event
      extended by org.zkoss.zk.ui.event.SelectEvent<T,E>
All Implemented Interfaces:
java.io.Serializable

public class SelectEvent<T extends Component,E>
extends Event

Represents an event cause by user's the list selection is changed at the client.

Author:
tomyeh
See Also:
Serialized Form

Nested Class Summary
static interface SelectEvent.SelectedObjectHandler<T extends Component>
          A handle to retrieve selected objects from selected items (components) if possible.
 
Field Summary
static int ALT_KEY
          Indicates whether the Alt key is pressed.
static int CTRL_KEY
          Indicates whether the Ctrl key is pressed.
static int SHIFT_KEY
          Indicates whether the Shift key is pressed.
 
Constructor Summary
SelectEvent(java.lang.String name, Component target, java.util.Set<T> selectedItems)
          Constructs a selection event.
SelectEvent(java.lang.String name, Component target, java.util.Set<T> selectedItems, java.util.Set<T> previousSelectedItems, java.util.Set<T> unselectedItems, java.util.Set<E> selectedObjects, java.util.Set<E> prevSelectedObjects, java.util.Set<E> unselectedObjects, T ref, java.lang.Object data, int keys)
          Constructs a selection event containing the data objects that model provided.
SelectEvent(java.lang.String name, Component target, java.util.Set<T> selectedItems, T ref)
          Constructs a selection event.
SelectEvent(java.lang.String name, Component target, java.util.Set<T> selectedItems, T ref, int keys)
          Constructs a selection event.
 
Method Summary
 int getKeys()
          Returns what keys were pressed when the mouse is clicked, or 0 if none of them was pressed.
 java.util.Set<T> getPreviousSelectedItems()
          Returns the previous selected items (never null).
 java.util.Set<E> getPreviousSelectedObjects()
          Returns the previous selected objects.
 T getReference()
          Returns the reference item that is the component causing the onSelect event(select or deselect) to be fired.
 java.util.Set<T> getSelectedItems()
          Returns the selected items (never null).
 java.util.Set<E> getSelectedObjects()
          Returns the selected objects (never null).
static
<T extends Component,E>
SelectEvent<T,E>
getSelectEvent(AuRequest request)
          Converts an AU request to a select event.
static
<T extends Component,E>
SelectEvent<T,E>
getSelectEvent(AuRequest request, SelectEvent.SelectedObjectHandler<T> handler)
          Converts an AU request to a select event.
 java.util.Set<T> getUnselectedItems()
          Returns the unselected items.
 java.util.Set<E> getUnselectedObjects()
          Returns the unselected objects.
 
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
 

Field Detail

ALT_KEY

public static final int ALT_KEY
Indicates whether the Alt key is pressed. It might be returned as part of getKeys().

See Also:
Constant Field Values

CTRL_KEY

public static final int CTRL_KEY
Indicates whether the Ctrl key is pressed. It might be returned as part of getKeys().

See Also:
Constant Field Values

SHIFT_KEY

public static final int SHIFT_KEY
Indicates whether the Shift key is pressed. It might be returned as part of getKeys().

See Also:
Constant Field Values
Constructor Detail

SelectEvent

public SelectEvent(java.lang.String name,
                   Component target,
                   java.util.Set<T> selectedItems)
Constructs a selection event.

Parameters:
selectedItems - a set of items that shall be selected.

SelectEvent

public SelectEvent(java.lang.String name,
                   Component target,
                   java.util.Set<T> selectedItems,
                   T ref)
Constructs a selection event.

Parameters:
selectedItems - a set of items that shall be selected.

SelectEvent

public SelectEvent(java.lang.String name,
                   Component target,
                   java.util.Set<T> selectedItems,
                   T ref,
                   int keys)
Constructs a selection event.

Parameters:
selectedItems - a set of items that shall be selected.
keys - a combination of CTRL_KEY, SHIFT_KEY and ALT_KEY.
Since:
3.6.0

SelectEvent

public SelectEvent(java.lang.String name,
                   Component target,
                   java.util.Set<T> selectedItems,
                   java.util.Set<T> previousSelectedItems,
                   java.util.Set<T> unselectedItems,
                   java.util.Set<E> selectedObjects,
                   java.util.Set<E> prevSelectedObjects,
                   java.util.Set<E> unselectedObjects,
                   T ref,
                   java.lang.Object data,
                   int keys)
Constructs a selection event containing the data objects that model provided.

Parameters:
selectedItems - a set of items that shall be selected.
selectedObjects - a set of data objects that shall be selected.
data - an arbitrary data
keys - a combination of CTRL_KEY, SHIFT_KEY and ALT_KEY.
Since:
6.0.0
Method Detail

getSelectEvent

public static final <T extends Component,E> SelectEvent<T,E> getSelectEvent(AuRequest request)
Converts an AU request to a select event.

Since:
5.0.0

getSelectEvent

public static final <T extends Component,E> SelectEvent<T,E> getSelectEvent(AuRequest request,
                                                                            SelectEvent.SelectedObjectHandler<T> handler)
Converts an AU request to a select event.

Since:
6.0.0

getSelectedItems

public final java.util.Set<T> getSelectedItems()
Returns the selected items (never null).


getPreviousSelectedItems

public final java.util.Set<T> getPreviousSelectedItems()
Returns the previous selected items (never null).

Since:
7.0.0

getPreviousSelectedObjects

public final java.util.Set<E> getPreviousSelectedObjects()
Returns the previous selected objects. The information is available only when the target component has a model.

Since:
7.0.1

getUnselectedItems

public final java.util.Set<T> getUnselectedItems()
Returns the unselected items.

Since:
7.0.1

getUnselectedObjects

public final java.util.Set<E> getUnselectedObjects()
Returns the unselected objects. The information is available only when the target component has a model.

Since:
7.0.1

getSelectedObjects

public final java.util.Set<E> getSelectedObjects()
Returns the selected objects (never null). The information is available only when the target component has a model.

Since:
6.0.0

getReference

public T getReference()
Returns the reference item that is the component causing the onSelect event(select or deselect) to be fired.

It is null, if the onSelect event is not caused by listbox or tree or combobox. Note: if not multiple, the getReference() is the same with the first item of getSelectedItems().

Since:
3.0.2

getKeys

public final int getKeys()
Returns what keys were pressed when the mouse is clicked, or 0 if none of them was pressed. It is a combination of CTRL_KEY, SHIFT_KEY and ALT_KEY.

Since:
3.6.0


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