You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by pepone pepone <pe...@gmail.com> on 2005/05/21 02:17:18 UTC

programatic way to remove a component

Hello  all

Any body knows howto remove a child component in a page method

i want to remove a componet that i add calling addBody(component1);

thanks

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: programatic way to remove a component

Posted by Massimo Lusetti <ml...@gmail.com>.
On 5/21/05, pepone pepone <pe...@gmail.com> wrote:

> you can use a Foreach component to render a variable number of other
> components in this page

Foreach components never remove components from pages.
>From foreach javadocs:
"Repeatedly renders its wrapped contents while iterating through a
list of values" so it never clone/duplicate a components or pages part
but it "repeatedly renders" them, so the page structure is never
changed.

Please, again, correct me if my understandings are wrong 

-- 
Massimo

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: programatic way to remove a component

Posted by pepone pepone <pe...@gmail.com>.
Hello Massimo i not thinking in Dom at all

I think in Tapestry as a web component framework, and componets can
has a number of child components if i right

when you create a tapestry.page you are using a tapestry specific
component and you can add sub-components in the page specification or
page template

you can use a Foreach component to render a variable number of other
components in this page

and i only want to do the same in an abstract component. 

i don't knows the correct way to  doit

but if it's posible to do in a tapestry page why not in a AbstractComponent?

 

On 5/21/05, Massimo Lusetti <ml...@gmail.com> wrote:
> On 5/21/05, pepone pepone <pe...@gmail.com> wrote:
> 
> > i don't understand what you want  say.
> 
> i think you're trying to see Tapestry pages as DOM (which they
> actually are since they're html) while Tapestry don't work on them
> like DOM.
> 
> You should use components and wrapping components within conditional
> ones like Howard say.
> 
> Howard and others, please correct me if I'm wrong
> 
> --
> Massimo
>

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: programatic way to remove a component

Posted by Massimo Lusetti <ml...@gmail.com>.
On 5/21/05, pepone pepone <pe...@gmail.com> wrote:

> i don't understand what you want  say.

i think you're trying to see Tapestry pages as DOM (which they
actually are since they're html) while Tapestry don't work on them
like DOM.

You should use components and wrapping components within conditional
ones like Howard say.

Howard and others, please correct me if I'm wrong

-- 
Massimo

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: programatic way to remove a component

Posted by pepone pepone <pe...@gmail.com>.
i don't understand what you want  say.  

is not the same case whe you have a for-each rendering a list of
components if the model of the for-each changue the list of components
needs to be updated and old version of this page will be difrent with
more or less items

what is the correct aproach in tapestry to manage a case like this.

one component for example CatalogView  and other component CatalogViewItem  
the CalogView renders a collection of CatalogViewItems this items
depends of the CatalogModel object asociated with CatalogView.
CatalogModel is exponse to changues by add or remove items in the
admin interface

thanks 

On 5/21/05, Howard Lewis Ship <hl...@gmail.com> wrote:
> It only appears to work fine.
> 
> You page will not pool correctly.  Different instances in the pool
> will not contain the same structure. It will appear to work as a
> single developer but will fail in production.
> 
> On 5/21/05, pepone pepone <pe...@gmail.com> wrote:
> > Hello Howard i thinking in a AbstractComponent not in a page sorry for
> > this mistake
> >
> >  i create and abstract component and add child componets  to this
> > component calling addBody(newComponent); and this works fine
> >
> > but what i don't know is how remove a component that is no more longer
> > needed for the page.
> >
> > thanks in advantage
> >
> > On 5/21/05, Howard Lewis Ship <hl...@gmail.com> wrote:
> > > In Tapestry, pages are supposed to be statically constructed, much
> > > like Java classes.  This question is equivalent to asking "how to I
> > > programmatically remove a method?".
> > >
> > > Use Conditional components to control if a component gets rendered.
> > >
> > > Use Block and RenderBlock to control which components get rendered.
> > >
> > > On 5/20/05, pepone pepone <pe...@gmail.com> wrote:
> > > > Hello  all
> > > >
> > > > Any body knows howto remove a child component in a page method
> > > >
> > > > i want to remove a componet that i add calling addBody(component1);
> > > >
> > > > thanks
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> > > > For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> > > >
> > > >
> > >
> > >
> > > --
> > > Howard M. Lewis Ship
> > > Independent J2EE / Open-Source Java Consultant
> > > Creator, Jakarta Tapestry
> > > Creator, Jakarta HiveMind
> > >
> > > Professional Tapestry training, mentoring, support
> > > and project work.  http://howardlewisship.com
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> >
> >
> 
> 
> --
> Howard M. Lewis Ship
> Independent J2EE / Open-Source Java Consultant
> Creator, Jakarta Tapestry
> Creator, Jakarta HiveMind
> 
> Professional Tapestry training, mentoring, support
> and project work.  http://howardlewisship.com
>

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: programatic way to remove a component

Posted by Howard Lewis Ship <hl...@gmail.com>.
It only appears to work fine.

You page will not pool correctly.  Different instances in the pool
will not contain the same structure. It will appear to work as a
single developer but will fail in production.

On 5/21/05, pepone pepone <pe...@gmail.com> wrote:
> Hello Howard i thinking in a AbstractComponent not in a page sorry for
> this mistake
> 
>  i create and abstract component and add child componets  to this
> component calling addBody(newComponent); and this works fine
> 
> but what i don't know is how remove a component that is no more longer
> needed for the page.
> 
> thanks in advantage
> 
> On 5/21/05, Howard Lewis Ship <hl...@gmail.com> wrote:
> > In Tapestry, pages are supposed to be statically constructed, much
> > like Java classes.  This question is equivalent to asking "how to I
> > programmatically remove a method?".
> >
> > Use Conditional components to control if a component gets rendered.
> >
> > Use Block and RenderBlock to control which components get rendered.
> >
> > On 5/20/05, pepone pepone <pe...@gmail.com> wrote:
> > > Hello  all
> > >
> > > Any body knows howto remove a child component in a page method
> > >
> > > i want to remove a componet that i add calling addBody(component1);
> > >
> > > thanks
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> > >
> > >
> >
> >
> > --
> > Howard M. Lewis Ship
> > Independent J2EE / Open-Source Java Consultant
> > Creator, Jakarta Tapestry
> > Creator, Jakarta HiveMind
> >
> > Professional Tapestry training, mentoring, support
> > and project work.  http://howardlewisship.com
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
> 


-- 
Howard M. Lewis Ship
Independent J2EE / Open-Source Java Consultant
Creator, Jakarta Tapestry
Creator, Jakarta HiveMind

Professional Tapestry training, mentoring, support
and project work.  http://howardlewisship.com

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: programatic way to remove a component

Posted by pepone pepone <pe...@gmail.com>.
Hello Howard i thinking in a AbstractComponent not in a page sorry for
this mistake

 i create and abstract component and add child componets  to this
component calling addBody(newComponent); and this works fine

but what i don't know is how remove a component that is no more longer
needed for the page.

thanks in advantage

On 5/21/05, Howard Lewis Ship <hl...@gmail.com> wrote:
> In Tapestry, pages are supposed to be statically constructed, much
> like Java classes.  This question is equivalent to asking "how to I
> programmatically remove a method?".
> 
> Use Conditional components to control if a component gets rendered.
> 
> Use Block and RenderBlock to control which components get rendered.
> 
> On 5/20/05, pepone pepone <pe...@gmail.com> wrote:
> > Hello  all
> >
> > Any body knows howto remove a child component in a page method
> >
> > i want to remove a componet that i add calling addBody(component1);
> >
> > thanks
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> >
> >
> 
> 
> --
> Howard M. Lewis Ship
> Independent J2EE / Open-Source Java Consultant
> Creator, Jakarta Tapestry
> Creator, Jakarta HiveMind
> 
> Professional Tapestry training, mentoring, support
> and project work.  http://howardlewisship.com
>

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: programatic way to remove a component

Posted by Howard Lewis Ship <hl...@gmail.com>.
In Tapestry, pages are supposed to be statically constructed, much
like Java classes.  This question is equivalent to asking "how to I
programmatically remove a method?".

Use Conditional components to control if a component gets rendered.

Use Block and RenderBlock to control which components get rendered.

On 5/20/05, pepone pepone <pe...@gmail.com> wrote:
> Hello  all
> 
> Any body knows howto remove a child component in a page method
> 
> i want to remove a componet that i add calling addBody(component1);
> 
> thanks
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
> 


-- 
Howard M. Lewis Ship
Independent J2EE / Open-Source Java Consultant
Creator, Jakarta Tapestry
Creator, Jakarta HiveMind

Professional Tapestry training, mentoring, support
and project work.  http://howardlewisship.com

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: programatic way to remove a component

Posted by Ron Piterman <mp...@vollbio.de>.
ציטוט pepone pepone:
> What i trying to is a Product catalog  my aproach is add One
> PoductViewComponent for each product in the catalog and one
> ProducCategory for each category in the catalog
> 
> 
> --------ProductCategoryComponent ---------
> ------------ProductCagetory 
> ------------ProductViewComponent 1----
> ...................................................
> ------------ProductViewComponent N -----
> 
> but if I understand you weel i can do it this whit only one instance
> of ProductViewComponent ProductCategoryComponent and render it many
> times?

Thats the only way to do it.
You create a ProductViewComponent, which renders the Product Bean, and 
use it in your CategoryComponent, most likeley inside a foreach component:

<span jwcid="@Foreach" source="ognl:products" 	
     value="ognl:currentProduct">

	<span
            jwcid="@ProductViewComponent"
            value="ognl:currentProduct"/>

</span>


Cheers,
Ron

> 
> 
> thanks
> On 5/22/05, Ron Piterman <mp...@vollbio.de> wrote:
> 
>>Hi,
>>
>>You don't tell much about what you want to do.
>>
>>If you have a component in your component, which should only render
>>occasionaly, you should use some kind of conditional *rendering*.
>>
>>In Tapestry, there seems to be a difference between *rendering* and
>>*instanciating*. Where instanciating (components) is of static nature.
>>rendering is flexible. so a components can be added only once to its
>>container (you can not use the same components twice...), but can be
>>rendered many times.
>>
>>If you can't live with that, you could delegate the rendering of your
>>component to an external Renderer, and keep it flexible... just an idee...
>>
>>Cheers,
>>Ron
>>
>>
>>
>>ציטוט pepone pepone:
>>
>>>Hello  all
>>>
>>>Any body knows howto remove a child component in a page method
>>>
>>>i want to remove a componet that i add calling addBody(component1);
>>>
>>>thanks
>>>
>>>---------------------------------------------------------------------
>>>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>>
>>>
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>
>>


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: programatic way to remove a component

Posted by pepone pepone <pe...@gmail.com>.
What i trying to is a Product catalog  my aproach is add One
PoductViewComponent for each product in the catalog and one
ProducCategory for each category in the catalog


--------ProductCategoryComponent ---------
------------ProductCagetory 
------------ProductViewComponent 1----
...................................................
------------ProductViewComponent N -----

but if I understand you weel i can do it this whit only one instance
of ProductViewComponent ProductCategoryComponent and render it many
times?


thanks
On 5/22/05, Ron Piterman <mp...@vollbio.de> wrote:
> Hi,
> 
> You don't tell much about what you want to do.
> 
> If you have a component in your component, which should only render
> occasionaly, you should use some kind of conditional *rendering*.
> 
> In Tapestry, there seems to be a difference between *rendering* and
> *instanciating*. Where instanciating (components) is of static nature.
> rendering is flexible. so a components can be added only once to its
> container (you can not use the same components twice...), but can be
> rendered many times.
> 
> If you can't live with that, you could delegate the rendering of your
> component to an external Renderer, and keep it flexible... just an idee...
> 
> Cheers,
> Ron
> 
> 
> 
> ציטוט pepone pepone:
> > Hello  all
> >
> > Any body knows howto remove a child component in a page method
> >
> > i want to remove a componet that i add calling addBody(component1);
> >
> > thanks
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> >
> >
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
>

Re: programatic way to remove a component

Posted by Ron Piterman <mp...@vollbio.de>.
Hi,

You don't tell much about what you want to do.

If you have a component in your component, which should only render 
occasionaly, you should use some kind of conditional *rendering*.

In Tapestry, there seems to be a difference between *rendering* and 
*instanciating*. Where instanciating (components) is of static nature. 
rendering is flexible. so a components can be added only once to its 
container (you can not use the same components twice...), but can be 
rendered many times.

If you can't live with that, you could delegate the rendering of your 
component to an external Renderer, and keep it flexible... just an idee...

Cheers,
Ron



ציטוט pepone pepone:
> Hello  all
> 
> Any body knows howto remove a child component in a page method
> 
> i want to remove a componet that i add calling addBody(component1);
> 
> thanks
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org