Inheritance
As mentioned before, a panel may explicitly extend a toplevel panel by specifying the super attribute. A derived panel extends its base panel in the following ways:
- An attribute that appears in the derived panel overrides an attribute in the base panel with the same name.
- A parameter that appears in the derived panel overrides a parameter in the base panel with the same name.
- A list that appears in the derived panel overrides a list in the base panel with the same name.
- Attributes, parameters, lists and subpanels, that are omitted in the derived panel, are inherited from the base panel.
- A derived panel may specify attributes, add lists, parameters and subpanels, that do not appear in the base definition.
- Subpanels of the derived panel implicitly extend their counterparts (subpanels with the same name) in the base panel; all rules apply to them as well.
During instantiation, these rules are to be applied when resolving attributes, subpanels, parameters and lists in the current panel.
Let us examine an example to make this clear:
<panel name="/base">
<panel name="nested">
<param name="param1"/>
<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. Furthermore, the nested subpanel contains the undefined parameter param1.
- Panel /derived extends /base and assigns a template value to subpanel nested, defines a value for 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.


