Class UIFocusEvent

  • All Implemented Interfaces:
    IMessageBox

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

      • UIFocusEvent

        public UIFocusEvent​(UIComp source,
                            UIComp opposite,
                            boolean isFocusGained)
        Constructs the event for a change without a trigger source.
        Parameters:
        source - The source.
        isFocusGained - Flag indicating focus was gained.
        Throws:
        java.lang.NullPointerException - If the source is null.
      • UIFocusEvent

        public UIFocusEvent​(UIComp source,
                            UIComp opposite,
                            boolean isFocusGained,
                            GProp<?> trigger)
        Constructs the event for a change event with a property being the trigger source, e.g. an UIButton or UICheckBox.
        Parameters:
        source - The source.
        isFocusGained - Flag indicating focus was gained.
        trigger - The trigger property.
    • 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, i.e. the item that gains or loses focus.
        Overrides:
        getSource in class BaseEvent<UIComp>
        Returns:
        The UIComp gaining or losing focus. If this event is fired to a listener on a panel, this value can be null when e.g. no one receives focus.
      • getOpposite

        public UIComp getOpposite()
        Gets the opposite component for the focus operation, i.e. if the operation is FocusGained, the opposite component is the one losing focus, and if the operation is FocusLost, the opposite component is the component gaining focus.
        Returns:
        The opposite component, or null for none.
      • isFocusGained

        public boolean isFocusGained()
        Returns if this is the focus gained operation.
        Returns:
        true if this is focus gained, false for focus lost.
      • isFocusLost

        public boolean isFocusLost()
        Returns if this is the focus lost operation.
        Returns:
        true if this is focus lost, false for focus gained.