Class DataStyleElement

All Implemented Interfaces:
Serializable, Cloneable, Element, ElementTraversal, EventTarget, Node, NodeList, TypeInfo
Direct Known Subclasses:
NumberDataStyleElementBase

public abstract class DataStyleElement extends OdfElement
interface of styles that represent the different number formats that are referenced from styles/auto styles with the data-style-name attribute
See Also:
  • Method Details

    • getMapping

      protected String getMapping(StyleMapElement mapElement)
    • getColorFromElement

      public String getColorFromElement(StyleTextPropertiesElement e)
      converts a color attribute to a color token of a number format string
      Parameters:
      e -
      Returns:
      the resulting color token
    • getColorElement

      protected static String getColorElement(String colorToken)
      Parameters:
      colorToken - color name used in number format
      Returns:
      resulting color value or empty string
    • tokenize

      protected static List<DataStyleElement.StringToken> tokenize(String format, DataStyleElement.NumberFormatType type)
      creates tokens from a number format
      Parameters:
      format -
      Returns:
      tokens to be converted to OdfElements

      TODO: at first only detecting currencies -

    • emitTokens

      protected void emitTokens(List<DataStyleElement.StringToken> tokens, DataStyleElement.NumberFormatType type)
    • emitCurrency

      protected void emitCurrency(String currencyToken)
    • emitColor

      protected void emitColor(String colorToken)
    • emitNumber

      protected void emitNumber(String numberToken, boolean forceCreateDecimalPlaces)
    • emitText

      protected void emitText(String textBuffer)
      Place pending text into a <number:text> element.
      Parameters:
      textBuffer - pending text
    • getNumberFormat

      public String getNumberFormat()
    • getFormat

      public abstract String getFormat(boolean caps)
      Get the format string that represents this style.
      Parameters:
      caps - use capitals
      Returns:
      the format string
    • getFormat

      public String getFormat()
      Get the format string that represents this style. Uses capitals by default
      Returns:
      the format string
    • setFormat

      public abstract void setFormat(String format)
      Get the format string that represents this style.
      Parameters:
      format - the format string