Class Styles

All Implemented Interfaces:
EventListener, IFontConsumer, IGProp<GProp<?>[]>, IPropCnr, Cloneable
Direct Known Subclasses:
EditorStyles

public class Styles extends AbstractStyles implements IFontConsumer
This styles property container holds the styles associated with a UI component. It is extendable on the server- and editor side. The API is common to all components, but each component only supports a subset of the styles. To see what styles can be set for a component, see its Style setting.
  • Field Details

    • SUBNAMES_LOCATION

      protected static final String[] SUBNAMES_LOCATION
      CSS variables.
    • SUBNAMES_CORNER

      protected static final String[] SUBNAMES_CORNER
    • TEXT_ALIGNS

      protected static final String[] TEXT_ALIGNS
    • TEXT_DECORATIONS

      protected static final String[] TEXT_DECORATIONS
    • TEXT_TRANSFORMS

      protected static final String[] TEXT_TRANSFORMS
    • WORD_BREAKS

      protected static final String[] WORD_BREAKS
    • LINE_STYLES

      protected static final String[] LINE_STYLES
    • BACKGROUND_BOX

      protected static final String[] BACKGROUND_BOX
    • BACKGROUND_REPEAT

      protected static final String[] BACKGROUND_REPEAT
    • BACKGROUND_SCROLL

      protected static final String[] BACKGROUND_SCROLL
    • LIST_TYPES

      protected static final String[] LIST_TYPES
    • LIST_POSITIONS

      protected static final String[] LIST_POSITIONS
    • BOX_SIZINGS

      protected static final String[] BOX_SIZINGS
    • FONT_WEIGHTS

      protected static final String[] FONT_WEIGHTS
    • FONT_STYLES

      protected static final String[] FONT_STYLES
    • EMPTY

      public static final Styles[] EMPTY
      Empty array of styles.
  • Constructor Details

    • Styles

      protected Styles()
      Creates the styles property container without a name. The name must be set in all cases using the setPropertyAtom call.
    • Styles

      public Styles(Atom propertyAtom)
      Creates the styles property container with the specified name. All system-reserved names for components begins with "$".
      Parameters:
      propertyAtom - the name of the component, unique within it's parent.
  • Method Details

    • getExtendsPossibleClasses

      public Class<?>[] getExtendsPossibleClasses()
      Gets the possible classes this container supports for the Extends Framework. The default implementation is to return null.
      Specified by:
      getExtendsPossibleClasses in interface IPropCnr
      Overrides:
      getExtendsPossibleClasses in class PropCnr
      Returns:
      List of supported classes, or null for none.
    • appendPropValue

      protected void appendPropValue(PropMgr propertyManager, SendTransaction trans, Object value)
      Overrides the append property value to transaction to check for font face(s) installation.
      Overrides:
      appendPropValue in class PropCnr
      Parameters:
      propertyManager - the property manager instance.
      trans - transaction to append the properties to.
      value - the value to append to the transaction, a reference to the current property value.
    • getFontFamily

      public String getFontFamily()
      Gets the font family set.
      Returns:
      The font family, possibly comma separated, or null for none.
    • getFontStyle

      public String getFontStyle()
      Gets the font style set.
      Returns:
      The style, or null if undefined.
    • getFontWeight

      public String getFontWeight()
      Gets the font weight set.
      Returns:
      The weight, or null if undefined.
    • collectConsumedFonts

      public void collectConsumedFonts(Set<FontConsumed> fonts)
      Collects the consumed fonts.
      Specified by:
      collectConsumedFonts in interface IFontConsumer
      Parameters:
      fonts - The set of consumed fonts is filled in by this method.
    • isStateStyles

      public boolean isStateStyles()
      Returns if this styles instance is a state style, i.e. it's parent is a Styles container.
    • getMainStyles

      public Styles getMainStyles()
      Returns the main (parent) styles.
      Returns:
      The main styles instance. This is the same instance in case it's not a state-styles instance.
    • getStateMask

      public int getStateMask()
      Gets the defined style bit mask value.
      Returns:
      The style bit mask value, or -1 if not a state styles instance or bit mask not defined.
    • getBackgroundColor

      public GColor getBackgroundColor()
      Returns the background color.
      Returns:
      The color, or null for none.
    • setBackgroundColor

      public boolean setBackgroundColor(GColor color)
      Sets the background color.
      Parameters:
      color - The color, or null to remove it.
      Returns:
      true for changed, false for no change.
    • getBackgroundGradient

      public GGradient getBackgroundGradient()
      Returns the background gradient.
      Returns:
      The gradient, or null for none.
    • setBackgroundGradient

      public boolean setBackgroundGradient(GGradient gradient)
      Sets the background gradient.
      Parameters:
      gradient - The gradient, or null to remove it.
      Returns:
      true for changed, false for no change.
    • getColor

      public GColor getColor()
      Returns the text color.
      Returns:
      The color, or null for none.
    • setColor

      public boolean setColor(GColor color)
      Sets the text color.
      Parameters:
      color - The color, or null to remove it.
      Returns:
      true for changed, false for no change.
    • getBackgroundImage

      public IImageTarget getBackgroundImage()
      Gets the background image.
      Returns:
      An image, null for none.
    • setBackgroundImage

      public boolean setBackgroundImage(IImageTarget image)
      Sets the background image.
      Parameters:
      image - The image, null for none.
      Returns:
      true for changed, false for no change.