Inheritance
Since our previous definition is abstract, we need to extend it to get a concrete panel definition:
<panel name="/base.page" template="/WEB-INF/jsp/layout/page.jsp"> <panel name="header" template="/WEB-INF/jsp/layout/header.jsp"/> <panel name="menu" template="/WEB-INF/jsp/layout/menu.jsp"/> <panel name="content"/> <panel name="footer" template="/WEB-INF/jsp/layout/footer.jsp"/> </panel> <panel name="/derived.page" super="/base.page"> <panel name="content" template="/WEB-INF/jsp/content/foo.jsp"/> </panel>
The super attribute is used to specify a toplevel panel as a base panel definition. In the above example, the /derived.page panel associates a template with the content subpanel, making it concrete.
Let us examine a slightly more complex example:
<panel name="/base">
<panel name="nested">
<param name="param1" value="p1"/>
<param name="param2" value="p2"/>
<panel name="nested1nested"/>
</param>
</panel>
<panel name="/derived" super="/base" template="/WEB-INF/derived.jsp">
<panel name="nested" template="/WEB-INF/nested1.jsp">
<param name="param1" value="p1"/>
<param name="param2" value="override p2"/>
<param name="param3" value="add p3"/>
</param>
<panel name="nested2" template="/WEB-INF/nested2.jsp"/>
</panel>
<panel name="/concrete" template="/WEB-INF/derived2.jsp">
<panel name="foo" super="/derived">
<panel name="nested">
<panel name="nested1nested" template="/WEB-INF/bar.jsp"/>
<param name="param3" value="override p3"/>
</panel>
</panel>
</panel>
Don't run away! It looks harder than it is... Let's work out what happens here:
- Toplevel panel /base defines an abstract subpanel nested. It is abstract, because it does not specify a template attribute and also, because it has an abstract subpanel nested1nested.
- Panel /derived extends /base and assigns a template value to nested, assigns a value to nested's param1, overrides the param2 parameter and adds the param3 parameter. Finally, it adds nested2, another nested panel. However, /derived is still abstract, because it inherits the abstract nested1nested panel.
- The /concrete panel definition takes a foo subpanel, which is derived from /derived. The foo panel overrides param3. Since it assigns a template attribute to nested1nested, foo is concrete and thus /concrete is concrete.
Got it?


