jaxx.runtime
Class DefaultJAXXContext

java.lang.Object
  extended by jaxx.runtime.DefaultJAXXContext
All Implemented Interfaces:
JAXXContext
Direct Known Subclasses:
DefaultApplicationContext, JAXXInitialContext

public class DefaultJAXXContext
extends java.lang.Object
implements JAXXContext

The default JAXXContext to be used in a JAXXObject by delegation.

The values are store in a Map but we can not use directly the values as key.

Because, it does not work if we add for the same object multi entries (named and unamed)...

We prefer use as entry the JAXXContextEntryDef associated with the value.

Author:
chemit

Field Summary
protected  java.util.Map<JAXXContextEntryDef,java.lang.Object> data
          les donnĂ©es contenues dans le context
protected static JAXXContextEntryDef<JAXXContext> PARENT_CONTEXT_ENTRY
           
protected  JAXXContext parentContext
          le context parent
protected  JAXXObject ui
          l'ui auquel est rattache le context
 
Constructor Summary
DefaultJAXXContext()
           
DefaultJAXXContext(JAXXObject ui)
           
 
Method Summary
 void clear()
           
<T> T
getContextValue(java.lang.Class<T> clazz)
          Seek for a unamed entry in the context

This is an exemple to call a method in JAXX :

<JButton onActionPerformed='{getContextValue(Action.class).method(args[])}'/>

<T> T
getContextValue(java.lang.Class<T> clazz, java.lang.String name)
          Seek for a named entry in the context
protected  JAXXContextEntryDef<?> getKey(java.lang.String name, java.lang.Class<?> klass)
           
 java.lang.String[] getKeys(java.lang.Class<?> klass)
          Obtain all the keys of data for a given type.
<O extends java.awt.Container>
O
getParentContainer(java.lang.Class<O> clazz)
          Return parent's container corresponding to the Class clazz
<O extends java.awt.Container>
O
getParentContainer(java.lang.Object top, java.lang.Class<O> clazz)
          Return parent's container corresponding to the Class clazz
protected  JAXXContext getParentContext()
           
protected  JAXXObject getUi()
           
protected
<T> T
remove0(java.lang.Class<T> klazz, java.lang.String name)
           
<T> void
removeContextValue(java.lang.Class<T> klazz)
          Remove from context the value with the given klazz as an unamed entry
<T> void
removeContextValue(java.lang.Class<T> klazz, java.lang.String name)
          Remove from context the value with the given klazz as an unamed (if name is null) or named entry
<T> void
setContextValue(T o)
          Push in the context a new unamed entry.
<T> void
setContextValue(T o, java.lang.String name)
          * Push in the context a new amed entry.
protected  void setParentContext(JAXXContext parentContext)
           
protected  void setUi(JAXXObject ui)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PARENT_CONTEXT_ENTRY

protected static final JAXXContextEntryDef<JAXXContext> PARENT_CONTEXT_ENTRY

ui

protected JAXXObject ui
l'ui auquel est rattache le context


parentContext

protected JAXXContext parentContext
le context parent


data

protected final java.util.Map<JAXXContextEntryDef,java.lang.Object> data
les données contenues dans le context

Constructor Detail

DefaultJAXXContext

public DefaultJAXXContext()

DefaultJAXXContext

public DefaultJAXXContext(JAXXObject ui)
Method Detail

setContextValue

public <T> void setContextValue(T o)
Description copied from interface: JAXXContext
Push in the context a new unamed entry.

If a previous entry exists in context (unamed and same class), it will be removed.

Specified by:
setContextValue in interface JAXXContext
Parameters:
o - the value to push in context

setContextValue

public <T> void setContextValue(T o,
                                java.lang.String name)
Description copied from interface: JAXXContext
* Push in the context a new amed entry.

If a previous entry exists in context (same name and class), it will be removed.

Specified by:
setContextValue in interface JAXXContext
Parameters:
o - the value to push in context
name - the name of the new entry

getContextValue

public <T> T getContextValue(java.lang.Class<T> clazz)
Description copied from interface: JAXXContext
Seek for a unamed entry in the context

This is an exemple to call a method in JAXX :

<JButton onActionPerformed='{getContextValue(Action.class).method(args[])}'/>

Specified by:
getContextValue in interface JAXXContext
Parameters:
clazz - the class of unamed entry to seek in context
Returns:
the value of the unamed entry for the given class, or null if no such entry.

getContextValue

public <T> T getContextValue(java.lang.Class<T> clazz,
                             java.lang.String name)
Description copied from interface: JAXXContext
Seek for a named entry in the context

Specified by:
getContextValue in interface JAXXContext
Parameters:
clazz - the class of named entry to seek in context
name - the name of the entry to seek in context
Returns:
the value of the named entry for the given class, or null if no such entry.

removeContextValue

public <T> void removeContextValue(java.lang.Class<T> klazz)
Description copied from interface: JAXXContext
Remove from context the value with the given klazz as an unamed entry

Specified by:
removeContextValue in interface JAXXContext
Parameters:
klazz - the klazz entry

removeContextValue

public <T> void removeContextValue(java.lang.Class<T> klazz,
                                   java.lang.String name)
Description copied from interface: JAXXContext
Remove from context the value with the given klazz as an unamed (if name is null) or named entry

Specified by:
removeContextValue in interface JAXXContext
Parameters:
klazz - the klazz entry
name - extra name of the entry

getParentContainer

public <O extends java.awt.Container> O getParentContainer(java.lang.Class<O> clazz)
Description copied from interface: JAXXContext
Return parent's container corresponding to the Class clazz

Specified by:
getParentContainer in interface JAXXContext
Parameters:
clazz - clazz desired
Returns:
parent's container

getParentContainer

public <O extends java.awt.Container> O getParentContainer(java.lang.Object top,
                                                           java.lang.Class<O> clazz)
Description copied from interface: JAXXContext
Return parent's container corresponding to the Class clazz

Specified by:
getParentContainer in interface JAXXContext
Parameters:
top - the top container
clazz - desired
Returns:
parent's container

getKeys

public java.lang.String[] getKeys(java.lang.Class<?> klass)
Obtain all the keys of data for a given type.

Parameters:
klass - the type of searched keys
Returns:
the array of all names of keys for the given type of data
Since:
1.3

clear

public void clear()

getUi

protected JAXXObject getUi()

setUi

protected void setUi(JAXXObject ui)

getKey

protected JAXXContextEntryDef<?> getKey(java.lang.String name,
                                        java.lang.Class<?> klass)

remove0

protected <T> T remove0(java.lang.Class<T> klazz,
                        java.lang.String name)

getParentContext

protected JAXXContext getParentContext()

setParentContext

protected void setParentContext(JAXXContext parentContext)


Copyright © 2008-2009 CodeLutin. All Rights Reserved.