java.lang.Object
org.broadleafcommerce.openadmin.web.form.entity.EntityForm

public class EntityForm extends Object
  • Field Details

    • HIDDEN_GROUP

      public static final String HIDDEN_GROUP
      See Also:
    • MAP_KEY_GROUP

      public static final String MAP_KEY_GROUP
      See Also:
    • DEFAULT_GROUP_NAME

      public static final String DEFAULT_GROUP_NAME
      See Also:
    • DEFAULT_GROUP_ORDER

      public static final Integer DEFAULT_GROUP_ORDER
    • DEFAULT_COLUMN

      public static final Integer DEFAULT_COLUMN
    • DEFAULT_TAB_NAME

      public static final String DEFAULT_TAB_NAME
      See Also:
    • DEFAULT_TAB_ORDER

      public static final Integer DEFAULT_TAB_ORDER
    • LOG

      protected static final org.apache.commons.logging.Log LOG
    • id

      protected String id
    • parentId

      protected String parentId
    • idProperty

      protected String idProperty
    • ceilingEntityClassname

      protected String ceilingEntityClassname
    • entityType

      protected String entityType
    • mainEntityName

      protected String mainEntityName
    • sectionKey

      protected String sectionKey
    • encType

      protected String encType
    • readOnly

      protected Boolean readOnly
    • preventSubmit

      protected Boolean preventSubmit
      special member used for only for a Translation entity form. Set at the controller, in order to populate a hidden field in the form indicating that there were errors and the form should not be allowed to submit.
    • jsErrorMap

      protected String jsErrorMap
      a string representation of a Javascript object containing a map of fields => errors Useful when filling a translation form, as the (only) way to determine to which fields error messaging needs to be attached
    • translationCeilingEntity

      protected String translationCeilingEntity
    • translationId

      protected String translationId
    • tabs

      protected TreeSet<Tab> tabs
    • sectionCrumbs

      protected List<SectionCrumb> sectionCrumbs
    • fields

      protected Map<String,Field> fields
    • dynamicForms

      protected Map<String,EntityForm> dynamicForms
    • dynamicFormInfos

      protected Map<String,DynamicEntityFormInfo> dynamicFormInfos
    • actions

      protected List<EntityFormAction> actions
    • attributes

      protected Map<String,Object> attributes
  • Constructor Details

    • EntityForm

      public EntityForm()
  • Method Details

    • getFields

      public Map<String,Field> getFields()
      Returns:
      a flattened, field name keyed representation of all of the fields in all of the groups for this form. This set will also includes all of the dynamic form fields.

      Note that if there collisions between the dynamic form fields and the fields on this form (meaning that they have the same name), then the dynamic form field will be excluded from the map and the preference will be given to first-level entities

    • clearFieldsMap

      public void clearFieldsMap()
      Clears out the cached 'fields' variable which is used to render the form on the frontend. Use this method if you want to force the entityForm to rebuild itself based on the tabs and groups that have been assigned and populated
    • getAllListGrids

      public List<ListGrid> getAllListGrids()
    • findListGrid

      public ListGrid findListGrid(String collectionFieldName)
      Convenience method for grabbing a grid by its collection field name. This is very similar to findField(String) but differs in that this only searches through the sub collections for the current entity
      Parameters:
      collectionFieldName - the field name of the collection on the top-level entity
      Returns:
    • findGroup

      public FieldGroup findGroup(String groupName)
    • findTab

      public Tab findTab(String tabKey)
    • findTabForField

      public Tab findTabForField(String fieldName)
    • findField

      public Field findField(String fieldName)
    • sanitizeFieldName

      public String sanitizeFieldName(String fieldName)
      Since this field name could come from the frontend (where all fields are referenced like fields[name].value, we need to strip that part out to look up the real field name in this entity
      Parameters:
      fieldName -
      Returns:
    • removeField

      public Field removeField(String fieldName)
    • removeGroup

      public void removeGroup(FieldGroup group)
    • removeTab

      public void removeTab(Tab tab)
    • removeTab

      public void removeTab(String tabName)
    • removeListGrid

      public ListGrid removeListGrid(String subCollectionFieldName)
    • addHiddenField

      public void addHiddenField(ClassMetadata cmd, Field field)
    • addField

      public void addField(ClassMetadata cmd, Field field)
    • addMapKeyField

      public void addMapKeyField(ClassMetadata cmd, Field field)
    • addField

      public void addField(ClassMetadata cmd, Field field, String groupName, Integer groupOrder, String tabName, Integer tabOrder)
    • addListGrid

      public void addListGrid(ClassMetadata cmd, ListGrid listGrid, String tabName, Integer tabOrder, String groupName, boolean isTabPresent)
    • addAction

      public void addAction(int position, EntityFormAction action)
      Uses a zero based position. Use 0 to add to the top of the list.
      Parameters:
      position -
      action -
    • addAction

      public void addAction(EntityFormAction action)
    • removeAction

      public void removeAction(EntityFormAction action)
    • removeAllActions

      public void removeAllActions()
    • getDynamicForm

      public EntityForm getDynamicForm(String name)
    • putDynamicForm

      public void putDynamicForm(String name, EntityForm ef)
    • getDynamicFormInfo

      public DynamicEntityFormInfo getDynamicFormInfo(String name)
    • putDynamicFormInfo

      public void putDynamicFormInfo(String name, DynamicEntityFormInfo info)
    • getReadOnly

      public Boolean getReadOnly()
    • setReadOnly

      public void setReadOnly(boolean readOnly)
    • getPreventSubmit

      public Boolean getPreventSubmit()
    • setPreventSubmit

      public void setPreventSubmit()
    • setReadOnly

      public void setReadOnly()
    • getActions

      public List<EntityFormAction> getActions()
    • setActions

      public void setActions(List<EntityFormAction> actions)
    • findActionById

      public EntityFormAction findActionById(String id)
    • collapseToOneFieldGroup

      public FieldGroup collapseToOneFieldGroup()
    • getTranslationCeilingEntity

      public String getTranslationCeilingEntity()
    • setTranslationCeilingEntity

      public void setTranslationCeilingEntity(String translationCeilingEntity)
    • getTranslationId

      public String getTranslationId()
    • setTranslationId

      public void setTranslationId(String translationId)
    • getId

      public String getId()
    • setId

      public void setId(String id)
    • getParentId

      public String getParentId()
    • setParentId

      public void setParentId(String parentId)
    • getIdProperty

      public String getIdProperty()
    • setIdProperty

      public void setIdProperty(String idProperty)
    • getCeilingEntityClassname

      public String getCeilingEntityClassname()
    • setCeilingEntityClassname

      public void setCeilingEntityClassname(String ceilingEntityClassname)
    • getEntityType

      public String getEntityType()
    • setEntityType

      public void setEntityType(String entityType)
    • getMainEntityName

      public String getMainEntityName()
    • setMainEntityName

      public void setMainEntityName(String mainEntityName)
    • getEncType

      public String getEncType()
    • setEncType

      public void setEncType(String encType)
      Changes the encoding type on the built <form>
    • getSectionKey

      public String getSectionKey()
    • setSectionKey

      public void setSectionKey(String sectionKey)
    • getTabs

      public Set<Tab> getTabs()
    • setTabs

      public void setTabs(Set<Tab> tabs)
    • getDynamicForms

      public Map<String,EntityForm> getDynamicForms()
    • setDynamicForms

      public void setDynamicForms(Map<String,EntityForm> dynamicForms)
    • getDynamicFormInfos

      public Map<String,DynamicEntityFormInfo> getDynamicFormInfos()
    • setDynamicFormInfos

      public void setDynamicFormInfos(Map<String,DynamicEntityFormInfo> dynamicFormInfos)
    • getSectionCrumbsImpl

      public List<SectionCrumb> getSectionCrumbsImpl()
    • setSectionCrumbsImpl

      public void setSectionCrumbsImpl(List<SectionCrumb> sectionCrumbs)
    • getSectionCrumbs

      public String getSectionCrumbs()
    • getAttributes

      public Map<String,Object> getAttributes()
    • setAttributes

      public void setAttributes(Map<String,Object> attributes)
    • getJsErrorMap

      public String getJsErrorMap()
    • setJsErrorMap

      public void setJsErrorMap(String jsErrorMap)
    • addTabFromTabMetadata

      public String addTabFromTabMetadata(TabMetadata tabMetadata)
    • addGroupFromGroupMetadata

      public void addGroupFromGroupMetadata(GroupMetadata groupMetadata, String unprocessedTabName)