de.cau.cs.kieler.synccharts.custom
Class OldStateLayout

java.lang.Object
  extended by org.eclipse.draw2d.AbstractLayout
      extended by org.eclipse.draw2d.AbstractHintLayout
          extended by de.cau.cs.kieler.synccharts.custom.OldStateLayout
All Implemented Interfaces:
LayoutManager

public class OldStateLayout
extends AbstractHintLayout

A special layout for states: If the state is simple, its name is written in the center and the compartments are reduced in size to zero. If the state is complex, the name is written on top and the compartments are laid out in a column below the name.

Rating proposed yellow
(2010-01-27) msp

Field Summary
static int COND_HEIGHT
          minimal height for conditional states.
static int COND_WIDTH
          minimal width for conditional states.
static int MIN_HEIGHT
          minimal height for normal states.
static int MIN_WIDTH
          minimal width for normal states.
 
Fields inherited from class org.eclipse.draw2d.AbstractLayout
isObservingVisibility, preferredSize
 
Constructor Summary
OldStateLayout()
          Creates a state layout.
 
Method Summary
 Dimension calculateMinimumSize(IFigure stateFigure, int whint, int hhint)
          Returns the minimum size of the figure.
protected  Dimension calculatePreferredSize(IFigure stateFigure, int whint, int hhint)
          Calculate the preferred size of the figure.
 void checkNewSize(IFigure stateFigure, State state, Rectangle newBounds)
          Checks the new size of the state figure.
 void layout(IFigure stateFigure)
          
 
Methods inherited from class org.eclipse.draw2d.AbstractHintLayout
getMinimumSize, getPreferredSize, invalidate, isSensitiveHorizontally, isSensitiveVertically
 
Methods inherited from class org.eclipse.draw2d.AbstractLayout
calculatePreferredSize, getBorderPreferredSize, getConstraint, getMinimumSize, getPreferredSize, invalidate, isObservingVisibility, remove, setConstraint, setObserveVisibility
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MIN_HEIGHT

public static final int MIN_HEIGHT
minimal height for normal states.

See Also:
Constant Field Values

MIN_WIDTH

public static final int MIN_WIDTH
minimal width for normal states.

See Also:
Constant Field Values

COND_HEIGHT

public static final int COND_HEIGHT
minimal height for conditional states.

See Also:
Constant Field Values

COND_WIDTH

public static final int COND_WIDTH
minimal width for conditional states.

See Also:
Constant Field Values
Constructor Detail

OldStateLayout

public OldStateLayout()
Creates a state layout.

Method Detail

layout

public void layout(IFigure stateFigure)


calculateMinimumSize

public Dimension calculateMinimumSize(IFigure stateFigure,
                                      int whint,
                                      int hhint)
Returns the minimum size of the figure. The minimum size of a simple state is fixed. The minimum height of complex states is the sum of all its children's minimum heights, while its minimum width is the maximum of all its children's minimum sizes. However, empty compartments are not considered.

Overrides:
calculateMinimumSize in class AbstractHintLayout
Parameters:
stateFigure - the figure on which this layout is installed
whint - the width hint
hhint - the height hint
Returns:
the layout's minimum size

calculatePreferredSize

protected Dimension calculatePreferredSize(IFigure stateFigure,
                                           int whint,
                                           int hhint)
Calculate the preferred size of the figure.

Specified by:
calculatePreferredSize in class AbstractLayout
Parameters:
stateFigure - the figure
whint - the width hint
hhint - the height hint
Returns:
the preferred size

checkNewSize

public void checkNewSize(IFigure stateFigure,
                         State state,
                         Rectangle newBounds)
Checks the new size of the state figure.

Parameters:
stateFigure - the state figure
state - the corresponding model element
newBounds - the new bounds of the state figure