Hi Gilberto,

Each page and control has a headElements List variable where JS and CSS can be 
added to.

At runtime the ClickServlet creates a PageImports instance and invokes it's 
populateTemplateModel
method. This method adds the page headElements and then iterates over every 
page control (and their
children, recursively) and gathers their headElements into a single List which 
is made available to
Velocity using the variable, $headElements.

If you debug the Page#hedElements, it will be empty, unless that page is adding 
its own head
elements to the page. If you debug menu.headElements, you'll see the menu JS 
and CSS it needs to
render correctly. So each control is responsible for it's own resources.

If you are interested in how Click works, I highly recommend looking at 
ClickServlet source code. It
It is a fairly large class but straightforward  and defines exactly how the 
Click runtime operates.

Does this answer your question?

Kind regards

Bob

On 22/10/2010 06:26, Beto wrote:
> Hi, dukedosa!
>
> <quote author="dukedosa">
> Hi,
>
> I have just started with the Click Framework. I have been looking at
> the examples on avoka.com. I was looking at the border-template.htm. I
> am trying to understand how the menu items are created and displayed.
> The bit I dont understand is there is ${headElements} which when i
> look through the debugger there is a headElements variable but it is
> empty. If I remove this from the html page then the menu items don't
> display in a row and correct layout. I looked at the api and this
> variable can be used to stored java scripts and css. I just want to
> know where this is defined.
>
> Regards
>
> </quote>
>
> They are set by the PageImports[1] utility class.
>
> Regards,
>
> Gilberto
> [1]http://click.apache.org/docs/click-api/org/apache/click/util/PageImports.html
>

Reply via email to