public class EntityDetailsTemplatePanel<T extends Serializable> extends ListViewTemplatePanel<EntityTemplate<TemplatePanel>,T> implements CustomTemplateRenderAdapter<T,org.apache.wicket.model.IModel,org.apache.wicket.Component,org.apache.wicket.MarkupContainer>
Panel for ENTITY . Renders its attributes and params dynamically.cachedComponents.org.apache.wicket.Component.ComponentModelChange, org.apache.wicket.Component.EnabledChange, org.apache.wicket.Component.IVisitor<T extends org.apache.wicket.Component>, org.apache.wicket.Component.VisibilityChangeCustomTemplateRenderAdapter.Nothing| Modifier and Type | Field and Description |
|---|---|
static String |
ON_SAVE_EnsureAccessorExistsTransformer
The
FacetMeta Requires a EnsureAccessorExistsTransformer to be called on save(Serializable, MetaItem, Object)
The value of this attribute is expected to be either a EnsureAccessorExistsTransformer or a Boolean value. |
authorizationModuletemplateENABLE, FLAG_CONFIGURED, FLAG_INITIALIZED, FLAG_REMOVING_FROM_HIERARCHY, FLAG_RESERVED1, FLAG_RESERVED2, FLAG_RESERVED3, FLAG_RESERVED4, FLAG_RESERVED5, FLAG_RESERVED6, FLAG_RESERVED7, FLAG_RESERVED8, PATH_SEPARATOR, RENDERnothing| Constructor and Description |
|---|
EntityDetailsTemplatePanel(String id,
org.apache.wicket.model.IModel<T> model,
EntityTemplate template,
CustomTemplateRenderAdapter<T,org.apache.wicket.model.IModel,org.apache.wicket.Component,org.apache.wicket.MarkupContainer> defaultRenderAdapter) |
| Modifier and Type | Method and Description |
|---|---|
protected Object |
extractFieldValue(Object rawValue,
MetaItem metaItemObject)
Converts different type of model field values to a model that is sent to the display
|
protected String |
getAddToCollectionSectionName(MetaItem metaItemObject)
The add section which should have a minimum of one "addOption" component can be customized
for different scenarios; by type or field name etc.
|
org.apache.wicket.Component |
getComponentForType(MetaItem metaItem,
String fieldComponentName,
org.apache.wicket.model.IModel model,
org.apache.wicket.MarkupContainer container,
T modelObject,
User user) |
protected org.apache.wicket.Component[] |
getComponents(T modelObject,
org.apache.wicket.markup.html.list.ListItem<MetaItem> item)
Main rendering method; adds components to the container
|
protected Collection<org.apache.wicket.Component> |
getComponentsForCollectionType(T modelObject,
MetaItem metaItem,
org.apache.wicket.MarkupContainer container) |
protected Collection<org.apache.wicket.Component> |
getComponentsForType(T modelObject,
MetaItem metaItem,
org.apache.wicket.model.IModel model,
org.apache.wicket.MarkupContainer container) |
<C extends org.apache.wicket.Component> |
getDataRelatedComponents(Class<C> type)
All elements added to the dynamic panel maybe added within wrapper elements and nested hierarchies.
|
String |
getItemRefId(MetaItem metaItem)
When rendering Items, for Feedback we may want to target
messages to sections in the form.
|
protected List |
getListForCollectionType(T modelObject,
MetaItem metaItem)
Get a
List to represent the Collection of values to presented to the UI by
#getComponentsForCollectionType(Entity, com.neurosys.content.wicket.pages.panel.TemplatePanel.MetaItem, MarkupContainer) |
protected org.apache.wicket.model.IModel |
getModelForFieldOrAttribute(T modelObject,
MetaItem metaItem)
get the value from the
Field or Attributes. |
Map<String,String> |
getResourcePaths() |
FileUploadWrapper |
getResourceUploader() |
protected boolean |
getStatelessHint() |
protected boolean |
isSetValueInSameModel(FacetMeta facetMeta,
Object value)
While saving if the value should be set back in the same model passed by the Entity (like
CompoundPropertyModel or assigned a new Model
Also a FacetMeta an explicitly opt-out of being part of CompoundPropertyModel by setting FacetMeta.setAssignIndependentModel(Boolean) to false. |
protected List |
mergeCollections(List existingValues,
List newValues)
Algorithm to merge Lists of existing values and new values.
|
protected void |
onBeforeRender() |
void |
onInitialize() |
Object |
processItem(T modelObject,
MetaItem metaItem,
org.apache.wicket.Component coreEntityDataField,
User user,
Object... contextParams)
For each meta item handle processing on submit and derive the value to be submitted/persisted back
|
T |
processSubmit(T entity,
org.apache.wicket.markup.html.form.Form<T> form)
Intended for processing of the part of the data thats generated by this panel only.
Elements belonging to this panel must update the modelObject based on input from the Form. |
protected void |
reorder(List<MetaItem> items)
Re-Order the items of the passed
List
This implementation does nothing. |
void |
reset()
During Ajax calls a Render Adapter maybe called multiple times.
|
protected void |
save(T entity,
MetaItem metaItem,
Object value)
Save the specific value associated with the
MetaItem back into the model Object |
void |
setResourcePaths(Map<String,String> resourcePaths)
Where different File type properties/fields can be stored.
|
void |
setResourceUploader(FileUploadWrapper resourceUploader) |
checkAuthorizationToSave, getComponents, getListComponentName, isAuthorized, processItemListaddFacetToMetaItems, extractMetaItems, filter, filterClasses, getContainer, getTemplate, iterateAndAddFacetsToPage, setTemplateonComponentTag, onComponentTagBody, renderHeadnewHeaderPartContainer, renderHeadFromAssociatedMarkupFilegetMarkupType, getWebPage, getWebRequestadd, addOrReplace, autoAdd, autoAdd, contains, findMarkupStream, get, get, getAssociatedMarkupStream, getMarkupStream, hasAssociatedMarkup, internalAdd, isTransparentResolver, iterator, iterator, newMarkupResourceStream, onRender, remove, remove, removeAll, renderAll, renderAssociatedMarkup, renderComponentTagBody, renderNext, replace, setDefaultModel, setMarkupStream, size, swap, toString, toString, visitChildren, visitChildrenadd, addStateChange, afterRender, beforeRender, callOnBeforeRenderIfNotVisible, checkComponentTag, checkComponentTagAttribute, checkHierarchyChange, configure, continueToOriginalDestination, debug, detach, detachBehaviors, detachModel, detachModels, determineVisibility, error, exceptionMessage, fatal, findPage, findParent, findParentWithAssociatedMarkup, getApplication, getBehaviors, getBehaviors, getBehaviorsRawList, getClassRelativePath, getComponentBorder, getConverter, getConverter, getDefaultModel, getDefaultModelObject, getDefaultModelObjectAsString, getDefaultModelObjectAsString, getEscapeModelStrings, getFeedbackMessage, getFlag, getFlag, getId, getInnermostModel, getInnermostModel, getLocale, getLocalizer, getMarkupAttributes, getMarkupId, getMarkupId, getMarkupIdImpl, getMetaData, getModelComparator, getOutputMarkupId, getOutputMarkupPlaceholderTag, getPage, getPageRelativePath, getParent, getPath, getRenderBodyOnly, getRequest, getRequestCycle, getResponse, getSession, getSizeInBytes, getString, getString, getString, getStyle, getVariation, hasBeenRendered, hasErrorMessage, hasFeedbackMessage, info, initModel, internalAttach, internalDetach, internalOnAttach, internalOnDetach, internalOnModelChanged, isActionAuthorized, isAncestorOf, isAttached, isBehaviorAccepted, isEnableAllowed, isEnabled, isEnabledInHierarchy, isIgnoreAttributeModifier, isRenderAllowed, isStateless, isVersioned, isVisibilityAllowed, isVisible, isVisibleInHierarchy, locateMarkupStream, markAttached, markRendering, modelChanged, modelChanging, onAfterRender, onAttach, onBeginRequest, onConfigure, onDetach, onEndRequest, onModelChanged, onModelChanging, onRemove, prepareForRender, prepareForRender, redirectToInterceptPage, remove, remove, render, render, renderComponent, renderComponent, renderComponentTag, rendered, renderPlaceholderTag, replaceComponentTagBody, replaceWith, sameInnermostModel, sameInnermostModel, setAuto, setComponentBorder, setDefaultModelObject, setEnabled, setEscapeModelStrings, setFlag, setFlag, setIgnoreAttributeModifier, setMarkupId, setMarkupIdImpl, setMetaData, setOutputMarkupId, setOutputMarkupPlaceholderTag, setRedirect, setRenderBodyOnly, setResponsePage, setResponsePage, setResponsePage, setVersioned, setVisibilityAllowed, setVisible, urlFor, urlFor, urlFor, urlFor, urlFor, urlFor, visitParents, warn, wrappublic static final String ON_SAVE_EnsureAccessorExistsTransformer
FacetMeta Requires a EnsureAccessorExistsTransformer to be called on save(Serializable, MetaItem, Object)
EnsureAccessorExistsTransformer or a Boolean value.
if its a boolean value it will use the global TemplatePanel.getTemplate().getAccessorExistsTransformer()public EntityDetailsTemplatePanel(String id, org.apache.wicket.model.IModel<T> model, EntityTemplate template, CustomTemplateRenderAdapter<T,org.apache.wicket.model.IModel,org.apache.wicket.Component,org.apache.wicket.MarkupContainer> defaultRenderAdapter)
public void onInitialize()
onInitialize in class TemplatePanel<EntityTemplate<TemplatePanel>,T extends Serializable>public org.apache.wicket.Component getComponentForType(MetaItem metaItem, String fieldComponentName, org.apache.wicket.model.IModel model, org.apache.wicket.MarkupContainer container, T modelObject, User user)
getComponentForType in interface CustomTemplateRenderAdapter<T extends Serializable,org.apache.wicket.model.IModel,org.apache.wicket.Component,org.apache.wicket.MarkupContainer>metaItem - as MetaItemfieldComponentName - as the rendering fieldComponentName or Id (of the component to be created)model - as MODEL of the value extracted from the original modelObject for the MetaItem.
This is a variable that would typically be extracted from the modeObject using the MetaItem,
however there is complex logic that can vary and hence is expected to be provided to this method.container - as CONTAINER_COMPONENT containing the produced componentmodelObject - as the core domain Object/Entityuser - as com.neurosys.security.auth.domain.User for any Authorization related needs @nullable trueProductDetailsTemplatePanel#getComponentForType(MetaItem, String, MODEL, CONTAINER_COMPONENT, com.neurosys.products.domain.Product)protected Object extractFieldValue(Object rawValue, MetaItem metaItemObject)
protected org.apache.wicket.model.IModel getModelForFieldOrAttribute(T modelObject, MetaItem metaItem)
Field or Attributes.
FacetMeta as it is defined by Config in a Template
Serializable and marked JSON. Auto converts them to JSON format. (TODO: Add Unit Test Case for this)
ContentType in #getComponentForType(com.neurosys.content.wicket.pages.panel.TemplatePanel.MetaItem, String, IModel, MarkupContainer)
MetaItem.getFacetMeta() FacetMeta.getCustomItemRenderAdapter() exists then it will skip any conversations as the custom logic is expected to be
provided by the adapter itself.modelObject - metaItem - IModelprotected boolean isSetValueInSameModel(FacetMeta facetMeta, Object value)
CompoundPropertyModel or assigned a new Model
FacetMeta an explicitly opt-out of being part of CompoundPropertyModel by setting FacetMeta.setAssignIndependentModel(Boolean) to false.facetMeta - as FacetMetavalue - as Objectprotected Collection<org.apache.wicket.Component> getComponentsForType(T modelObject, MetaItem metaItem, org.apache.wicket.model.IModel model, org.apache.wicket.MarkupContainer container)
modelObject - of the base/container entitymetaItem - for Componentmodel - for the componentcontainer - this#getComponentForType}protected String getAddToCollectionSectionName(MetaItem metaItemObject)
<wicket:fragment wicket:id="addSection_IMG">protected List getListForCollectionType(T modelObject, MetaItem metaItem)
List to represent the Collection of values to presented to the UI by
#getComponentsForCollectionType(Entity, com.neurosys.content.wicket.pages.panel.TemplatePanel.MetaItem, MarkupContainer)protected Collection<org.apache.wicket.Component> getComponentsForCollectionType(T modelObject, MetaItem metaItem, org.apache.wicket.MarkupContainer container)
protected org.apache.wicket.Component[] getComponents(T modelObject, org.apache.wicket.markup.html.list.ListItem<MetaItem> item)
getComponents in class ListViewTemplatePanel<EntityTemplate<TemplatePanel>,T extends Serializable>modelObject - as Mitem - as ListItempublic FileUploadWrapper getResourceUploader()
public void setResourceUploader(FileUploadWrapper resourceUploader)
public <C extends org.apache.wicket.Component> List<C> getDataRelatedComponents(Class<C> type)
TemplatePanelgetDataRelatedComponents in class TemplatePanel<EntityTemplate<TemplatePanel>,T extends Serializable>type - as Class of Component typeprotected void reorder(List<MetaItem> items)
ListViewTemplatePanelList
reorder in class ListViewTemplatePanel<EntityTemplate<TemplatePanel>,T extends Serializable>protected void onBeforeRender()
onBeforeRender in class org.apache.wicket.Componentprotected boolean getStatelessHint()
getStatelessHint in class org.apache.wicket.Componentpublic Object processItem(T modelObject, MetaItem metaItem, org.apache.wicket.Component coreEntityDataField, User user, Object... contextParams) throws Exception
processItem in interface CustomTemplateRenderAdapter<T extends Serializable,org.apache.wicket.model.IModel,org.apache.wicket.Component,org.apache.wicket.MarkupContainer>modelObject - as the entitymeta - as MetaItemcoreEntityDataField - as Componentuser - as User who is logged incontextParams - as VarargsNothing (nothing). Nothing should not be persisted or used, it implies it should be ignored.Exceptionprotected void save(T entity, MetaItem metaItem, Object value) throws Exception
MetaItem back into the model ObjectExceptionprotected List mergeCollections(List existingValues, List newValues)
Nothing (nothing)
to replace and merge
existingValues - as ListnewValues - as Listpublic T processSubmit(T entity, org.apache.wicket.markup.html.form.Form<T> form) throws Exception
entity; - modelObject that is in a transient state of saving. Data from fields will be set into the modelObject.form - as Form containing the new values from the form submittedExceptionpublic void setResourcePaths(Map<String,String> resourcePaths)
public String getItemRefId(MetaItem metaItem)
CustomTemplateRenderAdapterMetaItemgetItemRefId in interface CustomTemplateRenderAdapter<T extends Serializable,org.apache.wicket.model.IModel,org.apache.wicket.Component,org.apache.wicket.MarkupContainer>metaItem - as MetaItempublic void reset()
CustomTemplateRenderAdapterreset in interface CustomTemplateRenderAdapter<T extends Serializable,org.apache.wicket.model.IModel,org.apache.wicket.Component,org.apache.wicket.MarkupContainer>Copyright © 2018. All rights reserved.