You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by DCarr <li...@gmail.com> on 2011/01/26 18:13:47 UTC

Class-only inheritance

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: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Class-only inheritance

Posted by DCarr <li...@gmail.com>.
May have been due to some stale built files or a misconfiguration someplace. 
Restarted from scratch in a new project and now works as desired.

Thanks,
DC


DCarr wrote:
> 
> Hm - I'm doing something wrong, then.  The BaseClass.html does not have a
> <wicket:child> in it, and I do get that second error message:
> 
> Caused by: org.apache.wicket.WicketRuntimeException: Expected to find
> <wicket:child/> in base markup 
> 
> This is wicket 1.4.6.
> 
> If I turn on debug, I do get this just before the MarkupNotFoundException
> exception:
> 
> -DEBUG::26 Jan 2011 08:46:58.964::org.apache.wicket.markup.MergedMarkup:
> Merge markup: derived markup: DerivedClass1.html; base markup:
> BaseClass.html
> 
> but never get the list of all filenames tried.
> 
> I'll try a simple test case and see if I can spot anything.
> 
> Thanks for the speedy reply,
> DC.
> 
> 
> Igor Vaynberg-2 wrote:
>> 
>> 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 <li...@gmail.com> 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 )
>>>        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: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>> 
>> 
>> 
> 
> 

-- 
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Re-Class-only-inheritance-tp3238455p3239026.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Class-only inheritance

Posted by DCarr <li...@gmail.com>.
Hm - I'm doing something wrong, then.  The BaseClass.html does not have a
<wicket:child> in it, and I do get that second error message:

Caused by: org.apache.wicket.WicketRuntimeException: Expected to find
<wicket:child/> in base markup 

This is wicket 1.4.6.

If I turn on debug, I do get this just before the MarkupNotFoundException
exception:

-DEBUG::26 Jan 2011 08:46:58.964::org.apache.wicket.markup.MergedMarkup:
Merge markup: derived markup: DerivedClass1.html; base markup:
BaseClass.html

but never get the list of all filenames tried.

I'll try a simple test case and see if I can spot anything.

Thanks for the speedy reply,
DC.


Igor Vaynberg-2 wrote:
> 
> 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 <li...@gmail.com> 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 )
>>        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: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 
> 
> 

-- 
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Re-Class-only-inheritance-tp3238455p3238625.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Class-only inheritance

Posted by Igor Vaynberg <ig...@gmail.com>.
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 <li...@gmail.com> 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: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org