ERXInlineTemplate Class Reference

Inherits er::extensions::components::ERXNonSynchronizingComponent.

Inherited by ERXStatelessInlineTemplate.

Collaboration diagram for ERXInlineTemplate:

Collaboration graph
[legend]

List of all members.

Classes

class  CacheEntry
class  Error

Public Member Functions

void appendToResponse (WOResponse woresponse, WOContext wocontext)
boolean defaultToDynamicBindings ()
String errorTemplate ()
 ERXInlineTemplate (WOContext context)
boolean proxyParent ()
void takeValueForKey (Object obj, String s)
void takeValueForKeyPath (Object value, String keyPath)
WOElement template ()
Object valueForKey (String s)
Object valueForKeyPath (String keyPath)

Protected Attributes

Error _deferredError = null

Private Member Functions

WOElement _template ()

Static Private Attributes

static NSMutableDictionary
< String, CacheEntry
_cache = ERXMutableDictionary.synchronizedDictionary()
static final String CACHE_KEY_BINDING = "cacheKey"
static final String CACHE_VERSION_BINDING = "cacheVersion"
static final String DEFAULT_TO_DYNAMIC_BINDINGS_BINDING = "defaultToDynamicBindings"
static final String ERROR_TEMPLATE_BINDING = "errorTemplate"
static final String ERROR_TEMPLATE_DEFAULT = "<div class=\"ERXInlineTemplateError\" style=\"background-color: #faa; border: 2px dotted red;\">@@message@@</div>"
static Logger log = Logger.getLogger(ERXInlineTemplate.class)
static final String PROXY_PARENT_BINDING = "proxyParent"
static final String TEMPLATE_HTML_BINDING = "html"
static final String TEMPLATE_WOD_BINDING = "wod"


Detailed Description

ERXInlineTemplate allows to specify a component's template dynamically.
The content which would usually go into the ".html" file within a WOComponent's bundle, is specified using the "html" binding, the ".wod" part is pecified by the "wod" binding.

When using WOOgnl with "ognl.helperFunctions = true" and "ognl.inlineBindings = true", you can leave out the WOD part.

When keys are accessed, the component first determines the first element of the path (e.g. key "foo" for path "foo.bar") and looks, if there is a binding with that key.
If there is such a binding, the value is retrieved and the rest of the keyPath applied to it (valueForBinding("foo").valueForKeyPath("bar")).
If there is no binding with that name and "proxyParent" is true, the keyPath is resolved against the parent component.
Otherwise, dynamicBindings (ERXComponent#dynamicBindings()) are used.
You can switch off the usage of dynamicBindings by setting the binding "defaultToDynamicBindings" to false. Then a warning will be logged for unknown keys.

When an error occurs, an error message is displayed. The message can be altered using the "errorTemplate" binding.

Optionally, a "cacheKey" (String) can be specified, under which the parsed WOElement will be cached. To allow updating, a "cacheVersion" (Object) is available. When the version changes, the value is recalculated.

html HTML-part of the component (required) wod WOD-part of the component (optional) cacheKey Key under which to cache the WOElement (optional) cacheVersion Hint to determine if the cached object is up-to-date (optional) errorTemplate Template to use for displaying error messages. Uses ERXSimpleTemplateParser for display. Method name and HTML-escaped message are provided by the "method" and "message" keys. (optional) proxyParent whether to proxy key path lookup to the parent (default is false) defaultToDynamicBindings whether to use dynamicBindings for unknown keys (default is true)

Author:
th

Constructor & Destructor Documentation

ERXInlineTemplate ( WOContext  context  ) 


Member Function Documentation

WOElement _template (  )  [private]

void appendToResponse ( WOResponse  response,
WOContext  context 
)

Calls resetCachedBindingsInStatefulComponent prior to super.appendToResponse.

Parameters:
response to which we are appending
context context of the response

Reimplemented from ERXNonSynchronizingComponent.

boolean defaultToDynamicBindings (  ) 

String errorTemplate (  ) 

boolean proxyParent (  ) 

void takeValueForKey ( Object  obj,
String  s 
)

void takeValueForKeyPath ( Object  value,
String  keyPath 
)

WOElement template (  ) 

Object valueForKey ( String  s  ) 

Object valueForKeyPath ( String  keyPath  ) 


Member Data Documentation

NSMutableDictionary<String, CacheEntry> _cache = ERXMutableDictionary.synchronizedDictionary() [static, private]

Error _deferredError = null [protected]

final String CACHE_KEY_BINDING = "cacheKey" [static, private]

final String CACHE_VERSION_BINDING = "cacheVersion" [static, private]

final String DEFAULT_TO_DYNAMIC_BINDINGS_BINDING = "defaultToDynamicBindings" [static, private]

final String ERROR_TEMPLATE_BINDING = "errorTemplate" [static, private]

final String ERROR_TEMPLATE_DEFAULT = "<div class=\"ERXInlineTemplateError\" style=\"background-color: #faa; border: 2px dotted red;\">@@message@@</div>" [static, private]

Logger log = Logger.getLogger(ERXInlineTemplate.class) [static, private]

final String PROXY_PARENT_BINDING = "proxyParent" [static, private]

final String TEMPLATE_HTML_BINDING = "html" [static, private]

final String TEMPLATE_WOD_BINDING = "wod" [static, private]


The documentation for this class was generated from the following file:

Generated on Sat May 26 06:43:05 2012 for Project Wonder by  doxygen 1.5.8