|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--com.brunchboy.util.swing.relativelayout.ComponentSpecifications
Keeps track of the specifications that have been provided for a particular component, and is able to determine how to derive the rest from these constraints.
| Field Summary | |
static String |
VERSION
Provides access to the CVS version of this class. |
| Constructor Summary | |
ComponentSpecifications(String componentName)
Create a new set of specifications for the named component. |
|
ComponentSpecifications(String componentName,
Component component)
Create a new set of specifications for the supplied component. |
|
| Method Summary | |
void |
addConstraint(AttributeType type,
Constraint constraint)
Add a constraint for this component. |
void |
clearAttributeValues()
Clear out any existing attribute values in preparation for a new layout operation. |
void |
computeAttribute(AttributeType attribute,
AttributeSource allAttrs,
boolean minimumSize,
int parentWidth,
int parentHeight)
Compute the specified attribute, either from a supplied constraint, or by deriving it from other attributes of this component if it was not constrained. |
int |
getAttributeValue(AttributeType type)
Return an attribute value, assuming it has been resolved. |
Component |
getComponent()
Return the component being controlled by these specifications. |
int |
getComponentHeight(boolean minimumSize)
Look up the natural height of the component being managed, if there is one. |
String |
getComponentName()
Return the logical name of the component to which these specifications apply. |
int |
getComponentWidth(boolean minimumSize)
Look up the natural width of the component being managed, if there is one. |
boolean |
hasConstraint(AttributeType type)
Tests whether the specified attribute value has been defined explicitly (i.e. not through derivation). |
void |
layoutComponent(int xOffset,
int yOffset)
Sets the bounds of the component being managed by these specifications. |
void |
reportDependencies(DependencyManager dependencies)
Called the first time layout is being performed after components or constraints have been changed, to build up the master list of dependencies to be sorted. |
void |
setAttributeValue(AttributeType type,
int value)
Set an attribute value, which should not yet exist. |
void |
setComponent(Component component)
Set the component being controlled by these specifications, once we learn about it. |
| 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 ComponentSpecifications(String componentName)
Component associated with the
constraints; that will be set later.
componentName - the logical name by which the
RelativeLayout knows the component.
public ComponentSpecifications(String componentName,
Component component)
componentName - the logical name by which the
RelativeLayout knows the component.component - the graphical component that will be controlled by
these specifications.| Method Detail |
public String getComponentName()
RelativeLayout.public void setComponent(Component component)
component - the component to constrain.
IllegalStateException - if the component has already been set.public Component getComponent()
null if we
don't yet have one.public int getAttributeValue(AttributeType type)
type - the type of attribute desired.
IllegalStateException - if this method is called before the
specified attribute has been resolved.public boolean hasConstraint(AttributeType type)
type - the type of attribute desired.
true iff the attribute has been given a constraint.public int getComponentWidth(boolean minimumSize)
minimumSize - indicates whether we should ask the component for
its minimum size rather than its preferred size.
public int getComponentHeight(boolean minimumSize)
minimumSize - indicates whether we should ask the component for
its minimum size rather than its preferred size.
public void setAttributeValue(AttributeType type,
int value)
type - the type of attribute desired.value - the desired value of that attribute.
IllegalStateException - if this method is called to set an
attribute whose value has already been resolved.public void clearAttributeValues()
public void addConstraint(AttributeType type,
Constraint constraint)
type - the attribute which is to be constrained.constraint - the place from which the attribute's value can be
calculated.
IllegalStateException - if this would cause the component to
become overconstrained.
NullPointerException - if any argument is null.public void reportDependencies(DependencyManager dependencies)
dependencies - the dependency analyzer to which dependencies need
to be reported.
IllegalStateException - if this leads to a bad dependency graph.
public void computeAttribute(AttributeType attribute,
AttributeSource allAttrs,
boolean minimumSize,
int parentWidth,
int parentHeight)
attribute - the type of attribute that should now be computed.allAttrs - provides read access to all existing component
attributes, for use in evaluating constraintsminimumSize - if true the minimum sizes of components
should be used in order to compute a minimum size for the overall
layout. If false, the preferred sizes are used.parentWidth - the width of the parent container, in case we have
any container-based constraints.parentHeight - the height of the parent container, in case we have
any container-based constraints.
IllegalStateException - if called before a required attribute
has been computed, or if the component is underconstrained.
public void layoutComponent(int xOffset,
int yOffset)
xOffset - offset to be added to horizontal coordinates (for example
to account for container insets).yOffset - offset to be added to vertical coordinates (for example
to account for container insets).
IllegalStateException - if any required attributes have not been
computed.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||