Java Doc for VariableResolver.java in  » IDE-Netbeans » visualweb.api.designer » com » sun » rave » web » ui » util » 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 » IDE Netbeans » visualweb.api.designer » com.sun.rave.web.ui.util 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.sun.rave.web.ui.util.VariableResolver

VariableResolver
public class VariableResolver (Code)

VariableResolver is used to parse expressions of the format.

$<type$gt;{<key>}

<type> refers to a registerd VariableResolver.DataSource , custom VariableResolver.DataSource s can be registered via: VariableResolver.setDataSource(String key,VariableResolver.DataSource dataSource) . However, there are many built-in VariableResolver.DataSource types that are pre-registered.

Below are the pre-registered types:


author:
   Ken Paulsen (ken.paulsen@sun.com)

Inner Class :public interface DataSource
Inner Class :public static class AttributeDataSource implements DataSource
Inner Class :public static class RequestParameterDataSource implements DataSource
Inner Class :public static class PropertyDataSource implements DataSource
Inner Class :public static class HasPropertyDataSource implements DataSource
Inner Class :public static class HasFacetDataSource implements DataSource
Inner Class :public static class EscapeDataSource implements DataSource
Inner Class :public static class BooleanDataSource implements DataSource
Inner Class :public static class BrowserDataSource implements DataSource
Inner Class :public static class IntDataSource implements DataSource
Inner Class :public static class ConstantDataSource implements DataSource
Inner Class :public static class MethodBindingDataSource implements DataSource
Inner Class :public static class ResourceBundleDataSource implements DataSource
Inner Class :public static class SessionDataSource implements DataSource
Inner Class :public static class StyleDataSource implements DataSource
Inner Class :public static class ThemeDataSource implements DataSource
Inner Class :public static class ThemeJavaScriptDataSource implements DataSource
Inner Class :public static class ThisDataSource implements DataSource

Field Summary
final public static  StringATTRIBUTE
    

Defines "attribute" in $attribute{...}.

final public static  StringBOOLEAN
    

Defines "boolean" in $boolean{...}.

final public static  StringBROWSER
    

Defines "browser" in $browser{...}.

final public static  StringCONSTANT
    

Defines "constant" in $constant{...}.

final public static  StringESCAPE
    

Defines "escape" in $escape{...}.

final public static  StringHAS_FACET
    

Defines "hasFacet" in $hasFacet{...}.

final public static  StringHAS_PROPERTY
    

Defines "hasProperty" in $hasProperty{...}.

final public static  StringINT
    

Defines "int" in $int{...}.

final public static  StringMETHOD_BINDING
    

Defines "methodBinding" in $methodBinding{...}.

final public static  StringPROPERTY
    

Defines "property" in $property{...}.

final public static  StringREQUEST_PARAMETER
    

Defines "requestParameter" in $requestParameter{...}.

final public static  StringRESOURCE
    

Defines "resource" in $resource{...}.

final public static  StringSESSION
    

Defines "session" in $session{...}.

final public static  StringSTYLE
    

Defines "style" in $style{...}.

final public static  StringSUB_END
     The ')' character marks the end of the data content for a String substitution.
final public static  StringSUB_START
     The '$' character marks the beginning of a substituion in a String.
final public static  StringSUB_TYPE_DELIM
     The '(' character marks the beginning of the data content of a String substitution.
final public static  StringTHEME
    

Defines "theme" in $theme{...}.

final public static  StringTHEME_JS
    

Defines "themeScript" in $themeScript{...}.

final public static  StringTHIS
    

Defines "this" in $this{...}.



Method Summary
public static  VariableResolver.DataSourcegetDataSource(String key)
    

This method looks up the requested VariableResolver.DataSource by the given key.

public static  voidmain(String args)
     The main function for this class provides some simple test cases.
public static  ObjectresolveVariables(FacesContext ctx, LayoutElement desc, UIComponent component, String string, String startToken, String typeDelim, String endToken)
    

This method will substitute variables into the given String, or return the variable if the substitution is the whole String.

public static  ObjectresolveVariables(LayoutElement desc, UIComponent component, Object value)
     This method replaces the ${..} variables with their values.
public static  ObjectresolveVariables(FacesContext ctx, LayoutElement desc, UIComponent component, Object value)
     This method replaces the ${..} variables with their attribute values.
public static  voidsetDataSource(String key, VariableResolver.DataSource dataSource)
    

Field Detail
ATTRIBUTE
final public static String ATTRIBUTE(Code)

Defines "attribute" in $attribute{...}. This allows you to retrieve an HttpRequest attribute.




BOOLEAN
final public static String BOOLEAN(Code)

Defines "boolean" in $boolean{...}. This converts the given String to a Boolean.




BROWSER
final public static String BROWSER(Code)

Defines "browser" in $browser{...}. This checks properties of the browser that sent the request.




CONSTANT
final public static String CONSTANT(Code)

Defines "constant" in $constant{...}. This allows constants in java classes to be accessed.




ESCAPE
final public static String ESCAPE(Code)

Defines "escape" in $escape{...}. This allows some reserved characters to be escaped in "if" attributes. Such as '=' or '|'.




HAS_FACET
final public static String HAS_FACET(Code)

Defines "hasFacet" in $hasFacet{...}. This allows you to see if a facet from the UIComponent exists.




HAS_PROPERTY
final public static String HAS_PROPERTY(Code)

Defines "hasProperty" in $hasProperty{...}. This allows you to see if a property from the UIComponent exists.




INT
final public static String INT(Code)

Defines "int" in $int{...}. This converts the given String to an Integer.




METHOD_BINDING
final public static String METHOD_BINDING(Code)

Defines "methodBinding" in $methodBinding{...}. This allows MethodBindings in to be created.




PROPERTY
final public static String PROPERTY(Code)

Defines "property" in $property{...}. This allows you to retrieve a property from the UIComponent.




REQUEST_PARAMETER
final public static String REQUEST_PARAMETER(Code)

Defines "requestParameter" in $requestParameter{...}. This allows you to retrieve a HttpRequest parameter (QUERY_STRING parameter).




RESOURCE
final public static String RESOURCE(Code)

Defines "resource" in $resource{...}. This allows resource to be accessed.




SESSION
final public static String SESSION(Code)

Defines "session" in $session{...}. This allows you to retrieve an HttpSession attribute.




STYLE
final public static String STYLE(Code)

Defines "style" in $style{...}. This allows you to retrieve a style classes from the current com.sun.rave.web.ui.theme.Theme .




SUB_END
final public static String SUB_END(Code)
The ')' character marks the end of the data content for a String substitution.



SUB_START
final public static String SUB_START(Code)
The '$' character marks the beginning of a substituion in a String.



SUB_TYPE_DELIM
final public static String SUB_TYPE_DELIM(Code)
The '(' character marks the beginning of the data content of a String substitution.



THEME
final public static String THEME(Code)

Defines "theme" in $theme{...}. This allows you to retrieve a Theme message from the current com.sun.rave.web.ui.theme.Theme .




THEME_JS
final public static String THEME_JS(Code)

Defines "themeScript" in $themeScript{...}. This allows you to retrieve a JavaScript classes from the current com.sun.rave.web.ui.theme.Theme .




THIS
final public static String THIS(Code)

Defines "this" in $this{...}. This allows you to retrieve a number of different objects related to the relative placement of this expression.


See Also:   ThisDataSource





Method Detail
getDataSource
public static VariableResolver.DataSource getDataSource(String key)(Code)

This method looks up the requested VariableResolver.DataSource by the given key.
Parameters:
  key - The key identifying the desiredVariableResolver.DataSource The requested VariableResolver.DataSource




main
public static void main(String args)(Code)
The main function for this class provides some simple test cases.
Parameters:
  args - The commandline arguments.



resolveVariables
public static Object resolveVariables(FacesContext ctx, LayoutElement desc, UIComponent component, String string, String startToken, String typeDelim, String endToken)(Code)

This method will substitute variables into the given String, or return the variable if the substitution is the whole String. This method looks for the LAST occurance of startToken in the given String. It then searches from that location (if found) to the first occurance of typeDelim. The value inbetween is used as the type of substitution to perform (i.e. request attribute, session, etc.). It next looks for the next occurance of endToken. The value inbetween is used as the key passed to the VariableResolver.DataSource specified by the type. The String value from the VariableResolver.DataSource replaces the portion of the String from the startToken to the endToken. If this is the entire String, the Object is returned instead of the String value. This process is repeated until no more substitutions are * needed.

This algorithm will accomodate nested variables (e.g. "${A{$x}}"). It also allows the replacement value itself to contain variables. Care should be taken to ensure that the replacement String included does not directly or indirectly refer to itself -- this will cause an infinite loop.

There is one special case where the string to be evaluated begins with the startToken and ends with the endToken. In this case, string substitution is NOT performed. Instead the value of the request attribute is returned.


Parameters:
  ctx - The FacesContext
Parameters:
  desc - The closest LayoutElement to this string
Parameters:
  component - The assoicated UIComponent
Parameters:
  string - The string to be evaluated.
Parameters:
  startToken - Marks the beginning "$"
Parameters:
  typeDelim - Marks separation of type/variable "{"
Parameters:
  endToken - Marks the end of the variable "}" The new string with substitutions, or the specified requestattribute value.



resolveVariables
public static Object resolveVariables(LayoutElement desc, UIComponent component, Object value)(Code)
This method replaces the ${..} variables with their values. It will only do this for Strings and List's that contain Strings.
Parameters:
  desc - The LayoutElement descriptor
Parameters:
  component - The UIComponent
Parameters:
  value - The value to resolve The result



resolveVariables
public static Object resolveVariables(FacesContext ctx, LayoutElement desc, UIComponent component, Object value)(Code)
This method replaces the ${..} variables with their attribute values. It will only do this for Strings and List's that contain Strings.
Parameters:
  ctx - The FacesContext
Parameters:
  desc - The LayoutElement descriptor
Parameters:
  component - The UIComponent
Parameters:
  value - The value to resolve The result



setDataSource
public static void setDataSource(String key, VariableResolver.DataSource dataSource)(Code)

This method sets the given VariableResolver.DataSource to be used for $[type]{...} when key matches type.


Parameters:
  key - The key identifying theVariableResolver.DataSource
Parameters:
  dataSource - The VariableResolver.DataSource



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.