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
  • 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 class
      type - the format type
      log - 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 class
      exponent - the exponent to use as a multiplier for shifting the number
      decimals - the number of decimals to show
      suffix - a suffix to append to the end of the format
      showComma - true to show a comma separating thousands, false otherwise
      log - the logger
  • Method Details

    • setCustom

      public void setCustom​(int exponent, int decimals, String suffix, boolean showComma)
      Sets a custom format. This will set the type to CUSTOM.
      Parameters:
      exponent - the exponent to use as a multiplier for shifting the number
      decimals - the number of decimals to show
      suffix - a suffix to append to the end of the format
      showComma - true to show a comma separating thousands, false otherwise
    • getExponent

      public int getExponent()
    • getDecimals

      public int getDecimals()
    • getSuffix

      public String getSuffix()
    • isShowComma

      public boolean isShowComma()
    • getFormatType

      public FormatType getFormatType()
      Description copied from interface: AdjustableColumnFormat
      Gets the current format type.
      Returns:
      the format type
    • setFormatType

      public void setFormatType​(FormatType type)
      Description copied from interface: AdjustableColumnFormat
      Sets the format type. This causes the text to be formatted differently.
      Parameters:
      type - the format type
    • setDefaultFormatter

      public void setDefaultFormatter​(Format formatter)
      Description copied from interface: AdjustableColumnFormat
      Sets a default formatter to use when FormatType.DEFAULT is selected
      Parameters:
      formatter - the new default formatter
    • getProxy

      protected Format getProxy()
      Description copied from class: AbstractAdjustableColumnFormat
      Implementing classes should provide a proxy formatter to do the actual formatting.
      Specified by:
      getProxy in class AbstractAdjustableColumnFormat
      Returns:
      a proxy formatter
    • setDefaultFormat

      public void setDefaultFormat​(Format format)
    • 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 - An Element containing the persisted state.
    • isCompatible

      public boolean isCompatible​(Class<?> type)
      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