RE: override wicket mark up
Thank you Paul.. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/override-wicket-mark-up-tp4651624p4651687.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
RE: override wicket mark up
Have you checked the wiki page on the View Layer? https://cwiki.apache.org/WICKET/view-layer.html In your original e-mail you showed the following Wicket component tree: [Panel let's call it TogglePanel.java] - propertyValue (let's call it ReadOnlyPanel.java) - label - label And I believe you wanted to override it with the following Wicket component tree: [Panel] - propertyValue (let's call it EditGroupPanel.java) - adminGroupTabs - adminGroupTabLink - label - adminGroupView - value Obviously this is *not* an override, but a full replacement. A true override would preserve the same Wicket component tree but replace the HTML (ie: presentation layer) and your Java class would extend from the class that's overriding and call super with not too much other work to do. You got lucky because your panel in this case has a root component id of propertyValue. Thus all you would have to do is use the addOrReplace() inside the TogglePanel.java and toggle the panel that will be added: if(isReadOnly) { addOrReplace(new ReadOnlyPanel(propertyValue)); } else { addOrReplace(new EditGroupPanel(propertyValue)); } For the JavaDoc on addOrReplace see: http://wicket.apache.org/apidocs/1.5/org/apache/wicket/MarkupContainer.html# addOrReplace(org.apache.wicket.Component...) ~ Thank you, Paul Bors -Original Message- From: ramlael [mailto:grambab...@gmail.com] Sent: Thursday, August 30, 2012 5:10 AM To: users@wicket.apache.org Subject: Re: override wicket mark up Hi Martin, Once I call super(model) in extended class, its expecting markup (wicket:ids) should be in same order. Please can you provide sample code, how the replace or replaceWith will work. Regards, Rambabu -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/override-wicket-mark-up-tp4651624 p4651640.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
RE: override wicket mark up
I just run into a use-case of addOrRemove() just now while refactoring some code to support Accessibility and I through you might want to see some code snippets: ConfirmMessagePanel.html ... form wicket:id=form table width=100% height=200px tr td class=infobox align=center colspan=2 span wicket:id=iconimg src=../../../../../../../../../../../../../src/web/images/help.gif//span nbsp;nbsp;span class=infobox wicket:id=message[[message]]/span /td /tr ... ConfirmMessagePanel.java ... public ConfirmMessagePanel(String id, IModelString confirmMessageModel, IModelString confirmBtnModel, IModelString cancelBtnModel) { super(id); form = new FormVoid(form); form.add(new IconPanel(icon, TYPE.Help)); ... InfoMessagePanel extends ConfirmMessagePanel and this is how it looks like: InfoMessagePanel.html (not too many changes here in this simple example, but this can have other components added especially if you use wicket:extend /) ... form wicket:id=form table width=100% height=200px tr td class=infobox align=center span wicket:id=iconimg src=../../../../../../../../../../../../../src/web/images/info.gif//span nbsp;nbsp;span class=infobox wicket:id=message[[Info Message]]/span /td /tr ... InfoMessagePanel.java ... public InfoMessagePanel(String id, IModelString message, IModelString cancelBtnModel) { super(id, message, cancelBtnModel, cancelBtnModel); getForm().addOrReplace(new IconPanel(icon, TYPE.Info)); setConfirmationButtonVisible(false); // my own method not a Wiki one } ... Rambabu, I hope this feed your appetite :) ~ Thank you, Paul Bors -Original Message- From: Paul Bors [mailto:p...@bors.ws] Sent: Friday, August 31, 2012 12:03 PM To: users@wicket.apache.org Subject: RE: override wicket mark up Have you checked the wiki page on the View Layer? https://cwiki.apache.org/WICKET/view-layer.html In your original e-mail you showed the following Wicket component tree: [Panel let's call it TogglePanel.java] - propertyValue (let's call it ReadOnlyPanel.java) - label - label And I believe you wanted to override it with the following Wicket component tree: [Panel] - propertyValue (let's call it EditGroupPanel.java) - adminGroupTabs - adminGroupTabLink - label - adminGroupView - value Obviously this is *not* an override, but a full replacement. A true override would preserve the same Wicket component tree but replace the HTML (ie: presentation layer) and your Java class would extend from the class that's overriding and call super with not too much other work to do. You got lucky because your panel in this case has a root component id of propertyValue. Thus all you would have to do is use the addOrReplace() inside the TogglePanel.java and toggle the panel that will be added: if(isReadOnly) { addOrReplace(new ReadOnlyPanel(propertyValue)); } else { addOrReplace(new EditGroupPanel(propertyValue)); } For the JavaDoc on addOrReplace see: http://wicket.apache.org/apidocs/1.5/org/apache/wicket/MarkupContainer.html# addOrReplace(org.apache.wicket.Component...) ~ Thank you, Paul Bors -Original Message- From: ramlael [mailto:grambab...@gmail.com] Sent: Thursday, August 30, 2012 5:10 AM To: users@wicket.apache.org Subject: Re: override wicket mark up Hi Martin, Once I call super(model) in extended class, its expecting markup (wicket:ids) should be in same order. Please can you provide sample code, how the replace or replaceWith will work. Regards, Rambabu -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/override-wicket-mark-up-tp4651624 p4651640.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: override wicket mark up
If you extend a Component/Page and want to provide a different markup you cannot change the component hierarchy, so it's not possible to insert some container (in your case adminGroupTabs) into the tree. -Tom On 30.08.2012, at 05:05, ramlael grambab...@gmail.com wrote: Hi Friends, I would like to override wicket page, will have same wicket id's with different parent ids. Is it possible in wicket please help me... http://apache-wicket.1842946.n4.nabble.com/file/n4651624/wikcet-problem.png Regards, Rambabu - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: override wicket mark up
Ramlael's question is not very clear so I'm not sure whether I understand correctly. In the image I see the markup of two Panels. It is perfectly OK to replace one Panel with the other. Both of them have their own component tree (java+markup). On Thu, Aug 30, 2012 at 9:31 AM, Thomas Götz t...@decoded.de wrote: If you extend a Component/Page and want to provide a different markup you cannot change the component hierarchy, so it's not possible to insert some container (in your case adminGroupTabs) into the tree. -Tom On 30.08.2012, at 05:05, ramlael grambab...@gmail.com wrote: Hi Friends, I would like to override wicket page, will have same wicket id's with different parent ids. Is it possible in wicket please help me... http://apache-wicket.1842946.n4.nabble.com/file/n4651624/wikcet-problem.png Regards, Rambabu - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: override wicket mark up
Hey Martin.. I need to override the component with different hierarchy, and need to insert some container (in my case adminGroupTabs) into the tree. Is it possible?. Regards, Rambabu -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/override-wicket-mark-up-tp4651624p4651635.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: override wicket mark up
Yes. Just replace panel1 with panel2. See MarkupContainer#replace() and #replaceWith() methods. On Thu, Aug 30, 2012 at 10:22 AM, ramlael grambab...@gmail.com wrote: Hey Martin.. I need to override the component with different hierarchy, and need to insert some container (in my case adminGroupTabs) into the tree. Is it possible?. Regards, Rambabu -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/override-wicket-mark-up-tp4651624p4651635.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: override wicket mark up
Hi Martin, Once I call super(model) in extended class, its expecting markup (wicket:ids) should be in same order. Please can you provide sample code, how the replace or replaceWith will work. Regards, Rambabu -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/override-wicket-mark-up-tp4651624p4651640.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
override wicket mark up
Hi Friends, I would like to override wicket page, will have same wicket id's with different parent ids. Is it possible in wicket please help me... http://apache-wicket.1842946.n4.nabble.com/file/n4651624/wikcet-problem.png Regards, Rambabu -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/override-wicket-mark-up-tp4651624.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org