bibliothek.gui.dock.themes.basic
Class TabDisplayerCombinerTarget

java.lang.Object
  extended by bibliothek.gui.dock.themes.basic.TabDisplayerCombinerTarget
All Implemented Interfaces:
DisplayerCombinerTarget

public class TabDisplayerCombinerTarget
extends Object
implements DisplayerCombinerTarget

This DisplayerCombinerTarget can be used by DockableDisplayers that show a StackDockComponent to paint some tabs. This target will create a StackDockStation if execute(CombinerSource) is called.
Clients should first create an instance of this target, then call isValid() to check whether the parameters were valid.

Author:
Benjamin Sigg

Constructor Summary
TabDisplayerCombinerTarget(DockableDisplayer displayer, StackDockComponent stack, CombinerSource source, Enforcement force)
          Creates a new target, clients should call isValid() to check whether the new target can be executed.
 
Method Summary
 Dockable execute(CombinerSource source)
          Executes this operation.
 int getIndex()
          Gets the location where the Dockable would be inserted
 Dockable getTarget()
          Gets the Dockable over which the new item would be dragged.
 boolean isValid()
           
 void paint(Graphics g, Component component, StationPaint paint, Rectangle stationBounds, Rectangle dockableBounds)
          Allows this operation to paint some markings onto the screen.
 void paint(Graphics g, StationPaint paint)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TabDisplayerCombinerTarget

public TabDisplayerCombinerTarget(DockableDisplayer displayer,
                                  StackDockComponent stack,
                                  CombinerSource source,
                                  Enforcement force)
Creates a new target, clients should call isValid() to check whether the new target can be executed.

Parameters:
displayer - the owner of this target
stack - the stack that shows exactly one Dockable
source - information about the Dockable that is going to be dropped
force - whether this target should be forced to be valid in more cases
Method Detail

isValid

public boolean isValid()

getIndex

public int getIndex()
Gets the location where the Dockable would be inserted

Returns:
-1 if this target is invalid, otherwise 0 or 1

getTarget

public Dockable getTarget()
Gets the Dockable over which the new item would be dragged.

Returns:
the target Dockable, not null

execute

public Dockable execute(CombinerSource source)
Description copied from interface: DisplayerCombinerTarget
Executes this operation. Usually that means to invoke some method like DockStation.drag(Dockable).

Specified by:
execute in interface DisplayerCombinerTarget
Parameters:
source - the source of information to use for the execution, this may not be the same object as was used to create this DisplayerCombinerTarget.
Returns:
the replacement Dockable for the old item

paint

public void paint(Graphics g,
                  Component component,
                  StationPaint paint,
                  Rectangle stationBounds,
                  Rectangle dockableBounds)
Description copied from interface: DisplayerCombinerTarget
Allows this operation to paint some markings onto the screen.

Specified by:
paint in interface DisplayerCombinerTarget
Parameters:
g - the graphics context to use
component - the component on which g paints.
paint - painting algorithms fitting to the current DockTheme
stationBounds - an estimate of the area which will be affected by inserting the combined Dockable, not null
dockableBounds - the boundaries which a representation of the combined Dockable has. If possible this is the exact location and size, including any title. If the station cannot exactly tell where the Dockable is going to be (e.g. when CombinerSource.getSize() returned null), then this may be the location and size of a title. Never null.

paint

public void paint(Graphics g,
                  StationPaint paint)