WarnerJan Veldhuis wrote:
Ah, here's what went wrong: in the onInit() of the BorderPage, I had the
line getPageImports().add( new CssImport(...) ). It works, but has a
side effect on the order of the import. When I override
getHeadElements() it works fine: my css imports come last now.


You can also use getHeadElements from onInit:

  public void onInit() {
    getHeadElements().add(...);
  }

However check the Javadoc as there is a caveat if you are using stateful pages.

The only real use case for using getPageImports is if you want to merge all the Page imports into a single file for faster download. One would then set the PageImports "initialized" property to true so that no other imports are included. See this example: http://www.avoka.com/click-examples/general/page-imports-example.htm

It might have been a mistake to expose getPageImports on Page as it will create confusion on how to import JS and CSS resources.

bob

Reply via email to