public class CellFormat extends Object
#GENERAL_FORMAT
object.
TODO Merge this with DataFormatter
so we only have one set of
code for formatting numbers.Constructor and Description |
---|
CellFormat(String format)
Creates a new object.
|
Modifier and Type | Method and Description |
---|---|
CellFormatResult |
apply(Cell c)
Fetches the appropriate value from the cell, and returns the result of
applying it to the appropriate format.
|
CellFormatResult |
apply(JLabel label,
Cell c)
Fetches the appropriate value from the cell, and uses the result, setting
the text and color of a label before returning the result.
|
CellFormatResult |
apply(JLabel label,
Object value,
int cellWidth)
Uses the result of applying this format to the value, setting the text
and color of a label before returning the result.
|
CellFormatResult |
apply(Object value,
int cellWidth)
Returns the result of applying the format to the given value.
|
boolean |
equals(Object obj)
Returns true if the other object is a
CellFormat object
with the same format. |
static CellFormat |
getGeneralFormat(Locale locale) |
static CellFormat |
getInstance(String format,
Locale locale)
Returns a
CellFormat that applies the given format. |
int |
hashCode()
Returns a hash code for the format.
|
boolean |
isApplicableDateFormat(Double value) |
static int |
ultimateType(Cell cell)
Returns the ultimate cell type, following the results of formulas.
|
public CellFormat(String format)
format
- The format.public static final CellFormat getGeneralFormat(Locale locale)
public static CellFormat getInstance(String format, Locale locale)
CellFormat
that applies the given format. Two calls
with the same format may or may not return the same object.format
- The format.CellFormat
that applies the given format.public CellFormatResult apply(Object value, int cellWidth)
Number
object), the correct number
format type is chosen; otherwise it is considered a text object.value
- The valueCellFormatResult
.public CellFormatResult apply(Cell c)
c
- The cell.CellFormatResult
.public boolean isApplicableDateFormat(Double value)
public CellFormatResult apply(JLabel label, Object value, int cellWidth)
label
- The label to apply to.value
- The value to process.CellFormatResult
.public CellFormatResult apply(JLabel label, Cell c)
label
- The label to apply to.c
- The cell.CellFormatResult
.public static int ultimateType(Cell cell)
Cell.CELL_TYPE_FORMULA
, this returns the result of
Cell.getCachedFormulaResultType()
. Otherwise this returns the
result of Cell.getCellType()
.cell
- The cell.public boolean equals(Object obj)
CellFormat
object
with the same format.Copyright © 2020. All rights reserved.