Class CSSRectHelper


  • @Immutable
    public final class CSSRectHelper
    extends Object
    Provides rectangle handling sanity methods.
    Author:
    Philip Helger
    • Method Detail

      • isRectValue

        public static boolean isRectValue​(@Nullable
                                          String sCSSValue)
        Check if the passed value is CSS rectangle definition or not. It checks both the current syntax (rect(a,b,c,d)) and the old syntax ( rect(a b c d)).
        Parameters:
        sCSSValue - The value to check. May be null.
        Returns:
        true if the passed value is a rect value, false if not
      • getRectValues

        @Nullable
        public static String[] getRectValues​(@Nullable
                                             String sCSSValue)
        Get all the values from within a CSS rectangle definition.
        Parameters:
        sCSSValue - The CSS values to check. May be null.
        Returns:
        null if the passed String is not a CSS rectangle. An array with 4 Strings if the passed value is a CSS rectangle.
      • getAsRect

        @Nullable
        public static CSSRect getAsRect​(@Nullable
                                        String sCSSValue)
        Interpret the passed value as a CSS rectangle and convert it to a CSSRect.
        Parameters:
        sCSSValue - The CSS values to check. May be null.
        Returns:
        null if the passed String is not a CSS rectangle.