if your DerivedClass1.java does not have markup and your BaseClass.html does not have a wicket:child tag then DerivedClass1 will use BaseClass' markup. so it should already work as you want, just remove wicket:child tag.
-igor On Wed, Jan 26, 2011 at 9:13 AM, DCarr <[email protected]> wrote: > Hi, > > Is it possible to have class inheritance without markup inheritance? > > I would like a wicket-aware base class (with an associated markup file) > with derived classes supplying data (e.g.. BaseClass with an 'abstract > protected String getName()') and no markup files (or XML files). I know how > to do that if the derived classes have markup and the base class markup has > <wicket:child>, but cannot not figure out if it can be done without the > child markup. > > So: > > BaseClass.java (with abstract protected String getName(), and add(new > Label("name", getName()));) > BaseClass.html (with a <span wicket:id="name"></span>) > BaseClass.xml > > and the derived classes which extend BaseClass: > > DerivedClass1.java (with protected String getName() { return > "Class1";}) > DerivedClass2.java (with protected String getName() { return > "Class2";}) > > Currently, Wicket is trying to apply markup inheritance, but since I > don't have the markup for the derived classes I get: > > org.apache.wicket.markup.MarkupNotFoundException: Markup of type 'html' for > component 'com.xxxxx.DerivedClass1' not found. Enable debug messages for > org.apache.wicket.util.resource to get a list of all filenames tried: > > and > > Caused by: org.apache.wicket.WicketRuntimeException: Expected to find > <wicket:child/> in base markup > > As a work around I can create a data supplier interface, implement the > equivalent of the two derived classes and pass those in to my BaseClass, but > the derived classes are simpler. > > Thanks, > DC > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
