org.broadleafcommerce.openadmin.web.form.entity
Class EntityForm

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

public class EntityForm
extends Object


Field Summary
protected  List<EntityFormAction> actions
           
protected  String ceilingEntityClassname
           
static String DEFAULT_GROUP_NAME
           
static Integer DEFAULT_GROUP_ORDER
           
static String DEFAULT_TAB_NAME
           
static Integer DEFAULT_TAB_ORDER
           
protected  Map<String,DynamicEntityFormInfo> dynamicFormInfos
           
protected  Map<String,EntityForm> dynamicForms
           
protected  String entityType
           
protected  Map<String,Field> fields
           
static String HIDDEN_GROUP
           
protected  String id
           
protected  String idProperty
           
protected static org.apache.commons.logging.Log LOG
           
protected  String mainEntityName
           
static String MAP_KEY_GROUP
           
protected  String parentId
           
protected  Boolean readOnly
           
protected  List<SectionCrumb> sectionCrumbs
           
protected  String sectionKey
           
protected  Set<Tab> tabs
           
 
Constructor Summary
EntityForm()
           
 
Method Summary
 void addAction(EntityFormAction action)
           
 void addField(Field field)
           
 void addField(Field field, String groupName, Integer groupOrder, String tabName, Integer tabOrder)
           
 void addHiddenField(Field field)
           
 void addListGrid(ListGrid listGrid, String tabName, Integer tabOrder)
           
 void addMapKeyField(Field field)
           
 void clearFieldsMap()
          Clears out the cached 'fields' variable which is used to render the form on the frontend.
 Field findField(String fieldName)
           
 ListGrid findListGrid(String collectionFieldName)
          Convenience method for grabbing a grid by its collection field name.
 Tab findTab(String tabTitle)
           
 Tab findTabForField(String fieldName)
           
 List<EntityFormAction> getActions()
           
 List<ListGrid> getAllListGrids()
           
 String getCeilingEntityClassname()
           
 EntityForm getDynamicForm(String name)
           
 DynamicEntityFormInfo getDynamicFormInfo(String name)
           
 Map<String,DynamicEntityFormInfo> getDynamicFormInfos()
           
 Map<String,EntityForm> getDynamicForms()
           
 String getEntityType()
           
 Map<String,Field> getFields()
           
 String getId()
           
 String getIdProperty()
           
 String getMainEntityName()
           
 String getParentId()
           
 Boolean getReadOnly()
           
 String getSectionCrumbs()
           
 List<SectionCrumb> getSectionCrumbsImpl()
           
 String getSectionKey()
           
 Set<Tab> getTabs()
           
 void putDynamicForm(String name, EntityForm ef)
           
 void putDynamicFormInfo(String name, DynamicEntityFormInfo info)
           
 void removeAction(EntityFormAction action)
           
 void removeAllActions()
           
 Field removeField(String fieldName)
           
 ListGrid removeListGrid(String subCollectionFieldName)
           
 void removeTab(Tab tab)
           
 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
 void setActions(List<EntityFormAction> actions)
           
 void setCeilingEntityClassname(String ceilingEntityClassname)
           
 void setDynamicFormInfos(Map<String,DynamicEntityFormInfo> dynamicFormInfos)
           
 void setDynamicForms(Map<String,EntityForm> dynamicForms)
           
 void setEntityType(String entityType)
           
 void setId(String id)
           
 void setIdProperty(String idProperty)
           
 void setMainEntityName(String mainEntityName)
           
 void setParentId(String parentId)
           
 void setReadOnly()
           
 void setReadOnly(boolean readOnly)
           
 void setSectionCrumbs(String crumbs)
           
 void setSectionCrumbsImpl(List<SectionCrumb> sectionCrumbs)
           
 void setSectionKey(String sectionKey)
           
 void setTabs(Set<Tab> tabs)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

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

HIDDEN_GROUP

public static final String HIDDEN_GROUP
See Also:
Constant Field Values

MAP_KEY_GROUP

public static final String MAP_KEY_GROUP
See Also:
Constant Field Values

DEFAULT_GROUP_NAME

public static final String DEFAULT_GROUP_NAME
See Also:
Constant Field Values

DEFAULT_GROUP_ORDER

public static final Integer DEFAULT_GROUP_ORDER

DEFAULT_TAB_NAME

public static final String DEFAULT_TAB_NAME
See Also:
Constant Field Values

DEFAULT_TAB_ORDER

public static final Integer DEFAULT_TAB_ORDER

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

readOnly

protected Boolean readOnly

tabs

protected Set<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
Constructor Detail

EntityForm

public EntityForm()
Method Detail

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
See Also:
#getFields(boolean)}

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:

findTab

public Tab findTab(String tabTitle)

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)

removeTab

public void removeTab(Tab tab)

removeListGrid

public ListGrid removeListGrid(String subCollectionFieldName)

addHiddenField

public void addHiddenField(Field field)

addField

public void addField(Field field)

addMapKeyField

public void addMapKeyField(Field field)

addField

public void addField(Field field,
                     String groupName,
                     Integer groupOrder,
                     String tabName,
                     Integer tabOrder)

addListGrid

public void addListGrid(ListGrid listGrid,
                        String tabName,
                        Integer tabOrder)

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()

setReadOnly

public void setReadOnly(boolean readOnly)

getActions

public List<EntityFormAction> getActions()

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)

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)

setActions

public void setActions(List<EntityFormAction> actions)

getSectionCrumbsImpl

public List<SectionCrumb> getSectionCrumbsImpl()

setSectionCrumbsImpl

public void setSectionCrumbsImpl(List<SectionCrumb> sectionCrumbs)

setSectionCrumbs

public void setSectionCrumbs(String crumbs)

getSectionCrumbs

public String getSectionCrumbs()


Copyright © 2013. All Rights Reserved.