You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@click.apache.org by Beto <gi...@gmail.com> on 2010/10/21 21:26:42 UTC

Re: headElements click example on the avoka.com

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

Re: headElements click example on the avoka.com

Posted by Bob Schellink <sa...@gmail.com>.
Ah thanks,

It used to be that posting on nabble would forward the email here. Seems like something have
changed. I'll have a look.

Kind regards

Bob

On 23/10/2010 03:06, Beto wrote:
> Hi, Bob!
> Yes, thanks a lot!
> 
> I was trying to help dukedosa (I don't know his name), he used the
> nabble[1] forum to make that question.
> 
> Regards,
> 
> [1]http://click.1134972.n2.nabble.com/
> 


Re: headElements click example on the avoka.com

Posted by Beto <gi...@gmail.com>.
Hi, Bob!

>On Fri, Oct 22, 2010 at 1:46 AM, Bob Schellink <sa...@gmail.com> wrote:
>  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?
>
Yes, thanks a lot!

I was trying to help dukedosa (I don't know his name), he used the
nabble[1] forum to make that question.

Regards,

[1]http://click.1134972.n2.nabble.com/

Re: headElements click example on the avoka.com

Posted by Bob Schellink <sa...@gmail.com>.
 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
>