Interface FormItem.CustomStateGetter

Enclosing class:
FormItem

public static interface FormItem.CustomStateGetter
  • Method Details

    • getCustomState

      String getCustomState(FormItemElementType elementType, String derivedState)
      Deprecated.
      Do not use CustomStateGetter; use FormItem.StateCustomizer instead
      Implement this method to retrieve a custom state suffix to append to the style name that is applied to some element of a formItem. See FormItemBaseStyle for more information on how state-based FormItem style names are derived.

      If a FormItem has a CustomStateGetter, the framework will call its getCustomState() method, passing in the state suffix it has derived. Your getCustomState() implementation can make use of this derived state or ignore it. For example, if you wanted two different types of focus styling depending on some factor unrelated to focus, you would probably make use of the incoming "Focused" state and return something like "Focused1" or "Focused2". On the other hand, if you want your custom state to just override whatever the system derived, you would ignore the incoming state. Finally, if you do not wish to provide a custom style for this formItem element at this time - for example, you are only interested in providing a custom "textBox" style and this call is for a "cell" element type - your getCustomStyle() method should just return the state it was passed.

      CustomStatesGetters are advanced usage, and you should only use them if you have specialized styling requirements. If you do use a CustomStateGetter, note that its getCustomState() method will be called very frequently, from rendering code: if your custom logic does significant processing, it could introduce a system-wide performance problem.

      Parameters:
      elementType - The element type to return a custom state for
      derivedState - The state suffix the system derived
      Returns:
      custom state suffix to use for the parameter elementType for this formItem