Class MStyle

All Implemented Interfaces:
Serializable, Cloneable, Comparator<Object>, I_AD_Style, I_Persistent, Evaluatee, ImmutablePOSupport

public class MStyle extends X_AD_Style implements ImmutablePOSupport
CSS Style model
Author:
hengsin
See Also:
  • Field Details

  • Constructor Details

    • MStyle

      public MStyle(Properties ctx, String AD_Style_UU, String trxName)
      UUID based Constructor
      Parameters:
      ctx - Context
      AD_Style_UU - UUID key
      trxName - Transaction
    • MStyle

      public MStyle(Properties ctx, int AD_Style_ID, String trxName)
      Parameters:
      ctx -
      AD_Style_ID -
      trxName -
    • MStyle

      public MStyle(Properties ctx, ResultSet rs, String trxName)
      Parameters:
      ctx -
      rs -
      trxName -
    • MStyle

      public MStyle(MStyle copy)
      Copy constructor
      Parameters:
      copy -
    • MStyle

      public MStyle(Properties ctx, MStyle copy)
      Copy constructor
      Parameters:
      ctx -
      copy -
    • MStyle

      public MStyle(Properties ctx, MStyle copy, String trxName)
      Copy constructor
      Parameters:
      ctx -
      copy -
      trxName -
  • Method Details

    • get

      public static MStyle get(int AD_Style_ID)
      Get MStyle from cache (immutable)
      Parameters:
      AD_Style_ID -
      Returns:
      MStyle
    • get

      public static MStyle get(Properties ctx, int AD_Style_ID)
      Get MStyle from cache (immutable)
      Parameters:
      ctx -
      AD_Style_ID -
      Returns:
      MStyle
    • getStyleLines

      public MStyleLine[] getStyleLines()
      Get lines
      Returns:
      array of style line
    • buildStyle

      public String buildStyle(String defaultTheme, Evaluatee evaluatee)
      Build inline CSS style text from lines
      Parameters:
      defaultTheme -
      evaluatee -
      Returns:
      CSS style text
    • buildStyle

      public String buildStyle(String defaultTheme, Evaluatee evaluatee, boolean inline)
      Build CSS style text from lines
      Parameters:
      defaultTheme -
      evaluatee - evaluatee for display logic and for the substitution of @variable@ in inline style text (use '@@' for a literal '@')
      inline - true for inline (for style="..." use), false for css (for class="..." use)
      Returns:
      CSS style text
    • parseVariables

      public static String parseVariables(String styleText, Evaluatee evaluatee)
      Replace @variable@ in style text with the value provided by the evaluatee.
      • The SCLASS_PREFIX and ZCLASS_PREFIX prefix is not parsed.
      • '@' characters must be paired, '@@' is the escape for a literal '@'. Text with an odd number of '@' is returned as is (logged at FINE level).
      • Variable that can't be resolved is kept as is.
      Parameters:
      styleText -
      evaluatee -
      Returns:
      style text with variables replaced
    • isSClass

      public static boolean isSClass(String style)
      Parameters:
      style -
      Returns:
      true if style start with SCLASS_PREFIX (case insensitive)
    • isZClass

      public static boolean isZClass(String style)
      Parameters:
      style -
      Returns:
      true if style start with ZCLASS_PREFIX (case insensitive)
    • markImmutable

      public MStyle markImmutable()
      Description copied from interface: ImmutablePOSupport
      mark PO as immutable
      Specified by:
      markImmutable in interface ImmutablePOSupport
      Returns:
      PO