|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.iplanet.jato.view.ViewBase | +--com.iplanet.jato.view.ContainerViewBase
A default implementation of ContainerView
. This implementation
provides optimized initialization of child views; child views are not created
unless they are referenced.
Field Summary | |
static java.lang.String |
BEGIN_DISPLAY_EVENT_METHOD_PREFIX
|
static java.lang.String |
BEGIN_DISPLAY_EVENT_METHOD_SUFFIX
|
static java.lang.String |
END_DISPLAY_EVENT_METHOD_PREFIX
|
static java.lang.String |
END_DISPLAY_EVENT_METHOD_SUFFIX
|
protected static MethodRegistry |
eventMethodRegistry
|
protected static boolean |
OPTION_ENABLE_QUALIFIELD_CHILD_NAME_LOOKUPS
|
protected static boolean |
OPTION_USE_LEGACY_DISPLAY_EVENT_SIGNATURES
|
Fields inherited from interface com.iplanet.jato.view.View |
QUALIFIED_VIEW_NAME_SEPARATOR |
Constructor Summary | |
protected |
ContainerViewBase()
Default constructor |
|
ContainerViewBase(View parent,
java.lang.String name)
Creates a ContainerViewBase with a parent and name |
Method Summary | |
void |
appMessage(java.lang.String message)
Adds a message to the application message buffer that appears at the bottom of the rendered HTML page. |
boolean |
beginChildDisplay(ChildDisplayEvent event)
Automatically called as notification that the JSP has begun its display processing on the named child. |
protected boolean |
beginChildDisplay(java.lang.String childName)
Deprecated. Since JATO/1.2, the signature of this method has changed. This version of the method is marked final to prevent earler implementations from accidentally overriding it. |
protected void |
beginDisplay()
Deprecated. Since JATO/1.2, the signature of this method has changed. This version of the method is marked final to prevent earler implementations from accidentally overriding it. |
void |
beginDisplay(DisplayEvent event)
Automatically called as notification that the JSP has begun its display processing of this view. |
protected boolean |
childExists(java.lang.String name)
This method can be used to determine if a child has been allocated, and thus whether a value has been assigned to it. |
protected abstract View |
createChild(java.lang.String name)
Called to instantiate the named child. |
View |
createChildInternal(java.lang.String name)
Required for framework support. |
java.lang.String |
endChildDisplay(ChildContentDisplayEvent event)
Automatically called as notification that the JSP has completed its display processing on the named child. |
protected java.lang.String |
endChildDisplay(java.lang.String childName,
java.lang.String html)
Deprecated. Since JATO/1.2, the signature of this method has changed. This version of the method is marked final to prevent earler implementations from accidentally overriding it. |
protected void |
endDisplay()
Deprecated. Since JATO/1.2, the signature of this method has changed. This version of the method is marked final to prevent earler implementations from accidentally overriding it. |
void |
endDisplay(DisplayEvent event)
Automatically called as notification that the JSP has ended its display processing. |
protected View |
ensureChild(java.lang.String name)
Ensures that the named child has been instantiated within this container. |
View |
getChild(java.lang.String name)
Returns the named child view. |
java.lang.String[] |
getChildNames()
Returns the names of all children registered with this view. |
java.lang.String[] |
getChildNames(java.lang.Class type)
|
java.lang.Class |
getChildType(java.lang.String name)
Returns the type of the named child, as previously registered via
registerChild(...) . |
java.lang.String[] |
getCommandChildNames()
Returns the names of registered children that are of type Command
. |
Model |
getDefaultModel()
Returns this view's default model. |
DisplayField |
getDisplayField(java.lang.String name)
Returns the named DisplayField child. |
boolean |
getDisplayFieldBooleanValue(java.lang.String name)
Returns the value of the named DisplayField child as
a boolean. |
double |
getDisplayFieldDoubleValue(java.lang.String name)
Returns the value of the named DisplayField child as
a double. |
int |
getDisplayFieldIntValue(java.lang.String name)
Returns the value of the named DisplayField child as
an int. |
java.lang.String |
getDisplayFieldStringValue(java.lang.String name)
Returns the value of the named DisplayField child as
a string. |
java.lang.Object |
getDisplayFieldValue(java.lang.String name)
Returns the value of the named DisplayField child. |
int |
getNumChildren()
Returns the number of registered children |
java.lang.String[] |
getQualifiedCommandChildNames()
Returns the fully-qualified names of the children that are of type Command . |
protected void |
mapRequestParameter(DisplayField field,
java.lang.Object[] childValues)
Called by mapRequestParameters() to set the value of
a request parameter on a specific display field. |
void |
mapRequestParameters(javax.servlet.http.HttpServletRequest request)
Maps servlet request parameter values into subviews. |
protected void |
onValidationException(DisplayField field,
java.lang.Object[] values,
java.lang.RuntimeException e)
Called if the setValues(...) on a child DisplayField
throws an exception during request parameter mapping. |
void |
registerChild(java.lang.String name,
java.lang.Class type)
Called to register each child instance and its type with the container. |
protected static void |
registerDisplayEventHandlers(java.lang.Class clazz)
Internal method used to register child field display handler methods. |
void |
removeAllChildren()
Removes all instantiated children from this container. |
void |
removeChild(java.lang.String name)
Removes the named child from the current list of instantiated children. |
protected java.lang.String |
removeQualifiedNameIndices(java.lang.String name)
Given a name like this: |
void |
resetChildren()
Resets all children to a default state in a container-defined way. |
protected void |
setDefaultModel(Model value)
Sets the default model instance that will be used by this view. |
void |
setDisplayFieldValue(java.lang.String name,
boolean value)
Sets the value of the named DisplayField child to a
boolean value. |
void |
setDisplayFieldValue(java.lang.String name,
double value)
Sets the value of the named DisplayField child to a
double value. |
void |
setDisplayFieldValue(java.lang.String name,
int value)
Sets the value of the named DisplayField child to an
int value. |
void |
setDisplayFieldValue(java.lang.String name,
java.lang.Object value)
Sets the value of the named DisplayField child. |
void |
unregisterChild(java.lang.String name)
Removes the named child from the current list of instantiated and registered children |
Methods inherited from class com.iplanet.jato.view.ViewBase |
getName, getParent, getParentViewBean, getQualifiedName, getRootView, getRootView, setName, setParent |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.iplanet.jato.view.View |
getName, getParent, getQualifiedName, setParent |
Field Detail |
public static final java.lang.String BEGIN_DISPLAY_EVENT_METHOD_PREFIX
public static final java.lang.String BEGIN_DISPLAY_EVENT_METHOD_SUFFIX
public static final java.lang.String END_DISPLAY_EVENT_METHOD_PREFIX
public static final java.lang.String END_DISPLAY_EVENT_METHOD_SUFFIX
protected static final MethodRegistry eventMethodRegistry
protected static final boolean OPTION_ENABLE_QUALIFIELD_CHILD_NAME_LOOKUPS
protected static final boolean OPTION_USE_LEGACY_DISPLAY_EVENT_SIGNATURES
Constructor Detail |
protected ContainerViewBase()
public ContainerViewBase(View parent, java.lang.String name)
ContainerViewBase
with a parent and nameparent
- The parent view or null if this view has no parentname
- The logical name of this viewMethod Detail |
public Model getDefaultModel()
DisplayField
children for default value storage (if they
are not bound to any other model). This method returns a DefaultModel
instance if a default model hasn't already been set in this instance.
Note that the default model need not be an actual instance of
DefaultModel
, although this is usually the case.getDefaultModel
in interface ContainerView
protected void setDefaultModel(Model value)
DefaultModel
, although this is usually the case.value
- The default model to be usedpublic void registerChild(java.lang.String name, java.lang.Class type)
This method provides to the container the information necessary to manage the specified child views. This information is needed separately from the actual creation of the child views, and is used to manage them efficiently without instantiating them.
name
- The logical name of the child viewtype
- The class name of the child viewpublic void unregisterChild(java.lang.String name)
name
- The logical name of the child to unregisterprotected View ensureChild(java.lang.String name)
name
- The name of the child within this containerjava.lang.IllegalArgumentException
- Thrown if the child name does not correspond to a
child in this containerpublic void resetChildren()
DisplayField
, these children may be set to contain default values. This
implementation does nothing, leaving the appropriate action to derived
classes.resetChildren
in interface ContainerView
protected abstract View createChild(java.lang.String name)
getChild(...)
method call.name
- The name of the child to instantiate. This method may
throw an IllegalArgumentException
to indicate an
improper child name.public final View createChildInternal(java.lang.String name)
public void removeChild(java.lang.String name)
getChild()
.name
- The logical name of the child to remove from the current list
of instantiated childrenpublic void removeAllChildren()
getChild()
.public java.lang.String[] getChildNames()
getChildNames
in interface ContainerView
com.iplanet.jato.view.ContainerView
public java.lang.String[] getChildNames(java.lang.Class type)
public java.lang.Class getChildType(java.lang.String name)
registerChild(...)
. This method does not result in the instantiation
of the specified child.getChildType
in interface ContainerView
name
- The name of the child contained by this viewpublic int getNumChildren()
getNumChildren
in interface ContainerView
com.iplanet.jato.view.ContainerView
public View getChild(java.lang.String name)
createChild(...)
if the child does not currently
exist within this container.
The provided child name may also be a qualified view path to the
ContainerView.getChild(String name)
method, using forward
slashes ("/"
) as delimiters. All components in the path
except the last must refer to a ContainerView
or a
derivative of ContainerView
(such as TiledView
).
Both relative and absolute paths are possible. If a name path begins
with a forward slash, the name is assumed to be relative to the root
view (the view bean). If the path does not begin with a forward slash,
the name is assumed to refer to a child relative to the current container.
Two dots (".."
) may be used to refer to the container that is
the parent of the current container.
In the case of referencing children within a TiledView, developers can
also specify the specific tile on which the following child appears. The
syntax for this type of reference is .../<tiled view>[<index>]/...
,
where <index>
is the zero-based tiled index.
WARNING: Referencing a specific tile in this manner has side effects. The current tile location will be set to the referenced index; subsequent access to fields in the tiled view that do not specify a tile index will refer to the children of the last-referenced tile. These side effects may also affect tiled view iteration. Therefore, we generally recommend that developers avoid this style of reference when normal tiled view behavior (use of a current location) is sufficient.
getChild
in interface ContainerView
name
- The name of the child to retrieveprotected boolean childExists(java.lang.String name)
name
- The non-qualified name of the child
return True if the child has been allocatedpublic java.lang.String[] getCommandChildNames()
Command
.CommandField
public java.lang.String[] getQualifiedCommandChildNames()
Command
.CommandField
protected java.lang.String removeQualifiedNameIndices(java.lang.String name)
Page1.Repeated1[x].Repeated2[y].Field1we need to remove the indices:
Page1.Repeated1.Repeated2.Field1
protected final void beginDisplay() throws ModelControlException
protected final boolean beginChildDisplay(java.lang.String childName) throws ModelControlException
protected final java.lang.String endChildDisplay(java.lang.String childName, java.lang.String html) throws ModelControlException
protected final void endDisplay()
public void beginDisplay(DisplayEvent event) throws ModelControlException
beginDisplay
in interface ContainerView
event
- The DisplayEvent.ModelControlException
- Thrown if manipulation of a model fails during display preparation.public boolean beginChildDisplay(ChildDisplayEvent event) throws ModelControlException
public boolean begin<child name>Display(ChildDisplayEvent event) throws ModelControlExceptionIf no such method exists for a given child, the call is ignored and this method returns
true
.beginChildDisplay
in interface ContainerView
event
- The ChildDisplayEventModelControlException
- Thrown if manipulation of a model fails during display preparationpublic java.lang.String endChildDisplay(ChildContentDisplayEvent event) throws ModelControlException
public String end<child name>Display(ChildContentDisplayEvent event) throws ModelControlExceptionIf no such method exists for a given child, the call is ignored and this method returns the provided string.
endChildDisplay
in interface ContainerView
event
- The ChildContentDisplayEvent.ModelControlException
- Thrown if manipulation of a model fails during display preparationpublic void endDisplay(DisplayEvent event)
endDisplay
in interface ContainerView
event
- The DisplayEvent.public void mapRequestParameters(javax.servlet.http.HttpServletRequest request) throws ModelControlException
This method is called at the beginning of a servlet request in order to initialize this container and its children with values appropriate to the current request.
mapRequestParameters
in interface ContainerView
request
- The request object of the current servlet requestprotected void mapRequestParameter(DisplayField field, java.lang.Object[] childValues)
mapRequestParameters()
to set the value of
a request parameter on a specific display field. Developers can
override this method to validate or change the values being set.field
- The target display field childchildValues
- The values to be set on the display field childprotected void onValidationException(DisplayField field, java.lang.Object[] values, java.lang.RuntimeException e)
setValues(...)
on a child DisplayField
throws an exception during request parameter mapping. Normally
such an exception would indicate a problem setting the value on the child
view's bound model. This method is only called during the servlet's
call to mapRequestParameters(...)
at the beginning of a
submitted request.
The implemtantion of this method in this class throws a
ValidationException
by default. Developers should override this
method and take any appropriate action to set the provided values on the
child view.
field
- The child view throwing the provided exceptionvalues
- The values that the mapRequestParameters(...)
method attempted to set on the child viewe
- The original exception thrown by the provided child viewpublic DisplayField getDisplayField(java.lang.String name)
DisplayField
child.getDisplayField
in interface ContainerView
name
- The name of the DisplayField
child. This
child must implement the DisplayField
interface or this method throws an IllegalArgumentException
.DisplayField
child. This value
will never be null.DisplayField
public java.lang.Object getDisplayFieldValue(java.lang.String name)
DisplayField
child.getDisplayFieldValue
in interface ContainerView
name
- The name of the DisplayField
child. This
child must implement the DisplayField
interface or this method throws an IllegalArgumentException
.DisplayField
child value. This value
may be null.DisplayField
public void setDisplayFieldValue(java.lang.String name, java.lang.Object value)
DisplayField
child.setDisplayFieldValue
in interface ContainerView
name
- The name of the DisplayField
child. This
child must implement the DisplayField
interface or this method throws an IllegalArgumentException
.value
- The new DisplayField
child valueDisplayField
public java.lang.String getDisplayFieldStringValue(java.lang.String name)
DisplayField
child as
a string. The field's original value is converted to the desired type
using the methods in com.iplanet.jato.util.TypeConverter
.name
- The name of the DisplayField
child. This
child must implement the DisplayField
interface or this method throws an IllegalArgumentException
.DisplayField
child value. This value
may be null.DisplayField
,
TypeConverter
public int getDisplayFieldIntValue(java.lang.String name)
DisplayField
child as
an int. The field's original value is converted to the desired type
using the methods in com.iplanet.jato.util.TypeConverter
.name
- The name of the DisplayField
child. This
child must implement the DisplayField
interface or this method throws an IllegalArgumentException
.DisplayField
child value. If the
original value is null, this method returns zero.DisplayField
,
TypeConverter
public void setDisplayFieldValue(java.lang.String name, int value)
DisplayField
child to an
int value. The primitive value is converted to the object equivalent
before being set.name
- The name of the DisplayField
child. This
child must implement the DisplayField
interface or this method throws an IllegalArgumentException
.value
- The new DisplayField
child valueDisplayField
public double getDisplayFieldDoubleValue(java.lang.String name)
DisplayField
child as
a double. The field's original value is converted to the desired type
using the methods in com.iplanet.jato.util.TypeConverter
.name
- The name of the DisplayField
child. This
child must implement the DisplayField
interface or this method throws an IllegalArgumentException
.DisplayField
child value. If the
original value is null, this method returns zero.DisplayField
,
TypeConverter
public void setDisplayFieldValue(java.lang.String name, double value)
DisplayField
child to a
double value. The primitive value is converted to the object equivalent
before being set.name
- The name of the DisplayField
child. This
child must implement the DisplayField
interface or this method throws an IllegalArgumentException
.value
- The new DisplayField
child valueDisplayField
public boolean getDisplayFieldBooleanValue(java.lang.String name)
DisplayField
child as
a boolean. The field's original value is converted to the desired type
using the methods in com.iplanet.jato.util.TypeConverter
.name
- The name of the DisplayField
child. This
child must implement the DisplayField
interface or this method throws an IllegalArgumentException
.DisplayField
child value. If the
original value is null, this method returns false.DisplayField
,
TypeConverter
public void setDisplayFieldValue(java.lang.String name, boolean value)
DisplayField
child to a
boolean value. The primitive value is converted to the object
equivalent before being set.name
- The name of the DisplayField
child. This
child must implement the DisplayField
interface or this method throws an IllegalArgumentException
.value
- The new DisplayField
child valueDisplayField
public void appMessage(java.lang.String message)
getParentViewBean().getRequestContext().getMessageWriter().println(message);
message
- The message to be added to the application message bufferprotected static void registerDisplayEventHandlers(java.lang.Class clazz)
clazz
- The class to search for display handler methods
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |