java.lang.Object
com.inductiveautomation.perspective.common.config.styles.StyleVariantConfig

public class StyleVariantConfig extends 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 Details

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

    • StyleVariantConfig

      public StyleVariantConfig()
    • StyleVariantConfig

      public StyleVariantConfig(StyleVariantConfig copy)
  • Method Details

    • isDefaultStyle

      public boolean isDefaultStyle()
    • isAnimated

      public boolean isAnimated()
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • append

      public void append(@Nonnull StringBuilder css, @Nonnull String className, @Nullable 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