public final class ConstraintParser
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static BoundSize |
parseBoundSize(java.lang.String s,
boolean isGap,
boolean isHor)
Parses a single "min:pref:max" value.
|
static AC |
parseColumnConstraints(java.lang.String s)
Parses the column or rows constraints.
|
static CC |
parseComponentConstraint(java.lang.String s)
Parses one component constraint and returns the parsed value.
|
static java.util.Map<ComponentWrapper,CC> |
parseComponentConstraints(java.util.Map<ComponentWrapper,java.lang.String> constrMap)
Parses all component constraints and stores the parsed values in the transient (cache) member varables.
|
static UnitValue[] |
parseInsets(java.lang.String s,
boolean acceptPanel)
Parses insets which consists of 1-4
UnitValues. |
static LC |
parseLayoutConstraint(java.lang.String s)
Parses the layout constraints and stores the parsed values in the transient (cache) member varables.
|
static AC |
parseRowConstraints(java.lang.String s)
Parses the column or rows constraints.
|
static UnitValue |
parseUnitValue(java.lang.String s,
boolean isHor)
Parses a single unit value.
|
static UnitValue |
parseUnitValueOrAlign(java.lang.String s,
boolean isHor,
UnitValue emptyReplacement)
Parses a single unit value that may also be an alignment as parsed by
parseAlignKeywords(String, boolean). |
static java.lang.String |
prepare(java.lang.String s)
Makes
null "", trims and converts to lower case. |
public static LC parseLayoutConstraint(java.lang.String s)
s - The String to parse. Should not be null and must be lower case and trimmed.null.java.lang.RuntimeException - if the constaint was not valid.public static AC parseRowConstraints(java.lang.String s)
"[min:pref]rel[10px][]".s - The string to parse. Not null.DimConstraints that is as many are there exist "[...]" sections in the string that is parsed.java.lang.RuntimeException - if the constraint was not valid.public static AC parseColumnConstraints(java.lang.String s)
"[min:pref]rel[10px][]".s - The string to parse. Not null.DimConstraints that is as many are there exist "[...]" sections in the string that is parsed.java.lang.RuntimeException - if the constraint was not valid.public static java.util.Map<ComponentWrapper,CC> parseComponentConstraints(java.util.Map<ComponentWrapper,java.lang.String> constrMap)
constrMap - The constraints as Strings. Strings must be lower case and trimmednull.public static CC parseComponentConstraint(java.lang.String s)
s - The string to parse. Should not be null and must be lower case and trimmed.null.java.lang.RuntimeException - if the constaint was not valid.public static UnitValue[] parseInsets(java.lang.String s, boolean acceptPanel)
UnitValues.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 - If "panel" and "dialog" should be accepted. They are used to access platform defaults.java.lang.IllegalArgumentException - if the parsing could not be done.public static BoundSize parseBoundSize(java.lang.String s, boolean isGap, boolean isHor)
"10px:20lp:30%" or "pref!".s - The string to parse. Not null.isGap - If this bound size is a gap (different empty string handling).isHor - If the size is for the horizontal dimension.null if the string was "null", "n" or null.public static UnitValue parseUnitValueOrAlign(java.lang.String s, boolean isHor, UnitValue emptyReplacement)
parseAlignKeywords(String, boolean).s - The string to parse. Not null. May look something like "10px" or "5dlu".isHor - If the value is for the horizontal dimension.emptyReplacement - A replacement if s is empty. May be null.null.public static UnitValue parseUnitValue(java.lang.String s, boolean isHor)
s - The string to parse. Not null. May look something like "10px" or "5dlu".isHor - If the value is for the horizontal dimension.null is empty string,public static java.lang.String prepare(java.lang.String s)
null "", trims and converts to lower case.s - The string