click-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bob Schellink (JIRA)" <j...@apache.org>
Subject [JIRA] Commented: (CLK-501) Add first class support for HTML Head resources such as Javascript and CSS
Date Wed, 11 Mar 2009 06:08:11 GMT

    [ http://issues.apache.org/click/browse/CLK-501?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=11733#action_11733
] 

Bob Schellink commented on CLK-501:
-----------------------------------

I also thought about leveraging onRender, however users can skip this phase by returning false
from an action listener.

At least 3 approaches exist to add elements to the HeadElements List. 

# in the Page/Control constructor
# overriding getHeadElements using lazy loading
# in onInit and onProcess. However in this case the HeadElements List must be nullified in
the onDestroy callback. This ensures no memory leaks exist with stateful pages

> The Container controls then iterate through their children doing the same

My current approach is not to let the Container return their child control Head elements.
Instead PageImports recursively process each Control. The reason that each Control and Container
return only their own List of Head Elements, is to introduce the ability to dynamically add/remove
a Control's Javascript and CSS at runtime.

Introducing Element will also raise the question of how it ties in with Control. Should AbstractControl
extend Element?

Another thing to keep in mind is that TitleElement and CacheElement can also be supported
through a BorderPage and custom Velocity variables instead of HeadElements.


> Add first class support for HTML Head resources such as Javascript and CSS
> --------------------------------------------------------------------------
>
>                 Key: CLK-501
>                 URL: http://issues.apache.org/click/browse/CLK-501
>             Project: Click
>          Issue Type: New Feature
>          Components: core
>            Reporter: Bob Schellink
>            Assignee: Bob Schellink
>             Fix For: 2.1.0
>
>
> Currently Click supports HTML imports by overriding the method #getHtmlImports. 
> This method is string based which makes it difficult to support advanced features such
as templating, conditional imports, resource versioning etc.
> This feature request proposes to introduce first class HTML header resource classes including
Javascript, JavascriptImport, CssImport and Css.
> Further a new method should be added to the Control interface: 'public List getHtmlHeaders'
which returns a list of the Page or Control's HTML HEAD entries.
> This makes it possible to modify the Javascript and CSS imports without overriding a
Control.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message