Class UISelectionEvent

  • All Implemented Interfaces:
    IMessageBox

    public class UISelectionEvent
    extends UIBaseEvent<UIComp>
    The UI Selection Event is fired when the UI selection changes for a component, or when connected to the panel, for every child item in it.
    Author:
    Christopher Mindus
    • Constructor Detail

      • UISelectionEvent

        public UISelectionEvent​(UIComp source,
                                IUISelection selection)
        Constructs the event for a change without a trigger source.
        Parameters:
        source - The source.
        selection - The selection.
        Throws:
        java.lang.NullPointerException - If the source or selection is null.
      • UISelectionEvent

        public UISelectionEvent​(UIComp source,
                                IUISelection selection,
                                GProp<?> trigger)
        Constructs the event for a change event with a property being the trigger source, e.g. an UIGrid or UICheckBox.
        Parameters:
        source - The source.
        selection - The selection.
        trigger - The trigger property.
        Throws:
        java.lang.NullPointerException - If the source or selection is null.
    • Method Detail

      • getTrigger

        public GProp<?> getTrigger()
        Gets the trigger property being the source of the event.
        Returns:
        An instance of e.g. an UIButton, UICheckBox, a VS component or null if the trigger is not a property.
      • getSource

        public UIComp getSource()
        Gets the UI component that is the source of the event.
        Overrides:
        getSource in class BaseEvent<UIComp>
        Returns:
        The UIComp that had the selection changed.
      • getSelection

        public IUISelection getSelection()
        Gets the selection.
        Returns:
        The selection.
      • getFirstSelectedIndex

        public int getFirstSelectedIndex()
        Gets the first selected index.
        Returns:
        The first index in the current selection, or -1 for none or if selection is not index based.
      • getSelectedIndicies

        public int[] getSelectedIndicies()
        Gets the selected indicies, if the selection is index based.
        Returns:
        A new array of the selected indices (that may be modified to your liking), or a static zero in length array for no selection (or selection is not index based).
      • getIndexedSelection

        public IUIIndexedSelection getIndexedSelection()
        Gets the selection as an indexed selection.
        Returns:
        The selection instance, or null if the selection is not an indexed selection.
      • getSingleIndexedSelection

        public IUISingleIndexedSelection getSingleIndexedSelection()
        Gets the selection as a single indexed selection.
        Returns:
        The selection instance, or null if the selection is not a single indexed selection.
      • getAnimatedSingleIndexedSelection

        public IUIAnimatedSingleIndexedSelection getAnimatedSingleIndexedSelection()
        Gets the selection as an animated single indexed selection.
        Returns:
        The selection instance, or null if the selection is not an animated single indexed selection.
      • isSelected

        public boolean isSelected()
        Returns the selection state.
        Returns:
        true if selected, false if unselected or not boolean-based selection.
      • isUnselectedBoolean

        public boolean isUnselectedBoolean()
        Returns if the boolean-based selection is not set.
        Returns:
        true if unselected, false if selected or not boolean-based selection.
      • isON

        public boolean isON()
        Returns if the selection is "on".
        Returns:
        true if on, false if off or not boolean-based selection.
      • isOFF

        public boolean isOFF()
        Returns if the selection is "off".
        Returns:
        true if off, false if on or not boolean-based selection.
      • getBooleanSelection

        public IUIBooleanSelection getBooleanSelection()
        Gets the selection as a boolean selection.
        Returns:
        The selection instance, or null if the selection is not a boolean selection.
      • getCheckState

        public int getCheckState()
        Gets the check state.
        Returns:
        Returns 0={$link #UNSELECTED}, 1={$link #CHECKED}, 2={$link #THIRD_STATE} or -1 if the selection is not a tri-state-based selection.
      • isChecked

        public boolean isChecked()
        Returns if the state is checked.
        Returns:
        true if checked, false if unselected, in third state or the selection is not a tri-state-based selection.
      • isUnselectedTriState

        public boolean isUnselectedTriState()
        Returns if the tri-state-based selection state is unselected.
        Returns:
        true if unchecked, false if checked, in third state or the selection is not a tri-state-based selection.
      • isThirdState

        public boolean isThirdState()
        Returns if the state is third state, i.e. neither checked nor unselected.
        Returns:
        true if third state, false if checked, unselected or the selection is not a tri-state-based selection.
      • getTriStateSelection

        public IUITriStateSelection getTriStateSelection()
        Gets the selection as a tri-state selection.
        Returns:
        The selection instance, or null if the selection is not a tri-state selection.