Class StyleVariantConfig


  • public class StyleVariantConfig
    extends java.lang.Object
    A style variant is one style or animated style, which might serve as the base style for a Style Class or as a media-query or pseudo-selector variant style.
    • Field Detail

      • pseudo

        public PseudoSelector pseudo
        This will be non-null if this style variant is a pseudo-selector variant.
      • media

        public MediaQueryConfig media
        This will be non-null if this style variant is a media-query varient.
      • style

        public StyleDeclarations style
        This is the style block for this variant for non-animated styles.
      • animation

        public AnimationConfig animation
        This is the style block + animation settings for animated styles.
    • Constructor Detail

      • StyleVariantConfig

        public StyleVariantConfig()
    • Method Detail

      • isDefaultStyle

        public boolean isDefaultStyle()
      • isAnimated

        public boolean isAnimated()
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • append

        public void append​(@Nonnull
                           java.lang.StringBuilder css,
                           @Nonnull
                           java.lang.String className,
                           @Nullable
                           java.lang.Integer variantIndex)
        Compile this style to CSS format.

        For example, let's say we have the following style represented by its serialized JSON format:

        Resource "A":

        
           {
             "declarations": {
               "paddingTop": "10em",
               "borderColor": "red"
             }
           }
         
        The output of this method will compile this style to CSS. The CSS class name is equal to the style project resource name prepended with "psc-":
        
           .psc-A:in-range {
             border-color: red;
           }
         
        Parameters:
        className - The name of the CSS class to generate
        variantIndex - The index of this variant in the parent style class, or null if this is the base variant