public class CustomItemComponentRenderAdapter extends Object implements Serializable
MetaItem
could be rendered in ProductDetailsTemplatePanel
FacetMeta
definitions are Singleton's.modelTransformer
, #lookup
etc are all and should be stateless.Modifier and Type | Class and Description |
---|---|
protected class |
CustomItemComponentRenderAdapter.ContextualTwoWayTransformer
Some
TwoWayTransformer may need additional context, can use this to supply context. |
Modifier and Type | Field and Description |
---|---|
protected AuthorizationModule<Void> |
authorizationModule |
protected org.apache.commons.collections.Transformer |
modelTransformer
An OPTIONAL
Transformer or a TwoWayTransformer that knows how to Marshal the data model to presentation, and
in the case of a TwoWayTransformer then back from presentation to Data model. |
Constructor and Description |
---|
CustomItemComponentRenderAdapter() |
CustomItemComponentRenderAdapter(CustomItemComponentRenderAdapter t) |
Modifier and Type | Method and Description |
---|---|
protected org.apache.wicket.Component |
filter(org.apache.wicket.Component c,
MetaItem mi,
User user)
Apply
Authorization etc |
org.apache.wicket.Component |
getComponent(String componentId,
MetaItem metaItem,
org.apache.wicket.model.IModel rawModel,
Object modelObject,
User user)
Some fields/attribute may require display of options
for selection or Auto-Suggest etc..
|
List |
getDataList(Object rawLookup,
MetaItem metaItem,
Object modelObject)
Provides Lookup Data Model for {
#getLookupComponent(com.neurosys.content.wicket.pages.panel.TemplatePanel.MetaItem) |
protected Object |
getLookup(MetaItem metaItem) |
org.apache.commons.collections.Transformer |
getModelTransformer()
An OPTIONAL
Transformer or a TwoWayTransformer that knows how to Marshal the data model to presentation, and
in the case of a TwoWayTransformer then back from presentation to Data model. |
protected void |
markComponentReadOnly(org.apache.wicket.Component c) |
Object |
processSubmit(MetaItem metaItem,
org.apache.wicket.Component fieldEntityComponent,
Object value,
User user)
Call on submit of component.
|
void |
setModelTransformer(org.apache.commons.collections.Transformer modelTransformer)
An OPTIONAL
Transformer or a TwoWayTransformer that knows how to Marshal the data model to presentation, and
in the case of a TwoWayTransformer then back from presentation to Data model. |
protected org.apache.wicket.model.IModel |
translateCurrentSelectionModel(org.apache.wicket.model.IModel defaultModel,
Object modelObject,
MetaItem metaItem)
Helper method:
The Object model may not be the type expected by the component type defined in this Adapter, so provide a conversion from raw data to desired UI type. |
protected transient org.apache.commons.collections.Transformer modelTransformer
Transformer
or a TwoWayTransformer
that knows how to Marshal the data model to presentation, and
in the case of a TwoWayTransformer
then back from presentation to Data model.
Transformer
s to re-model it and pass it on to the final rendering component/widget.
Transformer
ation from the String to a genuine Collection
data structure.protected AuthorizationModule<Void> authorizationModule
public CustomItemComponentRenderAdapter()
public CustomItemComponentRenderAdapter(CustomItemComponentRenderAdapter t)
public List getDataList(Object rawLookup, MetaItem metaItem, Object modelObject)
#getLookupComponent(com.neurosys.content.wicket.pages.panel.TemplatePanel.MetaItem)
public org.apache.wicket.Component getComponent(String componentId, MetaItem metaItem, org.apache.wicket.model.IModel rawModel, Object modelObject, User user)
HiddenField
componentId
- as Sting id for the ComponentmetaItem
- as MetaItem meta data for rendering logicrawModel
- is the current data defined in a IModel
for the MetaItem.
The resultant model in the returned Component may NOT be same as the one passed to the inner component, hence always use the derived one.
This is because there maybe a mismatch in the form of core/raw data and one required for final presentation.
For example the input maybe a Comma Separated list of Strings, however for presentation in a List box we may convert the Model to a ListModel.modelObject
- as Object, that represents the main Entity (overall context)user
- as com.neurosys.security.auth.domain.User for any Authorization related needs @nullable trueprotected org.apache.wicket.model.IModel translateCurrentSelectionModel(org.apache.wicket.model.IModel defaultModel, Object modelObject, MetaItem metaItem)
getModelTransformer()
if it finds one
or else it will return the original IModel
passed.
defaultModel
- of the componentmodelObject
- of the container entitymetaItem
- as MetaItem
DefaultWicketTemplateRenderAdapter#validateAndTransform} and the use of {@link TwoWayTransformer} on how the Model is Transformed back during submission.
Provide any translation here.
public Object processSubmit(MetaItem metaItem, org.apache.wicket.Component fieldEntityComponent, Object value, User user)
modelTransformer
is a TwoWayTransformer
then this method can be skipped.metaItem
- as MetaItem
fieldEntityComponent
- as Component
, the same component that the RenderAdapter created in getComponent(String, MetaItem, IModel, Object, User)
value
- as Objectuser
- as Userpublic org.apache.commons.collections.Transformer getModelTransformer()
Transformer
or a TwoWayTransformer
that knows how to Marshal the data model to presentation, and
in the case of a TwoWayTransformer
then back from presentation to Data model.
Transformer
s to re-model it and pass it on to the final rendering component/widget.
Transformer
ation from the String to a genuine Collection
data structure.public void setModelTransformer(org.apache.commons.collections.Transformer modelTransformer)
Transformer
or a TwoWayTransformer
that knows how to Marshal the data model to presentation, and
in the case of a TwoWayTransformer
then back from presentation to Data model.
Transformer
s to re-model it and pass it on to the final rendering component/widget.
Transformer
ation from the String to a genuine Collection
data structure.protected void markComponentReadOnly(org.apache.wicket.Component c)
protected org.apache.wicket.Component filter(org.apache.wicket.Component c, MetaItem mi, User user)
Authorization
etcCopyright © 2018. All rights reserved.