Package org.eclipse.draw2d
Class XYLayout
java.lang.Object
org.eclipse.draw2d.AbstractLayout
org.eclipse.draw2d.XYLayout
- All Implemented Interfaces:
LayoutManager
- Direct Known Subclasses:
FreeformLayout
This class implements the
LayoutManager
interface
using the XY Layout algorithm. This lays out the components using the layout
constraints as defined by each component.-
Field Summary
FieldsModifier and TypeFieldDescriptionThe layout contraintsFields inherited from class org.eclipse.draw2d.AbstractLayout
isObservingVisibility, preferredSize
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected Dimension
calculatePreferredSize
(IFigure f, int wHint, int hHint) Calculates and returns the preferred size of the input figure.getConstraint
(IFigure figure) Returns the constraint for the given figure.Returns the origin for the given figure.void
Implements the algorithm to layout the components of the given container figure.void
Removes the given figure from this LayoutManager's list of figures.void
setConstraint
(IFigure figure, Object newConstraint) Sets the layout constraint of the given figure.Methods inherited from class org.eclipse.draw2d.AbstractLayout
calculatePreferredSize, getBorderPreferredSize, getMinimumSize, getMinimumSize, getPreferredSize, getPreferredSize, invalidate, invalidate, isObservingVisibility, setObserveVisibility
-
Field Details
-
constraints
The layout contraints
-
-
Constructor Details
-
XYLayout
public XYLayout()
-
-
Method Details
-
calculatePreferredSize
Calculates and returns the preferred size of the input figure. Since in XYLayout the location of the child should be preserved, the preferred size would be a region which would hold all the children of the input figure. If no constraint is set, that child is ignored for calculation. If width and height are not positive, the preferred dimensions of the child are taken.- Specified by:
calculatePreferredSize
in classAbstractLayout
- Parameters:
f
- The figurewHint
- The width hinthHint
- The height hint- Returns:
- The preferred size
- Since:
- 2.0
- See Also:
-
getConstraint
Description copied from class:AbstractLayout
Returns the constraint for the given figure.- Specified by:
getConstraint
in interfaceLayoutManager
- Overrides:
getConstraint
in classAbstractLayout
- Parameters:
figure
- The figure- Returns:
- The constraint
- See Also:
-
getOrigin
Returns the origin for the given figure.- Parameters:
parent
- the figure whose origin is requested- Returns:
- the origin
-
layout
Implements the algorithm to layout the components of the given container figure. Each component is laid out using its own layout constraint specifying its size and position.- Parameters:
parent
- The figure- See Also:
-
remove
Description copied from class:AbstractLayout
Removes the given figure from this LayoutManager's list of figures.- Specified by:
remove
in interfaceLayoutManager
- Overrides:
remove
in classAbstractLayout
- Parameters:
figure
- The figure to remove- See Also:
-
setConstraint
Sets the layout constraint of the given figure. The constraints can only be of typeRectangle
.- Specified by:
setConstraint
in interfaceLayoutManager
- Overrides:
setConstraint
in classAbstractLayout
- Parameters:
figure
- the childnewConstraint
- the child's new constraint- Since:
- 2.0
- See Also:
-