Class EntityForm
java.lang.Object
org.broadleafcommerce.openadmin.web.form.entity.EntityForm
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected List<EntityFormAction>protected Stringstatic final Integerstatic final Stringstatic final Integerstatic final Stringstatic final Integerprotected Map<String,DynamicEntityFormInfo> protected Map<String,EntityForm> protected Stringprotected Stringstatic final Stringprotected Stringprotected Stringprotected Stringa 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 attachedprotected static final org.apache.commons.logging.Logprotected Stringstatic final Stringprotected Stringprotected Booleanspecial member used for only for a Translation entity form.protected Booleanprotected List<SectionCrumb>protected Stringprotected Stringprotected String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAction(int position, EntityFormAction action) Uses a zero based position.voidaddAction(EntityFormAction action) voidaddField(ClassMetadata cmd, Field field) voidaddField(ClassMetadata cmd, Field field, String groupName, Integer groupOrder, String tabName, Integer tabOrder) voidaddGroupFromGroupMetadata(GroupMetadata groupMetadata, String unprocessedTabName) voidaddHiddenField(ClassMetadata cmd, Field field) voidaddListGrid(ClassMetadata cmd, ListGrid listGrid, String tabName, Integer tabOrder, String groupName, boolean isTabPresent) voidaddMapKeyField(ClassMetadata cmd, Field field) addTabFromTabMetadata(TabMetadata tabMetadata) voidClears out the cached 'fields' variable which is used to render the form on the frontend.findActionById(String id) findListGrid(String collectionFieldName) Convenience method for grabbing a grid by its collection field name.findTabForField(String fieldName) getDynamicForm(String name) getDynamicFormInfo(String name) getId()getTabs()voidputDynamicForm(String name, EntityForm ef) voidputDynamicFormInfo(String name, DynamicEntityFormInfo info) voidremoveAction(EntityFormAction action) voidremoveField(String fieldName) voidremoveGroup(FieldGroup group) removeListGrid(String subCollectionFieldName) voidvoidsanitizeFieldName(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 entityvoidsetActions(List<EntityFormAction> actions) voidsetAttributes(Map<String, Object> attributes) voidsetCeilingEntityClassname(String ceilingEntityClassname) voidsetDynamicFormInfos(Map<String, DynamicEntityFormInfo> dynamicFormInfos) voidsetDynamicForms(Map<String, EntityForm> dynamicForms) voidsetEncType(String encType) Changes the encoding type on the built<form>voidsetEntityType(String entityType) voidvoidsetIdProperty(String idProperty) voidsetJsErrorMap(String jsErrorMap) voidsetMainEntityName(String mainEntityName) voidsetParentId(String parentId) voidvoidvoidsetReadOnly(boolean readOnly) voidsetSectionCrumbsImpl(List<SectionCrumb> sectionCrumbs) voidsetSectionKey(String sectionKey) voidvoidsetTranslationCeilingEntity(String translationCeilingEntity) voidsetTranslationId(String translationId)
-
Field Details
-
HIDDEN_GROUP
- See Also:
-
MAP_KEY_GROUP
- See Also:
-
DEFAULT_GROUP_NAME
- See Also:
-
DEFAULT_GROUP_ORDER
-
DEFAULT_COLUMN
-
DEFAULT_TAB_NAME
- See Also:
-
DEFAULT_TAB_ORDER
-
LOG
protected static final org.apache.commons.logging.Log LOG -
id
-
parentId
-
idProperty
-
ceilingEntityClassname
-
entityType
-
mainEntityName
-
sectionKey
-
encType
-
readOnly
-
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
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
-
translationId
-
tabs
-
sectionCrumbs
-
fields
-
dynamicForms
-
dynamicFormInfos
-
actions
-
attributes
-
-
Constructor Details
-
EntityForm
public EntityForm()
-
-
Method Details
-
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
-
findListGrid
Convenience method for grabbing a grid by its collection field name. This is very similar tofindField(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
-
findTab
-
findTabForField
-
findField
-
sanitizeFieldName
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
-
removeGroup
-
removeTab
-
removeTab
-
removeListGrid
-
addHiddenField
-
addField
-
addMapKeyField
-
addField
-
addListGrid
public void addListGrid(ClassMetadata cmd, ListGrid listGrid, String tabName, Integer tabOrder, String groupName, boolean isTabPresent) -
addAction
Uses a zero based position. Use 0 to add to the top of the list.- Parameters:
position-action-
-
addAction
-
removeAction
-
removeAllActions
public void removeAllActions() -
getDynamicForm
-
putDynamicForm
-
getDynamicFormInfo
-
putDynamicFormInfo
-
getReadOnly
-
setReadOnly
public void setReadOnly(boolean readOnly) -
getPreventSubmit
-
setPreventSubmit
public void setPreventSubmit() -
setReadOnly
public void setReadOnly() -
getActions
-
setActions
-
findActionById
-
collapseToOneFieldGroup
-
getTranslationCeilingEntity
-
setTranslationCeilingEntity
-
getTranslationId
-
setTranslationId
-
getId
-
setId
-
getParentId
-
setParentId
-
getIdProperty
-
setIdProperty
-
getCeilingEntityClassname
-
setCeilingEntityClassname
-
getEntityType
-
setEntityType
-
getMainEntityName
-
setMainEntityName
-
getEncType
-
setEncType
Changes the encoding type on the built<form> -
getSectionKey
-
setSectionKey
-
getTabs
-
setTabs
-
getDynamicForms
-
setDynamicForms
-
getDynamicFormInfos
-
setDynamicFormInfos
-
getSectionCrumbsImpl
-
setSectionCrumbsImpl
-
getSectionCrumbs
-
getAttributes
-
setAttributes
-
getJsErrorMap
-
setJsErrorMap
-
addTabFromTabMetadata
-
addGroupFromGroupMetadata
-