com.javadocking.drag.painter
Class SwDockableDragPainter

java.lang.Object
  extended by com.javadocking.drag.painter.SwDockableDragPainter
All Implemented Interfaces:
DockableDragPainter

public class SwDockableDragPainter
extends java.lang.Object
implements DockableDragPainter

This painter paints a Dockable during dragging.

The dragged dockable is showed with a java.awt.Component. This component is created by the DragComponentFactory. The default drag component factory is RectangleDragComponentFactory. If this default factory is used, a RectanglePainter that paints the dockable on the component, should be provided to the constructor of this class.

The component that represents the dockable, is added to the java.swing.JLayeredPane of the Dock.

The given dock should be a java.awt.Component and the ancestor window should be javax.swing.JFrame, javax.swing.JWindow, or javax.swing.JDialog. Otherwise nothing will be done by this painter.

Author:
Heidi Rakels.

Constructor Summary
SwDockableDragPainter(DragComponentFactory dragComponentFactory)
          Constructs a Swing dockable drag painter that uses the given drag component factory.
SwDockableDragPainter(DragComponentFactory dragComponentFactory, boolean onlyComponentDocks)
          Constructs a Swing dockable drag painter that uses the given drag component factory.
SwDockableDragPainter(RectanglePainter rectanglePainter)
          Constructs a Swing dockable drag painter that uses a RectangleDragComponentFactory as drag component factory.
SwDockableDragPainter(RectanglePainter rectanglePainter, boolean onlyComponentDocks)
          Constructs a Swing dockable drag painter that uses a RectangleDragComponentFactory as drag component factory.
 
Method Summary
 void clear()
          Clears everything what was painted by this painter before.
 boolean isOnlyComponentDocks()
          Gets if the dockable will only be painted when the dock is java.awt.Component.
 void paintDockableDrag(Dockable dockable, Dock dock, java.awt.Rectangle rectangle, java.awt.Point locationInDestinationDock)
           Paints a dockable during dragging.
 void setOnlyComponentDocks(boolean onlyComponentDocks)
          Sets if the dockable will only be painted when the dock is java.awt.Component.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SwDockableDragPainter

public SwDockableDragPainter(DragComponentFactory dragComponentFactory)
Constructs a Swing dockable drag painter that uses the given drag component factory.

Parameters:
dragComponentFactory - The factory that creates the component that represents the dragged dockable.

SwDockableDragPainter

public SwDockableDragPainter(RectanglePainter rectanglePainter)
Constructs a Swing dockable drag painter that uses a RectangleDragComponentFactory as drag component factory.

Parameters:
rectanglePainter - The rectangle painter used by the default drag component factory to paint the dragged dockable on the component.

SwDockableDragPainter

public SwDockableDragPainter(DragComponentFactory dragComponentFactory,
                             boolean onlyComponentDocks)
Constructs a Swing dockable drag painter that uses the given drag component factory.

Parameters:
dragComponentFactory - The factory that creates the component that represents the dragged dockable.
onlyComponentDocks - When true, the dockable will only be painted when the dock is java.awt.Component.

SwDockableDragPainter

public SwDockableDragPainter(RectanglePainter rectanglePainter,
                             boolean onlyComponentDocks)
Constructs a Swing dockable drag painter that uses a RectangleDragComponentFactory as drag component factory.

Parameters:
rectanglePainter - The rectangle painter used by the default drag component factory to paint the dragged dockable on the component.
onlyComponentDocks - When true, the dockable will only be painted when the dock is java.awt.Component.
Method Detail

paintDockableDrag

public void paintDockableDrag(Dockable dockable,
                              Dock dock,
                              java.awt.Rectangle rectangle,
                              java.awt.Point locationInDestinationDock)
Description copied from interface: DockableDragPainter

Paints a dockable during dragging.

Usually a rectangle is painted. It shows where the dockable will be docked in the dock, if the mouse would be released at the current mouse position.

Specified by:
paintDockableDrag in interface DockableDragPainter
Parameters:
dock - Should be a java.awt.Component and the ancestor window should be javax.swing.JFrame, javax.swing.JWindow, or javax.swing.JDialog. Otherwise nothing is done.
dockable - The dockable that will be painted.
rectangle - The rectangle that defines, where the given dockable will be docked, if the mouse is released at the current mouse position. The position of the rectangle is relative to the given dock.
locationInDestinationDock - The position of the mouse relative to the given dock.

clear

public void clear()
Description copied from interface: DockableDragPainter
Clears everything what was painted by this painter before.

Specified by:
clear in interface DockableDragPainter

isOnlyComponentDocks

public boolean isOnlyComponentDocks()
Gets if the dockable will only be painted when the dock is java.awt.Component.

Returns:
When true, the dockable will only be painted when the dock is java.awt.Component.

setOnlyComponentDocks

public void setOnlyComponentDocks(boolean onlyComponentDocks)
Sets if the dockable will only be painted when the dock is java.awt.Component.

Parameters:
onlyComponentDocks - When true, the dockable will only be painted when the dock is java.awt.Component.