Class ConstraintParser
-
Method Summary
Modifier and TypeMethodDescriptionstatic BoundSizeparseBoundSize(String s, boolean isGap, boolean isHor) Parses a single "min:pref:max" value.static ACParses the column or rows constraints.static CCParses one component constraint and returns the parsed value.static Map<ComponentWrapper, CC> parseComponentConstraints(Map<ComponentWrapper, String> constrMap) Parses all component constraints and stores the parsed values in the transient (cache) member variables.static UnitValue[]parseInsets(String s, boolean acceptPanel) Parses insets which consists of 1-4UnitValues.static LCParses the layout constraints and stores the parsed values in the transient (cache) member varables.static ACParses the column or rows constraints.static UnitValueparseUnitValue(String s, boolean isHor) Parses a single unit value.static UnitValueparseUnitValueOrAlign(String s, boolean isHor, UnitValue emptyReplacement) Parses a single unit value that may also be an alignment as parsed byboolean).static StringMakesnull"", trims and converts to lower case.Methods inherited from class Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitModifier and TypeMethodDescriptionprotected Objectclone()booleanIndicates whether some other object is "equal to" this one.final ClassgetClass()Returns the runtime class of an object.inthashCode()Returns a hash code value for the object.final voidnotify()Wakes up a single thread that is waiting on this object's monitor.final voidWakes up all threads that are waiting on this object's monitor.toString()Returns a string representation of the object.final voidwait()Causes current thread to wait until another thread invokes the method or the method for this object.final voidwait(long timeout) Causes current thread to wait until either another thread invokes the method or the method for this object, or a specified amount of time has elapsed.final voidwait(long timeout, int nanos) Causes current thread to wait until another thread invokes the method or the method for this object, or some other thread interrupts the current thread, or a certain amount of real time has elapsed.
-
Method Details
-
parseLayoutConstraint
Parses the layout constraints and stores the parsed values in the transient (cache) member varables.
Parameters
s: @param s The String to parse. Should not benulland must be lower case and trimmed.
Returns
The parsed constraint. Never
null.Throws
RuntimeException: if the constaint was not valid.
-
parseRowConstraints
Parses the column or rows constraints. They normally looks something like
"[min:pref]rel[10px][]".Parameters
s: The string to parse. Notnull.
Returns
- Returns:
An array of
DimConstraints that is as many are there exist "[...]" sections in the string that is parsed.Throws
RuntimeException: if the constraint was not valid.
-
parseColumnConstraints
Parses the column or rows constraints. They normally looks something like
"[min:pref]rel[10px][]".Parameters
s: The string to parse. Notnull.
Returns
- Returns:
An array of
DimConstraints that is as many are there exist "[...]" sections in the string that is parsed.Throws
RuntimeException: if the constraint was not valid.
-
parseComponentConstraints
public static Map<ComponentWrapper, CC> parseComponentConstraints(Map<ComponentWrapper, String> constrMap) Parses all component constraints and stores the parsed values in the transient (cache) member variables.
Parameters
constrMap: @param constrMap The constraints asStrings. Strings must be lower case and trimmed
Returns
The parsed constraints. Never
null. -
parseComponentConstraint
Parses one component constraint and returns the parsed value.
Parameters
s: @param s The string to parse. Should not benulland must be lower case and trimmed.
Returns
The parsed constraint. Never
null.Throws
RuntimeException: if the constraint was not valid.
-
parseInsets
Parses insets which consists of 1-4
UnitValues.Parameters
-
s: @param s The string to parse. E.g. "10 10 10 10" or "20". If less than 4 groups the last will be used for the missing. -
acceptPanel: @param acceptPanel If "panel" and "dialog" should be accepted. They are used to access platform defaults.
Returns
An array of length 4 with the parsed insets.
Throws
IllegalArgumentException: if the parsing could not be done.
-
-
parseBoundSize
Parses a single "min:pref:max" value. May look something like
"10px:20lp:30%"or"pref!".Parameters
-
s: The string to parse. Notnull. -
isGap: @param isGap If this bound size is a gap (different empty string handling). -
isHor: If the size is for the horizontal dimension.
Returns
- Returns:
- A bound size that may be
nullif the string was "null", "n" ornull.
-
-
parseUnitValueOrAlign
Parses a single unit value that may also be an alignment as parsed by
boolean).Parameters
-
s: @param s The string to parse. Notnull. May look something like"10px"or"5dlu". -
isHor: If the value is for the horizontal dimension. -
emptyReplacement: @param emptyReplacement A replacement ifsis empty. May benull.
Returns
The parsed unit value. May be
null. -
-
parseUnitValue
Parses a single unit value. E.g. "10px" or "5in"
Parameters
-
s: @param s The string to parse. Notnull. May look something like"10px"or"5dlu". -
isHor: If the value is for the horizontal dimension.
Returns
The parsed unit value.
nullis empty string, -
-
prepare
-