Class Style

  • All Implemented Interfaces:
    Comparable<AbstractStyle>

    public class Style
    extends AbstractStyle
    Class representing a style which consists of several components
    Author:
    Raphael Stoeckli
    • Constructor Detail

      • Style

        public Style()
        Default constructor
      • Style

        public Style​(String name)
        Constructor with parameters
        Parameters:
        name - Name of the style
      • Style

        public Style​(String name,
                     int forcedOrder,
                     boolean internal)
        Constructor with parameters (internal use)
        Parameters:
        name - Name of the style
        forcedOrder - Number of the style for sorting purpose. Style will be placed to this position (internal use only)
        internal - If true, the style is marked as internal
    • Method Detail

      • getBorder

        public Border getBorder()
        Gets the border component of the style
        Returns:
        Border of the style
      • getCellXf

        public CellXf getCellXf()
        Gets the cellXf component of the style
        Returns:
        CellXf of the style
      • getFill

        public Fill getFill()
        Gets the fill component of the style
        Returns:
        Fill of the style
      • getFont

        public Font getFont()
        Gets the font component of the style
        Returns:
        Font of the style
      • getNumberFormat

        public NumberFormat getNumberFormat()
        Gets the number format component of the style
        Returns:
        Number format of the style
      • setBorder

        public void setBorder​(Border borderRef)
        Sets the border component of the style
        Parameters:
        borderRef - Border of the style
      • setCellXf

        public void setCellXf​(CellXf cellXfRef)
        Sets the cellXf component of the style
        Parameters:
        cellXfRef - CellXf of the style
      • setFill

        public void setFill​(Fill fillRef)
        Sets the fill component of the style
        Parameters:
        fillRef - Fill of the style
      • setFont

        public void setFont​(Font fontRef)
        Sets the font component of the style
        Parameters:
        fontRef - Font of the style
      • setNumberFormat

        public void setNumberFormat​(NumberFormat numberFormatRef)
        Sets the number format component of the style
        Parameters:
        numberFormatRef - Number format of the style
      • setStyleManagerReference

        public void setStyleManagerReference​(StyleManager styleManagerReference)
        Sets the reference of the style manager
        Parameters:
        styleManagerReference - Reference to the corresponding style manager object
      • getName

        public String getName()
        Gets the name of the style.
        Returns:
        Name
      • setName

        public void setName​(String name)
        Sets the name of the style. If not defined, the automatically calculated hash will be used as name
        Parameters:
        name - Name
      • isInternalStyle

        public boolean isInternalStyle()
        Gets whether the style is system internal
        Returns:
        If true, the style is an internal style. Such styles are not meant to be altered
      • append

        public Style append​(AbstractStyle styleToAppend)
        Appends the specified style parts to the current one. The parts can be instances of sub-classes like Border or CellXf or a Style instance. Only the altered properties of the specified style or style part that differs from a new / untouched style instance will be appended. This enables method chaining
        Parameters:
        styleToAppend - The style to append or a sub-class of Style
        Returns:
        Current style with appended style parts
      • toString

        public String toString()
        Override toString method
        Overrides:
        toString in class Object
        Returns:
        String of a class instance
      • hashCode

        public int hashCode()
        Override method to calculate the hash of this component
        Overrides:
        hashCode in class Object
        Returns:
        Calculated hash as string
      • copy

        public AbstractStyle copy()
        Method to copy the current object to a new one
        Specified by:
        copy in class AbstractStyle
        Returns:
        Copy of the current object without the internal ID
      • copyStyle

        public Style copyStyle()
        Copies the current object as casted style
        Returns:
        Copy of the current object without the internal ID