Class SelectEvent<T extends Component,E>

java.lang.Object
org.zkoss.zk.ui.event.Event
org.zkoss.zk.ui.event.SelectEvent<T,E>
All Implemented Interfaces:
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:
  • Field Details

    • 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:
    • 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:
    • 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:
  • Constructor Details

    • SelectEvent

      public SelectEvent(String name, Component target, Set<T> selectedItems)
      Constructs a selection event.
      Parameters:
      selectedItems - a set of items that shall be selected.
    • SelectEvent

      public SelectEvent(String name, Component target, Set<T> selectedItems, T ref)
      Constructs a selection event.
      Parameters:
      selectedItems - a set of items that shall be selected.
    • SelectEvent

      public SelectEvent(String name, Component target, 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(String name, Component target, Set<T> selectedItems, Set<T> previousSelectedItems, Set<T> unselectedItems, Set<E> selectedObjects, Set<E> prevSelectedObjects, Set<E> unselectedObjects, T ref, 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 Details

    • 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 Set<T> getSelectedItems()
      Returns the selected items (never null).
    • getPreviousSelectedItems

      public final Set<T> getPreviousSelectedItems()
      Returns the previous selected items (never null).
      Since:
      7.0.0
    • getPreviousSelectedObjects

      public final 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 Set<T> getUnselectedItems()
      Returns the unselected items.
      Since:
      7.0.1
    • getUnselectedObjects

      public final 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 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