org.openbp.cockpit.modeler.figures.layouter
Class MultiplexLayouter

java.lang.Object
  extended by org.openbp.cockpit.modeler.figures.layouter.AbstractTagLayouter
      extended by org.openbp.cockpit.modeler.figures.layouter.MultiplexLayouter
All Implemented Interfaces:
TagLayouter

public class MultiplexLayouter
extends AbstractTagLayouter

Layout multiplexer that delegates layouting to a surrogate according to the direction of the tag.

Author:
Stephan Moritz

Field Summary
 
Fields inherited from class org.openbp.cockpit.modeler.figures.layouter.AbstractTagLayouter
direction, insets, tagFigure
 
Constructor Summary
MultiplexLayouter(AbstractTagFigure tagFigure)
          Default constructor.
 
Method Summary
 void applyDirection()
          Initializes the layouter according to the current direction.
 java.awt.Rectangle calculateSize()
          Calculates the dimensions of the figure by simulating the layout process.
 TagLayouter getActiveLayouter()
          Gets the the currently active layouter.
 java.awt.Insets getInsets()
          Gets the insets for each sub component.
static MultiplexLayouter getLeftRightInstance(AbstractTagFigure tag)
          The left-right multiplex layouter will layout the tag contents horizontally (from left to right).
static MultiplexLayouter getRadialInstance(AbstractTagFigure tag)
          The radial multiplex layouter will layout the tag contents radially according to the tag direction.
static MultiplexLayouter getRadialInstance2(AbstractTagFigure tag)
          The inverse radial multiplex layouter will layout the tag contents radially according to the tag direction, but in the inverse direction of the layouter returned by getRadialInstance(org.openbp.cockpit.modeler.figures.tag.AbstractTagFigure).
static MultiplexLayouter getStraightInstance(AbstractTagFigure tag)
           
static MultiplexLayouter getUpDownInstance(AbstractTagFigure tag)
          The left-right multiplex layouter will layout the tag contents vertically (from top to bottom).
 boolean isVerticalLayouter()
          Checks if the orientation of the tag is vertical or horizontal.
 void performLayout(java.awt.Rectangle box)
          Performs the layout of the figure.
 void setInsets(java.awt.Insets insets)
          Sets the insets for each sub component.
 void setLayouter(int begin, int end, TagLayouter layouter, int mappedDir)
          Sets the surrogate layouter for a given direction range.
 void setLayouter(int dir, TagLayouter layouter, int mappedDir)
          Sets the surrogate layouter for a given direction.
 void setupLayouter()
          Sets up the layouter.
 
Methods inherited from class org.openbp.cockpit.modeler.figures.layouter.AbstractTagLayouter
determineDirection, setDirection
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MultiplexLayouter

public MultiplexLayouter(AbstractTagFigure tagFigure)
Default constructor.

Parameters:
tagFigure - Tag to lay out
Method Detail

setLayouter

public void setLayouter(int begin,
                        int end,
                        TagLayouter layouter,
                        int mappedDir)
Sets the surrogate layouter for a given direction range.

Parameters:
begin - Begin of the range (inclusive, one of the direction constants of the CircleConstants class)
end - End of the range (exclusive, one of the direction constants of the CircleConstants class)
layouter - Layouter to set for this range or null for the layouter that is already present at this range (i. e. the default HorizontalLayouter).
mappedDir - Direction to use for the specified range

setLayouter

public void setLayouter(int dir,
                        TagLayouter layouter,
                        int mappedDir)
Sets the surrogate layouter for a given direction.

Parameters:
dir - Direction, one of the direction constants of the CircleConstants class
layouter - Layouter to set for this range or null for the layouter that is already present at this range (i. e. the default HorizontalLayouter).
mappedDir - Direction to use for the specified layouter

setupLayouter

public void setupLayouter()
Description copied from class: AbstractTagLayouter
Sets up the layouter. Sets up surrogate layouters and such. Does nothing by default.

Overrides:
setupLayouter in class AbstractTagLayouter
See Also:
AbstractTagLayouter.setupLayouter()

applyDirection

public void applyDirection()
Description copied from class: AbstractTagLayouter
Initializes the layouter according to the current direction.

Specified by:
applyDirection in class AbstractTagLayouter
See Also:
AbstractTagLayouter.applyDirection()

isVerticalLayouter

public boolean isVerticalLayouter()
Description copied from interface: TagLayouter
Checks if the orientation of the tag is vertical or horizontal.

Specified by:
isVerticalLayouter in interface TagLayouter
Specified by:
isVerticalLayouter in class AbstractTagLayouter
Returns:
true; The vertical layouter is always vertically oriented
See Also:
AbstractTagLayouter.isVerticalLayouter()

calculateSize

public java.awt.Rectangle calculateSize()
Description copied from interface: TagLayouter
Calculates the dimensions of the figure by simulating the layout process.

Returns:
The new dimensions of the figure
See Also:
TagLayouter.calculateSize()

performLayout

public void performLayout(java.awt.Rectangle box)
Description copied from interface: TagLayouter
Performs the layout of the figure.

Parameters:
box - Desired display box of the figure
See Also:
TagLayouter.performLayout(Rectangle box)

setInsets

public void setInsets(java.awt.Insets insets)
Description copied from class: AbstractTagLayouter
Sets the insets for each sub component. The insets define the distance between the sub components and the distance to the edge of the container.

Specified by:
setInsets in interface TagLayouter
Overrides:
setInsets in class AbstractTagLayouter
Parameters:
insets - New spacing dimensions
See Also:
AbstractTagLayouter.setInsets(Insets insets)

getInsets

public java.awt.Insets getInsets()
Description copied from class: AbstractTagLayouter
Gets the insets for each sub component. The insets define the distance between the sub components and the distance to the edge of the container.

Specified by:
getInsets in interface TagLayouter
Overrides:
getInsets in class AbstractTagLayouter
Returns:
spacing dimensions
See Also:
AbstractTagLayouter.getInsets()

getActiveLayouter

public TagLayouter getActiveLayouter()
Gets the the currently active layouter.


getStraightInstance

public static MultiplexLayouter getStraightInstance(AbstractTagFigure tag)

getLeftRightInstance

public static MultiplexLayouter getLeftRightInstance(AbstractTagFigure tag)
The left-right multiplex layouter will layout the tag contents horizontally (from left to right).

Parameters:
tag - Tag to layout
Returns:
A new layouter instance for the given tag

getUpDownInstance

public static MultiplexLayouter getUpDownInstance(AbstractTagFigure tag)
The left-right multiplex layouter will layout the tag contents vertically (from top to bottom).

Parameters:
tag - Tag to layout
Returns:
A new layouter instance for the given tag

getRadialInstance

public static MultiplexLayouter getRadialInstance(AbstractTagFigure tag)
The radial multiplex layouter will layout the tag contents radially according to the tag direction.

Parameters:
tag - Tag to layout
Returns:
A new layouter instance for the given tag

getRadialInstance2

public static MultiplexLayouter getRadialInstance2(AbstractTagFigure tag)
The inverse radial multiplex layouter will layout the tag contents radially according to the tag direction, but in the inverse direction of the layouter returned by getRadialInstance(org.openbp.cockpit.modeler.figures.tag.AbstractTagFigure).

Parameters:
tag - Tag to layout
Returns:
A new layouter instance for the given tag


Copyright © 2011. All Rights Reserved.