|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--com.brunchboy.util.swing.relativelayout.RelativeLayout
A layout manager that uses a dependency analyzer to support an arbitrary (but consistent and complete) set of relative constraints between its components.
| Field Summary | |
static String |
VERSION
Provides access to the CVS version of this class. |
| Constructor Summary | |
RelativeLayout()
|
|
| Method Summary | |
void |
addConstraint(String componentName,
AttributeType type,
Constraint constraint)
Programmatically add a constraint for a component attribute. |
void |
addLayoutComponent(Component component,
Object constraints)
Add a component to be laid out, with specified constraints. |
void |
addLayoutComponent(String name,
Component component)
Add a component to be laid out. |
float |
getLayoutAlignmentX(Container target)
Returns the alignment along the x axis. |
float |
getLayoutAlignmentY(Container target)
Returns the alignment along the y axis. |
void |
invalidateLayout(Container target)
Invalidates the layout, indicating that if the layout manager has cached information it should be discarded. |
void |
layoutContainer(Container parent)
Lays out the specified container, according to the constraints that have been established. |
Dimension |
maximumLayoutSize(Container target)
Calculates the maximum size dimensions for the specified container, given the components it contains. |
Dimension |
minimumLayoutSize(Container parent)
Calculates the minimum size dimensions for the specified container, given the components it contains. |
Dimension |
preferredLayoutSize(Container parent)
Calculates the preferred size dimensions for the specified container, given the components it contains. |
void |
removeLayoutComponent(Component component)
Removes the specified component from the layout. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final String VERSION
| Constructor Detail |
public RelativeLayout()
| Method Detail |
public void addLayoutComponent(String name,
Component component)
addConstraint.
addLayoutComponent in interface LayoutManagername - the logical name by which the component will be known; this
will be used in all constraints that relate to the component. If
the component's actual name isn't
already equal this value, it will be set by this method.component - the graphical component whose size and position is to
be managed according to our constraint hierarchy.
IllegalStateException - if multiple components are added with the
same logical name, or if the same component is added more than
once.
IllegalArgumentException - if you try to use the name reserved
for the container, DependencyManager.ROOT_NAME.
NullPointerException - if name is null.
public void addLayoutComponent(Component component,
Object constraints)
addLayoutComponent in interface LayoutManager2component - the graphical component whose size and position is to
be managed according to our constraint hierarchy.constraints - currently must be a String specifying the
logical name of the component (making this method is identical
to the version in which the parameters are reversed). A
straightforward enhancement would be to also support passing
a new class (perhaps named ConstraintList) that spelled out
the component's logical name and the constraints associated
with it. It turns out that the XML-based configuration is even
more convenient, so this hasn't been implemented.
IllegalStateException - if multiple components are added with the
same logical name, or if the same component is added more than
once.
IllegalArgumentException - if the constraints parameter is not a
String.
NullPointerException - if name is null.
public void addConstraint(String componentName,
AttributeType type,
Constraint constraint)
componentName - the logical name of the component for which a
constraint is to be recorded.type - the attribute for which a constraint is to be recorded.constraint - the information from which the attribute value should
be computed (for example an AttributeConstraint or
AxisConstraint).
IllegalStateException - if this would overconstrain the component.
IllegalArgumentException - if you try to use the name reserved
for the container, DependencyManager.ROOT_NAME.
NullPointerException - if any argument is null.public void layoutContainer(Container parent)
layoutContainer in interface LayoutManagerparent - the container to be laid out.
IllegalStateException - if there is a problem with the dependency
tree.public void removeLayoutComponent(Component component)
removeLayoutComponent in interface LayoutManagercomponent - the component to be removed.public Dimension preferredLayoutSize(Container parent)
preferredLayoutSize in interface LayoutManagerparent - the container to be laid out.
IllegalStateException - if there are any unresolved component
attributes.minimumLayoutSize(java.awt.Container)public Dimension minimumLayoutSize(Container parent)
minimumLayoutSize in interface LayoutManagerparent - the component to be laid out.
IllegalStateException - if there are any unresolved component
attributes.preferredLayoutSize(java.awt.Container)public Dimension maximumLayoutSize(Container target)
maximumLayoutSize in interface LayoutManager2Component.getMaximumSize(),
LayoutManagerpublic float getLayoutAlignmentY(Container target)
getLayoutAlignmentY in interface LayoutManager2public float getLayoutAlignmentX(Container target)
getLayoutAlignmentX in interface LayoutManager2public void invalidateLayout(Container target)
invalidateLayout in interface LayoutManager2
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||