com.javadocking.drag.painter
Class RectangleDragComponentFactory

java.lang.Object
  extended by com.javadocking.drag.painter.RectangleDragComponentFactory
All Implemented Interfaces:
DragComponentFactory

public class RectangleDragComponentFactory
extends java.lang.Object
implements DragComponentFactory

This factory creates a javax.swing.JComponent to represent the dragged dockable. The javax.swing.JComponent uses a RectanglePainter to paint the dragged dockable.

Author:
Heidi Rakels.

Constructor Summary
RectangleDragComponentFactory(RectanglePainter rectanglePainter)
          Constructs a rectangle drag component factory that uses the given painter for painting the rectangles on the javax.swing.JComponent.
RectangleDragComponentFactory(RectanglePainter rectanglePainter, boolean drawLabel)
          Constructs a rectangle drag component factory that uses the given painter for painting the rectangles on the javax.swing.JComponent.
 
Method Summary
 java.awt.Component createDragComponent(Dockable dockable, Dock dock, java.awt.Rectangle rectangle)
          Creates a component to show where a dockable will be docked in a dock while dragging the dockable.
 RectanglePainter getRectanglePainter()
          Gets the painter that paints the rectangles on the javax.swing.JComponents returned by this factory.
 boolean isDrawLabel()
          Determines if a label has to be painted on the rectangle.
 void setDrawLabel(boolean drawLabel)
          Sets if a label has to be painted on the rectangle.
 void setRectanglePainter(RectanglePainter rectanglePainter)
          Sets the painter that paints the rectangles on the javax.swing.JComponents returned by this factory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RectangleDragComponentFactory

public RectangleDragComponentFactory(RectanglePainter rectanglePainter)
Constructs a rectangle drag component factory that uses the given painter for painting the rectangles on the javax.swing.JComponent.

Parameters:
rectanglePainter - The painter that paints the rectangles on the javax.swing.JComponents returned by this factory.

RectangleDragComponentFactory

public RectangleDragComponentFactory(RectanglePainter rectanglePainter,
                                     boolean drawLabel)
Constructs a rectangle drag component factory that uses the given painter for painting the rectangles on the javax.swing.JComponent.

Parameters:
rectanglePainter - The painter that paints the rectangles on the javax.swing.JComponents returned by this factory.
drawLabel - True when a label has to be painted on the rectangle.
Method Detail

createDragComponent

public java.awt.Component createDragComponent(Dockable dockable,
                                              Dock dock,
                                              java.awt.Rectangle rectangle)
Description copied from interface: DragComponentFactory
Creates a component to show where a dockable will be docked in a dock while dragging the dockable.

Specified by:
createDragComponent in interface DragComponentFactory
Parameters:
dockable - The dragged dockable.
dock - The dock in which the dockable will be docked, if the mouse is released in the current position.
rectangle - The rectangle relative to the dock that represents the window for the dockable, if the mouse is released in the current position.
Returns:
The component that shows where a dockable will be docked in a dock.

getRectanglePainter

public RectanglePainter getRectanglePainter()
Gets the painter that paints the rectangles on the javax.swing.JComponents returned by this factory.

Returns:
The painter that paints the rectangles on the JComponents returned by this factory.

setRectanglePainter

public void setRectanglePainter(RectanglePainter rectanglePainter)
Sets the painter that paints the rectangles on the javax.swing.JComponents returned by this factory.

Parameters:
rectanglePainter - The painter that paints the rectangles on the JComponents returned by this factory.

isDrawLabel

public boolean isDrawLabel()
Determines if a label has to be painted on the rectangle.

Returns:
True when a label has to be painted on the rectangle.

setDrawLabel

public void setDrawLabel(boolean drawLabel)
Sets if a label has to be painted on the rectangle.

Parameters:
drawLabel - True when a label has to be painted on the rectangle.