Class DelegatingEditActionHandlerFocusAdapter

  • All Implemented Interfaces:
    java.awt.event.FocusListener, java.util.EventListener

    public class DelegatingEditActionHandlerFocusAdapter
    extends java.awt.event.FocusAdapter
    A FocusAdapter which sets the injected DelegatingEditActionHandler's delegate to the injected EditActionHandler delegate when the target gains focus. When the target loses focus, the DelegatingEditActionHandler's delegate is set to null only if its delegate is still set to the injected delegate and if the component that the target lost focus to descends from the injected parent Component (since focus could be on the Designer's edit menu bar, in this case the edit action delegation chain will not break).
    See Also:
    SwingUtilities.isDescendingFrom(Component, Component)
    • Constructor Detail

      • DelegatingEditActionHandlerFocusAdapter

        public DelegatingEditActionHandlerFocusAdapter​(java.awt.Component parent,
                                                       DelegatingEditActionHandler delegator,
                                                       EditActionHandler delegate)
                                                throws java.lang.NullPointerException
        Constructor for injecting the parent, delegator, and delegate.
        Parameters:
        parent - The parent Component
        delegator - The delegator
        delegate - The delegate to whom the delegator will delegate handling of edit actions
        Throws:
        java.lang.NullPointerException - when parent or delegator is null
    • Method Detail

      • focusGained

        public void focusGained​(java.awt.event.FocusEvent e)
        Specified by:
        focusGained in interface java.awt.event.FocusListener
        Overrides:
        focusGained in class java.awt.event.FocusAdapter
      • focusLost

        public void focusLost​(java.awt.event.FocusEvent e)
        Specified by:
        focusLost in interface java.awt.event.FocusListener
        Overrides:
        focusLost in class java.awt.event.FocusAdapter