Tnx. :) Why don't the component implement iheadercontributor already? It would be more obvious then..
** Martin 2009/2/15 Igor Vaynberg <[email protected]>: > yep, thats how it works. any component can implement iheadercontributor. > > -igor > > On Sat, Feb 14, 2009 at 11:29 PM, Martin Makundi > <[email protected]> wrote: >>> unless you are planning to reuse such snippets it is cleaner to let >>> your component implement IHeaderContributor. >> >> So if I make a Panel implement IHeaderContributor, the renderHead will >> automatically be called? This would be very nice. Maybe it should be >> more apparent from the framework? >> >> ** >> Martin >> >>> >>> -igor >>> >>> On Sat, Feb 14, 2009 at 2:52 AM, Martin Makundi >>> <[email protected]> wrote: >>>> Hi! >>>> >>>> Does Wicket have this functionality built-in? Would it make sense? >>>> public abstract class AbstractHeaderJavaScriptBehavior extends >>>> AbstractBehavior >>>> implements IHeaderContributor { >>>> >>>> /** >>>> * @see >>>> org.apache.wicket.behavior.AbstractBehavior#renderHead(org.apache.wicket.markup.html.IHeaderResponse) >>>> */ >>>> @Override >>>> public void renderHead(IHeaderResponse response) { >>>> super.renderHead(response); >>>> response.renderJavascript(getHeaderJavaScript(), getScriptId()); >>>> } >>>> >>>> /** >>>> * @return default null >>>> */ >>>> public String getScriptId() { >>>> return null; >>>> } >>>> >>>> /** >>>> * @return Javascript wanted for header contribution. >>>> */ >>>> public abstract CharSequence getHeaderJavaScript(); >>>> } >>>> >>>> ** >>>> Martin >>>> >>>> --------------------------------------------------------------------- >>>> To unsubscribe, e-mail: [email protected] >>>> For additional commands, e-mail: [email protected] >>>> >>>> >>> >>> --------------------------------------------------------------------- >>> To unsubscribe, e-mail: [email protected] >>> For additional commands, e-mail: [email protected] >>> >>> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [email protected] >> For additional commands, e-mail: [email protected] >> >> > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
