Each format part can contain a color, a condition, and will always contain a
format specification. For example "[Red][>=10]#" has a color
([Red]), a condition (>=10) and a format specification
(#).
This class also contains patterns for matching the subparts of format specification. These are used internally, but are made public in case other code has use for them.
| Modifier and Type | Class and Description |
|---|---|
| pack-priv static interface |
| Modifier and Type | Field and Description |
|---|---|
| private final Color | |
| public static final int | COLOR_GROUP
Within |
| public static final Pattern | COLOR_PAT
Pattern for the color part of a cell format part. |
| private final CellFormatCondition | |
| public static final int | CONDITION_OPERATOR_GROUP
Within |
| public static final Pattern | CONDITION_PAT
Pattern for the condition part of a cell format part. |
| public static final int | CONDITION_VALUE_GROUP
Within |
| public static final Pattern | CURRENCY_PAT
Pattern for the currency symbol part of a cell format part |
| private final CellFormatter | |
| public static final Pattern | FORMAT_PAT
Pattern for an entire cell single part. |
| private static final Logger | |
| pack-priv static final Map | |
| public static final int | SPECIFICATION_GROUP
Within |
| public static final Pattern | SPECIFICATION_PAT
Pattern for the format specification part of a cell format part. |
| private final CellFormatType |
| Access | Constructor and Description |
|---|---|
| public | |
| public | CellFormatPart(Locale
The locale to use. locale, String The string to parse. desc)Create an object to represent a format part. |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | |
| public CellFormatResult | Returns: ACellFormatResult object containing the results of
applying the format to the value.The value to apply this format part to. value)Apply this format part to the given value. |
| public CellFormatResult | |
| pack-priv static String | Returns: The character repeated three times.The character to be repeated is the second character in this
string. part)Expands a character. |
| private static int | |
| private CellFormatType | Returns: The type of format.The format specification fdesc)Returns the type of format. |
| private CellFormatType | Returns: The CellFormatType.The matcher for the format part. matcher)Returns the CellFormatType object implied by the format specification for the format part. |
| pack-priv CellFormatType | Returns: The CellFormatType.Returns the CellFormatType object implied by the format specification for the format part. |
| private static Color | |
| private CellFormatCondition | Returns: The condition specification ornull.The matcher for the format part. m)Returns the condition specification from the matcher, or |
| private CellFormatter | Returns: The formatter.The matcher for the format part. matcher)Returns the formatter object implied by the format specification for the format part. |
| public static String | |
| pack-priv boolean | Returns: true if this format part has a condition.Returns |
| public static StringBuffer | |
| pack-priv static String | Returns: A version of the string with any special characters replaced.The original string. repl, CellFormatType The format type representation object. type)Returns a version of the original string that has any special characters quoted (or escaped) as appropriate for the cell format type. |
| public String |
| color | back to summary |
|---|---|
| private final Color color | |
| COLOR_GROUP | back to summary |
|---|---|
| public static final int COLOR_GROUP Within | |
| COLOR_PAT | back to summary |
|---|---|
| public static final Pattern COLOR_PAT Pattern for the color part of a cell format part. | |
| condition | back to summary |
|---|---|
| private final CellFormatCondition condition | |
| CONDITION_OPERATOR_GROUP | back to summary |
|---|---|
| public static final int CONDITION_OPERATOR_GROUP Within | |
| CONDITION_PAT | back to summary |
|---|---|
| public static final Pattern CONDITION_PAT Pattern for the condition part of a cell format part. | |
| CONDITION_VALUE_GROUP | back to summary |
|---|---|
| public static final int CONDITION_VALUE_GROUP Within | |
| CURRENCY_PAT | back to summary |
|---|---|
| public static final Pattern CURRENCY_PAT Pattern for the currency symbol part of a cell format part | |
| format | back to summary |
|---|---|
| private final CellFormatter format | |
| FORMAT_PAT | back to summary |
|---|---|
| public static final Pattern FORMAT_PAT Pattern for an entire cell single part. | |
| LOG | back to summary |
|---|---|
| private static final Logger LOG | |
| NAMED_COLORS | back to summary |
|---|---|
| pack-priv static final Map<String, Color> NAMED_COLORS | |
| SPECIFICATION_GROUP | back to summary |
|---|---|
| public static final int SPECIFICATION_GROUP Within | |
| SPECIFICATION_PAT | back to summary |
|---|---|
| public static final Pattern SPECIFICATION_PAT Pattern for the format specification part of a cell format part. | |
| type | back to summary |
|---|---|
| private final CellFormatType type | |
| CellFormatPart | back to summary |
|---|---|
| public CellFormatPart(String desc) Create an object to represent a format part.
| |
| CellFormatPart | back to summary |
|---|---|
| public CellFormatPart(Locale locale, String desc) Create an object to represent a format part. | |
| applies | back to summary |
|---|---|
| public boolean applies(Object valueObject) Returns
| |
| apply | back to summary |
|---|---|
| public CellFormatResult apply(Object value) Apply this format part to the given value. This returns a
| |
| apply | back to summary |
|---|---|
| public CellFormatResult apply(JLabel label, Object value) Apply this format part to the given value, applying the result to the given label.
| |
| expandChar | back to summary |
|---|---|
| pack-priv static String expandChar(String part) Expands a character. This is only partly done, because we don't have the correct info. In Excel, this would be expanded to fill the rest of the cell, but we don't know, in general, what the "rest of the cell" is. | |
| findGroup | back to summary |
|---|---|
| private static int findGroup(Pattern pat, String str, String marker) Returns the number of the first group that is the same as the marker string. Starts from group 1.
| |
| formatType | back to summary |
|---|---|
| private CellFormatType formatType(String fdesc) Returns the type of format.
| |
| getCellFormatType | back to summary |
|---|---|
| private CellFormatType getCellFormatType(Matcher matcher) Returns the CellFormatType object implied by the format specification for the format part.
| |
| getCellFormatType | back to summary |
|---|---|
| pack-priv CellFormatType getCellFormatType() Returns the CellFormatType object implied by the format specification for the format part.
| |
| getColor | back to summary |
|---|---|
| private static Color getColor(Matcher m) Returns the color specification from the matcher, or | |
| getCondition | back to summary |
|---|---|
| private CellFormatCondition getCondition(Matcher m) Returns the condition specification from the matcher, or
| |
| getFormatter | back to summary |
|---|---|
| private CellFormatter getFormatter(Locale locale, Matcher matcher) Returns the formatter object implied by the format specification for the format part.
| |
| group | back to summary |
|---|---|
| public static String group(Matcher m, int g) Returns the string from the group, or | |
| hasCondition | back to summary |
|---|---|
| pack-priv boolean hasCondition() Returns
| |
| parseFormat | back to summary |
|---|---|
| public static StringBuffer parseFormat(String fdesc, CellFormatType type, CellFormatPart. | |
| quoteSpecial | back to summary |
|---|---|
| pack-priv static String quoteSpecial(String repl, CellFormatType type) Returns a version of the original string that has any special characters quoted (or escaped) as appropriate for the cell format type. The format type object is queried to see what is special.
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object.
Satisfying this method's contract implies a non-
| |
| Modifier and Type | Method and Description |
|---|---|
| public String |
| handlePart | back to summary |
|---|---|
| public String handlePart(Matcher m, String part, CellFormatType type, StringBuffer desc) | |