|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.wicket.markup.resolver.ScopedComponentResolver
public class ScopedComponentResolver
Implement a component resolver which walks up the component tree until a Page or Panel and tries to find a component with a matching wicket id, effectively providing something like scoping for wicket id resolution.
Note: This resolver is not activated by default. It has to be added by means of
Application.getComponentResolvers().add(new InheritComponentResolver())
to be activated.
.
Example:
MyPage() { add(new Label("hidden-by-cont1", "hidden")); add(new Label("global", "can be everywhere")); //the interesting case WebMarkupContainer cont1 = new WebMarkupContainer("cont1"); add(cont1); cont1.add(new Label("hidden-by-cont1", "cont1 hides")); cont1.add(new Label("same-id", "cont1 same-id")); WebMarkupContainer cont2 = new WebMarkupContainer("cont2"); add(cont2); cont2.add(new Label("same-id", "cont2 same-id")); }
HTML: <html> <body> <span wicket:id="hidden-by-cont1">Prints: hidden</span> <div wicket:id="cont1"> <span wicket:id="hidden-by-cont1">Prints: cont1 hides</span> <span wicket:id="same-id">Prints: cont1 same-id</span> </div> <div wicket:id="cont2"> <span wicket:id="global">Prints: can be everywhere</span> <span wicket:id="same-id">Prints: cont2 same-id</span> </div>So you can use the same ids in the same page. If the containing containers are not in the same hierarchy-line nothing changes. A comp with the same id hides the one of the parent-container with the same id.
MarkupContainer.isTransparentResolver()
,
ParentResolver
,
Serialized FormConstructor Summary | |
---|---|
ScopedComponentResolver()
Construct. |
Method Summary | |
---|---|
boolean |
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 java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ScopedComponentResolver()
Method Detail |
---|
public boolean 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
IComponentResolver.resolve(org.apache.wicket.MarkupContainer,
org.apache.wicket.markup.MarkupStream, org.apache.wicket.markup.ComponentTag)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |