How to include style for a component composed by other components

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

How to include style for a component composed by other components

cdelaunay
Hi,

Here is what I would like to do with my apllication:

- I have a root component composed by several components. If I understand well how to do that, I just define a 'children' method wich define the subcomponents of this root component.  I can not define a "renderContentOn:" method in the root component, but only in the subcomponents. Am I right?

- Therefor, I can specify some CSS Classes or Ids to the subcompenent but not for the whole root component. Imagine I want a specific background color for my root component and inside him, a specific background colour for each subcomponent (so that between each of them we see the 'root colour'). How can I do that? 

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: How to include style for a component composed by other components

Julian Fitzell-2
No, your root component can have a #renderContentOn: method. The
default behaviour if there isn't one is to simply render each of the
children in order, but I'd say more or less nobody relies on that
behaviour. In your renderContentOn: method, you simple do "html
render: childComponent" wherever you want one of the children rendered
(and yes, you should return them from #children also).

Julian

On Mon, Jan 4, 2010 at 7:05 AM, Cyrille Delaunay <[hidden email]> wrote:

> Hi,
> Here is what I would like to do with my apllication:
> - I have a root component composed by several components. If I understand
> well how to do that, I just define a 'children' method wich define the
> subcomponents of this root component.  I can not define a "renderContentOn:"
> method in the root component, but only in the subcomponents. Am I right?
> - Therefor, I can specify some CSS Classes or Ids to the subcompenent but
> not for the whole root component. Imagine I want a specific background color
> for my root component and inside him, a specific background colour for each
> subcomponent (so that between each of them we see the 'root colour'). How
> can I do that?
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
>
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: How to include style for a component composed by other components

cdelaunay
Thank you. Now I have another question:)
If I have subcomponents (in my root component ) that I render only in specific conditions (when the user press a button for example), should those components always figure in the children method?
Or should they be added in the children only when they are rendered?

In general, what is the comon solution to deal with this kind of problem (render components in specific conditions) ?

2010/1/4 Julian Fitzell <[hidden email]>
No, your root component can have a #renderContentOn: method. The
default behaviour if there isn't one is to simply render each of the
children in order, but I'd say more or less nobody relies on that
behaviour. In your renderContentOn: method, you simple do "html
render: childComponent" wherever you want one of the children rendered
(and yes, you should return them from #children also).

Julian

On Mon, Jan 4, 2010 at 7:05 AM, Cyrille Delaunay <[hidden email]> wrote:
> Hi,
> Here is what I would like to do with my apllication:
> - I have a root component composed by several components. If I understand
> well how to do that, I just define a 'children' method wich define the
> subcomponents of this root component.  I can not define a "renderContentOn:"
> method in the root component, but only in the subcomponents. Am I right?
> - Therefor, I can specify some CSS Classes or Ids to the subcompenent but
> not for the whole root component. Imagine I want a specific background color
> for my root component and inside him, a specific background colour for each
> subcomponent (so that between each of them we see the 'root colour'). How
> can I do that?
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
>
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside


_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: How to include style for a component composed by other components

Julian Fitzell-2
Either is probably fine. In general, it would be *better* to arrange for only the active sub-components to be in #children (all #children are given the opportunity to add stylesheets, updateUrl:, etc. and you may not want inactive components to do that) but I'd say it's a common pattern to return all the children that you *might* render.

Julian

On Thu, Jan 7, 2010 at 4:33 AM, Cyrille Delaunay <[hidden email]> wrote:
Thank you. Now I have another question:)
If I have subcomponents (in my root component ) that I render only in specific conditions (when the user press a button for example), should those components always figure in the children method?
Or should they be added in the children only when they are rendered?

In general, what is the comon solution to deal with this kind of problem (render components in specific conditions) ?

2010/1/4 Julian Fitzell <[hidden email]>

No, your root component can have a #renderContentOn: method. The
default behaviour if there isn't one is to simply render each of the
children in order, but I'd say more or less nobody relies on that
behaviour. In your renderContentOn: method, you simple do "html
render: childComponent" wherever you want one of the children rendered
(and yes, you should return them from #children also).

Julian

On Mon, Jan 4, 2010 at 7:05 AM, Cyrille Delaunay <[hidden email]> wrote:
> Hi,
> Here is what I would like to do with my apllication:
> - I have a root component composed by several components. If I understand
> well how to do that, I just define a 'children' method wich define the
> subcomponents of this root component.  I can not define a "renderContentOn:"
> method in the root component, but only in the subcomponents. Am I right?
> - Therefor, I can specify some CSS Classes or Ids to the subcompenent but
> not for the whole root component. Imagine I want a specific background color
> for my root component and inside him, a specific background colour for each
> subcomponent (so that between each of them we see the 'root colour'). How
> can I do that?
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
>
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside


_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside



_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside