com.sun.rave.web.ui.component.util.descriptors
Class LayoutWhile

java.lang.Object
  extended by com.sun.rave.web.ui.component.util.descriptors.LayoutElementBase
      extended by com.sun.rave.web.ui.component.util.descriptors.LayoutIf
          extended by com.sun.rave.web.ui.component.util.descriptors.LayoutWhile
All Implemented Interfaces:
LayoutElement, java.io.Serializable

public class LayoutWhile
extends LayoutIf
implements LayoutElement

This class defines a LayoutWhile LayoutElement. The LayoutWhile provides the functionality necessary to iteratively display a portion of the layout tree. The condition is a boolean equation and may use "$...{...}" type expressions to substitute values.

See Also:
VariableResolver, PermissionChecker, Serialized Form

Field Summary
static java.lang.String AFTER_LOOP
           This is the event "type" for Handler elements to be invoked after this LayoutWhile is processed (outside loop).
static java.lang.String BEFORE_LOOP
           This is the event "type" for Handler elements to be invoked before this LayoutWhile is processed (outside loop).
 
Fields inherited from class com.sun.rave.web.ui.component.util.descriptors.LayoutElementBase
AFTER_ENCODE, BEFORE_ENCODE, ENCODE
 
Constructor Summary
LayoutWhile(LayoutElement parent, java.lang.String condition)
          Constructor
 
Method Summary
 void encode(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component)
           This implementation overrides the parent encode method.
protected  boolean encodeThis(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component)
           This method always returns true.
protected  boolean shouldContinue(javax.faces.component.UIComponent component)
           This method returns true if the condition of this LayoutWhile is met, false otherwise.
 
Methods inherited from class com.sun.rave.web.ui.component.util.descriptors.LayoutIf
getCondition
 
Methods inherited from class com.sun.rave.web.ui.component.util.descriptors.LayoutElementBase
addChildLayoutElement, createHandlerContext, dispatchHandlers, dispatchHandlers, encodeChild, getChildLayoutElements, getHandlers, getHandlers, getHandlersByTypeMap, getId, getLayoutDefinition, getParent, getUnevaluatedId, resolveValue, setHandlers, setHandlersByTypeMap, setParent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.sun.rave.web.ui.component.util.descriptors.LayoutElement
addChildLayoutElement, dispatchHandlers, dispatchHandlers, getChildLayoutElements, getHandlers, getId, getLayoutDefinition, getParent, getUnevaluatedId, setHandlers
 

Field Detail

AFTER_LOOP

public static final java.lang.String AFTER_LOOP

This is the event "type" for Handler elements to be invoked after this LayoutWhile is processed (outside loop).

See Also:
Constant Field Values

BEFORE_LOOP

public static final java.lang.String BEFORE_LOOP

This is the event "type" for Handler elements to be invoked before this LayoutWhile is processed (outside loop).

See Also:
Constant Field Values
Constructor Detail

LayoutWhile

public LayoutWhile(LayoutElement parent,
                   java.lang.String condition)
Constructor

Method Detail

encodeThis

protected boolean encodeThis(javax.faces.context.FacesContext context,
                             javax.faces.component.UIComponent component)

This method always returns true. The condition is checked in shouldContinue(UIComponent) instead of here because the encode(FacesContext, UIComponent) method evaluates the condition and calls the super. Performing the check here would cause the condition to be evaluated twice.

Overrides:
encodeThis in class LayoutIf
Parameters:
context - The FacesContext
component - The UIComponent
Returns:
true

shouldContinue

protected boolean shouldContinue(javax.faces.component.UIComponent component)

This method returns true if the condition of this LayoutWhile is met, false otherwise. This provides the functionality for iteratively displaying a portion of the layout tree.

Parameters:
component - The UIComponent
Returns:
true if children are to be rendered, false otherwise.

encode

public void encode(javax.faces.context.FacesContext context,
                   javax.faces.component.UIComponent component)
            throws java.io.IOException

This implementation overrides the parent encode method. It does this to cause the encode process to loop while shouldContinue(UIComponent) returns true. Currently there is no infinite loop checking, so be careful.

Specified by:
encode in interface LayoutElement
Overrides:
encode in class LayoutElementBase
Parameters:
context - The FacesContext
component - The UIComponent
Throws:
java.io.IOException