Thanks for the reply igor I will experiment... On 9/13/06, Igor Vaynberg
[EMAIL PROTECTED] wrote:depends on what you want to do with it, if you want the input to go back into the question you can just do
item.add(new TextField(inputText
, new PropertyModel(item.getModel(), questionText));-IgorOn 9/12/06,
Joshua Lim
[EMAIL PROTECTED] wrote:
Hi
I am trying to create a set of dynamic components that will generate dynamic numbers of input components, but I got stuck in providing a model for it.for e.g. I have TextGroupPanel - which will create a series of TextField
RadioGroupPanel - which will generate a Grid type of Radio buttons.. etc ...Generating it is not a problem, I have a problem though with providing the models for each (dynamic numnber) of Text/Radio components
I know I'll probably need a hashMap to handle that, but not sure of the best approach so that this component can be reuseable...any suggestion would be most welcomed/** Text Group **/public class TextGroupPanel extends WidgetPanel
public TextGroupPanel(String id, final IQuestion question) { super(id, question); add(new Label(questionText, question.getText()));
// a list of children question
List questions = question.getQuestions(); add(new ListView(questions, questions) {@Overrideprotected void populateItem(ListItem item)
{ IQuestion question = (IQuestion) item.getModelObject(); item.add(new Label(question, question.getText())); item.add(new TextField(inputText
, newModel()));} }); }/** Radio Group as a Grid **/
public class RadioGroupPanel extends WidgetPanel public RadioGroupPanel(String id, IQuestion question) { super(id, question); // add the question (group)
add(new Label(questionText, question.getText())); final List choices = question.getChoices(); List questions = question.getQuestions();
// add Choices Text add(new RefreshingView(choiceTexts) {@Overrideprotected Iterator getItemModels(){ return new ModelIteratorAdapter(
choices.iterator()) { @Override protected IModel model(Object object) { return new Model((Serializable)object);
} }; }@Overrideprotected void populateItem(Item item){ IChoice choice = (IChoice)
item.getModelObject(); item.add(new Label(choiceText, choice.getText()));} }); // add rows of Question and Choices add(new ListView(questions, questions) {
@Overrideprotected void populateItem(ListItem item){ // question for this row IQuestion aQuestion = (IQuestion)item.getModelObject();
item.add(new Label(question, aQuestion.getText())); // choices for this row RadioGroup radioGroup = new RadioGroup(choicesGroup,
newModel()); item.add(radioGroup); // adds radio into radio group radioGroup.add(new RefreshingView(choices) {
@Override protected Iterator getItemModels() { return new ModelIteratorAdapter(choices.iterator()) {
@Overrideprotected IModel model(Object object){ return new Model((Serializable)object);
} }; } @Override protected void populateItem(Item item) {
item.add(new Radio(choice, item.getModel())); } });} }); }
-Using Tomcat but need to do more? Need to support web services, security?Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642___Wicket-user mailing list
Wicket-user@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/wicket-user
-Using Tomcat but need to do more? Need to support web services, security?Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642___Wicket-user mailing list
Wicket-user@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/wicket-user
-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user