Err... ignore the comment about InnerComponentBean.  That was just me confusing 
myself.

Rich Eggert
Member of Technical Staff
Proteus Technologies, LLC
http://www.proteus-technologies.com



-----Original Message-----
From: Richard Eggert [mailto:[EMAIL PROTECTED]
Sent: Mon 9/10/2007 11:13 AM
To: user@shale.apache.org
Subject: RE: HtmlSelectOneMenu dynamically
 
I haven't tried to do anything like this myself, but it seems to me that you  
should just need to do something along these lines:

ElementBean inputElement = new ElementBean();
inputElement.setComponentType("javax.faces.HtmlSelectOneMenu");
inputElement.setJsfid("securitycheck");
inputElement.setId("securitycheck");

// Added by me
ElementBean optionsElement = new ElementBean(); // use InnerComponentBean 
instead?
optionsElement.setComponentType("javax.faces.SelectItems");
optionsElement.setJsfid("selectItems");
// TODO: fill in SelectItems-specific details (perhaps using addAttributes?)
inputElement.addChild(optionsElement);
// Alternatively, use a series of SelectItem elements instead of a single 
SelectItems.

root.addChild(inputElement);



I hope this helps!

Rich Eggert
Member of Technical Staff
Proteus Technologies, LLC
http://www.proteus-technologies.com



-----Original Message-----
From: Mike Otto [mailto:[EMAIL PROTECTED]
Sent: Mon 9/10/2007 9:45 AM
To: user@shale.apache.org
Subject: HtmlSelectOneMenu dynamically
 
How do I create

HtmlSelectManyListbox, HtmlSelectOneRadio, HtmlSelectOneMenu dynamically with
clay?

In the rolodex example I found a function with the name

"createInputElementMetadata" which teaches me how to create links.

// create a command link attribute
   ElementBean link = new ElementBean();
   link.setRenderId(generateId());
   link.setJsfid("commandLink");
   link.setComponentType("javax.faces.HtmlCommandLink");


I tried this:

ElementBean inputElement = new ElementBean();
inputElement.setComponentType("javax.faces.HtmlSelectOneMenu");
inputElement.setJsfid("securitycheck");
inputElement.setId("securitycheck");
root.addChild(inputElement);


This is the output

<select id="systemform:securitycheck" name="systemform:securitycheck"
size="1"></select>


Well I am missing the <option>-Tags .. any idea how to add
the option attributes dynamically is appreciated

as well as any documentation about the subject :-)


Best Regards
Mike










Reply via email to