You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Timo Rantalaiho <Ti...@ri.fi> on 2008/01/02 19:06:05 UTC

Re: Ways of making components in a page optional?

On Tue, 18 Dec 2007, wfaler wrote:
> Hmm, haven't tried that. That might work - sometimes you just don't check all
> the methods thoroughly enough.. :)

Yep, as far as I know the Wicket Way (TM) of making
components optional is controlling their visibility. This
need becomes more obvious when you consider that (except
repeaters) there is a 1:1 correspondence between HTML
elements with wicket:id and Wicket components, and it
wouldn't be nice to need to change the HTML files runtime :) 

One consequence is that all components of the page always
get constructed even if they are not visible, so on one hand
you don't want to do heavy work in the constructor of such
component but on other hand you get more fail-fast with
regard to component creation.

Best wishes,
Timo

-- 
Timo Rantalaiho           
Reaktor Innovations Oy    <URL: http://www.ri.fi/ >

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


Re: Ways of making components in a page optional?

Posted by Paolo Di Tommaso <pa...@gmail.com>.
Yes, I use this approach in conjunction to an ajax action to refresh/create
UI components in response  to user interaction.


Paolo

On Jan 3, 2008 7:43 AM, Timo Rantalaiho <Ti...@ri.fi> wrote:

> On Wed, 02 Jan 2008, Paolo Di Tommaso wrote:
> > An easy trick to avoid this is to use a Panel/Fragment instantiating
> just a
> > WebMarkupContainer when you don't want to display/create the full
> component.
>
> Ah, you mean something like
>
>  add(new WebmarkupContainer("myComplexComponent"));
>
> at construction and then later on
>
>  replace(new MyComplexComponent("myComplexComponent"))
>
> ?
>
> That's an interesting idea, thanks!
>
> Best wishes,
> Timo
>
> --
> Timo Rantalaiho
> Reaktor Innovations Oy    <URL: http://www.ri.fi/ >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: Ways of making components in a page optional?

Posted by Timo Rantalaiho <Ti...@ri.fi>.
On Wed, 02 Jan 2008, Paolo Di Tommaso wrote:
> An easy trick to avoid this is to use a Panel/Fragment instantiating just a
> WebMarkupContainer when you don't want to display/create the full component.

Ah, you mean something like

  add(new WebmarkupContainer("myComplexComponent"));

at construction and then later on

  replace(new MyComplexComponent("myComplexComponent"))

?

That's an interesting idea, thanks!

Best wishes,
Timo

-- 
Timo Rantalaiho           
Reaktor Innovations Oy    <URL: http://www.ri.fi/ >

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


Re: Ways of making components in a page optional?

Posted by Paolo Di Tommaso <pa...@gmail.com>.
An easy trick to avoid this is to use a Panel/Fragment instantiating just a
WebMarkupContainer when you don't want to display/create the full component.


That's all

Paolo

On Jan 2, 2008 7:06 PM, Timo Rantalaiho <Ti...@ri.fi> wrote:

> On Tue, 18 Dec 2007, wfaler wrote:
> > Hmm, haven't tried that. That might work - sometimes you just don't
> check all
> > the methods thoroughly enough.. :)
>
> Yep, as far as I know the Wicket Way (TM) of making
> components optional is controlling their visibility. This
> need becomes more obvious when you consider that (except
> repeaters) there is a 1:1 correspondence between HTML
> elements with wicket:id and Wicket components, and it
> wouldn't be nice to need to change the HTML files runtime :)
>
> One consequence is that all components of the page always
> get constructed even if they are not visible, so on one hand
> you don't want to do heavy work in the constructor of such
> component but on other hand you get more fail-fast with
> regard to component creation.
>
> Best wishes,
> Timo
>
> --
> Timo Rantalaiho
> Reaktor Innovations Oy    <URL: http://www.ri.fi/ >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>