Re: Using RadioGroup inside a Grid
Can you create a mixin to force the name to particular value? On Jul 26, 2011 11:39 PM, Stephan Windmüller stephan.windmuel...@tu-dortmund.de wrote: On 27.07.2011 01:25, Thiago H. de Paula Figueiredo wrote: Imagine a questionnaire with many statements (rows). For each statement you have to select if you agree with it or not on a scale from 1 to 10. For this I need a RadioGroup for each row. Add add=scale in your Grid then p:scale !-- radio group here -- /p:scale. It's absolutely the same way as using a RadioGroup outside a Grid. It seems to me the only missing piece of the puzzle for you was how to add a column to a Grid. This would put the radio group inside a single column. But as I stated in my first e-mail, the options should be split among many columns. Here is an example (view with a fixed font): /--\ | Statement | Good | OK | Bad | |--| | First | o | o | o | |--| | Second | o | o | o | |--| | Third | o | o | o | \--/ Or in HTML: table [...] tr tdFirst/td tdinput type=radio name=select_first value=goodGood/td tdinput type=radio name=select_first value=okOK/td tdinput type=radio name=select_first value=badBad/td /tr tr tdSecond/td tdinput type=radio name=select_second value=goodGood/td tdinput type=radio name=select_second value=okOK/td tdinput type=radio name=select_second value=badBad/td /tr [...] /table - Stephan - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Using RadioGroup inside a Grid
On 27.07.2011 01:25, Thiago H. de Paula Figueiredo wrote: Imagine a questionnaire with many statements (rows). For each statement you have to select if you agree with it or not on a scale from 1 to 10. For this I need a RadioGroup for each row. Add add=scale in your Grid then p:scale !-- radio group here -- /p:scale. It's absolutely the same way as using a RadioGroup outside a Grid. It seems to me the only missing piece of the puzzle for you was how to add a column to a Grid. This would put the radio group inside a single column. But as I stated in my first e-mail, the options should be split among many columns. Here is an example (view with a fixed font): /--\ | Statement | Good | OK | Bad | |--| | First |o |o |o | |--| | Second|o |o |o | |--| | Third |o |o |o | \--/ Or in HTML: table [...] tr tdFirst/td tdinput type=radio name=select_first value=goodGood/td tdinput type=radio name=select_first value=okOK/td tdinput type=radio name=select_first value=badBad/td /tr tr tdSecond/td tdinput type=radio name=select_second value=goodGood/td tdinput type=radio name=select_second value=okOK/td tdinput type=radio name=select_second value=badBad/td /tr [...] /table - Stephan - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Using RadioGroup inside a Grid
On Wed, 27 Jul 2011 03:38:43 -0300, Stephan Windmüller stephan.windmuel...@tu-dortmund.de wrote: This would put the radio group inside a single column. But as I stated in my first e-mail, the options should be split among many columns. Here is an example (view with a fixed font): /--\ | Statement | Good | OK | Bad | |--| | First |o |o |o | |--| | Second|o |o |o | |--| | Third |o |o |o | \--/ Ooops, I'm sorry for not understanding your requirements earlier. I don't think you'll be able to do this with Grid without resorting to Tapestry DOM rewriting (adding the columns, putting the RadioGroup inside one and then moving the generated radio buttons to the desired columns). -- Thiago H. de Paula Figueiredo Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and instructor Owner, Ars Machina Tecnologia da Informação Ltda. http://www.arsmachina.com.br - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Using RadioGroup inside a Grid
On 25.07.2011 15:14, Taha Hafeez wrote: While trying to answer your question, I came up with an example. Enjoy !! Thanks for your suggestion, but this will not work in my case. I do not want a selection between _rows_ of a grid but between _columns_ of each row. Imagine a questionnaire with many statements (rows). For each statement you have to select if you agree with it or not on a scale from 1 to 10. For this I need a RadioGroup for each row. - Stephan - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Using RadioGroup inside a Grid
On 25.07.2011 15:40, Thiago H. de Paula Figueiredo wrote: I am trying to use a RadioGroup inside a Grid component. Each selectable radio option should be displayed in its own column. I don't know if it will work, but have you tried putting the Grid inside the RadioGroup? If I understand RadioGroup correctly, it holds one selection value. In my case I need a selection for each row. - Stephan - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Using RadioGroup inside a Grid
On Tue, 26 Jul 2011 06:39:01 -0300, Stephan Windmüller stephan.windmuel...@tu-dortmund.de wrote: Imagine a questionnaire with many statements (rows). For each statement you have to select if you agree with it or not on a scale from 1 to 10. For this I need a RadioGroup for each row. Add add=scale in your Grid then p:scale !-- radio group here -- /p:scale. It's absolutely the same way as using a RadioGroup outside a Grid. It seems to me the only missing piece of the puzzle for you was how to add a column to a Grid. -- Thiago H. de Paula Figueiredo Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and instructor Owner, Ars Machina Tecnologia da Informação Ltda. http://www.arsmachina.com.br - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Using RadioGroup inside a Grid
Hello! I am trying to use a RadioGroup inside a Grid component. Each selectable radio option should be displayed in its own column. In pure HTML it would be possible to insert input elements with the same name attribute into each cell but Tapestry requires a surrounding RadioGroup component. Since this would have to surround the whole table row which is generated by the Grid, I do not know how to proceed here. Any suggestions? TIA Stephan - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Using RadioGroup inside a Grid
Hi Stephan, afaik it's easy to ovveride the rendering of a single column in Grid, but it's hard to overide the rendering of a whole row. You could subclass Grid and GridRows to get the desired behavior. Anoter option could be to put your whole radiogroup in just one td and write a mixin that changes the markup in afterRender to split up the clumn into several tds. I can recall that Subclassing Grid and GridRow invloves quite an amount of work and the mixin might look a bit dirty. Perhaps you should refrain from using Grid and better implement your own component that suits your needs. Cheers nillehammer - http://www.winfonet.eu -- View this message in context: http://tapestry.1045711.n5.nabble.com/Using-RadioGroup-inside-a-Grid-tp4629982p4630617.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Using RadioGroup inside a Grid
Hi While trying to answer your question, I came up with an example. Enjoy !! public class RadioGroupDemo { @Property @Persist private ListUser users; @SuppressWarnings(unused) @Property private User user; @SuppressWarnings(unused) @Property @Persist(PersistenceConstants.FLASH) private User selectedUser; void onActivate() { if(users == null) { users = new ArrayListUser(); users.add(new User(John, New York)); users.add(new User(Ramesh, India)); } } public ValueEncoderUser getEncoder() { return new ValueEncoderUser() { @Override public String toClient(User user) { if(user == null) { return null; } return user.getName(); } @Override public User toValue(String clientValue) { for(User user : users) { if(user.getName().equals(clientValue)) { return user; } } return null; } }; } } html xmlns:t='http://tapestry.apache.org/schema/tapestry_5_1_0.xsd' xmlns:p='tapestry:parameter' body t:if test='selectedUser' You selected : ${selectedUser.name} /t:if form t:type='form' div t:type='radioGroup' t:value='selectedUser' encoder='encoder' div t:type='grid' source='users' t:add='select' row='user' p:selectCell input t:type='radio' type='radio' t:value='user' / /p:selectCell /div /div input type='submit' value='submit'/ /form /body /html Remember, your object (User here) must has proper equals/hashcode methods for selection to work Regards Taha On Mon, Jul 25, 2011 at 6:18 PM, nillehammer tapestry.nilleham...@winfonet.eu wrote: Hi Stephan, afaik it's easy to ovveride the rendering of a single column in Grid, but it's hard to overide the rendering of a whole row. You could subclass Grid and GridRows to get the desired behavior. Anoter option could be to put your whole radiogroup in just one td and write a mixin that changes the markup in afterRender to split up the clumn into several tds. I can recall that Subclassing Grid and GridRow invloves quite an amount of work and the mixin might look a bit dirty. Perhaps you should refrain from using Grid and better implement your own component that suits your needs. Cheers nillehammer - http://www.winfonet.eu -- View this message in context: http://tapestry.1045711.n5.nabble.com/Using-RadioGroup-inside-a-Grid-tp4629982p4630617.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Using RadioGroup inside a Grid
On Mon, 25 Jul 2011 05:22:32 -0300, Stephan Windmüller stephan.windmuel...@tu-dortmund.de wrote: Hello! Hi! I am trying to use a RadioGroup inside a Grid component. Each selectable radio option should be displayed in its own column. I don't know if it will work, but have you tried putting the Grid inside the RadioGroup? -- Thiago H. de Paula Figueiredo Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and instructor Owner, Ars Machina Tecnologia da Informação Ltda. http://www.arsmachina.com.br - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org