org.apache.beehive.netui.tags.databinding.repeater.pad
Class Pad

Object
  extended by TagSupport
      extended by BodyTagSupport
          extended by AbstractClassicTag
              extended by RepeaterComponent
                  extended by Pad
All Implemented Interfaces:
Serializable, BodyTag, IterationTag, JspTag, Tag, INetuiTag

public class Pad
extends RepeaterComponent

Sets the number of items rendered by a Repeater tag. The <netui-data:pad> tag has the ability to turn an irregular data set in the <netui-data:repeater> tag into a regular data set through the use of the three attributes:

If the padText attribute is unset, the body of the <netui-data:pad> tag is used as the default text.

Note, the container data binding context should not be used inside of the Pad's padText attribute as binding to both the item and index could product unexpected results.

In the following example, assume that the <netui-data:repeater> tag iterates over a List object. The <netui-data:pad> limits the iteration to three cycles, no matter how many elements are actually in the List.

     <netui-data:repeater dataSource="pageFlow.myList">
         <netui-data:pad maxRepeat="3"/>
             <netui-data:repeaterItem>
                 <netui:span value="${container.item}" />
             </netui-data:repeaterItem>
     </netui-data:repeater>
 

See Also:
Serialized Form
Example

In the following example, assume that the <netui-data:repeater> tag iterates over a List object. The <netui-data:pad> limits the iteration to three cycles, no matter how many elements are actually in the List.

     <netui-data:repeater dataSource="pageFlow.myList">
         <netui-data:pad maxRepeat="3"/>
             <netui-data:repeaterItem>
                 <netui:span value="${container.item}" />
             </netui-data:repeaterItem>
     </netui-data:repeater>
 


Field Summary
 
Fields inherited from class AbstractClassicTag
DefaultNamingChain, EMPTY_STRING, NETUI_UNIQUE_CNT
 
Fields inherited from class BodyTagSupport
bodyContent
 
Fields inherited from class TagSupport
id, pageContext
 
Fields inherited from interface BodyTag
EVAL_BODY_BUFFERED, EVAL_BODY_TAG
 
Fields inherited from interface IterationTag
EVAL_BODY_AGAIN
 
Fields inherited from interface Tag
EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE
 
Constructor Summary
Pad()
           
 
Method Summary
 int doAfterBody()
          Default implementation of this JSP lifecycle method.
 String getTagName()
          Get the name of this tag.
protected  void localRelease()
          Reset all of the fields of this tag.
protected  int renderEndTag(int state)
          Complete rendering the body of this tag.
 void setMaxRepeat(int maxRepeat)
          Set the maximum number of items that will be rendered by a <netui-data:repeater> tag.
 void setMinRepeat(int minRepeat)
           
 void setPadText(String padText)
          Set the text that will be used when padding a Repeater that renders its body too few times.
protected  boolean shouldRender()
           
protected  void verifyAttributes()
          Verify that the attributes set on the tag are correct.
 
Methods inherited from class RepeaterComponent
doEndTag, doStartTag, getRepeater
 
Methods inherited from class AbstractClassicTag
applyNamingChain, getErrorsReport, getIdForTagId, getNamingChain, getNearestForm, getNextId, getScriptReporter, getUserLocale, hasErrors, qualifyAttribute, registerTagError, registerTagError, reportAndExit, reportErrors, rewriteName, setNonEmptyValueAttribute, setRequiredValueAttribute, write
 
Methods inherited from class BodyTagSupport
doInitBody, getBodyContent, getPreviousOut, release, setBodyContent
 
Methods inherited from class TagSupport
findAncestorWithClass, getId, getParent, getValue, getValues, removeValue, setId, setPageContext, setParent, setValue
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface Tag
getParent, setPageContext, setParent
 

Constructor Detail

Pad

public Pad()
Method Detail

getTagName

public String getTagName()
Get the name of this tag. This is used to identify the type of this tag for reporting tag errors.

Specified by:
getTagName in interface INetuiTag
Specified by:
getTagName in class AbstractClassicTag
Returns:
a constant String representing the name of this tag.

setPadText

public void setPadText(String padText)
Set the text that will be used when padding a Repeater that renders its body too few times.

Parameters:
padText - the text that is used to pad a repeater's content

setMaxRepeat

public void setMaxRepeat(int maxRepeat)
Set the maximum number of items that will be rendered by a <netui-data:repeater> tag. If the size of the data set is greater than this, only this many items will be rendered. This value can be an integer or can be an expression that resolves to an integer.

Parameters:
maxRepeat - an integer or an expression that references an integer for the maximum number of items to render

setMinRepeat

public void setMinRepeat(int minRepeat)
Parameters:
minRepeat - an integer or an expression that references an integer for the minimum number of items to render

shouldRender

protected boolean shouldRender()
Specified by:
shouldRender in class RepeaterComponent

doAfterBody

public int doAfterBody()
                throws JspException
Description copied from class: RepeaterComponent
Default implementation of this JSP lifecycle method.

Specified by:
doAfterBody in interface IterationTag
Overrides:
doAfterBody in class RepeaterComponent
Returns:
SKIP_BODY
Throws:
JspException

renderEndTag

protected int renderEndTag(int state)
                    throws JspException
Complete rendering the body of this tag. If the padText property was unset, the body of the tag is used as the pad text.

Overrides:
renderEndTag in class RepeaterComponent
Parameters:
state - the current render state of the Repeater
Returns:
EVAL_PAGE
Throws:
JspException - if an error occurs that can not be reported on the page

localRelease

protected void localRelease()
Reset all of the fields of this tag.

Overrides:
localRelease in class RepeaterComponent

verifyAttributes

protected void verifyAttributes()
                         throws JspException
Verify that the attributes set on the tag are correct. Check:

Overrides:
verifyAttributes in class RepeaterComponent
Throws:
JspException - if an error occurs that can not be reported on the page