Java Doc for TilesTool.java in  » Template-Engine » Velocity » org » apache » velocity » tools » struts » 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 » Template Engine » Velocity » org.apache.velocity.tools.struts 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.apache.velocity.tools.view.ImportSupport
      org.apache.velocity.tools.struts.TilesTool

TilesTool
public class TilesTool extends ImportSupport (Code)
View tool to use struts-tiles with Velocity.

 Template example(s):
 <!-- insert a tile -->
 $tiles.myTileDefinition
 <!-- get named attribute value from the current tiles-context -->
 $tiles.getAttribute("myTileAttribute")
 <!-- import all attributes of the current tiles-context into the velocity-context. -->
 $tiles.importAttributes()
 Toolbox configuration:
 <tool>
 <key>tiles</key>
 <scope>request</scope>
 <class>org.apache.velocity.tools.struts.TilesTool</class>
 </tool>
 

This tool should only be used in the request scope.


author:
   Marino A. Jonsson
since:
   VelocityTools 1.1
version:
   $Revision: 477914 $ $Date: 2006-11-21 13:52:11 -0800 (Tue, 21 Nov 2006) $


Field Summary
final static  StringAPPLICATION_SCOPE
    
final protected static  LogLOG
    
final static  StringPAGE_SCOPE
    
final static  StringREQUEST_SCOPE
    
final static  StringSESSION_SCOPE
    
protected  StackcontextStack
     A stack to hold ComponentContexts while nested tile-definitions are rendered.
protected  ContextvelocityContext
    

Constructor Summary
public  TilesTool()
     Default constructor.

Method Summary
protected  StringdoInsert(String page, String role, Controller controller)
     Use this if there is no nested tile.
protected  StringdoInsert(Map attributes, String page, String role, Controller controller)
     Use this if there is a nested tile.
protected  StringdoInsert(ComponentContext subCompContext, String page, String role, Controller controller)
    
public  Stringget(Object obj)
     A generic tiles insert function.
public  ObjectgetAttribute(String name)
     Fetches a named attribute-value from the current tiles-context.
protected  ComponentContextgetCurrentContext()
     Retrieve the current tiles component context.
public  voidimportAttribute(String name)
     Imports the named attribute-value from the current tiles-context into the current Velocity context.
public  voidimportAttribute(String name, String scope)
     Imports the named attribute-value from the current tiles-context into the named context ("page", "request", "session", or "application").
public  voidimportAttributes()
     Imports all attributes in the current tiles-context into the current velocity-context.
public  voidimportAttributes(String scope)
     Imports all attributes in the current tiles-context into the named context ("page", "request", "session", or "application").
public  voidinit(Object obj)
     Initializes this tool.
protected  voidpopTilesContext()
     Pops the tiles sub-context off the context-stack after the lower level tiles have been rendered.
protected  StringprocessAsDefinitionOrURL(String name)
     Try to process name as a definition, or as an URL if not found.
Parameters:
  name - Name to process.
protected  StringprocessDefinition(ComponentDefinition definition)
     End of Process for definition.
Parameters:
  definition - Definition to process.
protected  StringprocessObjectValue(Object value)
     Process an object retrieved as a bean or attribute.
Parameters:
  value - - Object can be a typed attribute, a String, or anythingelse.
protected  StringprocessTypedAttribute(AttributeDefinition value)
     Process typed attribute according to its type.
Parameters:
  value - Typed attribute to process.
protected  StringprocessUrl(String url)
     Processes an url
Parameters:
  url - the URI to process.
protected  voidpushTilesContext()
    

pushes the current tiles context onto the context-stack.


Field Detail
APPLICATION_SCOPE
final static String APPLICATION_SCOPE(Code)



LOG
final protected static Log LOG(Code)



PAGE_SCOPE
final static String PAGE_SCOPE(Code)



REQUEST_SCOPE
final static String REQUEST_SCOPE(Code)



SESSION_SCOPE
final static String SESSION_SCOPE(Code)



contextStack
protected Stack contextStack(Code)
A stack to hold ComponentContexts while nested tile-definitions are rendered.



velocityContext
protected Context velocityContext(Code)




Constructor Detail
TilesTool
public TilesTool()(Code)
Default constructor. Tool must be initialized before use.




Method Detail
doInsert
protected String doInsert(String page, String role, Controller controller) throws Exception(Code)
Use this if there is no nested tile.
Parameters:
  page - the page to process.
Parameters:
  role - possible user-role
Parameters:
  controller - possible tiles-controller the rendered template as String.
throws:
  Exception -



doInsert
protected String doInsert(Map attributes, String page, String role, Controller controller) throws Exception(Code)
Use this if there is a nested tile.
Parameters:
  attributes - attributes for the sub-context
Parameters:
  page - the page to process.
Parameters:
  role - possible user-role
Parameters:
  controller - possible tiles-controller the rendered template as String.
throws:
  Exception -



doInsert
protected String doInsert(ComponentContext subCompContext, String page, String role, Controller controller) throws Exception(Code)
An extension of the other two doInsert functions
Parameters:
  subCompContext - the sub-context to set in scope when thetemplate is rendered.
Parameters:
  page - the page to process.
Parameters:
  role - possible user-role
Parameters:
  controller - possible tiles-controller the rendered template as String.
throws:
  Exception -



get
public String get(Object obj)(Code)
A generic tiles insert function.

This is functionally equivalent to <tiles:insert attribute="foo" />.


Parameters:
  obj - Can be any of the following:AttributeDefinition,tile-definition name,tile-attribute name,regular uri.(checked in that order) the rendered template or value as a String
throws:
  Exception - on failure



getAttribute
public Object getAttribute(String name)(Code)
Fetches a named attribute-value from the current tiles-context.

This is functionally equivalent to <tiles:getAsString name="foo" />.


Parameters:
  name - the name of the tiles-attribute to fetch attribute value for the named attribute



getCurrentContext
protected ComponentContext getCurrentContext()(Code)
Retrieve the current tiles component context. This is pretty much just a convenience method.



importAttribute
public void importAttribute(String name)(Code)
Imports the named attribute-value from the current tiles-context into the current Velocity context.

This is functionally equivalent to <tiles:importAttribute name="foo" />
Parameters:
  name - the name of the tiles-attribute to import




importAttribute
public void importAttribute(String name, String scope)(Code)
Imports the named attribute-value from the current tiles-context into the named context ("page", "request", "session", or "application").

This is functionally equivalent to <tiles:importAttribute name="foo" scope="scopeValue" />
Parameters:
  name - the name of the tiles-attribute to import
Parameters:
  scope - the named context scope to put the attribute into.




importAttributes
public void importAttributes()(Code)
Imports all attributes in the current tiles-context into the current velocity-context.

This is functionally equivalent to <tiles:importAttribute />.




importAttributes
public void importAttributes(String scope)(Code)
Imports all attributes in the current tiles-context into the named context ("page", "request", "session", or "application").

This is functionally equivalent to <tiles:importAttribute scope="scopeValue" />.


Parameters:
  scope - the named context scope to put the attributes into.



init
public void init(Object obj)(Code)
Initializes this tool.
Parameters:
  obj - the current ViewContext
throws:
  IllegalArgumentException - if the param is not a ViewContext



popTilesContext
protected void popTilesContext()(Code)
Pops the tiles sub-context off the context-stack after the lower level tiles have been rendered.



processAsDefinitionOrURL
protected String processAsDefinitionOrURL(String name) throws Exception(Code)
Try to process name as a definition, or as an URL if not found.
Parameters:
  name - Name to process. the fully processed definition or URL
throws:
  Exception -



processDefinition
protected String processDefinition(ComponentDefinition definition) throws Exception(Code)
End of Process for definition.
Parameters:
  definition - Definition to process. the fully processed definition.
throws:
  Exception - from InstantiationException Can't create requested controller



processObjectValue
protected String processObjectValue(Object value) throws Exception(Code)
Process an object retrieved as a bean or attribute.
Parameters:
  value - - Object can be a typed attribute, a String, or anythingelse. If typed attribute, use associated type. Otherwise, applytoString() on object, and use returned string as a name.
throws:
  Exception - - Throws by underlying nested call toprocessDefinitionName() the fully processed value as String



processTypedAttribute
protected String processTypedAttribute(AttributeDefinition value) throws Exception(Code)
Process typed attribute according to its type.
Parameters:
  value - Typed attribute to process. the fully processed attribute value as String.
throws:
  Exception - - Throws by underlying nested call to processDefinitionName()



processUrl
protected String processUrl(String url) throws Exception(Code)
Processes an url
Parameters:
  url - the URI to process. the rendered template as String.
throws:
  Exception -



pushTilesContext
protected void pushTilesContext()(Code)

pushes the current tiles context onto the context-stack. preserving the context is necessary so that a sub-context can be put into request scope and lower level tiles can be rendered




Fields inherited from org.apache.velocity.tools.view.ImportSupport
final protected static String DEFAULT_ENCODING(Code)(Java Doc)
final protected static Log LOG(Code)(Java Doc)
final protected static String VALID_SCHEME_CHARS(Code)(Java Doc)
protected ServletContext application(Code)(Java Doc)
protected HttpServletRequest request(Code)(Java Doc)
protected HttpServletResponse response(Code)(Java Doc)

Methods inherited from org.apache.velocity.tools.view.ImportSupport
protected Reader acquireReader(String url) throws IOException, Exception(Code)(Java Doc)
protected String acquireString(String url) throws IOException, Exception(Code)(Java Doc)
public static String getContentTypeAttribute(String input, String name)(Code)(Java Doc)
public static boolean isAbsoluteUrl(String url)(Code)(Java Doc)
public static String stripSession(String url)(Code)(Java Doc)

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.