Class Field

java.lang.Object
com.adobe.granite.ui.components.Field

public class Field extends Object
Utility class for form field component.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static String
    The name of the CSS class to apply in order to hide empty field components in default mode.
    static String
    The suffix that specifies if a property is a mixed value (for bulk editing).
  • Constructor Summary

    Constructors
    Constructor
    Description
     
    Creates a new Field object with the given config.
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    Clears the bulk edit mode
    getRootClass(boolean isEmpty)
    Returns the CSS class (or space separated class values) that have to be applied to the root element of field component.
    static String
    getRootClass(Config cfg, boolean isEmpty)
    Returns the CSS class (or space separated class values) that have to be applied to the root element of field component.
    static String
    getRootClass(Config cfg, String value)
    Returns the CSS class (or space separated class values) that have to be applied to the root element of field component.
    Returns the CSS class (or space separated class values) that have to be applied to the root element of field component.
    boolean
    Returns true if bulk edit is allowed on this field; false otherwise.
    static boolean
    Returns true if bulk edit mode is set; false otherwise Bulk edit mode is set if the request has an attribute BULK_EDIT_MODE_ATTRIBUTE which has the value of true
    static boolean
    isMixed(Config cfg, Value value)
    Returns true if the field is a mixed value; false otherwise.
    boolean
    isMixed(Value value)
    Returns true if the field is a mixed value; false otherwise.
    static void
    Sets the bulk edit mode

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • HIDE_IN_DEFAULT_CLASS

      @Nonnull public static String HIDE_IN_DEFAULT_CLASS
      The name of the CSS class to apply in order to hide empty field components in default mode.
    • IS_MIXED_SUFFIX

      @Nonnull public static String IS_MIXED_SUFFIX
      The suffix that specifies if a property is a mixed value (for bulk editing).
  • Constructor Details

    • Field

      public Field()
    • Field

      public Field(@Nonnull Config cfg)
      Creates a new Field object with the given config.
      Parameters:
      cfg - The config of the component
  • Method Details

    • getRootClass

      @Nonnull public String getRootClass(boolean isEmpty)
      Returns the CSS class (or space separated class values) that have to be applied to the root element of field component. The provided class allows for example to hide empty field components in read only mode.
      Parameters:
      isEmpty - Indicate if the field is empty
      Returns:
      the CSS class (or space separated class values)
    • getRootClass

      @Nonnull public String getRootClass(@CheckForNull String value)
      Returns the CSS class (or space separated class values) that have to be applied to the root element of field component. The provided class allows for example to hide empty field components in read only mode.
      Parameters:
      value - The value of the field component
      Returns:
      the CSS class (or space separated class values)
    • isMixed

      public boolean isMixed(@Nonnull Value value)
      Returns true if the field is a mixed value; false otherwise. A field is a mixed value if it has a property named cfg.get("name") + IS_MIXED_SUFFIX which has the value of true.
      Parameters:
      value - The form value
      Returns:
      True if the field component holds a mixed value, false otherwise
    • isBulkEditAllowed

      public boolean isBulkEditAllowed()
      Returns true if bulk edit is allowed on this field; false otherwise. A field could be bulk edited if it has a property named allowBulkEdit which has the value of true.
      Returns:
      True if the field component could be bulk edited, false otherwise
    • isBulkEditMode

      public static boolean isBulkEditMode(@Nonnull HttpServletRequest request)
      Returns true if bulk edit mode is set; false otherwise Bulk edit mode is set if the request has an attribute BULK_EDIT_MODE_ATTRIBUTE which has the value of true
      Parameters:
      request - The request providing the parameter
      Returns:
      True if the bulk edit mode is set
    • setBulkEditMode

      public static void setBulkEditMode(@Nonnull HttpServletRequest request)
      Sets the bulk edit mode
      Parameters:
      request - The request that would hold the parameter
    • clearBulkEditMode

      public static void clearBulkEditMode(@Nonnull HttpServletRequest request)
      Clears the bulk edit mode
      Parameters:
      request - The request that was holding the parameter
    • getRootClass

      @Nonnull public static String getRootClass(@Nonnull Config cfg, boolean isEmpty)
      Returns the CSS class (or space separated class values) that have to be applied to the root element of field component. The provided class allows for example to hide empty field components in read only mode.
      Parameters:
      cfg - The config object of the field component
      isEmpty - Indicate if the field is empty
      Returns:
      the CSS class (or space separated class values)
    • getRootClass

      @Nonnull public static String getRootClass(@Nonnull Config cfg, @CheckForNull String value)
      Returns the CSS class (or space separated class values) that have to be applied to the root element of field component. The provided class allows for example to hide empty field components in read only mode.
      Parameters:
      cfg - The config object of the field component
      value - The value of the field component
      Returns:
      the CSS class (or space separated class values)
    • isMixed

      public static boolean isMixed(@Nonnull Config cfg, @Nonnull Value value)
      Returns true if the field is a mixed value; false otherwise. A field is a mixed value if it has a property named cfg.get("name") + IS_MIXED_SUFFIX which has the value of true.
      Parameters:
      cfg - The config object of the field component
      value - The form value
      Returns:
      True if the field component holds a mixed value, false otherwise