org.jopendocument.dom.style.data
Class DataStyle
java.lang.Object
org.jopendocument.dom.ODNode
org.jopendocument.dom.Style
org.jopendocument.dom.style.data.DataStyle
- Direct Known Subclasses:
- BooleanStyle, CurrencyStyle, DateStyle, NumberStyle, PercentStyle, TextStyle, TimeStyle
public abstract class DataStyle
- extends Style
Method Summary |
static void |
addStringLiteral(StringBuilder formatSB,
String s)
|
boolean |
canFormat(Class<?> toFormat)
Whether instances of the passed class can be formatted . |
Object |
convert(Object o)
Convert the passed object to something that format(Object, CellStyle, boolean) can
accept. |
protected abstract Object |
convertNonNull(Object o)
|
abstract String |
format(Object o,
CellStyle defaultStyle,
boolean lenient)
|
protected String |
formatNumberOrScientificNumber(org.jdom.Element elem,
Number n,
CellStyle defaultStyle)
|
protected String |
formatNumberOrScientificNumber(org.jdom.Element elem,
Number n,
int multiplier,
CellStyle defaultStyle)
|
ODValueType |
getDataType()
|
static int |
getDecimalPlaces(CellStyle defaultStyle)
|
static
|
getDesc(Class<S> clazz,
XMLVersion version)
|
ODEpoch |
getEpoch()
|
TextStyle.StyleTextProperties |
getTextProperties()
|
String |
getTitle()
|
static void |
registerDesc()
|
protected static void |
reportError(String msg,
boolean lenient)
|
Methods inherited from class org.jopendocument.dom.Style |
checkElemName, dup, equals, getDesc, getFormattingProperties, getFormattingProperties, getFormattingProperties, getName, getNonNullStyleDesc, getNS, getPackage, getReferencedStyle, getReferencedStyleElement, getReferences, getSTYLE, getStyle, getStyleDesc, getStyleStyleDesc, hashCode, isReferencedAtMostOnce, isStandardStyleResolution, register, registerAllVersions, setStandardStyleResolution, warp |
DEFAULT_DECIMAL_PLACES
public static final int DEFAULT_DECIMAL_PLACES
- See Also:
- Constant Field Values
DATA_STYLES
public static final Set<Class<? extends DataStyle>> DATA_STYLES
DataStyle
protected DataStyle(ODPackage pkg,
org.jdom.Element elem,
ODValueType type)
getDecimalPlaces
public static int getDecimalPlaces(CellStyle defaultStyle)
addStringLiteral
public static void addStringLiteral(StringBuilder formatSB,
String s)
registerDesc
public static void registerDesc()
getDesc
public static <S extends DataStyle> DataStyle.DataStyleDesc<S> getDesc(Class<S> clazz,
XMLVersion version)
getDataType
public final ODValueType getDataType()
getEpoch
public final ODEpoch getEpoch()
convert
public final Object convert(Object o)
throws NullPointerException
- Convert the passed object to something that
format(Object, CellStyle, boolean)
can
accept.
- Parameters:
o
- the object to convert.
- Returns:
- an object that can be formatted,
null
if o
cannot be
converted.
- Throws:
NullPointerException
- if o
is null
.- See Also:
canFormat(Class)
convertNonNull
protected abstract Object convertNonNull(Object o)
canFormat
public final boolean canFormat(Class<?> toFormat)
- Whether instances of the passed class can be
formatted
.
- Parameters:
toFormat
- the class.
- Returns:
true
if instances of toFormat
can be formatted.
getTitle
public final String getTitle()
getTextProperties
public final TextStyle.StyleTextProperties getTextProperties()
format
public abstract String format(Object o,
CellStyle defaultStyle,
boolean lenient)
throws UnsupportedOperationException
- Throws:
UnsupportedOperationException
reportError
protected static final void reportError(String msg,
boolean lenient)
throws UnsupportedOperationException
- Throws:
UnsupportedOperationException
formatNumberOrScientificNumber
protected final String formatNumberOrScientificNumber(org.jdom.Element elem,
Number n,
CellStyle defaultStyle)
formatNumberOrScientificNumber
protected final String formatNumberOrScientificNumber(org.jdom.Element elem,
Number n,
int multiplier,
CellStyle defaultStyle)
Copyright © 2010 jOpenDocument All Rights Reserved.