Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jboss.portal.format.template
Class DelegateContext

    java.lang.Object
      org.jboss.portal.format.template.DelegateContext

All Implemented Interfaces:
  Context

    public class DelegateContext

extends java.lang.Object
implements Context

Version:
  $Revision: 8784 $
Author:
  Julien Viet

Field Summary

Fields inherited from interface org.jboss.portal.format.template.Context
`NULL_CONTEXT`

Constructor Summary
`DelegateContext()` creates a new DelegateContext object.
`DelegateContext(java.util.Map delegate, java.util.Map children)` creates a new DelegateContext object.

Method Summary
`void` | `append(java.lang.String name, Context ctx)` add an existing data context into this context for use in template loops or nested template data.
`java.util.Iterator` | `childIterator(java.lang.String name)` get an iterator for the nested/loop data contexts
`static DelegateContext` | `createWithChildren(java.util.Map children)` create a new "root" data context and name/value pairs to be used as nested or loop data
`static DelegateContext` | `createWithValues(java.util.Map values)` create a new data context with already existing name/value pairs
`java.lang.String` | `get(java.lang.String key)` get the template data from the context
`DelegateContext` | `next(java.lang.String name)` create a new object to place data for use in template loops or nested template data.
`Context` | `put(java.lang.String key, java.lang.String value)` add data to be rendered in the template through variable substitution

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### DelegateContext

    public DelegateContext()

  creates a new DelegateContext object.

### DelegateContext

    public DelegateContext(java.util.Map delegate,
                           java.util.Map children)

  creates a new DelegateContext object.

  Parameters:
    `delegate` - name/value pairs for "root" data
    `children` - name/value pairs for nested or loop data

Method Detail

### createWithChildren

    public static final DelegateContext createWithChildren(java.util.Map children)

  create a new "root" data context and name/value pairs to be used as nested or loop data

  Parameters:
    `children` - name/value pairs for nested or loop data
  Returns:
    context to continue adding template data too

### createWithValues

    public static final DelegateContext createWithValues(java.util.Map values)

  create a new data context with already existing name/value pairs

  Parameters:
    `values` - existing name/value pair map
  Returns:
    context to continue adding template data too

### append

    public void append(java.lang.String name,
                       Context ctx)

  add an existing data context into this context for use in template loops or nested template data.

  Parameters:
    `name` - variable prefix name
    `ctx` - context to add

### childIterator

    public java.util.Iterator childIterator(java.lang.String name)

  Description copied from interface: `Context`
  get an iterator for the nested/loop data contexts

  Specified by:
    `childIterator` in interface `Context`
  Parameters:
    `name` - template variable prefix name
  Returns:
    iterator for the children
  See Also:
    `Context.childIterator(java.lang.String)`

### get

    public java.lang.String get(java.lang.String key)

  Description copied from interface: `Context`
  get the template data from the context

  Specified by:
    `get` in interface `Context`
  Parameters:
    `key` - template variable name
  Returns:
    template value
  See Also:
    `Context.get(java.lang.String)`

### next

    public DelegateContext next(java.lang.String name)

  create a new object to place data for use in template loops or nested template data. tpl var format: { prefix.VAR_NAME }

  Parameters:
    `name` - variable prefix name
  Returns:
    delegate context that will contain the loop or nested data

### put

    public Context put(java.lang.String key,
                       java.lang.String value)

  Description copied from interface: `Context`
  add data to be rendered in the template through variable substitution

  Specified by:
    `put` in interface `Context`
  Parameters:
    `key` - template variable name
    `value` - value to render in template
  Returns:
    context to place data into
  See Also:
    `Context.put(java.lang.String,java.lang.String)`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD