Package com.jgoodies.forms.layout
Class ConstantSize.Unit
- java.lang.Object
-
- com.jgoodies.forms.layout.ConstantSize.Unit
-
- All Implemented Interfaces:
java.io.Serializable
- Enclosing class:
- ConstantSize
public static final class ConstantSize.Unit extends java.lang.Object implements java.io.Serializable
An ordinal-based serializable typesafe enumeration for units as used in instances ofConstantSize
.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.String
abbreviation
private java.lang.String
name
private static int
nextOrdinal
private int
ordinal
private java.lang.String
parseAbbreviation
(package private) boolean
requiresIntegers
-
Constructor Summary
Constructors Modifier Constructor Description private
Unit(java.lang.String name, java.lang.String abbreviation, java.lang.String parseAbbreviation, boolean requiresIntegers)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
abbreviation()
Returns the first character of this Unit's name.java.lang.String
encode()
Returns a parseable string representation of this unit.private java.lang.Object
readResolve()
java.lang.String
toString()
Returns a string representation of this unit object.(package private) static ConstantSize.Unit
valueOf(java.lang.String name, boolean horizontal)
Returns a Unit that corresponds to the specified string.
-
-
-
Field Detail
-
name
private final transient java.lang.String name
-
abbreviation
private final transient java.lang.String abbreviation
-
parseAbbreviation
private final transient java.lang.String parseAbbreviation
-
requiresIntegers
final transient boolean requiresIntegers
-
nextOrdinal
private static int nextOrdinal
-
ordinal
private final int ordinal
-
-
Method Detail
-
valueOf
static ConstantSize.Unit valueOf(java.lang.String name, boolean horizontal)
Returns a Unit that corresponds to the specified string.- Parameters:
name
- the encoded unit, trimmed and in lower casehorizontal
- true for a horizontal unit, false for vertical- Returns:
- the corresponding Unit
- Throws:
java.lang.IllegalArgumentException
- if no Unit exists for the string
-
toString
public java.lang.String toString()
Returns a string representation of this unit object. Note: This implementation may change at any time. It is intended for debugging purposes. For parsing, useencode()
instead.- Overrides:
toString
in classjava.lang.Object
- Returns:
- a string representation of the constant size
-
encode
public java.lang.String encode()
Returns a parseable string representation of this unit.- Returns:
- a String that can be parsed by the Forms parser
- Since:
- 1.2
-
abbreviation
public java.lang.String abbreviation()
Returns the first character of this Unit's name. Used to identify it in short format strings.- Returns:
- the first character of this Unit's name.
-
readResolve
private java.lang.Object readResolve()
-
-