On Fri, 07 Feb 2014 14:10:43 -0200, iberck <[email protected]> wrote:
Hi Thiago, thank you very much by your answer.
Hi!
The scenario is the next:
I have to create a page to show a survey, so in my model I have some
clases:
---------------------------------------------------------------
Survey
+ List<Question> questions
Question
QuestionText extends Question
QuestionRating extends Question
QuestionOptions extends Question
So a question can be text, rating or (multiple) options?
So, I need to display each Question to be answered by the user.
With tapestry I think I have to create a component for each question type
No, the framework doesn't oblige you to do that. You can have a single
component if you want. You can have one for each type. You choose.
In this case, as you have a small number of different question types, I'd
write a single component and just use some If's which use the question
type as the test (isText(), isRating(), isOptions()) for the parts which
are specific to a given question type.
Your solution in the previous message would be good too, although I think
it's more complex than you need for the scenario described above, but
still perfectly valid.
--
Thiago H. de Paula Figueiredo
Tapestry, Java and Hibernate consultant and developer
http://machina.com.br
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]