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

java.lang.Object
  extended by org.openbp.cockpit.modeler.figures.layouter.AbstractTagLayouter
All Implemented Interfaces:
TagLayouter
Direct Known Subclasses:
HorizontalLayouter, MultiplexLayouter, VerticalLayouter

public abstract class AbstractTagLayouter
extends java.lang.Object
implements TagLayouter

A tag layouter is responsible for laying out the sub figures of a tag. If a center figure is given, the direction of the tag will be determined by checking if the tag angle crosses the left, right, top or bottom lines of the center figure's display box. Otherwise, the direction will be determined according to the circle section that is determined by the angle. For square- or circle shaped figures, you don't need to provide a center figure. For rectangular or elliptic figures, however, it is recommended.

Author:
Stephan Moritz

Field Summary
protected  int direction
          Direction to which the tag currently faces (one of the EIGHT_* direction constants of the CircleConstants class)
protected  java.awt.Insets insets
          Insets for each sub component.
protected  AbstractTagFigure tagFigure
          Tag figure to layout
 
Constructor Summary
AbstractTagLayouter(AbstractTagFigure tagFigure)
          Constructor.
 
Method Summary
abstract  void applyDirection()
          Initializes the layouter according to the current direction.
 void determineDirection()
          Determines the direction of the tag by the angle of the associated figure and updates the layouter accordingly.
 java.awt.Insets getInsets()
          Gets the insets for each sub component.
abstract  boolean isVerticalLayouter()
          Checks if the orientation of the tag is vertical or horizontal.
 void setDirection(int direction)
          Sets the direction to which the tag currently faces and updates the layouter accordingly.
 void setInsets(java.awt.Insets insets)
          Sets the insets for each sub component.
protected  void setupLayouter()
          Sets up the layouter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.openbp.cockpit.modeler.figures.layouter.TagLayouter
calculateSize, performLayout
 

Field Detail

insets

protected java.awt.Insets insets
Insets for each sub component. The insets define the distance between the sub components and the distance to the edge of the container.


direction

protected int direction
Direction to which the tag currently faces (one of the EIGHT_* direction constants of the CircleConstants class)


tagFigure

protected AbstractTagFigure tagFigure
Tag figure to layout

Constructor Detail

AbstractTagLayouter

public AbstractTagLayouter(AbstractTagFigure tagFigure)
Constructor.

Parameters:
tagFigure - Tag to lay out
Method Detail

setupLayouter

protected void setupLayouter()
Sets up the layouter. Sets up surrogate layouters and such. Does nothing by default.


applyDirection

public abstract void applyDirection()
Initializes the layouter according to the current direction.


isVerticalLayouter

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

Specified by:
isVerticalLayouter in interface TagLayouter
Returns:
true; The vertical layouter is always vertically oriented

getInsets

public java.awt.Insets getInsets()
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
Returns:
spacing dimensions

setInsets

public void setInsets(java.awt.Insets insets)
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
Parameters:
insets - New spacing dimensions

setDirection

public void setDirection(int direction)
Sets the direction to which the tag currently faces and updates the layouter accordingly.

Specified by:
setDirection in interface TagLayouter
Parameters:
direction - One of the eighth direction constants of the CircleConstants class (EIGHTH_*)

determineDirection

public void determineDirection()
Determines the direction of the tag by the angle of the associated figure and updates the layouter accordingly.

Specified by:
determineDirection in interface TagLayouter


Copyright © 2011. All Rights Reserved.