Class NumericAdjustableColumnFormat
java.lang.Object
java.text.Format
com.illumon.iris.gui.table.format.AbstractAdjustableColumnFormat
com.illumon.iris.gui.table.format.NumericAdjustableColumnFormat
- All Implemented Interfaces:
AdjustableColumnFormat
,Workspace
,Serializable
,Cloneable
public class NumericAdjustableColumnFormat extends AbstractAdjustableColumnFormat
An adjustable column formatter for Numeric types.
- See Also:
- Serialized Form
-
Nested Class Summary
-
Constructor Summary
Constructors Constructor Description NumericAdjustableColumnFormat(Class<?> columnClass, int exponent, int decimals, String suffix, boolean showComma, com.fishlib.io.logger.Logger log)
Creates a custom format.NumericAdjustableColumnFormat(Class<?> columnClass, FormatType type, com.fishlib.io.logger.Logger log)
Creates a NumericAdjustableColumnFormat for a given column class and format type. -
Method Summary
Modifier and Type Method Description int
getDecimals()
int
getExponent()
FormatType
getFormatType()
Gets the current format type.protected Format
getProxy()
Implementing classes should provide a proxy formatter to do the actual formatting.String
getSuffix()
org.jdom2.Element
getWorkspaceInfo()
Serialize the class into an element to be stored in the workspaceboolean
isCompatible(Class<?> type)
Check if the specified type is compatible with the current formatter.boolean
isShowComma()
void
setCustom(int exponent, int decimals, String suffix, boolean showComma)
Sets a custom format.void
setDefaultFormat(Format format)
void
setDefaultFormatter(Format formatter)
Sets a default formatter to use whenFormatType.DEFAULT
is selectedvoid
setFormatType(FormatType type)
Sets the format type.void
setWorkspaceInfo(org.jdom2.Element workspaceInfo)
Restore the class to the state defined by the data persisted in workspaceInfoMethods inherited from class com.illumon.iris.gui.table.format.AbstractAdjustableColumnFormat
format, parseObject
-
Constructor Details
-
NumericAdjustableColumnFormat
public NumericAdjustableColumnFormat(Class<?> columnClass, FormatType type, com.fishlib.io.logger.Logger log)Creates a NumericAdjustableColumnFormat for a given column class and format type.- Parameters:
columnClass
- the column classtype
- the format typelog
- the logger
-
NumericAdjustableColumnFormat
public NumericAdjustableColumnFormat(Class<?> columnClass, int exponent, int decimals, String suffix, boolean showComma, com.fishlib.io.logger.Logger log)Creates a custom format. This will set the type to CUSTOM.- Parameters:
columnClass
- the column classexponent
- the exponent to use as a multiplier for shifting the numberdecimals
- the number of decimals to showsuffix
- a suffix to append to the end of the formatshowComma
- true to show a comma separating thousands, false otherwiselog
- the logger
-
-
Method Details
-
setCustom
Sets a custom format. This will set the type to CUSTOM.- Parameters:
exponent
- the exponent to use as a multiplier for shifting the numberdecimals
- the number of decimals to showsuffix
- a suffix to append to the end of the formatshowComma
- true to show a comma separating thousands, false otherwise
-
getExponent
public int getExponent() -
getDecimals
public int getDecimals() -
getSuffix
-
isShowComma
public boolean isShowComma() -
getFormatType
Description copied from interface:AdjustableColumnFormat
Gets the current format type.- Returns:
- the format type
-
setFormatType
Description copied from interface:AdjustableColumnFormat
Sets the format type. This causes the text to be formatted differently.- Parameters:
type
- the format type
-
setDefaultFormatter
Description copied from interface:AdjustableColumnFormat
Sets a default formatter to use whenFormatType.DEFAULT
is selected- Parameters:
formatter
- the new default formatter
-
getProxy
Description copied from class:AbstractAdjustableColumnFormat
Implementing classes should provide a proxy formatter to do the actual formatting.- Specified by:
getProxy
in classAbstractAdjustableColumnFormat
- Returns:
- a proxy formatter
-
setDefaultFormat
-
getWorkspaceInfo
public org.jdom2.Element getWorkspaceInfo()Description copied from interface:Workspace
Serialize the class into an element to be stored in the workspace- Returns:
- An
Element
containing the data to persist.
-
setWorkspaceInfo
public void setWorkspaceInfo(org.jdom2.Element workspaceInfo)Description copied from interface:Workspace
Restore the class to the state defined by the data persisted in workspaceInfo- Parameters:
workspaceInfo
- AnElement
containing the persisted state.
-
isCompatible
Description copied from interface:AdjustableColumnFormat
Check if the specified type is compatible with the current formatter.- Parameters:
type
- the type to check- Returns:
- true if it is compatible
-