Yes Stefan, I would think that would be a better approach to use a new set of 
tags. It also allows you to choose more correct naming (because inheritance 
isn't actually a parent/child relationship so the word child just confuses the 
issue).

Maybe wicket:abstract in the base and wicket:implements (nice - thanks to 
whoever suggested that) or wicket:override in the derived (extended) markup.

I think using IDs up front would also be great, if not necessary, because in 
Java as would probably occur in wicket mark up, you can have intermediate 
classes that don't implement all abstract methods in a base class. Without IDs 
you won't know exactly which abstract method an intermediate class is 
implementing.

This example hopefully demonstrates what I mean:

Base
----
<wicket:abstract id=header />
<wicket:abstract id=body />

PumpsBase
---------
<wicket:implements id=header>
        A header for all pages to do with pumps
</wicket:implements>

Note: no body implemented here - deferred until a more specialized 
class/markups: WaterPumpsBase and OilPumpsBase

WaterPumpBase
-------------
Note: no header implemented here - the general PumpsBase one suffices for all 
pumps pages

<wicket:implements id=body>
        A body discussing water pumps
</wicket:implements>


OilPumpBase
-----------
Note: no header implemented here - the general PumpsBase one suffices for all 
pumps pages

<wicket:implements id=body>
        A body discussing oil pumps
</wicket:implements>


I think the tag pairs abstract/implements flow much better from an OO 
perspective than child/extends. It hurts my brain way to much to think of a 
base class as a child.

Wouldn't this essentially be the same as using <wicket:panel id="header"/> and using WebMarkupContainers on the java side?
I.e.:

Base
----
<wicket:panel id=header />
<wicket:panel id=body />

PumpsBase
---------
<wicket:panel id=header>
   A header for all pages to do with pumps
</wicket:panel>

Note: no body implemented here - deferred until a more specialized class/markups: WaterPumpsBase and OilPumpsBase

WaterPumpBase
-------------
Note: no header implemented here - the general PumpsBase one suffices for all pumps pages

<wicket:panel id=body>
   A body discussing water pumps
</wicket:panel>


OilPumpBase
-----------
Note: no header implemented here - the general PumpsBase one suffices for all pumps pages

<wicket:panel id=body>
   A body discussing oil pumps
</wicket:panel>

On the java side you'd have to addOrReplace(new WebMarkupContainer("header")) but it's essentially the same. Or am I missing some point?

I think the power of wicket lies in its component-based approach and not (necessarily) in its OO features.

Matthijs

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to