Class Styles

  • All Implemented Interfaces:
    EventListener, IFontConsumer, IGProp<GProp<?>[]>, IPropCnr, java.lang.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 Detail

      • SUBNAMES_LOCATION

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

        protected static final java.lang.String[] SUBNAMES_CORNER
      • TEXT_ALIGNS

        protected static final java.lang.String[] TEXT_ALIGNS
      • TEXT_DECORATIONS

        protected static final java.lang.String[] TEXT_DECORATIONS
      • TEXT_TRANSFORMS

        protected static final java.lang.String[] TEXT_TRANSFORMS
      • WORD_BREAKS

        protected static final java.lang.String[] WORD_BREAKS
      • LINE_STYLES

        protected static final java.lang.String[] LINE_STYLES
      • BACKGROUND_BOX

        protected static final java.lang.String[] BACKGROUND_BOX
      • BACKGROUND_REPEAT

        protected static final java.lang.String[] BACKGROUND_REPEAT
      • BACKGROUND_SCROLL

        protected static final java.lang.String[] BACKGROUND_SCROLL
      • LIST_TYPES

        protected static final java.lang.String[] LIST_TYPES
      • LIST_POSITIONS

        protected static final java.lang.String[] LIST_POSITIONS
      • BOX_SIZINGS

        protected static final java.lang.String[] BOX_SIZINGS
      • FONT_WEIGHTS

        protected static final java.lang.String[] FONT_WEIGHTS
      • FONT_STYLES

        protected static final java.lang.String[] FONT_STYLES
      • EMPTY

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

      • 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 Detail

      • getExtendsPossibleClasses

        public java.lang.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,
                                       java.lang.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 java.lang.String getFontFamily()
        Gets the font family set.
        Returns:
        The font family, possibly comma separated, or null for none.
      • getFontStyle

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

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

        public void collectConsumedFonts​(java.util.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.