|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.jgoodies.forms.layout.FormSpec
public abstract class FormSpec
An abstract class that specifies columns and rows in FormLayout
by their default alignment, start size and resizing behavior.
API users will use the subclasses ColumnSpec
and RowSpec
.
ColumnSpec
,
RowSpec
,
FormLayout
,
CellConstraints
,
Serialized FormNested Class Summary | |
---|---|
static class |
FormSpec.DefaultAlignment
An ordinal-based serializable typesafe enumeration for the column and row default alignment types. |
Field Summary | |
---|---|
(package private) static FormSpec.DefaultAlignment |
BOTTOM_ALIGN
By default put the components in the bottom. |
(package private) static FormSpec.DefaultAlignment |
CENTER_ALIGN
By default put the components in the center. |
static double |
DEFAULT_GROW
The default resize weight. |
private FormSpec.DefaultAlignment |
defaultAlignment
Holds the default alignment that will be used if a cell does not override this default. |
(package private) static FormSpec.DefaultAlignment |
FILL_ALIGN
By default fill the column or row. |
(package private) static FormSpec.DefaultAlignment |
LEFT_ALIGN
By default put components in the left. |
static double |
NO_GROW
Gives a column or row a fixed size. |
private double |
resizeWeight
Holds the resize weight; is 0 if not used. |
(package private) static FormSpec.DefaultAlignment |
RIGHT_ALIGN
By default put components in the right. |
private Size |
size
Holds the size that describes how to size this column or row. |
(package private) static FormSpec.DefaultAlignment |
TOP_ALIGN
By default put the components in the top. |
private static FormSpec.DefaultAlignment[] |
VALUES
An array of all enumeration values used to canonicalize deserialized default alignments. |
Constructor Summary | |
---|---|
protected |
FormSpec(FormSpec.DefaultAlignment defaultAlignment,
Size size,
double resizeWeight)
Constructs a FormSpec for the given default alignment,
size, and resize weight. |
protected |
FormSpec(FormSpec.DefaultAlignment defaultAlignment,
java.lang.String encodedDescription)
Constructs a FormSpec from the specified encoded
description. |
Method Summary | |
---|---|
(package private) boolean |
canGrow()
Checks and answers whether this spec can grow or not. |
private Size |
decodeAtomicSize(java.lang.String token)
Decodes and returns an atomic size that is either a constant size or a component size. |
private double |
decodeResize(java.lang.String token)
Decodes an encoded resize mode and resize weight and answers the resize weight. |
FormSpec.DefaultAlignment |
getDefaultAlignment()
Returns the default alignment. |
double |
getResizeWeight()
Returns the current resize weight. |
Size |
getSize()
Returns the size. |
(package private) abstract boolean |
isHorizontal()
Returns if this is a horizontal specification (vs. vertical). |
(package private) int |
maximumSize(java.awt.Container container,
java.util.List components,
FormLayout.Measure minMeasure,
FormLayout.Measure prefMeasure,
FormLayout.Measure defaultMeasure)
Computes the maximum size for the given list of components, using this form spec and the specified measure. |
private Size |
parseAndInitBoundedSize(java.lang.String token,
boolean setMax)
Parses an encoded compound size and sets the size fields. |
private void |
parseAndInitSize(java.lang.String token)
Parses an encoded size spec and initializes the size fields. |
private void |
parseAndInitValues(java.lang.String encodedDescription)
Parses an encoded form spec and initializes all required fields. |
java.lang.String |
toShortString()
Returns a string representation of this form specification. |
java.lang.String |
toString()
Returns a string representation of this form specification. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
static final FormSpec.DefaultAlignment LEFT_ALIGN
static final FormSpec.DefaultAlignment RIGHT_ALIGN
static final FormSpec.DefaultAlignment TOP_ALIGN
static final FormSpec.DefaultAlignment BOTTOM_ALIGN
static final FormSpec.DefaultAlignment CENTER_ALIGN
static final FormSpec.DefaultAlignment FILL_ALIGN
private static final FormSpec.DefaultAlignment[] VALUES
public static final double NO_GROW
public static final double DEFAULT_GROW
private FormSpec.DefaultAlignment defaultAlignment
private Size size
private double resizeWeight
Constructor Detail |
---|
protected FormSpec(FormSpec.DefaultAlignment defaultAlignment, Size size, double resizeWeight)
FormSpec
for the given default alignment,
size, and resize weight. The resize weight must be a non-negative
double; you can use NONE
as a convenience value for no
resize.
defaultAlignment
- the spec's default alignmentsize
- a constant, component or bounded sizeresizeWeight
- the spec resize weight
java.lang.IllegalArgumentException
- if the resize weight is negativeprotected FormSpec(FormSpec.DefaultAlignment defaultAlignment, java.lang.String encodedDescription)
FormSpec
from the specified encoded
description. The description will be parsed to set initial values.
defaultAlignment
- the default alignmentencodedDescription
- the encoded descriptionMethod Detail |
---|
public final FormSpec.DefaultAlignment getDefaultAlignment()
public final Size getSize()
public final double getResizeWeight()
final boolean canGrow()
NO_GROW
.
private void parseAndInitValues(java.lang.String encodedDescription)
encodedDescription
- the FormSpec in an encoded format
java.lang.IllegalArgumentException
- if the string is empty, has no size,
or is otherwise invalidprivate void parseAndInitSize(java.lang.String token)
token
- a token that represents a size, either bounded or plainprivate Size parseAndInitBoundedSize(java.lang.String token, boolean setMax)
token
- a token for a bounded size, e.g. "max(50dlu; pref)"setMax
- if true we set a maximum size, otherwise a minimum size
private Size decodeAtomicSize(java.lang.String token)
token
- the encoded size
private double decodeResize(java.lang.String token)
token
- the encoded resize weight
java.lang.IllegalArgumentException
- if the string description is an
invalid string representationpublic final java.lang.String toString()
This method does not return a decoded version of this object; the contrary is the case. Many instances will return a string that cannot be parsed.
Note: The string representation may change at any time. It is strongly recommended to not use this string for parsing purposes.
toString
in class java.lang.Object
public final java.lang.String toShortString()
This method does not return a decoded version of this object; the contrary is the case. Many instances will return a string that cannot be parsed.
Note: The string representation may change at any time. It is strongly recommended to not use this string for parsing purposes.
abstract boolean isHorizontal()
final int maximumSize(java.awt.Container container, java.util.List components, FormLayout.Measure minMeasure, FormLayout.Measure prefMeasure, FormLayout.Measure defaultMeasure)
Invoked by FormLayout to determine the size of one of my elements
container
- the layout containercomponents
- the list of components to measureminMeasure
- the measure used to determine the minimum sizeprefMeasure
- the measure used to determine the preferred sizedefaultMeasure
- the measure used to determine the default size
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |