public abstract class TemplatePanel<T extends Template<TemplatePanel>,M extends Serializable> extends org.apache.wicket.markup.html.panel.Panel implements ContentPanel
Template to create the UI component for the template.
TemplatePage this can be used @ a component level and represent any MODEL type
that is processed by the Templating engine to produce the Panel
TODO: Control visibility of certain fields (for Authorization/Security etc)| Constructor and Description |
|---|
TemplatePanel(String id,
org.apache.wicket.model.IModel<M> model,
T template) |
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
addFacetToMetaItems(FacetMeta facet,
Map<String,Field> fieldMap,
ContentType... filterContentType)
Determine which fields/FacetMeta will render and be processed
|
protected List<MetaItem> |
extractMetaItems(M modelObject,
Collection<? extends FacetMeta> facets,
ContentType... filterContentType)
Get template attributes + Fields that satisfy
filter(Map, Serializable)
In addition { filter(Map, Serializable) |
protected void |
filter(Map<String,Field> fieldMap,
M modelObject)
Apply Filter.
By Default filter any Field that matches the default set of types defined by filterClasses() & those that have Type annotation. |
protected Class[] |
filterClasses()
Return all the types from the main model & parents that are eligible for rendering
By default this impl includes primitive types, String, Double, Float, Character, Integer, Boolean and Serializable
All should be Serializable types |
protected abstract org.apache.wicket.Component[] |
getComponents(M modelObject,
MetaItem item)
Called by and added to page my processItemList().
An entity can define native field UI support using Type. |
protected org.apache.wicket.MarkupContainer |
getContainer()
By default the container for all the elements added to this component
|
abstract <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.
|
T |
getTemplate() |
protected boolean |
isAuthorized(FacetMeta facet,
Map<String,Field> fieldMap,
ContentType... filterContentType) |
protected void |
iterateAndAddFacetsToPage(org.apache.wicket.MarkupContainer container,
M modelObject,
Collection<? extends FacetMeta> facets)
Iterates over the collection of ? extends
FacetMetas and adds them to the TemplatePanel. |
void |
onInitialize() |
protected void |
processItemList(org.apache.wicket.MarkupContainer container,
M modelObject,
List<MetaItem> items)
A list sorting, pre-processing, filtering etc can be performed here.
|
void |
setTemplate(T template) |
onComponentTag, 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, getStatelessHint, 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, onBeforeRender, 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, wrapprotected T extends Template<TemplatePanel> template
public void onInitialize()
onInitialize in class org.apache.wicket.Componentprotected boolean isAuthorized(FacetMeta facet, Map<String,Field> fieldMap, ContentType... filterContentType)
protected boolean addFacetToMetaItems(FacetMeta facet, Map<String,Field> fieldMap, ContentType... filterContentType)
facet - as FacetMetafieldMap - as MapfilterContentType - as ContentType to accept onlyprotected List<MetaItem> extractMetaItems(M modelObject, Collection<? extends FacetMeta> facets, ContentType... filterContentType)
filter(Map, Serializable)
filter(Map, Serializable)modelObject - as Mfacets - as Collection of FacetMetaList of MetaItemprotected void iterateAndAddFacetsToPage(org.apache.wicket.MarkupContainer container,
M modelObject,
Collection<? extends FacetMeta> facets)
FacetMetas and adds them to the TemplatePanel.
onInitialize() method.Locale & ContentContext can be derived by the
Component.getLocale() & #getPageContext() methods.container - @nullable true (if not null then it adds facets to specified container, else it adds to the page directly)M - as model objectfacets - as Collection of ? extends FacetMetaprotected void filter(Map<String,Field> fieldMap, M modelObject)
filterClasses() & those that have Type annotation.fieldMap - as Map for local reference (shared map)modelObject - protected Class[] filterClasses()
Serializable
Serializable typesprotected void processItemList(org.apache.wicket.MarkupContainer container,
M modelObject,
List<MetaItem> items)
container - @nullable false (expects a valid container from iterateAndAddFacetsToPage(MarkupContainer, Serializable, Collection))M - as model objectList - of MetaItemitems - protected abstract org.apache.wicket.Component[] getComponents(M modelObject, MetaItem item)
Type.
All fields that are annotated with this will be processed also by this method. If a Facet and field share the same name then both will not be null.
M - as Model Objectitem - as MetaItemprotected org.apache.wicket.MarkupContainer getContainer()
MarkupContainerpublic abstract <C extends org.apache.wicket.Component> List<C> getDataRelatedComponents(Class<C> type)
type - as Class of Component typepublic T getTemplate()
public void setTemplate(T template)
Copyright © 2018. All rights reserved.