Class ModelFormField

java.lang.Object
org.apache.ofbiz.widget.model.ModelFormField

public final class ModelFormField extends Object
Models the <field> element.
See Also:
  • Method Details

    • from

      public static ModelFormField from(Consumer<ModelFormFieldBuilder> spec)
      Constructs a form field model from a builder specification.
      Parameters:
      spec - the specification of form field definition
      Returns:
      the form field model corresponding to the specification.
    • from

      public static ModelFormField from(ModelFormFieldBuilder builder)
    • getAction

      public FlexibleStringExpander getAction()
    • getAction

      public String getAction(Map<String,? extends Object> context)
    • getAttributeName

      public String getAttributeName()
      Gets the name of the Service Attribute (aka Parameter) that corresponds with this field. This can be used to get additional information about the field. Use the getServiceName() method to get the Entity name that the field is in.
      Returns:
      returns the name of the Service Attribute
    • getCurrentContainerId

      public String getCurrentContainerId(Map<String,Object> context)
      Gets the current id name of the ModelFormField and if in a multi type ModelForm, suffixes it with the index row.
      Parameters:
      context -
      Returns:
    • getEncodeOutput

      public boolean getEncodeOutput()
    • getEntityName

      public String getEntityName()
    • getEntry

      public String getEntry(Map<String,? extends Object> context)
      Gets the entry from the context that corresponds to this field; if this form is being rendered in an error condition (ie isError in the context is true) then the value will be retrieved from the parameters Map in the context.
      Parameters:
      context - the context
      Returns:
      returns the entry from the context that corresponds to this field
    • getEntry

      public String getEntry(Map<String,? extends Object> context, String defaultValue)
    • getEntryAcsr

      public FlexibleMapAccessor<Object> getEntryAcsr()
    • getEntryName

      public String getEntryName()
    • getEvent

      public String getEvent()
    • getFieldInfo

      public FieldInfo getFieldInfo()
    • getFieldName

      public String getFieldName()
      Gets the name of the Entity Field that corresponds with this field. This can be used to get additional information about the field. Use the getEntityName() method to get the Entity name that the field is in.
      Returns:
      return the name of the Entity Field that corresponds with this field
    • getHeaderLink

      public String getHeaderLink()
    • getHeaderLinkStyle

      public String getHeaderLinkStyle()
    • getIdName

      public String getIdName()
      Gets the id name of the ModelFormField that is :
      • The id-name" specified on the field definition
      • Else the concatenation of the formName and fieldName
      Returns:
    • getTabindex

      public String getTabindex()
    • getConditionGroup

      public String getConditionGroup()
    • getDisabledSpec

      public FlexibleStringExpander getDisabledSpec()
    • getDisabled

      public boolean getDisabled(Map<String,Object> context)
    • getMap

      public Map<String,? extends Object> getMap(Map<String,? extends Object> context)
    • getMapAcsr

      public FlexibleMapAccessor<Map<String,? extends Object>> getMapAcsr()
    • getMapName

      public String getMapName()
      Get the name of the Map in the form context that contains the entry, available from the getEntryName() method. This entry is used to pre-populate the field widget when not in an error condition. In an error condition the parameter name is used to get the value from the parameters Map.
      Returns:
      returns the name of the Map in the form context that contains the entry
    • getModelForm

      public ModelForm getModelForm()
    • getName

      public String getName()
    • getOnChangeUpdateAreas

      public List<ModelForm.UpdateArea> getOnChangeUpdateAreas()
    • getOnClickUpdateAreas

      public List<ModelForm.UpdateArea> getOnClickUpdateAreas()
    • getParameterName

      public FlexibleStringExpander getParameterName()
    • getParameterName

      public String getParameterName(Map<String,? extends Object> context)
      Get the name to use for the parameter for this field in the form interpreter. For HTML forms this is the request parameter name.
      Returns:
      returns the name to use for the parameter for this field in the form interpreter
    • getPosition

      public int getPosition()
    • getRedWhen

      public String getRedWhen()
    • getRequiredField

      public boolean getRequiredField()
    • getRequiredFieldStyle

      public String getRequiredFieldStyle()
    • getSeparateColumn

      public boolean getSeparateColumn()
    • getServiceName

      public String getServiceName()
    • getSortField

      public Boolean getSortField()
    • getSortFieldAscStyle

      public String getSortFieldAscStyle()
    • getSortFieldDescStyle

      public String getSortFieldDescStyle()
    • getSortFieldHelpText

      public String getSortFieldHelpText()
    • getSortFieldHelpText

      public String getSortFieldHelpText(Map<String,Object> context)
    • getSortFieldStyle

      public String getSortFieldStyle()
    • getSortFieldStyleAsc

      public String getSortFieldStyleAsc()
    • getSortFieldStyleDesc

      public String getSortFieldStyleDesc()
    • getTitle

      public FlexibleStringExpander getTitle()
    • getTitle

      public String getTitle(Map<String,Object> context)
    • getTitleAreaStyle

      public String getTitleAreaStyle()
    • getTitleStyle

      public String getTitleStyle()
    • getTooltip

      public FlexibleStringExpander getTooltip()
    • getTooltip

      public String getTooltip(Map<String,Object> context)
    • getTooltipStyle

      public String getTooltipStyle()
    • getUseWhen

      public FlexibleStringExpander getUseWhen()
    • getUseWhen

      public String getUseWhen(Map<String,Object> context)
    • getIgnoreWhen

      public String getIgnoreWhen(Map<String,Object> context)
    • getWidgetAreaStyle

      public String getWidgetAreaStyle()
    • getWidgetStyle

      public String getWidgetStyle()
    • getParentFormName

      public String getParentFormName()
    • isRowSubmit

      public boolean isRowSubmit()
      Checks if field is a row submit field.
    • isSortField

      public boolean isSortField()
    • isUseWhenEmpty

      public boolean isUseWhenEmpty()
    • renderFieldString

      public void renderFieldString(Appendable writer, Map<String,Object> context, FormStringRenderer formStringRenderer) throws IOException
      Throws:
      IOException
    • shouldBeRed

      public boolean shouldBeRed(Map<String,Object> context)
      the widget/interaction part will be red if the date value is before-now (for ex. thruDate), after-now (for ex. fromDate), or by-name (if the field's name or entry-name or fromDate or thruDate the corresponding action will be done); only applicable when the field is a timestamp
      Parameters:
      context - the context
      Returns:
      true if the field should be read otherwise false
    • shouldUse

      public boolean shouldUse(Map<String,Object> context)
    • usedFields

      public static Predicate<ModelFormField> usedFields(Map<String,Object> context)
      Provides a stateful predicate checking if a field must be used.
      Parameters:
      context - the context determining if the field must be used
      Returns:
      a stateful predicate checking if a field must be used.
    • shouldIgnore

      public boolean shouldIgnore(Map<String,Object> context)