problem with this is that pages can have dynamic components which dynamic header contributions.
so either you have to somehow collect all possible header contributions from all possible component combinations - breaking encapsulation in the process, or you have to do what you do - ending up with many many possible and big javascript files to serve to the user. -igor On Tue, Sep 2, 2008 at 2:57 PM, richardwilko <[EMAIL PROTECTED]> wrote: > > The problem of breaking encapsulation: > > I did some work on this problem on my own a few months ago, my solution was > to use a header contrib manager, and instead of adding files with a header > contributer i add them to the manager, then get a single contributer per > page from the manger. > > for example in a panel you would do > > @Override > protected void onBeforeRender() { > super.onBeforeRender(); > ResourceReference rr = new ResourceReference(getClass(), > "test.js"); > WicketApplication.get().getHcm().add(rr, getPage().getClass()); > } > > See how it uses getPage().getClass(), so the manager knows which class the > panel is being added into > > then in the main page class > > @Override > protected void onBeforeRender() { > super.onBeforeRender(); > > add(WicketApplication.get().getHcm().getHeaderContributor(getClass())); > } > > since the manager knows all of the resources added for the page at this > point, it is easy to compress them all together and serve a single file, and > you dont have to list the files up front. > > What do you think of this idea? > > My code is here: > http://www.nabble.com/file/p19279269/HeaderContribManagerTest.zip > HeaderContribManagerTest.zip > > It still has bugs etc in it, and doesnt really work cos ive messed up the > registerResource method, but you should be able to get the idea from it > > Richard > > > > ----- > http://www.richard-wilkinson.co.uk My blog: > http://www.richard-wilkinson.co.uk > -- > View this message in context: > http://www.nabble.com/Discussion-on-%22Wicket-Interface-Speed-Up%22-tp19197540p19279269.html > Sent from the Wicket - User mailing list archive at Nabble.com. > > > --------------------------------------------------------------------- > 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]