Java Doc for HtmlPageAttributes.java in  » Web-Framework » TURBINE » org » apache » turbine » util » template » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Web Framework » TURBINE » org.apache.turbine.util.template 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.apache.turbine.util.template.HtmlPageAttributes

HtmlPageAttributes
public class HtmlPageAttributes implements ApplicationTool(Code)
Template context tool that can be used to set various attributes of a HTML page. This tool does not automatically make the changes in the HTML page for you. You must use this tool in your layout template to retrieve the attributes.

The set/add methods are can be used from a screen template, action, screen class, layour template, or anywhere else. The get methods should be used in your layout template(s) to construct the appropriate HTML tags.

Example usage of this tool to build the HEAD and BODY tags in your layout templates:

## Set defaults for all pages using this layout. Anything set here can
## be overridden in the screen template.
$page.setTitle("My default page title");
$page.setHttpEquiv("Content-Style-Type","text/css")
$page.addStyleSheet($content.getURI("myStyleSheet.css"))
$page.addScript($content.getURI("globalJavascriptCode.js"))

## build the HTML, HEAD, and BODY tags dynamically
<html>
<head>
#if( $page.Title != "" )
<title>$page.Title</title>
#end
#foreach($metaTag in $page.MetaTags.keySet())
<meta name="$metaTag" content="$page.MetaTags.get($metaTag)">
#end
#foreach($httpEquiv in $page.HttpEquivs.keySet())
<meta http-equiv="$httpEquiv" content="$page.HttpEquivs.get($httpEquiv)">
#end
#foreach( $linkTag in $page.Links )
<link rel="$linkTag.Relation" href="$linkTag.Url"
#if($linkTag.Type != "" ) type="$linkTag.Type" #end
#if($linkTag.Media != "") media="$linkTag.Media" #end
#if($linkTag.Title != "") title="$linkTag.Title" #end
/>
#end
#foreach( $script in $page.Scripts )
<script type="text/javascript" src="$script" language="JavaScript"></script>
#end
</head>

## Construct the body tag. Iterate through the body attributes to build the opening tag
<body
#foreach( $attributeName in $page.BodyAttributes.keySet() )
$attributeName = "$page.BodyAttributes.get($attributeName)"
#end
>

Example usages of this tool in your screen templates:
$page.addScript($content.getURI("myJavascript.js")
$page.setTitle("My page title")
$page.setHttpEquiv("refresh","5; URL=http://localhost/nextpage.html")

author:
   Quinton McCombs
author:
   Scott Eade
author:
   Thomas Vandahl
version:
   $Id: HtmlPageAttributes.java 534527 2007-05-02 16:10:59Z tv $


Inner Class :public class LinkTag


Constructor Summary
public  HtmlPageAttributes()
     Default constructor.
public  HtmlPageAttributes(RunData data)
     Construct a new instance with the given RunData object.

Method Summary
public  HtmlPageAttributesaddAttribute(String name, String value)
     Adds an attribute to the BODY tag.
Parameters:
  name - A String.
Parameters:
  value - A String.
public  HtmlPageAttributesaddBodyAttribute(String name, String value)
     Adds an attribute to the BODY tag.
Parameters:
  name - A String.
Parameters:
  value - A String.
public  HtmlPageAttributesaddLink(String relation, String linkURL)
    
public  HtmlPageAttributesaddLink(String relation, String linkURL, String title)
    
public  HtmlPageAttributesaddLink(String relation, String linkURL, String title, String type)
    
public  HtmlPageAttributesaddScript(String scriptURL)
    
public  HtmlPageAttributesaddStyle(String styleText)
     Adds a STYLE element to the HEAD of the page with the provided content.
Parameters:
  styleText - The contents of the style tag.
public  HtmlPageAttributesaddStyleSheet(String styleSheetURL)
    
public  HtmlPageAttributesaddStyleSheet(String styleSheetURL, String media, String title, String type)
    
public  MapgetBodyAttributes()
    
public  StringgetDefaultDoctype()
     Retrieve the default Doctype as configured by the TurbineResources.peoperties default.doctype.root.element, default.doctype.identifier and default.doctype.url properties (defaults are "HTML", "-//W3C//DTD HTML 4.01 Transitional//EN" and "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd" respectively).
public  MapgetHttpEquivs()
    
public  ListgetLinks()
    
public  MapgetMetaTags()
    
public  ListgetScripts()
    
public  ListgetStyleSheets()
    
public  ListgetStyles()
    
public  StringgetTitle()
     Get the title in the page.
public  voidinit(Object data)
     Initialise this instance with the given RunData object.
public  voidrefresh()
    
public  HtmlPageAttributessetAlinkColor(String color)
     Set the active link color for the BODY tag.
Parameters:
  color - A String.
public  HtmlPageAttributessetBackground(String url)
     Set the background image for the BODY tag.
Parameters:
  url - A String.
public  HtmlPageAttributessetBgColor(String color)
     Set the background color for the BODY tag.
public  HtmlPageAttributessetDescription(String description)
     Add a description META tag to the HEAD of the page.
Parameters:
  description - A String.
public  HtmlPageAttributessetHttpEquiv(String httpEquiv, String content)
     Sets a HttpEquiv META tag in the HEAD of the page, usage:
setHttpEquiv("refresh", "5; URL=http://localhost/nextpage.html")
setHttpEquiv("Expires", "Tue, 20 Aug 1996 14:25:27 GMT")
Parameters:
  httpEquiv - The value to use for the http-equiv attribute.
Parameters:
  content - The text for the content attribute of the meta tag.
public  HtmlPageAttributessetKeywords(String keywords)
     Set a keywords META tag in the HEAD of the page.
Parameters:
  keywords - A String.
public  HtmlPageAttributessetLinkColor(String color)
     Set the link color for the BODY tag.
public  HtmlPageAttributessetScript(String scriptURL)
    
public  HtmlPageAttributessetStyle(String styleText)
     Adds a STYLE element to the HEAD of the page with the provided content.
Parameters:
  styleText - The contents of the style tag.
public  HtmlPageAttributessetStyleSheet(String styleSheetURL)
    
public  HtmlPageAttributessetStyleSheet(String styleSheetURL, String media)
    
public  HtmlPageAttributessetTextColor(String color)
     Set the text color for the BODY tag.
public  HtmlPageAttributessetTitle(String title)
     Set the title in the page.
public  HtmlPageAttributessetVlinkColor(String color)
     Set the visited link color for the BODY tag.
Parameters:
  color - A String.
public  StringtoString()
     A dummy toString method that returns an empty string.


Constructor Detail
HtmlPageAttributes
public HtmlPageAttributes()(Code)
Default constructor. The init method must be called before use



HtmlPageAttributes
public HtmlPageAttributes(RunData data)(Code)
Construct a new instance with the given RunData object.
Parameters:
  data - a RunData instance




Method Detail
addAttribute
public HtmlPageAttributes addAttribute(String name, String value)(Code)
Adds an attribute to the BODY tag.
Parameters:
  name - A String.
Parameters:
  value - A String. a HtmlPageAttributes (self).



addBodyAttribute
public HtmlPageAttributes addBodyAttribute(String name, String value)(Code)
Adds an attribute to the BODY tag.
Parameters:
  name - A String.
Parameters:
  value - A String. a HtmlPageAttributes (self).



addLink
public HtmlPageAttributes addLink(String relation, String linkURL)(Code)
Adds a generic external reference
Parameters:
  relation - type of the reference (prev, next, first, last, top, etc.)
Parameters:
  linkURL - URL of the reference a HtmlPageAttributes (self).



addLink
public HtmlPageAttributes addLink(String relation, String linkURL, String title)(Code)
Adds a generic external reference
Parameters:
  relation - type of the reference (prev, next, first, last, top, etc.)
Parameters:
  linkURL - URL of the reference
Parameters:
  title - title of the reference a HtmlPageAttributes (self).



addLink
public HtmlPageAttributes addLink(String relation, String linkURL, String title, String type)(Code)
Adds a generic external reference
Parameters:
  relation - type of the reference (prev, next, first, last, top, etc.)
Parameters:
  linkURL - URL of the reference
Parameters:
  title - title of the reference
Parameters:
  type - content type a HtmlPageAttributes (self).



addScript
public HtmlPageAttributes addScript(String scriptURL)(Code)
Adds a script reference
Parameters:
  scriptURL - a HtmlPageAttributes (self).



addStyle
public HtmlPageAttributes addStyle(String styleText)(Code)
Adds a STYLE element to the HEAD of the page with the provided content.
Parameters:
  styleText - The contents of the style tag. a HtmlPageAttributes (self).



addStyleSheet
public HtmlPageAttributes addStyleSheet(String styleSheetURL)(Code)
Adds a style sheet reference
Parameters:
  styleSheetURL - URL of the style sheet a HtmlPageAttributes (self).



addStyleSheet
public HtmlPageAttributes addStyleSheet(String styleSheetURL, String media, String title, String type)(Code)
Adds a style sheet reference
Parameters:
  styleSheetURL - URL of the style sheet
Parameters:
  media - name of the media
Parameters:
  title - title of the stylesheet
Parameters:
  type - content type a HtmlPageAttributes (self).



getBodyAttributes
public Map getBodyAttributes()(Code)
Returns the map of body attributes the map



getDefaultDoctype
public String getDefaultDoctype()(Code)
Retrieve the default Doctype as configured by the TurbineResources.peoperties default.doctype.root.element, default.doctype.identifier and default.doctype.url properties (defaults are "HTML", "-//W3C//DTD HTML 4.01 Transitional//EN" and "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd" respectively). the DOCTYPE tag constructed from the properties inTurbineResources.properties.



getHttpEquivs
public Map getHttpEquivs()(Code)
Gets the map of http equiv tags Map of http equiv names to the contents



getLinks
public List getLinks()(Code)
Returns a collection of link URLs list LinkTag objects (inner class)



getMetaTags
public Map getMetaTags()(Code)
Gets the map of meta tags Map of http equiv names to the contents



getScripts
public List getScripts()(Code)
Returns a collection of script URLs list of String objects constainings URLs of javascript filesto include



getStyleSheets
public List getStyleSheets()(Code)
Returns a collection of script URLs list LinkTag objects (inner class)



getStyles
public List getStyles()(Code)
Returns a collection of styles list of String objects containing the contents of style tags



getTitle
public String getTitle()(Code)
Get the title in the page. This returns an empty String if empty so that the template doesn't complain about getting a null return value. A String with the title.



init
public void init(Object data)(Code)
Initialise this instance with the given RunData object. (ApplicationTool method)
Parameters:
  data - Assumed to be a RunData instance



refresh
public void refresh()(Code)
Refresh method - does nothing



setAlinkColor
public HtmlPageAttributes setAlinkColor(String color)(Code)
Set the active link color for the BODY tag.
Parameters:
  color - A String. a HtmlPageAttributes (self).



setBackground
public HtmlPageAttributes setBackground(String url)(Code)
Set the background image for the BODY tag.
Parameters:
  url - A String. a HtmlPageAttributes (self).



setBgColor
public HtmlPageAttributes setBgColor(String color)(Code)
Set the background color for the BODY tag. You can use either color names or color values (e.g. "white" or "#ffffff" or "ffffff").
Parameters:
  color - A String. a HtmlPageAttributes (self).



setDescription
public HtmlPageAttributes setDescription(String description)(Code)
Add a description META tag to the HEAD of the page.
Parameters:
  description - A String. a HtmlPageAttributes (self).



setHttpEquiv
public HtmlPageAttributes setHttpEquiv(String httpEquiv, String content)(Code)
Sets a HttpEquiv META tag in the HEAD of the page, usage:
setHttpEquiv("refresh", "5; URL=http://localhost/nextpage.html")
setHttpEquiv("Expires", "Tue, 20 Aug 1996 14:25:27 GMT")
Parameters:
  httpEquiv - The value to use for the http-equiv attribute.
Parameters:
  content - The text for the content attribute of the meta tag. a HtmlPageAttributes (self).



setKeywords
public HtmlPageAttributes setKeywords(String keywords)(Code)
Set a keywords META tag in the HEAD of the page.
Parameters:
  keywords - A String. a HtmlPageAttributes (self).



setLinkColor
public HtmlPageAttributes setLinkColor(String color)(Code)
Set the link color for the BODY tag. You can use either color names or color values (e.g. "white" or "#ffffff" or "ffffff").
Parameters:
  color - A String. a HtmlPageAttributes (self).



setScript
public HtmlPageAttributes setScript(String scriptURL)(Code)
Adds a script reference
Parameters:
  scriptURL - a HtmlPageAttributes (self).



setStyle
public HtmlPageAttributes setStyle(String styleText)(Code)
Adds a STYLE element to the HEAD of the page with the provided content.
Parameters:
  styleText - The contents of the style tag. a HtmlPageAttributes (self).



setStyleSheet
public HtmlPageAttributes setStyleSheet(String styleSheetURL)(Code)
Adds a style sheet reference
Parameters:
  styleSheetURL - a HtmlPageAttributes (self).



setStyleSheet
public HtmlPageAttributes setStyleSheet(String styleSheetURL, String media)(Code)
Adds a style sheet reference
Parameters:
  styleSheetURL -
Parameters:
  media - name of the media a HtmlPageAttributes (self).



setTextColor
public HtmlPageAttributes setTextColor(String color)(Code)
Set the text color for the BODY tag. You can use either color names or color values (e.g. "white" or "#ffffff" or "ffffff").
Parameters:
  color - A String. a HtmlPageAttributes (self).



setTitle
public HtmlPageAttributes setTitle(String title)(Code)
Set the title in the page. This returns an empty String so that the template doesn't complain about getting a null return value. Subsequent calls to this method will replace the current title.
Parameters:
  title - A String with the title. a HtmlPageAttributes (self).



setVlinkColor
public HtmlPageAttributes setVlinkColor(String color)(Code)
Set the visited link color for the BODY tag.
Parameters:
  color - A String. a HtmlPageAttributes (self).



toString
public String toString()(Code)
A dummy toString method that returns an empty string. An empty String ("").



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.