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
An adjustable column formatter for Numeric types.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.text.Format
Format.Field -
Constructor Summary
ConstructorsConstructorDescriptionNumericAdjustableColumnFormat(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 TypeMethodDescriptionintintGets the current format type.protected FormatgetProxy()Implementing classes should provide a proxy formatter to do the actual formatting.org.jdom2.ElementSerialize the class into an element to be stored in the workspacebooleanisCompatible(Class<?> type) Check if the specified type is compatible with the current formatter.booleanvoidSets 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, parseObjectMethods inherited from class java.text.Format
clone, format, formatToCharacterIterator, parseObjectMethods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.illumon.iris.gui.workspace.Workspace
isGlobalSetting
-
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
-