You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Ryan McKinley <ry...@gmail.com> on 2009/04/03 07:47:53 UTC

panel wicket:extend confusion

I have been using markup inheritance for page layout for a while  
without any issue.

I just tried to use it for a Panel and am running into some issues --  
I imagine it is user error, so i figured I would ask here before  
banging my head much longer.

I have two classes:


SimpleRow.java
public class SimpleRow extends Panel
{
   public SimpleRow(String id )
   {
     ...
    }
}

SimpleRow.html
<table>
<wicket:panel>

<tr valign="top">
  <td width="60">
    <img wicket:id="img" src="img/explore.gif" />
  </td>
  <td wicket:id="td" valign="top">
    <h2 wicket:id="title">Title</h2>
    <wicket:child/>
  </td>
</tr>

</wicket:panel>
</table>

- - - - - - - - - -

Then I want a subclass to fill in content for <wicket:child/>

ExportRow.java
public class ExportRow extends SimpleRow
{
   public ExportRow(String id)
   {
     super( id );

     add( new Label( "test", "hello" ) );
   }
}

ExportRow.html
<wicket:extend>
Here is some text <span wicket:id="test">xxx</span>
</wicket:extend>

- - - - - -  -

With this, I get an errror:
Unable to find component with id 'test' in [MarkupContainer [Component  
id = _extend8]] ...

If I do not try to add any components in the subclass, things behave  
as I would expect.

Am I missing something?

Thanks
ryan



Re: panel wicket:extend confusion

Posted by Martijn Dashorst <ma...@gmail.com>.
On Fri, Apr 3, 2009 at 2:02 PM, Ryan McKinley <ry...@gmail.com> wrote:
> aaah.
>
> I take it a Page is automatically marked as a transparent resolver -- how do

No. You add components directly to the page. this.add(...) remember?

> I mark a Panel as a transparent resolver?
>
> I'll add the solution to:
> http://cwiki.apache.org/WICKET/markup-inheritance.html
>
> for the next guy!
>
>
> On Apr 3, 2009, at 3:42 AM, Martijn Dashorst wrote:
>
>> You don't add the child to the right component: you have wrapped the
>> <child/> tag inside a markup container. You have to make the markup
>> container a transparent resolver, *or* add the child components to the
>> markup container.
>>
>> Martijn
>>
>> On Fri, Apr 3, 2009 at 7:47 AM, Ryan McKinley <ry...@gmail.com> wrote:
>>>
>>> I have been using markup inheritance for page layout for a while without
>>> any
>>> issue.
>>>
>>> I just tried to use it for a Panel and am running into some issues -- I
>>> imagine it is user error, so i figured I would ask here before banging my
>>> head much longer.
>>>
>>> I have two classes:
>>>
>>>
>>> SimpleRow.java
>>> public class SimpleRow extends Panel
>>> {
>>>  public SimpleRow(String id )
>>>  {
>>>   ...
>>>  }
>>> }
>>>
>>> SimpleRow.html
>>> <table>
>>> <wicket:panel>
>>>
>>> <tr valign="top">
>>>  <td width="60">
>>>  <img wicket:id="img" src="img/explore.gif" />
>>>  </td>
>>>  <td wicket:id="td" valign="top">
>>>  <h2 wicket:id="title">Title</h2>
>>>  <wicket:child/>
>>>  </td>
>>> </tr>
>>>
>>> </wicket:panel>
>>> </table>
>>>
>>> - - - - - - - - - -
>>>
>>> Then I want a subclass to fill in content for <wicket:child/>
>>>
>>> ExportRow.java
>>> public class ExportRow extends SimpleRow
>>> {
>>>  public ExportRow(String id)
>>>  {
>>>   super( id );
>>>
>>>   add( new Label( "test", "hello" ) );
>>>  }
>>> }
>>>
>>> ExportRow.html
>>> <wicket:extend>
>>> Here is some text <span wicket:id="test">xxx</span>
>>> </wicket:extend>
>>>
>>> - - - - - -  -
>>>
>>> With this, I get an errror:
>>> Unable to find component with id 'test' in [MarkupContainer [Component id
>>> =
>>> _extend8]] ...
>>>
>>> If I do not try to add any components in the subclass, things behave as I
>>> would expect.
>>>
>>> Am I missing something?
>>>
>>> Thanks
>>> ryan
>>>
>>>
>>>
>>
>>
>>
>> --
>> Become a Wicket expert, learn from the best: http://wicketinaction.com
>> Apache Wicket 1.3.5 is released
>> Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.
>>
>> ---------------------------------------------------------------------
>> 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
>
>



-- 
Become a Wicket expert, learn from the best: http://wicketinaction.com
Apache Wicket 1.3.5 is released
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.

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


Re: panel wicket:extend confusion

Posted by Serkan Camurcuoglu <Se...@telenity.com>.
AFAIK you should override isTransparentResolver and return true..



Ryan McKinley wrote:
> aaah.
>
> I take it a Page is automatically marked as a transparent resolver -- 
> how do I mark a Panel as a transparent resolver?
>
> I'll add the solution to:
> http://cwiki.apache.org/WICKET/markup-inheritance.html
>
> for the next guy!
>
>
> On Apr 3, 2009, at 3:42 AM, Martijn Dashorst wrote:
>
>> You don't add the child to the right component: you have wrapped the
>> <child/> tag inside a markup container. You have to make the markup
>> container a transparent resolver, *or* add the child components to the
>> markup container.
>>
>> Martijn
>>
>> On Fri, Apr 3, 2009 at 7:47 AM, Ryan McKinley <ry...@gmail.com> wrote:
>>> I have been using markup inheritance for page layout for a while 
>>> without any
>>> issue.
>>>
>>> I just tried to use it for a Panel and am running into some issues -- I
>>> imagine it is user error, so i figured I would ask here before 
>>> banging my
>>> head much longer.
>>>
>>> I have two classes:
>>>
>>>
>>> SimpleRow.java
>>> public class SimpleRow extends Panel
>>> {
>>>  public SimpleRow(String id )
>>>  {
>>>    ...
>>>   }
>>> }
>>>
>>> SimpleRow.html
>>> <table>
>>> <wicket:panel>
>>>
>>> <tr valign="top">
>>>  <td width="60">
>>>   <img wicket:id="img" src="img/explore.gif" />
>>>  </td>
>>>  <td wicket:id="td" valign="top">
>>>   <h2 wicket:id="title">Title</h2>
>>>   <wicket:child/>
>>>  </td>
>>> </tr>
>>>
>>> </wicket:panel>
>>> </table>
>>>
>>> - - - - - - - - - -
>>>
>>> Then I want a subclass to fill in content for <wicket:child/>
>>>
>>> ExportRow.java
>>> public class ExportRow extends SimpleRow
>>> {
>>>  public ExportRow(String id)
>>>  {
>>>    super( id );
>>>
>>>    add( new Label( "test", "hello" ) );
>>>  }
>>> }
>>>
>>> ExportRow.html
>>> <wicket:extend>
>>> Here is some text <span wicket:id="test">xxx</span>
>>> </wicket:extend>
>>>
>>> - - - - - -  -
>>>
>>> With this, I get an errror:
>>> Unable to find component with id 'test' in [MarkupContainer 
>>> [Component id =
>>> _extend8]] ...
>>>
>>> If I do not try to add any components in the subclass, things behave 
>>> as I
>>> would expect.
>>>
>>> Am I missing something?
>>>
>>> Thanks
>>> ryan
>>>
>>>
>>>
>>
>>
>>
>> -- 
>> Become a Wicket expert, learn from the best: http://wicketinaction.com
>> Apache Wicket 1.3.5 is released
>> Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.
>>
>> ---------------------------------------------------------------------
>> 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
>
>


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


Re: panel wicket:extend confusion

Posted by Ryan McKinley <ry...@gmail.com>.
aaah.

I take it a Page is automatically marked as a transparent resolver --  
how do I mark a Panel as a transparent resolver?

I'll add the solution to:
http://cwiki.apache.org/WICKET/markup-inheritance.html

for the next guy!


On Apr 3, 2009, at 3:42 AM, Martijn Dashorst wrote:

> You don't add the child to the right component: you have wrapped the
> <child/> tag inside a markup container. You have to make the markup
> container a transparent resolver, *or* add the child components to the
> markup container.
>
> Martijn
>
> On Fri, Apr 3, 2009 at 7:47 AM, Ryan McKinley <ry...@gmail.com>  
> wrote:
>> I have been using markup inheritance for page layout for a while  
>> without any
>> issue.
>>
>> I just tried to use it for a Panel and am running into some issues  
>> -- I
>> imagine it is user error, so i figured I would ask here before  
>> banging my
>> head much longer.
>>
>> I have two classes:
>>
>>
>> SimpleRow.java
>> public class SimpleRow extends Panel
>> {
>>  public SimpleRow(String id )
>>  {
>>    ...
>>   }
>> }
>>
>> SimpleRow.html
>> <table>
>> <wicket:panel>
>>
>> <tr valign="top">
>>  <td width="60">
>>   <img wicket:id="img" src="img/explore.gif" />
>>  </td>
>>  <td wicket:id="td" valign="top">
>>   <h2 wicket:id="title">Title</h2>
>>   <wicket:child/>
>>  </td>
>> </tr>
>>
>> </wicket:panel>
>> </table>
>>
>> - - - - - - - - - -
>>
>> Then I want a subclass to fill in content for <wicket:child/>
>>
>> ExportRow.java
>> public class ExportRow extends SimpleRow
>> {
>>  public ExportRow(String id)
>>  {
>>    super( id );
>>
>>    add( new Label( "test", "hello" ) );
>>  }
>> }
>>
>> ExportRow.html
>> <wicket:extend>
>> Here is some text <span wicket:id="test">xxx</span>
>> </wicket:extend>
>>
>> - - - - - -  -
>>
>> With this, I get an errror:
>> Unable to find component with id 'test' in [MarkupContainer  
>> [Component id =
>> _extend8]] ...
>>
>> If I do not try to add any components in the subclass, things  
>> behave as I
>> would expect.
>>
>> Am I missing something?
>>
>> Thanks
>> ryan
>>
>>
>>
>
>
>
> -- 
> Become a Wicket expert, learn from the best: http://wicketinaction.com
> Apache Wicket 1.3.5 is released
> Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.
>
> ---------------------------------------------------------------------
> 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


Re: panel wicket:extend confusion

Posted by Martijn Dashorst <ma...@gmail.com>.
You don't add the child to the right component: you have wrapped the
<child/> tag inside a markup container. You have to make the markup
container a transparent resolver, *or* add the child components to the
markup container.

Martijn

On Fri, Apr 3, 2009 at 7:47 AM, Ryan McKinley <ry...@gmail.com> wrote:
> I have been using markup inheritance for page layout for a while without any
> issue.
>
> I just tried to use it for a Panel and am running into some issues -- I
> imagine it is user error, so i figured I would ask here before banging my
> head much longer.
>
> I have two classes:
>
>
> SimpleRow.java
> public class SimpleRow extends Panel
> {
>  public SimpleRow(String id )
>  {
>    ...
>   }
> }
>
> SimpleRow.html
> <table>
> <wicket:panel>
>
> <tr valign="top">
>  <td width="60">
>   <img wicket:id="img" src="img/explore.gif" />
>  </td>
>  <td wicket:id="td" valign="top">
>   <h2 wicket:id="title">Title</h2>
>   <wicket:child/>
>  </td>
> </tr>
>
> </wicket:panel>
> </table>
>
> - - - - - - - - - -
>
> Then I want a subclass to fill in content for <wicket:child/>
>
> ExportRow.java
> public class ExportRow extends SimpleRow
> {
>  public ExportRow(String id)
>  {
>    super( id );
>
>    add( new Label( "test", "hello" ) );
>  }
> }
>
> ExportRow.html
> <wicket:extend>
> Here is some text <span wicket:id="test">xxx</span>
> </wicket:extend>
>
> - - - - - -  -
>
> With this, I get an errror:
> Unable to find component with id 'test' in [MarkupContainer [Component id =
> _extend8]] ...
>
> If I do not try to add any components in the subclass, things behave as I
> would expect.
>
> Am I missing something?
>
> Thanks
> ryan
>
>
>



-- 
Become a Wicket expert, learn from the best: http://wicketinaction.com
Apache Wicket 1.3.5 is released
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.

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