Page inheritance problem
Hi experts, I have a Page class with serves as base html-template for the derived pages. (e.g. http://www.javalobby.org/java/forums/t69357.html) For some special needs, subclass-markup should be placed in some element managed by wicket and not at the root. base.html body div wicket:id=superDiv wicket:child/ /div /body My workaround currently is, that the Base-class provides a getSuperDiv() method, wich must be used from the subpages to add their content to. SubPage(String) { super(...); // NOW, wrong: add( new Label(hello,Hello)); // CORRECT getSuperDiv().add( new Label(hello,Hello)); } Anybody, knows some more clean solution to this? Maybe the root-Container for the subpages can be set somehow. Thanks Jens - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Page inheritance problem
Jens, Your super class could declare an abstract protected void getThatPanelIWantSometimes() method that the children can then implement to return whatever they like and then the ball's back in the parent's court. Regards - Cemal jWeekend OO Java Technologies, Wicket Training and Development http://jWeekend.com mcbain wrote: Hi experts, I have a Page class with serves as base html-template for the derived pages. (e.g. http://www.javalobby.org/java/forums/t69357.html) For some special needs, subclass-markup should be placed in some element managed by wicket and not at the root. base.html body div wicket:id=superDiv wicket:child/ /div /body My workaround currently is, that the Base-class provides a getSuperDiv() method, wich must be used from the subpages to add their content to. SubPage(String) { super(...); // NOW, wrong: add( new Label(hello,Hello)); // CORRECT getSuperDiv().add( new Label(hello,Hello)); } Anybody, knows some more clean solution to this? Maybe the root-Container for the subpages can be set somehow. Thanks Jens - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- View this message in context: http://www.nabble.com/Page-inheritance-problem-tp25776777p25776824.html Sent from the Wicket - User 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: Page inheritance problem
Hmmm... this effectivly not uses the wicket:child/ thing for the inner-subclass-components. If i do so, from the Java-side its really bad to invoke subclass-methods from super-contructors. Can the invocation of the getThatPanelIWantAlwaysButAtCertainLocation() method be deferred somehow?? Regards Jens Jens, Your super class could declare an abstract protected void getThatPanelIWantSometimes() method that the children can then implement to return whatever they like and then the ball's back in the parent's court. Regards - Cemal jWeekend OO Java Technologies, Wicket Training and Development http://jWeekend.com jWeekend schrieb: -- dipl. inform jens zastrow phone | +49.152.04840108 mail | m...@jens-zastrow.de web | http://jens-zastrow.de xing | http://www.xing.com/profile/Jens_Zastrow - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Page inheritance problem
Jens, That indeed could be dangerous (if the subclass implementation refers to subclass state that will not be initialised yet) - you can addOrReplace the returned component in onBeforeRender. This solution is nothing to do with the wicket:child/extension inheritance by the way, that will still work as per normal. You're just asking the children to supply some component the super-class will place in its bit of the markup (ie outside of wicket:child). Does that make sense? Regards - Cemal jWeekend OO Java Technologies, Wicket Training and Development http://jWeekend.com mcbain wrote: Hmmm... this effectivly not uses the wicket:child/ thing for the inner-subclass-components. If i do so, from the Java-side its really bad to invoke subclass-methods from super-contructors. Can the invocation of the getThatPanelIWantAlwaysButAtCertainLocation() method be deferred somehow?? Regards Jens Jens, Your super class could declare an abstract protected void getThatPanelIWantSometimes() method that the children can then implement to return whatever they like and then the ball's back in the parent's court. Regards - Cemal jWeekend OO Java Technologies, Wicket Training and Development http://jWeekend.com jWeekend schrieb: -- dipl. inform jens zastrow phone | +49.152.04840108 mail | m...@jens-zastrow.de web | http://jens-zastrow.de xing | http://www.xing.com/profile/Jens_Zastrow - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- View this message in context: http://www.nabble.com/Page-inheritance-problem-tp25776777p25777065.html Sent from the Wicket - User 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: Page inheritance problem
whatever component is the superDiv has to have gettransparentresolver() overridden to return true -igor On Tue, Oct 6, 2009 at 2:20 PM, Jens Zastrow m...@jens-zastrow.de wrote: Hi experts, I have a Page class with serves as base html-template for the derived pages. (e.g. http://www.javalobby.org/java/forums/t69357.html) For some special needs, subclass-markup should be placed in some element managed by wicket and not at the root. base.html body div wicket:id=superDiv wicket:child/ /div /body My workaround currently is, that the Base-class provides a getSuperDiv() method, wich must be used from the subpages to add their content to. SubPage(String) { super(...); // NOW, wrong: add( new Label(hello,Hello)); // CORRECT getSuperDiv().add( new Label(hello,Hello)); } Anybody, knows some more clean solution to this? Maybe the root-Container for the subpages can be set somehow. Thanks Jens - 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: Page inheritance problem
yeah, what you are doing is not inheritance, it is a mix of composition and inhertiace - which is quiet hard to map. the transparent resolver hack is there for such circumstances but...use at your own risk :) -gior On Tue, Oct 6, 2009 at 2:45 PM, jWeekend jweekend_for...@cabouge.com wrote: Jens, That indeed could be dangerous (if the subclass implementation refers to subclass state that will not be initialised yet) - you can addOrReplace the returned component in onBeforeRender. This solution is nothing to do with the wicket:child/extension inheritance by the way, that will still work as per normal. You're just asking the children to supply some component the super-class will place in its bit of the markup (ie outside of wicket:child). Does that make sense? Regards - Cemal jWeekend OO Java Technologies, Wicket Training and Development http://jWeekend.com mcbain wrote: Hmmm... this effectivly not uses the wicket:child/ thing for the inner-subclass-components. If i do so, from the Java-side its really bad to invoke subclass-methods from super-contructors. Can the invocation of the getThatPanelIWantAlwaysButAtCertainLocation() method be deferred somehow?? Regards Jens Jens, Your super class could declare an abstract protected void getThatPanelIWantSometimes() method that the children can then implement to return whatever they like and then the ball's back in the parent's court. Regards - Cemal jWeekend OO Java Technologies, Wicket Training and Development http://jWeekend.com jWeekend schrieb: -- dipl. inform jens zastrow phone | +49.152.04840108 mail | m...@jens-zastrow.de web | http://jens-zastrow.de xing | http://www.xing.com/profile/Jens_Zastrow - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- View this message in context: http://www.nabble.com/Page-inheritance-problem-tp25776777p25777065.html Sent from the Wicket - User 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: Page inheritance problem
The SuperDiv component is just a WebMarkupContainer I just tried to find the getTransparentResolver() method, but without success... Igor Vaynberg schrieb: -- dipl. inform jens zastrow phone | +49.152.04840108 mail | m...@jens-zastrow.de web | http://jens-zastrow.de xing | http://www.xing.com/profile/Jens_Zastrow - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Page inheritance problem
Jens, MarkupContainer#isTransparentResolver (but Igor says use it at your own risk!) Regards - Cemal jWeekend OO Java Technologies, Wicket Training and Development http://jWeekend.com mcbain wrote: The SuperDiv component is just a WebMarkupContainer I just tried to find the getTransparentResolver() method, but without success... Igor Vaynberg schrieb: -- dipl. inform jens zastrow phone | +49.152.04840108 mail | m...@jens-zastrow.de web | http://jens-zastrow.de xing | http://www.xing.com/profile/Jens_Zastrow - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- View this message in context: http://www.nabble.com/Page-inheritance-problem-tp25776777p25777180.html Sent from the Wicket - User 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