|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--com.brunchboy.util.swing.relativelayout.DependencyManager
Keeps track of all dependencies that have been declared or
derived in setting up the component constraints in the
RelativeLayout, and can sort them in the proper order for resolution
when it's time to lay the components out.
| Field Summary | |
static String |
ROOT_NAME
The name of the special Component corresponding to the container in which the RelativeLayout is managing components. |
static String |
VERSION
Provides access to the CVS version of this class. |
| Constructor Summary | |
DependencyManager()
|
|
| Method Summary | |
void |
add(Attribute dependent,
Attribute anchor)
Records a dependency between attributes. |
List |
sort()
Returns the list of dependent attributes, sorted in the order in which they must be resolved. |
void |
validate()
Validates the set of dependencies by verifying that there are no cycles and that every dependency can be resolved. |
| 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
public static final String ROOT_NAME
RelativeLayout is managing components. Dependencies
associated with this component are allowed to be roots in the dependency
tree because its dimensions are known.
| Constructor Detail |
public DependencyManager()
| Method Detail |
public void add(Attribute dependent,
Attribute anchor)
throws IllegalStateException
dependent - the attribute which depends on another.anchor - the attribute whose value controls the dependent.
IllegalStateException - if there is already a dependency between
these attributes.public void validate()
IllegalStateException - if a cycle or unresolvable dependency
is detected.public List sort()
If the sort has already been performed, its cached result is returned. Otherwise, ensures that the graph is in a valid state (which, as a side effect, sets up the reference counts needed by the sort). Then recursively scans through resolved nodes, decrementing child reference counts. When a child's reference count reaches zero, that child is resolved; it is added to the List and its descendants are searched.
Attributes that need to be resolved, in
the order that they should be resolved.
IllegalStateException - if there is a cycle or otherwise invalid
dependency tree.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||