public class DefaultMouseFocusObserver extends Object implements MouseFocusObserver
MouseFocusObserver offers methods to handle
FocusVetoListeners and registers a VetoableDockRelocatorListener. On a
drop event this observer
will automatically transfer the focus to the dropped Dockable.| Constructor and Description |
|---|
DefaultMouseFocusObserver(DockController controller,
ControllerSetupCollection setup)
Creates a new FocusController.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
check(AWTEvent event)
Lets check this controller whether the focus should change, or not.
|
protected void |
check(Component component,
AWTEvent event)
Tries to find the Dockable which owns
component
and sets this Dockable to the focusedDockable. |
protected void |
check(Component component,
boolean ensureFocus,
boolean requestFocusInWindow,
AWTEvent event)
Tries to find the Dockable which owns
component
and sets this Dockable to the focusedDockable. |
void |
check(MouseEvent event)
This method may be called at any time by any component that received
the
MouseEvent event. |
void |
check(MouseWheelEvent event)
This method may be called at any time by any component that received
the
MouseWheelEvent event. |
DockController |
getController()
Gets the affected controller.
|
protected DockElementRepresentative |
getDockable(Component component,
AWTEvent event)
Gets the top-dockable which has
component or
parent of component as base Component. |
protected void |
handleVeto(AWTEvent event,
FocusVetoListener.FocusVeto veto)
Handles the veto that was given when trying to forward
event. |
protected boolean |
interact(AWTEvent event)
Tells whether this event should change the focus.
|
void |
kill()
Stops this FocusController.
|
public DefaultMouseFocusObserver(DockController controller, ControllerSetupCollection setup)
controller - the controller which will be informed about
focus-changessetup - an observable informing this object when controller
is set up.public void kill()
kill in interface MouseFocusObserverpublic DockController getController()
getController in interface MouseFocusObserverpublic void check(MouseEvent event)
MouseEvent event. This observer may transfer the
focus because of this call.restricted environment
than any DockStation of this framework will call this method.event - the event to checkpublic void check(MouseWheelEvent event)
MouseWheelEvent event. This observer may transfer the
focus because of this call.restricted environment
than any DockStation of this framework will call this method.event - the event to checkprotected void check(AWTEvent event)
event is
allowed to change the focus or not. This check can be done through the
method interact(AWTEvent).event - The event to react on.interact(AWTEvent)protected boolean interact(AWTEvent event)
event - the eventtrue if the focus could be changedprotected void handleVeto(AWTEvent event, FocusVetoListener.FocusVeto veto)
event. The default implementation calls
InputEvent.consume() to get rid of the event.event - the event to handleveto - which veto was called by a FocusVetoListenerprotected void check(Component component, AWTEvent event)
component
and sets this Dockable to the focusedDockable. The method
only succeeds if no veto-listener reacts.component - the component whose dockable parent is to set
focusedevent - the event that causes this checkprotected void check(Component component, boolean ensureFocus, boolean requestFocusInWindow, AWTEvent event)
component
and sets this Dockable to the focusedDockable. The method
only succeeds if no veto-listener reacts.component - the component whose dockable parent is to set
focusedensureFocus - whether the DockController should ensure
that the focus is set correctly or not.requestFocusInWindow - whether Component.requestFocusInWindow() should be
called or notevent - the event that causes this checkprotected DockElementRepresentative getDockable(Component component, AWTEvent event)
component or
parent of component as base Component.component - a Componentevent - the event that causes this checknull if nothing was foundCopyright © 2017 Docking Frames. All rights reserved.