|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.click.util.PageImports
public class PageImports
Provides a utility object for rendering a Page's HEAD elements and control HEAD elements.
PageImports automatically makes the HEAD elements available to Velocity templates and JSP pages through the following variables:<html> <head> $headElements </head> <body> $form $jsElements <body> </html>Its not always possible to move the JavaScript elements to the bottom of the Page, for example there might be JavaScript scoping issues. In those situations you can simply place the JavaScript elements variable in the Page HEAD section:
<html> <head> $headElements $jsElements </head> <body> $form <body> </html>Please note: the variables $headElements and $jsElements are new in Click 2.1.0. For backwards compatibility the HEAD elements are also available through the following variables:
Page.getHeadElements()
,
Control.getHeadElements()
.
Field Summary | |
---|---|
protected List<CssImport> |
cssImports
The list of CSS import lines. |
protected List<CssStyle> |
cssStyles
The list of CSS styles. |
protected List<Element> |
headElements
The list of head elements. |
protected boolean |
initialized
The page imports initialized flag. |
protected List<JsImport> |
jsImports
The list of JS import lines. |
protected List<JsScript> |
jsScripts
The list of JS script block lines. |
protected Page |
page
The page instance. |
Constructor Summary | |
---|---|
PageImports(Page page)
Create a page control HTML includes object. |
Method Summary | |
---|---|
void |
add(Element element)
Add the given Element to the Page HEAD elements. |
void |
addAll(List<Element> elements)
Add the given list of Elements to the Page HEAD elements. |
List<Element> |
getHeadElements()
Return the list of processed HEAD elements, excluding any JavaScript elements. |
List<Element> |
getJsElements()
Return the list of processed JavaScript elements. |
boolean |
isInitialized()
Return true if the page imports have been initialized. |
void |
populateRequest(HttpServletRequest request,
Map<String,Object> model)
Populate the specified request with html import keys. |
void |
populateTemplateModel(Map<String,Object> model)
Populate the specified model with html import keys. |
void |
processControl(Control control)
Process the given control HEAD elements. |
void |
processControls(List<Control> controls)
Process the HEAD elements of the given list of Controls. |
protected void |
processHeadElements(List<Element> elements)
Process the given list of HEAD elements. |
protected void |
processPageControls()
Process the Page's set of control HEAD elements. |
protected void |
renderAllIncludes(HtmlStringBuffer buffer)
Deprecated. rather use renderHeadElements(org.apache.click.util.HtmlStringBuffer)
and renderJsElements(org.apache.click.util.HtmlStringBuffer) |
protected void |
renderCssElements(HtmlStringBuffer buffer)
Render an HTML representation of all all the page's HTML CSS imports and styles . |
protected void |
renderHeadElements(HtmlStringBuffer buffer)
Render an HTML representation of all the page's HTML head elements, including: CSS imports, CSS styles, Title and Meta elements. |
protected void |
renderJsElements(HtmlStringBuffer buffer)
Render an HTML representation of all the page's HTML JavaScript imports and scripts . |
void |
setInitialized(boolean initialized)
Set whether the page imports have been initialized. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected boolean initialized
protected List<Element> headElements
protected List<CssImport> cssImports
protected List<JsImport> jsImports
protected List<JsScript> jsScripts
protected List<CssStyle> cssStyles
protected final Page page
Constructor Detail |
---|
public PageImports(Page page)
page
- the page to provide HTML includes forMethod Detail |
---|
public void add(Element element)
element
- the Element to add
IllegalArgumentException
- if the Element is nullpublic void addAll(List<Element> elements)
elements
- the list of Elements to add to the Page HEAD elements
IllegalArgumentException
- is the list of Elements are nullpublic boolean isInitialized()
public void setInitialized(boolean initialized)
initialized
- the page imports have been initialized flagpublic void populateTemplateModel(Map<String,Object> model)
model
- the model to populate with html import keyspublic void populateRequest(HttpServletRequest request, Map<String,Object> model)
request
- the http request to populatemodel
- the model to populate with html import keyspublic void processControls(List<Control> controls)
getHeadElements()
and
getJsElements()
.
This method delegates to processControl(org.apache.click.Control)
to add the given Control's HEAD elements to the Page imports.
controls
- the list of Controls which HEAD elements to processpublic void processControl(Control control)
getHeadElements()
and
getJsElements()
.
This method delegates to processHeadElements(java.util.List)
to add the HEAD elements to the Page imports.
control
- the control to processpublic final List<Element> getHeadElements()
getJsElements()
.
public final List<Element> getJsElements()
protected void renderHeadElements(HtmlStringBuffer buffer)
buffer
- the specified buffer to render the page's HTML imports toprotected void renderAllIncludes(HtmlStringBuffer buffer)
renderHeadElements(org.apache.click.util.HtmlStringBuffer)
and renderJsElements(org.apache.click.util.HtmlStringBuffer)
buffer
- the specified buffer to render the page's HTML imports toprotected void renderCssElements(HtmlStringBuffer buffer)
imports
and styles
.
buffer
- the specified buffer to render the page's HTML imports toprotected void renderJsElements(HtmlStringBuffer buffer)
imports
and scripts
.
buffer
- the specified buffer to render the page's HTML imports toprotected void processPageControls()
protected void processHeadElements(List<Element> elements)
add(org.apache.click.element.Element)
for
every Element entry in the specified list.
elements
- the list of HEAD elements to process
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |