|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--com.brunchboy.util.swing.relativelayout.AttributeType
A typesafe enumeration of the types of attributes that can be associated
with components within a RelativeLayout. This class is immutable,
and thus may be safely shared without concern for threading behavior.
This is an abstract class; there is a concrete subclass for each defined attribute type. The concrete subclasses know how to derive their own value from other available attributes. This refinement is an illustration of how typesafe enumerations can grow into full-fledged, polymorphic tools.
| Field Summary | |
static AttributeType |
BOTTOM
Attribute type representing the bottom edge of a component. |
static AttributeType |
HEIGHT
Attribute type representing the height of a component. |
static AttributeType |
HORIZONTAL_CENTER
Attribute type representing the horizontal center of a component. |
static AttributeType |
LEFT
Attribute type representing the left edge of a component. |
static AttributeType |
RIGHT
Attribute type representing the right edge of a component. |
static AttributeType |
TOP
Attribute type representing the top edge of a component. |
static String |
VERSION
Provides access to the CVS version of this class. |
static AttributeType |
VERTICAL_CENTER
Attribute type representing the vertical center of a component. |
static AttributeType |
WIDTH
Attribute type representing the width of a component. |
| Constructor Summary | |
protected |
AttributeType(String name,
AttributeAxis axis)
Protected constructor prevents instantiation of this class. |
| Method Summary | |
abstract int |
deriveValue(ComponentSpecifications specs,
boolean minimumSize)
Compute the value of this attribute given other attributes from which it can be derived. |
static Set |
getAllTypes()
Return the set of all known attribute types. |
AttributeAxis |
getAxis()
Return the axis on which this attribute type is defined. |
static Set |
getAxisTypes(AttributeAxis axis)
Return the set of attribute types associated with an axis. |
static AttributeType |
getInstance(String name)
Static factory that looks up an attribute type by name. |
String |
getName()
Return name of this attribute type. |
String |
toString()
Provide a textual representation of the attribute type for debugging purposes. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static final String VERSION
public static final AttributeType LEFT
public static final AttributeType RIGHT
public static final AttributeType HORIZONTAL_CENTER
public static final AttributeType WIDTH
public static final AttributeType TOP
public static final AttributeType BOTTOM
public static final AttributeType VERTICAL_CENTER
public static final AttributeType HEIGHT
| Constructor Detail |
protected AttributeType(String name,
AttributeAxis axis)
name - the name of the attribute type to create.axis - the axis on which this attribute type is defined.
NullPointerException - if either parameter is null.| Method Detail |
public String getName()
public AttributeAxis getAxis()
public static AttributeType getInstance(String name)
name - the name of the desired attribute type.
NoSuchElementException - if the desired instance doesn't exist.
public abstract int deriveValue(ComponentSpecifications specs,
boolean minimumSize)
specs - source of other attributes for deriving this value.minimumSize - indicates whether, should we need to query the
component itself for sizing information, we should ask for
the minimum size as opposed to the preferred size.
IllegalStateException - if there are not enough values from which
to derive ours.public static Set getAllTypes()
public static Set getAxisTypes(AttributeAxis axis)
axis - the axis of interest.
null. Cannot be modified.public String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||