acquire
public void acquire()
Acquires the target context.
- acquire in interface Context
addElement
public final Element addElement(String name,
Class type,
Object value,
char separator)
throws JonathanException
Adds an element to the target context.
This method is equivalent to
addElement(Name,Class,Object)
, except that the name to use
is specified by a string and a separator separating the different elements of
the name.
If
separator == 0
, the name corresponds to an object
local to the target context.
If the name begins with the separator, the name is an absolute name (this
only makes sense if the context has a tree structure); otherwise, the name is
relative to the target context.
- addElement in interface Context
name
- a string representing the name of the seeked element;type
- the type of the object to be added;value
- the object to be added;separator
- the separator character used to parse name
;
- the previous element, if any; null otherwise.
JonathanException
- if something goes wrong (usually, a type
exception).
addElement
public final Element addElement(String name,
Class type,
int value,
char separator)
throws JonathanException
Adds an element to the target context.
This method is equivalent to
addElement(Name,Class,int)
, except that the name to use
is specified by a string and a separator separating the different elements of
the name.
If
separator == 0
, the name corresponds to an object
local to the target context.
If the name begins with the separator, the name is an absolute name (this
only makes sense if the context has a tree structure); otherwise, the name is
relative to the target context.
- addElement in interface Context
name
- a string representing the name of the seeked element;value
- the integer value of the element to be added;separator
- the separator character used to parse name
;
- the previous element, if any; null otherwise.
JonathanException
- if something goes wrong (usually, a type
exception).
addElement
public final Element addElement(String _name,
Component _component,
char separator)
throws JonathanException
Adds an element to the target context.
This method is equivalent to
addElement(Name,Component)
, except that the name to use
is specified by a string and a separator separating the different elements of
the name.
If
separator == 0
, the name corresponds to an object
local to the target context.
If the name begins with the separator, the name is an absolute name (this
only makes sense if the context has a tree structure); otherwise, the name is
relative to the target context.
- addElement in interface Context
separator
- the separator character used to parse name
;
- the previous element, if any; null otherwise.
JonathanException
- if something goes wrong (usually, a type
exception).
addElement
public final Element addElement(Name _name,
Class _type,
int _value)
throws JonathanException
Adds an element to the target context.
In this case, the value's type must be promotable to
an integer. Class
is one of int.class, short.class, char.class,
or byte.class.
- addElement in interface Context
- the previous element, if any, null otherwise.
JonathanException
- if something goes wrong (usually, a type
exception).
addElement
public final Element addElement(Name _name,
Component _component)
throws JonathanException
Adds an element in the target context. If the component is already attached to some element,
this attachment will be lost in this operation.
- addElement in interface Context
- the previous element, if any; null otherwise.
JonathanException
- if something goes wrong (usually, a type
exception).
finalize
protected void finalize()
throws Throwable
getComponent
public final Component getComponent(String name,
char separator)
Returns the component contained in the element registered in the target context under
the name name
.
This method is equivalent to getComponent(Name)
, except that the name to use
is specified by a string and a separator separating the different elements of
the name.
If separator == 0
, the name corresponds to an object
local to the target context.
If the name begins with the separator, the name is an absolute name (this
only makes sense if the context has a tree structure); otherwise, the name is
relative to the target context.
- getComponent in interface Context
name
- the name of the element whose component is seeked;separator
- the separator character used to parse name
;
- the corresponding component, or null.
getElement
protected Element getElement(String name,
boolean local)
Returns the local element identified by name, or null if none exists.
name
- a local name;local
- if true, don't search the enclosing context.
- the local element identified by name, or null if none exists.
getElement
public final Element getElement(String _name,
char _separator)
Returns the element in the target context identified by name
,
null if no element is registered under name name
.
This method is equivalent to getElement(Name)
, except that the name to use
is specified by a string and a separator separating the different elements of
the name.
If separator == 0
, the name corresponds to an object
local to the target context.
If the name begins with the separator, the name is an absolute name (this
only makes sense if the context has a tree structure); otherwise, the name is
relative to the target context.
- getElement in interface Context
- the corresponding element, if any; null otherwise.
getElement
public final Element getElement(Name _name)
may need to be synchronized
- getElement in interface Component
- getElement in interface JComponent
_name
-
- the element corresponding to
_name
, if any.
getElements
public Enumeration getElements()
Returns an enumeration of the elements found in the target context.
- getElements in interface Context
- an enumeration of the elements found in the target context.
getFactoryValue
public final Object getFactoryValue(String name,
char separator)
throws JonathanException
getIntValue
public final int getIntValue(String name,
char separator)
Returns the value of the element registered in the target context under
the name
name
.
This method is equivalent to
getIntValue(Name)
, except that the name to use
is specified by a string and a separator separating the different elements of
the name.
If
separator == 0
, the name corresponds to an object
local to the target context.
If the name begins with the separator, the name is an absolute name (this
only makes sense if the context has a tree structure); otherwise, the name is
relative to the target context.
- getIntValue in interface Context
name
- the name of the element whose value is seeked;separator
- the separator character used to parse name
;
- the corresponding value, or
Integer.MAX_VALUE
getIntValue
public final int getIntValue(Name _name)
Returns the value of the element registered in the target context under
the name
name
.
A call to
getIntValue(name)
is equivalent to
getElement(name)
.getIntValue()
if the provided name actually corresponds to an
element. If it is not the case,
Integer.MAX_VALUE
is returned.
- getIntValue in interface Context
- the corresponding value, or
Integer.MAX_VALUE
getScope
public Context getScope()
Returns the scope of the target context;
- getScope in interface Context
- the scope of the target context;
getValue
public final Object getValue(String name,
char separator)
Returns the value of the element registered in the target context under
the name name
.
This method is equivalent to getValue(Name)
, except that the name to use
is specified by a string and a separator separating the different elements of
the name.
If separator == 0
, the name corresponds to an object
local to the target context.
If the name begins with the separator, the name is an absolute name (this
only makes sense if the context has a tree structure); otherwise, the name is
relative to the target context.
- getValue in interface Context
name
- the name of the element whose value is seeked;separator
- the separator character used to parse name
;
- the corresponding value, or
NO_VALUE
.
handleScopeElement
protected Element handleScopeElement(Element element)
newComponent
protected Component newComponent(Class type,
Object value)
newComponent
protected Component newComponent(Class type,
int value)
newContextElement
protected final JContextFactory.ContextElement newContextElement(String name,
Component component,
Context container)
Creates a new context element, using the provided parameters
to initialize it.
name
- a name;
- a new context element, initialized using the provided parameters
recycle
protected void recycle()
release
public void release()
Releases the target context, releasing all the resources it uses, if no one still
uses it.
The context should no longer
be used once it has been released.
- release in interface Context
setScope
public Context setScope(Context scope)
Sets the scope of the target context;
- setScope in interface Context
scope
- the new scope of the target context;
- the previous scope of the target context;
toString
public String toString()
- toString in interface JComponent