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 intgetDecimals()intgetExponent()FormatTypegetFormatType()Gets the current format type.protected FormatgetProxy()Implementing classes should provide a proxy formatter to do the actual formatting.StringgetSuffix()org.jdom2.ElementgetWorkspaceInfo()Serialize the class into an element to be stored in the workspacebooleanisCompatible(Class<?> type)Check if the specified type is compatible with the current formatter.booleanisShowComma()voidsetCustom(int exponent, int decimals, String suffix, boolean showComma)Sets a custom format.voidsetDefaultFormat(Format format)voidsetDefaultFormatter(Format formatter)Sets a default formatter to use whenFormatType.DEFAULTis selectedvoidsetFormatType(FormatType type)Sets the format type.voidsetWorkspaceInfo(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:AdjustableColumnFormatGets the current format type.- Returns:
- the format type
-
setFormatType
Description copied from interface:AdjustableColumnFormatSets the format type. This causes the text to be formatted differently.- Parameters:
type- the format type
-
setDefaultFormatter
Description copied from interface:AdjustableColumnFormatSets a default formatter to use whenFormatType.DEFAULTis selected- Parameters:
formatter- the new default formatter
-
getProxy
Description copied from class:AbstractAdjustableColumnFormatImplementing classes should provide a proxy formatter to do the actual formatting.- Specified by:
getProxyin classAbstractAdjustableColumnFormat- Returns:
- a proxy formatter
-
setDefaultFormat
-
getWorkspaceInfo
public org.jdom2.Element getWorkspaceInfo()Description copied from interface:WorkspaceSerialize the class into an element to be stored in the workspace- Returns:
- An
Elementcontaining the data to persist.
-
setWorkspaceInfo
public void setWorkspaceInfo(org.jdom2.Element workspaceInfo)Description copied from interface:WorkspaceRestore the class to the state defined by the data persisted in workspaceInfo- Parameters:
workspaceInfo- AnElementcontaining the persisted state.
-
isCompatible
Description copied from interface:AdjustableColumnFormatCheck if the specified type is compatible with the current formatter.- Parameters:
type- the type to check- Returns:
- true if it is compatible
-