You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by gv...@C3tools.com on 2005/09/15 20:18:44 UTC
Creating a Custom Component with other components inside...
Hi,
I'm looking at designing a simple component that would render the
following:
2 ListBoxes with items in each of them. Each being plugged on a
different List in the background.
I'm trying to figure out how to do that right now... I have created a
custom component that works but does not render my listboxes. The way I
saw this was that in my component's code, in encodeBegin, I could create
2 UISelectMany components and setting their parent to my component.
Now be honest... Is this a horrible way to do things :p? The reason I'm
asking is because I'm trying to figure out if i can render this without
having to use the responsewriter to write HTML, ie by using another
component and calling its encodeBegin method so that later changes can
be repercuted in my component automatically.
Are there any examples of custom components that do this? I'm figuring I
could use the ResponseWriter and iterate through the ListBoxes' lists
etc... but I'm wondering if creaeting the components and setting their
required properties is possible.
Thanks a lot,
Greg
Re: Creating a Custom Component with other components inside...
Posted by Mike Kienenberger <mk...@gmail.com>.
If you're not limited to pure JSP tag technology, you could consider
the following three alternatives, which allow you to quickly create
composite components:
1) Facelets
2) Shale/Clay
3) t:aliasBean + jsp includes
On 9/15/05, gvial@c3tools.com <gv...@c3tools.com> wrote:
> Hi,
>
> I'm looking at designing a simple component that would render the
> following:
>
> 2 ListBoxes with items in each of them. Each being plugged on a
> different List in the background.
>
> I'm trying to figure out how to do that right now... I have created a
> custom component that works but does not render my listboxes. The way I
> saw this was that in my component's code, in encodeBegin, I could create
> 2 UISelectMany components and setting their parent to my component.
>
> Now be honest... Is this a horrible way to do things :p? The reason I'm
> asking is because I'm trying to figure out if i can render this without
> having to use the responsewriter to write HTML, ie by using another
> component and calling its encodeBegin method so that later changes can
> be repercuted in my component automatically.
>
> Are there any examples of custom components that do this? I'm figuring I
> could use the ResponseWriter and iterate through the ListBoxes' lists
> etc... but I'm wondering if creaeting the components and setting their
> required properties is possible.
>
> Thanks a lot,
>
> Greg
>
Re: rendering a custom component
Posted by Hendrik Neumann <th...@googlemail.com>.
This code snippet from my last project should give you a good hint:
HtmlOutputText iconDesc = (HtmlOutputText)
app.createComponent(HtmlOutputText.COMPONENT_TYPE);
iconDesc.setValue("xxx");
try
{
RendererUtils.renderChild(ctx, iconDesc );
}
catch (IOException e){e.printStackTrace();}
I hope this answered your question?
2005/9/16, Goyo Escobar Escalero <go...@hotmail.com>:
> If I have inside of my encodeBegin method a UISelectOne object... how can I
> render it??
>
>
>
--
Mit freundlichen Grüßen / Greetings,
Hendrik Neumann
rendering a custom component
Posted by Goyo Escobar Escalero <go...@hotmail.com>.
If I have inside of my encodeBegin method a UISelectOne object... how can I
render it??
RE: Creating a Custom Component with other components inside...
Posted by Balaji Saranathan <ba...@wipro.com>.
I remember trying to learn custom components by creating a form builder
that will create a form from XML file.
What I did was to create a Label component and a HtmlInputText component
as to the number of properties specified and add Validators
accordingly.(Only regular Expression validator though). Add these
components to my component.
I did the above in encodeBegin(). In the encodeChildren(). Loop thru my
component and call the renderers of these children.
However, what I realised was I had a check at the start like this...
If(myComponent.getChildren().size == 0)
{
//Create the needed type of Uicomponents and add to
myComponent.getChildren().add()
}
I think this check was not needed...However, it was my test
component...so left it at that....
To make the long story short, yes, you can do it the way you had
mentioned. Most of the composite components that aggregates components
like this, does that I guess.\
Hope this helps.
Regards
Balaji
-----Original Message-----
From: gvial@C3tools.com [mailto:gvial@C3tools.com]
Sent: Thursday, September 15, 2005 2:19 PM
To: users@myfaces.apache.org
Subject: Creating a Custom Component with other components inside...
Hi,
I'm looking at designing a simple component that would render the
following:
2 ListBoxes with items in each of them. Each being plugged on a
different List in the background.
I'm trying to figure out how to do that right now... I have created a
custom component that works but does not render my listboxes. The way I
saw this was that in my component's code, in encodeBegin, I could create
2 UISelectMany components and setting their parent to my component.
Now be honest... Is this a horrible way to do things :p? The reason I'm
asking is because I'm trying to figure out if i can render this without
having to use the responsewriter to write HTML, ie by using another
component and calling its encodeBegin method so that later changes can
be repercuted in my component automatically.
Are there any examples of custom components that do this? I'm figuring I
could use the ResponseWriter and iterate through the ListBoxes' lists
etc... but I'm wondering if creaeting the components and setting their
required properties is possible.
Thanks a lot,
Greg
Confidentiality Notice
The information contained in this electronic message and any attachments to this message are intended
for the exclusive use of the addressee(s) and may contain confidential or privileged information. If
you are not the intended recipient, please notify the sender at Wipro or Mailadmin@wipro.com immediately
and destroy all copies of this message and any attachments.