bibliothek.gui.dock.station.split
Class DefaultSplitDividerStrategy.Handler

java.lang.Object
  extended by java.awt.event.MouseAdapter
      extended by bibliothek.gui.dock.station.split.DefaultSplitDividerStrategy.Handler
All Implemented Interfaces:
DockHierarchyListener, AWTEventListener, MouseListener, MouseMotionListener, MouseWheelListener, EventListener
Enclosing class:
DefaultSplitDividerStrategy

public static class DefaultSplitDividerStrategy.Handler
extends MouseAdapter
implements MouseListener, MouseMotionListener, AWTEventListener, DockHierarchyListener

A DefaultSplitDividerStrategy.Handler is responsible for handling the needs of one SplitDockStation.

Author:
Benjamin Sigg

Constructor Summary
DefaultSplitDividerStrategy.Handler(SplitDockStation station)
          Creates a new strategy that will monitor station.
 
Method Summary
protected  void checkMousePositionAsync()
          Asynchronously checks the current position of the mouse and updates the cursor if necessary.
 void controllerChanged(DockHierarchyEvent event)
          Invoked whenever the controller of dockable has changed
 void destroy()
          Disposes all resources that are used by this handler.
 void eventDispatched(AWTEvent event)
          AWT event listener.
 Component getContainer()
          Gets the Component with which this strategy was initialized.
protected  Divideable getDividerNode(int x, int y)
          Gets the node whose dividier contains x, y.
 SplitDockStation getStation()
          Gets the station which is monitored by this strategy
 void hierarchyChanged(DockHierarchyEvent event)
          Called when the path of the observed Dockable has been changed.
 void install(Component container)
           
 void mouseDragged(MouseEvent e)
           
 void mouseExited(MouseEvent e)
           
 void mouseMoved(MouseEvent e)
           
 void mousePressed(MouseEvent e)
           
 void mouseReleased(MouseEvent e)
           
 void paint(Graphics g)
          Paints a line at the current location of the divider.
protected  void repaint(int x, int y, int width, int height)
          Repaints parts of the base component.
protected  void setCursor(Cursor cursor)
          Changes the cursor of the base component.
protected  void setDivider(Divideable node, double dividier)
          Called if the dividier of node needs to be changed.
 
Methods inherited from class java.awt.event.MouseAdapter
mouseClicked, mouseEntered, mouseWheelMoved
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.awt.event.MouseListener
mouseClicked, mouseEntered
 

Constructor Detail

DefaultSplitDividerStrategy.Handler

public DefaultSplitDividerStrategy.Handler(SplitDockStation station)
Creates a new strategy that will monitor station.

Parameters:
station - the station to monitor
Method Detail

getStation

public SplitDockStation getStation()
Gets the station which is monitored by this strategy

Returns:
the owner of this strategy

install

public void install(Component container)

hierarchyChanged

public void hierarchyChanged(DockHierarchyEvent event)
Description copied from interface: DockHierarchyListener
Called when the path of the observed Dockable has been changed.

Specified by:
hierarchyChanged in interface DockHierarchyListener
Parameters:
event - the new path

controllerChanged

public void controllerChanged(DockHierarchyEvent event)
Description copied from interface: DockHierarchyListener
Invoked whenever the controller of dockable has changed

Specified by:
controllerChanged in interface DockHierarchyListener
Parameters:
event - the current path and controller

eventDispatched

public void eventDispatched(AWTEvent event)
AWT event listener. Used to reset the mouse cursor when divider was changed and mouse exited event had not occurred normally.

Specified by:
eventDispatched in interface AWTEventListener
Parameters:
event -

getContainer

public Component getContainer()
Gets the Component with which this strategy was initialized.

Returns:
the argument from install(Component)

destroy

public void destroy()
Disposes all resources that are used by this handler.


setCursor

protected void setCursor(Cursor cursor)
Changes the cursor of the base component. Subclasses may override this method to use custom cursors.

Parameters:
cursor - the cursor to set, may be null

repaint

protected void repaint(int x,
                       int y,
                       int width,
                       int height)
Repaints parts of the base component.

Parameters:
x - x coordinate
y - y coordinate
width - the width of the are to repaint
height - the height of the are to repaint

getDividerNode

protected Divideable getDividerNode(int x,
                                    int y)
Gets the node whose dividier contains x, y.

Parameters:
x - the x coordinate
y - the y coordinate
Returns:
the node containing x, y

checkMousePositionAsync

protected void checkMousePositionAsync()
Asynchronously checks the current position of the mouse and updates the cursor if necessary.


mousePressed

public void mousePressed(MouseEvent e)
Specified by:
mousePressed in interface MouseListener
Overrides:
mousePressed in class MouseAdapter

mouseDragged

public void mouseDragged(MouseEvent e)
Specified by:
mouseDragged in interface MouseMotionListener
Overrides:
mouseDragged in class MouseAdapter

mouseReleased

public void mouseReleased(MouseEvent e)
Specified by:
mouseReleased in interface MouseListener
Overrides:
mouseReleased in class MouseAdapter

setDivider

protected void setDivider(Divideable node,
                          double dividier)
Called if the dividier of node needs to be changed.

Parameters:
node - the node whose divider changes
dividier - the new divider

mouseMoved

public void mouseMoved(MouseEvent e)
Specified by:
mouseMoved in interface MouseMotionListener
Overrides:
mouseMoved in class MouseAdapter

mouseExited

public void mouseExited(MouseEvent e)
Specified by:
mouseExited in interface MouseListener
Overrides:
mouseExited in class MouseAdapter

paint

public void paint(Graphics g)
Paints a line at the current location of the divider.

Parameters:
g - the Graphics used to paint