|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.wicket.Component org.apache.wicket.MarkupContainer org.apache.wicket.markup.html.WebMarkupContainer org.apache.wicket.markup.html.internal.Enclosure
public class Enclosure
An Enclosure are automatically created by Wicket. Do not create it yourself. An Enclosure container is created if <wicket:enclosure> is found in the markup. It is meant to solve the following situation. Instead of
<table wicket:id="label-container" class="notify"><tr><td><span wicket:id="label">[[notification]]</span></td></tr></table> WebMarkupContainer container=new WebMarkupContainer("label-container") { public boolean isVisible() { return hasNotification(); } }; add(container); container.add(new Label("label", notificationModel));with Enclosure you are able to do the following:
<wicket:enclosure> <table class="notify"><tr><td><span wicket:id="label">[[notification]]</span></td></tr></table> </wicket:enclosure> add(new Label("label", notificationModel)) { public boolean isVisible() { return hasNotification(); } }Please note that since a transparent auto-component is created for the tag, the markup and the component hierarchy will not be in sync which leads to subtle differences if your code relies on onBeforeRender() and validate() being called for the children inside the enclosure tag. E.g. it might happen that onBeforeRender() and validate() gets called on invisible components. In doubt, please fall back to
EnclosureContainer
.
EnclosureResolver
,
EnclosureHandler
,
EnclosureContainer
,
Serialized FormField Summary |
---|
Fields inherited from class org.apache.wicket.Component |
---|
ENABLE, FLAG_INITIALIZED, FLAG_REMOVING_FROM_HIERARCHY, FLAG_RESERVED1, FLAG_RESERVED2, FLAG_RESERVED3, FLAG_RESERVED4, FLAG_RESERVED5, FLAG_RESERVED8, PATH_SEPARATOR, RENDER |
Constructor Summary | |
---|---|
Enclosure(String id,
CharSequence childId)
Construct. |
Method Summary | |
---|---|
void |
onComponentTagBody(MarkupStream markupStream,
ComponentTag openTag)
Handle the container's body. |
protected void |
onInitialize()
This method is meant to be used as an alternative to initialize components. |
Component |
resolve(MarkupContainer container,
MarkupStream markupStream,
ComponentTag tag)
Try to resolve the tag, then create a component, add it to the container and render it. |
Methods inherited from class org.apache.wicket.markup.html.WebMarkupContainer |
---|
getWebPage, getWebRequest |
Methods inherited from class org.apache.wicket.MarkupContainer |
---|
add, addOrReplace, autoAdd, contains, get, get, getAssociatedMarkup, getAssociatedMarkupStream, getMarkup, getMarkupType, hasAssociatedMarkup, internalAdd, iterator, iterator, onMarkupAttached, onRender, remove, remove, removeAll, renderAll, renderAssociatedMarkup, renderNext, replace, setDefaultModel, size, swap, toString, toString, visitChildren, visitChildren |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Enclosure(String id, CharSequence childId)
id
- childId
- Method Detail |
---|
protected void onInitialize()
Component
Page
thus providing the component with an atomic callback
when the component's environment is built out.
Overrides must call super#Component.onInitialize()
. Usually this should be the first thing an
override does, much like a constructor.
Parent containers are guaranteed to be initialized before their children
It is safe to use Component.getPage()
in this method
NOTE:The timing of this call is not precise, the contract is that it is called sometime
before Component.onBeforeRender()
.
onInitialize
in class Component
public void onComponentTagBody(MarkupStream markupStream, ComponentTag openTag)
MarkupContainer
onComponentTagBody
in class MarkupContainer
markupStream
- The markup streamopenTag
- The open tag for the bodypublic Component resolve(MarkupContainer container, MarkupStream markupStream, ComponentTag tag)
IComponentResolver
resolve
in interface IComponentResolver
container
- The container parsing its markupmarkupStream
- The current markupStreamtag
- The current component tag while parsing the markup
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |