You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Benedikt Rothe <be...@qleo.de> on 2011/01/28 23:11:55 UTC

Add Component if markup exists?

Hi everybody

Is it possible to add a Wicket-Component depending on the existence of a 
wicket:id
in the Markup? Something like

   // Code with adding Components
   if there is a Markup-Element with WicketId "Submit" then
       this.add(new Button("Submit",...));

As far as I  understood, it is not possible in this way. But maybe 
there's an #
equivalent solution?

Bye
Benedikt

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


Re: Add Component if markup exists?

Posted by Igor Vaynberg <ig...@gmail.com>.
yes, see component.getmarkup()

-igor

On Sat, Jan 29, 2011 at 1:17 PM, Benedikt Rothe <be...@qleo.de> wrote:
> Thank you, Igor.
>
> I will need some time to figure your hints out.
>
> Do I understand right: The solution "analyze the markup and add..." is
> possible from 1.5 on?
>
> Benedikt
>
> Am 28.01.2011 23:37, schrieb Igor Vaynberg:
>>
>> if it only needs to live during render there is IComponentResolver
>>
>> if you need it to have a normal lifecycle you can analyze the markup
>> and add the component if not already added. in 1.5 you can use
>> getmarkup in onmarkupattached() or oninitialize()
>>
>> -igor
>>
>> On Fri, Jan 28, 2011 at 2:11 PM, Benedikt Rothe<be...@qleo.de>
>>  wrote:
>>>
>>> Hi everybody
>>>
>>> Is it possible to add a Wicket-Component depending on the existence of a
>>> wicket:id
>>> in the Markup? Something like
>>>
>>>  // Code with adding Components
>>>  if there is a Markup-Element with WicketId "Submit" then
>>>      this.add(new Button("Submit",...));
>>>
>>> As far as I  understood, it is not possible in this way. But maybe
>>> there's
>>> an #
>>> equivalent solution?
>>>
>>> Bye
>>> Benedikt
>>>
>>> ---------------------------------------------------------------------
>>> 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
>
>

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


Re: Add Component if markup exists?

Posted by Benedikt Rothe <be...@qleo.de>.
Thank you, Igor.

I will need some time to figure your hints out.

Do I understand right: The solution "analyze the markup and add..." is 
possible from 1.5 on?

Benedikt

Am 28.01.2011 23:37, schrieb Igor Vaynberg:
> if it only needs to live during render there is IComponentResolver
>
> if you need it to have a normal lifecycle you can analyze the markup
> and add the component if not already added. in 1.5 you can use
> getmarkup in onmarkupattached() or oninitialize()
>
> -igor
>
> On Fri, Jan 28, 2011 at 2:11 PM, Benedikt Rothe<be...@qleo.de>  wrote:
>> Hi everybody
>>
>> Is it possible to add a Wicket-Component depending on the existence of a
>> wicket:id
>> in the Markup? Something like
>>
>>   // Code with adding Components
>>   if there is a Markup-Element with WicketId "Submit" then
>>       this.add(new Button("Submit",...));
>>
>> As far as I  understood, it is not possible in this way. But maybe there's
>> an #
>> equivalent solution?
>>
>> Bye
>> Benedikt
>>
>> ---------------------------------------------------------------------
>> 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: Add Component if markup exists?

Posted by Igor Vaynberg <ig...@gmail.com>.
if it only needs to live during render there is IComponentResolver

if you need it to have a normal lifecycle you can analyze the markup
and add the component if not already added. in 1.5 you can use
getmarkup in onmarkupattached() or oninitialize()

-igor

On Fri, Jan 28, 2011 at 2:11 PM, Benedikt Rothe <be...@qleo.de> wrote:
> Hi everybody
>
> Is it possible to add a Wicket-Component depending on the existence of a
> wicket:id
> in the Markup? Something like
>
>  // Code with adding Components
>  if there is a Markup-Element with WicketId "Submit" then
>      this.add(new Button("Submit",...));
>
> As far as I  understood, it is not possible in this way. But maybe there's
> an #
> equivalent solution?
>
> Bye
> Benedikt
>
> ---------------------------------------------------------------------
> 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