public abstract class AbstractHintLayout extends AbstractLayout
Subclasses may be sensitive to one or both hints. By default, this class
assumes both hints are important. Subclasses may override this behavior in
isSensitiveHorizontally(IFigure)
and
isSensitiveVertically(IFigure)
. At least one of these method should
return true
.
isObservingVisibility, preferredSize
Constructor and Description |
---|
AbstractHintLayout() |
Modifier and Type | Method and Description |
---|---|
protected Dimension |
calculateMinimumSize(IFigure container,
int wHint,
int hHint)
Calculates the minimum size using the given width and height hints.
|
Dimension |
getMinimumSize(IFigure container,
int w,
int h)
Returns the minimum size of the given figure.
|
Dimension |
getPreferredSize(IFigure container,
int w,
int h)
Returns the preferred size of the given figure, using width and height
hints.
|
void |
invalidate()
Extends the superclass implementation to flush the cached minimum size.
|
protected boolean |
isSensitiveHorizontally(IFigure container)
Returns whether this layout manager is sensitive to changes in the
horizontal hint.
|
protected boolean |
isSensitiveVertically(IFigure container)
Returns whether this layout manager is sensitive to changes in the
vertical hint.
|
calculatePreferredSize, calculatePreferredSize, getBorderPreferredSize, getConstraint, getMinimumSize, getPreferredSize, invalidate, isObservingVisibility, remove, setConstraint, setObserveVisibility
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
layout
protected Dimension calculateMinimumSize(IFigure container, int wHint, int hHint)
getMinimumSize(IFigure, int, int)
whenever
the cached minimum size has been flushed.
By default, this method just calls
getPreferredSize(IFigure, int, int)
, meaning minimum and
preferres sizes will be the same unless this method is overridden.
container
- the Figure on which this layout is installedwHint
- the width hinthHint
- the height hintpublic Dimension getMinimumSize(IFigure container, int w, int h)
LayoutManager
getMinimumSize
in interface LayoutManager
getMinimumSize
in class AbstractLayout
container
- The Figurew
- the width hinth
- the height hintLayoutManager.getMinimumSize(IFigure, int, int)
public final Dimension getPreferredSize(IFigure container, int w, int h)
AbstractLayout
AbstractLayout.calculatePreferredSize(IFigure, int, int)
is called.getPreferredSize
in interface LayoutManager
getPreferredSize
in class AbstractLayout
container
- The figurew
- The width hinth
- The height hintLayoutManager.getPreferredSize(IFigure, int, int)
public void invalidate()
invalidate
in interface LayoutManager
invalidate
in class AbstractLayout
LayoutManager.invalidate()
protected boolean isSensitiveHorizontally(IFigure container)
true
.container
- the layout's containertrue
if this layout is sensite to horizontal hint
changesprotected boolean isSensitiveVertically(IFigure container)
true
.container
- the layout's containertrue
if this layout is sensite to vertical hint
changesCopyright (c) IBM Corp. and others 2000, 2011. All Rights Reserved.