JavaGantt 2011.1 API

eu.beesoft.gaia.app
Class Context

java.lang.Object
  extended by eu.beesoft.gaia.app.Context
Direct Known Subclasses:
Application

public class Context
extends java.lang.Object

Context is a data holder for session and controller. Because all controllers are singletons, this is the only one place where can be stored data between the client requests.


Method Summary
 Context close()
          Closes this context.
 boolean containsValue(java.lang.Class<?> clazz)
          Returns true if the context map contains an entry with the name of the given class.
 boolean containsValue(java.lang.String name)
          Returns true if the context map contains an entry with given name.
 java.lang.Object findValue(java.lang.Class<?> clazz)
          Returns a value from the context entry with a name of the given class.
 java.lang.Object findValue(java.lang.String name)
          Returns a value from the context entry with the given name.
 Application getApplication()
          Returns an application to which this context belongs.
 Context getCurrentContext()
          Returns a current context.
 Context getChildContext()
          Returns a child context of this context.
 Context getParentContext()
          Returns a parent context of this context.
 Controller getRunner()
          Returns a controller which is using this context.
 Controller getStarter()
          Returns a controller which created this context.
 java.lang.Object getValue(java.lang.Class<?> clazz)
          Returns a value from the context entry with a name of the given class.
 java.lang.Object getValue(java.lang.String name)
          Returns a value from the context entry with the given name.
 boolean isClosed()
          Returns true if this context is closed (unusable).
 void removeValue(java.lang.Class<?> clazz)
          Removes an entry with the name of the given class from the context map.
 void removeValue(java.lang.String name)
          Removes an entry with given name from the context map.
 void setRunner(Controller runner)
          Sets a controller which is using this context.
 void setValue(java.lang.Class<?> clazz, java.lang.Object value)
          Sets an entry with the name of the given class and with given value to the context map.
 void setValue(java.lang.String name, java.lang.Object value)
          Sets an entry with given name and value to the context map.
 Context startNewContext(Controller starter, Controller runner)
          Creates a new context with this as its parent and given starter and runner controllers.
 java.lang.String toString()
          Returns a string representation of this context.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getStarter

public Controller getStarter()
Returns a controller which created this context.

Returns:
the context creator

getRunner

public Controller getRunner()
Returns a controller which is using this context.

Returns:
the context using controller

setRunner

public void setRunner(Controller runner)
Sets a controller which is using this context.

Parameters:
runner - - a controller to set

getParentContext

public Context getParentContext()
Returns a parent context of this context.

Returns:
a parent context

getChildContext

public Context getChildContext()
Returns a child context of this context.

Returns:
a child context or null (if this is current context)

getCurrentContext

public Context getCurrentContext()
Returns a current context.

Returns:
a current context

getApplication

public Application getApplication()
Returns an application to which this context belongs.

Returns:
a context's application

setValue

public void setValue(java.lang.String name,
                     java.lang.Object value)
Sets an entry with given name and value to the context map.

Parameters:
name - - name of the context entry
value - - value of the context entry

setValue

public void setValue(java.lang.Class<?> clazz,
                     java.lang.Object value)
Sets an entry with the name of the given class and with given value to the context map.

Parameters:
clazz - - a name of this class is a name of the context entry
value - - value of the context entry

removeValue

public void removeValue(java.lang.String name)
Removes an entry with given name from the context map.

Parameters:
name - - name of the context entry to remove

removeValue

public void removeValue(java.lang.Class<?> clazz)
Removes an entry with the name of the given class from the context map.

Parameters:
clazz - - name of this class is the name of the context entry to remove

containsValue

public boolean containsValue(java.lang.String name)
Returns true if the context map contains an entry with given name.

Parameters:
name - - name of the context entry to check
Returns:
true if entry exists

containsValue

public boolean containsValue(java.lang.Class<?> clazz)
Returns true if the context map contains an entry with the name of the given class.

Parameters:
clazz - - a name of this class is an entry name in the context to check
Returns:
true if entry exists

getValue

public java.lang.Object getValue(java.lang.String name)
Returns a value from the context entry with the given name.

Parameters:
name - - name of context entry
Returns:
value of context entry with given name or null

getValue

public java.lang.Object getValue(java.lang.Class<?> clazz)
Returns a value from the context entry with a name of the given class.

Parameters:
clazz - - name of this class is a name of the searched context entry
Returns:
value of context entry or null if ot found

findValue

public java.lang.Object findValue(java.lang.String name)
Returns a value from the context entry with the given name. It searches this context and if the entry is not found, searches parent context up to root context.

Parameters:
name - - name of context entry
Returns:
value of context entry with given name or null

findValue

public java.lang.Object findValue(java.lang.Class<?> clazz)
Returns a value from the context entry with a name of the given class. It searches this context and if the entry is not found, searches parent context up to root context.

Parameters:
clazz - - name of this class is a name of the searched context entry
Returns:
value of context entry or null if ot found

startNewContext

public Context startNewContext(Controller starter,
                               Controller runner)
Creates a new context with this as its parent and given starter and runner controllers.

Parameters:
starter - - a controller that invokes this method
runner - - a controller for which is the new context dedicated
Returns:
a new context

close

public Context close()
Closes this context. Removes references to parent and child context.

Returns:
parent context

isClosed

public boolean isClosed()
Returns true if this context is closed (unusable).

Returns:
true if context is closed

toString

public java.lang.String toString()
Returns a string representation of this context.

Overrides:
toString in class java.lang.Object
Returns:
string representation of this context

JavaGantt 2011.1 API