RE: Creating a Custom Component with other components inside...

2005-09-15 Thread Balaji Saranathan

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: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
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 [EMAIL 
PROTECTED] immediately
and destroy all copies of this message and any attachments.


Re: Creating a Custom Component with other components inside...

2005-09-15 Thread Mike Kienenberger
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, [EMAIL PROTECTED] <[EMAIL PROTECTED]> 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
>