public class ProductDetailsTemplatePanel<P extends Product> extends ListViewTemplatePanel<ProductTemplate<TemplatePanel>,P> implements CustomTemplateRenderAdapter<P,org.apache.wicket.model.IModel,org.apache.wicket.Component,org.apache.wicket.MarkupContainer>, IAdminPanel
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.VisibilityChange
CustomTemplateRenderAdapter.Nothing
Modifier and Type | Field and Description |
---|---|
static String |
PRODUCT_NAME_CLEAN_REGEX |
authorizationModule
template
ENABLE, 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, RENDER
nothing
Constructor and Description |
---|
ProductDetailsTemplatePanel(String id,
org.apache.wicket.model.IModel<P> model,
ProductTemplate template) |
ProductDetailsTemplatePanel(String id,
org.apache.wicket.model.IModel<P> model,
Template template,
CustomTemplateRenderAdapter<P,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,
P modelObject,
User user) |
protected org.apache.wicket.Component[] |
getComponents(P 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(P modelObject,
MetaItem metaItem,
org.apache.wicket.MarkupContainer container) |
protected Collection<org.apache.wicket.Component> |
getComponentsForType(P 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(P modelObject,
MetaItem metaItem)
Get a
List to represent the Collection of values to presented to the UI by
#getComponentsForCollectionType(Product, com.neurosys.content.wicket.pages.panel.TemplatePanel.MetaItem, MarkupContainer) |
protected org.apache.wicket.model.IModel |
getModelForFieldOrAttribute(P modelObject,
MetaItem metaItem)
get the value from the
Field or Attributes . |
Map<String,String> |
getResourceLocationMap(P parentProduct) |
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() |
Object |
processItem(P product,
MetaItem metaItem,
org.apache.wicket.Component coreProductDataField,
User user,
Object... contextParams)
For each meta item handle processing on submit and derive the value to be submitted/persisted back
|
void |
processSubmit(P product,
org.apache.wicket.markup.html.form.Form<P> form,
P parentProduct)
Intended for processing of the part of the data thats generated by this panel only.
Elements belonging to this panel must update the product object 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(P product,
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, processItemList
addFacetToMetaItems, extractMetaItems, filter, filterClasses, getContainer, getTemplate, iterateAndAddFacetsToPage, onInitialize, setTemplate
onComponentTag, onComponentTagBody, renderHead
newHeaderPartContainer, renderHeadFromAssociatedMarkupFile
getMarkupType, getWebPage, getWebRequest
add, 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, visitChildren
add, 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, wrap
public static final String PRODUCT_NAME_CLEAN_REGEX
public ProductDetailsTemplatePanel(String id, org.apache.wicket.model.IModel<P> model, Template template, CustomTemplateRenderAdapter<P,org.apache.wicket.model.IModel,org.apache.wicket.Component,org.apache.wicket.MarkupContainer> defaultRenderAdapter)
public ProductDetailsTemplatePanel(String id, org.apache.wicket.model.IModel<P> model, ProductTemplate template)
public org.apache.wicket.Component getComponentForType(MetaItem metaItem, String fieldComponentName, org.apache.wicket.model.IModel model, org.apache.wicket.MarkupContainer container, P modelObject, User user)
getComponentForType
in interface CustomTemplateRenderAdapter<P extends Product,org.apache.wicket.model.IModel,org.apache.wicket.Component,org.apache.wicket.MarkupContainer>
metaItem
- as MetaItem
fieldComponentName
- 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(P 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
- IModel
protected 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 FacetMeta
value
- as Objectprotected Collection<org.apache.wicket.Component> getComponentsForType(P modelObject, MetaItem metaItem, org.apache.wicket.model.IModel model, org.apache.wicket.MarkupContainer container)
modelObject
- metaItem
- model
- container
- this#getComponentForType}
protected String getAddToCollectionSectionName(MetaItem metaItemObject)
<wicket:fragment wicket:id="addSection_IMG">
protected List getListForCollectionType(P modelObject, MetaItem metaItem)
List
to represent the Collection of values to presented to the UI by
#getComponentsForCollectionType(Product, com.neurosys.content.wicket.pages.panel.TemplatePanel.MetaItem, MarkupContainer)
protected Collection<org.apache.wicket.Component> getComponentsForCollectionType(P modelObject, MetaItem metaItem, org.apache.wicket.MarkupContainer container)
protected org.apache.wicket.Component[] getComponents(P modelObject, org.apache.wicket.markup.html.list.ListItem<MetaItem> item)
getComponents
in class ListViewTemplatePanel<ProductTemplate<TemplatePanel>,P extends Product>
modelObject
- as Mitem
- as ListItem
public FileUploadWrapper getResourceUploader()
public void setResourceUploader(FileUploadWrapper resourceUploader)
public <C extends org.apache.wicket.Component> List<C> getDataRelatedComponents(Class<C> type)
TemplatePanel
getDataRelatedComponents
in class TemplatePanel<ProductTemplate<TemplatePanel>,P extends Product>
type
- as Class of Component
typeprotected void reorder(List<MetaItem> items)
ListViewTemplatePanel
List
reorder
in class ListViewTemplatePanel<ProductTemplate<TemplatePanel>,P extends Product>
protected void onBeforeRender()
onBeforeRender
in class org.apache.wicket.Component
protected boolean getStatelessHint()
getStatelessHint
in class org.apache.wicket.Component
public Map<String,String> getResourceLocationMap(P parentProduct)
product
- as Ptemplate
- as ProductTemplate
Map
of combined attribute/field name and the folder where the resource should gopublic Object processItem(P product, MetaItem metaItem, org.apache.wicket.Component coreProductDataField, User user, Object... contextParams) throws Exception
processItem
in interface CustomTemplateRenderAdapter<P extends Product,org.apache.wicket.model.IModel,org.apache.wicket.Component,org.apache.wicket.MarkupContainer>
product
- meta
- resourceLocationMap
- item
- Nothing
(nothing). Nothing should not be persisted or used, it implies it should be ignored.Exception
protected void save(P product, MetaItem metaItem, Object value) throws Exception
MetaItem
back into the model ObjectException
protected List mergeCollections(List existingValues, List newValues)
Nothing
(nothing)
to replace and merge
existingValues
- as ListnewValues
- as Listpublic void processSubmit(P product, org.apache.wicket.markup.html.form.Form<P> form, P parentProduct) throws Exception
product
- as P; a product object that is in a transient state of saving.form
- as Form
containing the new values from the form submittedparentProduct
- as P; if null then product is usedException
public void setResourcePaths(Map<String,String> resourcePaths)
public String getItemRefId(MetaItem metaItem)
CustomTemplateRenderAdapter
MetaItem
getItemRefId
in interface CustomTemplateRenderAdapter<P extends Product,org.apache.wicket.model.IModel,org.apache.wicket.Component,org.apache.wicket.MarkupContainer>
metaItem
- as MetaItem
public void reset()
CustomTemplateRenderAdapter
reset
in interface CustomTemplateRenderAdapter<P extends Product,org.apache.wicket.model.IModel,org.apache.wicket.Component,org.apache.wicket.MarkupContainer>
Copyright © 2018. All rights reserved.