|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sun.rave.web.ui.component.util.descriptors.LayoutElementBase
public abstract class LayoutElementBase
This class provides some common functionality between the various types of LayoutElements. It is the base class of most implementations (perhaps all).
Field Summary | |
---|---|
static java.lang.String |
AFTER_ENCODE
This is the "type" for handlers to be invoked after the encoding of this element. |
static java.lang.String |
BEFORE_ENCODE
This is the "type" for handlers to be invoked before the encoding of this element. |
static java.lang.String |
ENCODE
This is the "type" for handlers to be invoked during the encoding of this element. |
Constructor Summary | |
---|---|
protected |
LayoutElementBase(LayoutElement parent,
java.lang.String id)
Constructor |
Method Summary | |
---|---|
void |
addChildLayoutElement(LayoutElement element)
This method is used to add a LayoutElement. |
protected HandlerContext |
createHandlerContext(javax.faces.context.FacesContext context,
java.util.EventObject event,
java.lang.String eventType)
This method is responsible for creating a new HandlerContext. |
java.lang.Object |
dispatchHandlers(javax.faces.context.FacesContext context,
java.lang.String eventType,
java.util.EventObject event)
This method iterates over the handlers and executes each one. |
java.lang.Object |
dispatchHandlers(HandlerContext handlerCtx,
java.util.List handlers)
As currently implemented, this method is essentially a utility method. |
void |
encode(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component)
This is the base implementation for encode. |
static void |
encodeChild(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component)
This method is a convenience method for encoding the given UIComponent . |
protected abstract boolean |
encodeThis(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component)
This method allows each LayoutElement to provide it's own encode functionality. |
java.util.List |
getChildLayoutElements()
This method returns the LayoutElements as a List. |
java.util.List |
getHandlers(java.lang.String type)
This method retrieves the Handlers for the requested type. |
java.util.List |
getHandlers(java.lang.String type,
javax.faces.component.UIComponent comp)
This method retrieves the Handlers for the requested type. |
java.util.Map |
getHandlersByTypeMap()
This method provides access to the "handlersByType" Map . |
java.lang.String |
getId(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent parent)
Accessor method for id. |
LayoutDefinition |
getLayoutDefinition()
This method walks to the top-most LayoutElement, which should be a LayoutDefinition. |
LayoutElement |
getParent()
This method returns the parent LayoutElement. |
java.lang.String |
getUnevaluatedId()
This method generally should not be used. |
java.lang.Object |
resolveValue(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent parent,
java.lang.String value)
This method will attempt to resolve EL strings in the given value. |
void |
setHandlers(java.lang.String type,
java.util.List handlers)
This method associates 'type' with the given list of Handlers. |
void |
setHandlersByTypeMap(java.util.Map map)
This method provides a means to set the "handlersByType" Map. |
protected void |
setParent(LayoutElement parent)
This method sets the parent LayoutElement. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String AFTER_ENCODE
This is the "type" for handlers to be invoked after the encoding of this element.
public static final java.lang.String BEFORE_ENCODE
This is the "type" for handlers to be invoked before the encoding of this element.
public static final java.lang.String ENCODE
This is the "type" for handlers to be invoked during the encoding of this element. This occurs before any child LayoutElements are invoked and only if child Elements are to be invoked.
Constructor Detail |
---|
protected LayoutElementBase(LayoutElement parent, java.lang.String id)
parent
- The parent LayoutElementid
- Identifier for this LayoutElementMethod Detail |
---|
public void addChildLayoutElement(LayoutElement element)
addChildLayoutElement
in interface LayoutElement
element
- The LayoutElement to add as a childpublic java.util.List getChildLayoutElements()
getChildLayoutElements
in interface LayoutElement
public LayoutDefinition getLayoutDefinition()
getLayoutDefinition
in interface LayoutElement
public LayoutElement getParent()
getParent
in interface LayoutElement
protected void setParent(LayoutElement parent)
parent
- Parent LayoutElementpublic java.lang.String getUnevaluatedId()
This method generally should not be used. It does not resolve
expressions. Instead use
getId(FacesContext, UIComponent)
.
getUnevaluatedId
in interface LayoutElement
public java.lang.String getId(javax.faces.context.FacesContext context, javax.faces.component.UIComponent parent)
Accessor method for id. This returns a non-null value, it may return "" if id is not set or does not apply.
This method will also attempt to resolve EL strings.
getId
in interface LayoutElement
context
- The FacesContext
parent
- The parent UIComponent
. This is used
because the current UIComponent is typically
unknown (or not even created yet).
public java.lang.Object resolveValue(javax.faces.context.FacesContext context, javax.faces.component.UIComponent parent, java.lang.String value)
This method will attempt to resolve EL strings in the given value.
context
- The FacesContext
parent
- The parent UIComponent
. This is used
because the current UIComponent is typically
unknown (or not even created yet).value
- The String to resolve
protected abstract boolean encodeThis(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component) throws java.io.IOException
This method allows each LayoutElement to provide it's own encode
functionality. If the LayoutElement
should render its
children, this method should return true. Otherwise, this method
should return false.
context
- The FacesContextcomponent
- The UIComponent
java.io.IOException
public void encode(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component) throws java.io.IOException
This is the base implementation for encode. Typically each type of LayoutElement wants to do something specific then conditionally have its children rendered. This method invokes the abstract method "encodeThis" to do specific functionality, it the walks the children and renders them, if encodeThis returns true. It skips the children if encodeThis returns false.
encode
in interface LayoutElement
context
- The FacesContext
component
- The UIComponent
java.io.IOException
public java.lang.Object dispatchHandlers(javax.faces.context.FacesContext context, java.lang.String eventType, java.util.EventObject event)
This method iterates over the handlers and executes each one. A HandlerContext will be created to pass to each Handler. The HandlerContext object is reused across all Handlers that are invoked; the setHandler(Handler) method is invoked with the correct Handler descriptor before the handler is executed.
dispatchHandlers
in interface LayoutElement
context
- The FacesContexteventType
- The event type which is being firedevent
- An optional EventObject providing more detail
public java.lang.Object dispatchHandlers(HandlerContext handlerCtx, java.util.List handlers)
As currently implemented, this method is essentially a utility method. May want to rethink this.
dispatchHandlers
in interface LayoutElement
protected HandlerContext createHandlerContext(javax.faces.context.FacesContext context, java.util.EventObject event, java.lang.String eventType)
This method is responsible for creating a new HandlerContext. It does not set the Handler descriptor. This is done right before a Handler is invoked. This allows the HandlerContext object to be reused.
context
- The FacesContextpublic java.util.List getHandlers(java.lang.String type)
This method retrieves the Handlers for the requested type.
getHandlers
in interface LayoutElement
type
- The type of Handlers to retrieve.
public java.util.Map getHandlersByTypeMap()
This method provides access to the "handlersByType"
Map
.
public void setHandlersByTypeMap(java.util.Map map)
This method provides a means to set the "handlersByType" Map.
Normally this is done for each type individually via
setHandlers(String, List)
. This Map may not be null (null
will be ignored) and should contain entries that map to
List
s of Handler
s.
public java.util.List getHandlers(java.lang.String type, javax.faces.component.UIComponent comp)
This method retrieves the Handlers for the requested type. But also includes any handlers that are associated with the instance (i.e. the UIComponent).
type
- The type of Handler
s to retrieve.event
- The associated UIComponent
(or null).
public void setHandlers(java.lang.String type, java.util.List handlers)
This method associates 'type' with the given list of Handlers.
setHandlers
in interface LayoutElement
type
- The String type for the List of Handlershandlers
- The List of Handlerspublic static void encodeChild(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component) throws java.io.IOException
This method is a convenience method for encoding the given
UIComponent
. It calls the appropriate encoding
methods on the component and calls itself recursively for all
UIComponent
children that do not render their own
children.
context
- FacesContext
component
- UIComponent
to encode
java.io.IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |