net.sf.springlayout.web.layout.taglib
Class AbstractFieldTag

java.lang.Object
  extended by javax.servlet.jsp.tagext.TagSupport
      extended by org.springframework.web.servlet.tags.RequestContextAwareTag
          extended by org.springframework.web.servlet.tags.HtmlEscapingAwareTag
              extended by net.sf.springlayout.web.layout.taglib.LayoutBindTag
                  extended by net.sf.springlayout.web.layout.taglib.AbstractFieldTag
All Implemented Interfaces:
java.io.Serializable, javax.servlet.jsp.tagext.IterationTag, javax.servlet.jsp.tagext.Tag, javax.servlet.jsp.tagext.TryCatchFinally
Direct Known Subclasses:
AbstractHtmlAttributesTag

public abstract class AbstractFieldTag
extends LayoutBindTag

Abstract class for creating field tags with support for binding to the model and form field fieldDefinition. Uses the FormTag.CURRENT_PANEL request attribute to get a handle to the layoutPanel for the current form being displayed in order to evaluate the current field against it's field definition. This tag provides html passthrough for all general javascript events as well as standard htmlAttributes applicable to all labels and fields. This code lends heavily from the Spring form tags.

Author:
Rob Monie, Adam Boas
See Also:
Serialized Form

Field Summary
protected static SpringLayoutConfiguration config
           
protected  java.lang.String emptyDisplayString
           
protected  OnPageFieldInstance fieldInstance
           
 
Fields inherited from class net.sf.springlayout.web.layout.taglib.LayoutBindTag
ignoreNestedPath, path, pathIfNestedNull, previousStatus, status
 
Fields inherited from class org.springframework.web.servlet.tags.RequestContextAwareTag
logger, REQUEST_CONTEXT_PAGE_ATTRIBUTE
 
Fields inherited from class javax.servlet.jsp.tagext.TagSupport
id, pageContext
 
Fields inherited from interface javax.servlet.jsp.tagext.IterationTag
EVAL_BODY_AGAIN
 
Fields inherited from interface javax.servlet.jsp.tagext.Tag
EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE
 
Constructor Summary
AbstractFieldTag()
           
 
Method Summary
protected abstract  void addToFieldSet(FieldDefinition fieldDefinition, OnPageFieldInstance fieldInstance)
          Adds this OnPageFieldInstance to the appropriate set in the fieldDefinition
protected abstract  void appendEditModeOutput(java.lang.StringBuffer output)
          Builds the ouput which the tag must supply in Edit mode.
protected  void appendReadOnlyOutput(java.lang.StringBuffer output)
          Builds the ouput which the tag must supply in ReadOnly mode.
abstract  int doFieldStartTag()
          Called in sub classes
 int doStartTagInternal()
           Sets up a FieldStatus Field based on the current context and config in the field definitions for use by spring field tags.
protected  FieldDefinition getFieldDefinition(javax.servlet.http.HttpServletRequest request)
           
 int getGroupSize()
          Gets the default group size of one for non grouped fields
 java.lang.StringBuffer getOutput()
          Primarily for testing this allows the StringBuffer that this tag and it's children use to append their html output to be set and re-acquired.
protected  org.springframework.beans.BeanWrapper getWrappedCommand()
           
 boolean isGroupedField()
          Does this field use a group of options rendered as separate fields such as a radio button or multiple checkboxes with the same name - default is false
 void setEmptyDisplayString(java.lang.String emptyDisplayString)
          Sets the emptyDisplayString for this InputFieldTag.
 void setOutput(java.lang.StringBuffer output)
          Sets the output which this AbstractFieldTag will use to append html.
 
Methods inherited from class net.sf.springlayout.web.layout.taglib.LayoutBindTag
doEndTag, doFinally, getEditor, getErrors, getPath, getProperty, isIgnoreNestedPath, setIgnoreNestedPath, setPath
 
Methods inherited from class org.springframework.web.servlet.tags.HtmlEscapingAwareTag
isHtmlEscape, setHtmlEscape
 
Methods inherited from class org.springframework.web.servlet.tags.RequestContextAwareTag
doCatch, doStartTag, getRequestContext
 
Methods inherited from class javax.servlet.jsp.tagext.TagSupport
doAfterBody, findAncestorWithClass, getId, getParent, getValue, getValues, release, removeValue, setId, setPageContext, setParent, setValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fieldInstance

protected OnPageFieldInstance fieldInstance

config

protected static SpringLayoutConfiguration config

emptyDisplayString

protected java.lang.String emptyDisplayString
Constructor Detail

AbstractFieldTag

public AbstractFieldTag()
Method Detail

getOutput

public java.lang.StringBuffer getOutput()
Primarily for testing this allows the StringBuffer that this tag and it's children use to append their html output to be set and re-acquired. Retrieves the output StringBuffer which this AbstractFieldTag is using to append html.

Returns:
Returns the output which this AbstractFieldTag is using to append html.

setOutput

public void setOutput(java.lang.StringBuffer output)
Sets the output which this AbstractFieldTag will use to append html.

Parameters:
output - Sets the output which this AbstractFieldTag will use to append html

setEmptyDisplayString

public void setEmptyDisplayString(java.lang.String emptyDisplayString)
Sets the emptyDisplayString for this InputFieldTag.

Parameters:
emptyDisplayString - Sets the emptyDisplayString for this InputFieldTag.

doStartTagInternal

public int doStartTagInternal()
                       throws java.lang.Exception

Sets up a FieldStatus Field based on the current context and config in the field definitions for use by spring field tags.

Overrides:
doStartTagInternal in class LayoutBindTag
Throws:
java.lang.Exception
See Also:
RequestContextAwareTag.doStartTagInternal()

doFieldStartTag

public abstract int doFieldStartTag()
                             throws javax.servlet.jsp.JspTagException
Called in sub classes

Returns:
Throws:
javax.servlet.jsp.JspTagException

appendReadOnlyOutput

protected void appendReadOnlyOutput(java.lang.StringBuffer output)
Builds the ouput which the tag must supply in ReadOnly mode.


appendEditModeOutput

protected abstract void appendEditModeOutput(java.lang.StringBuffer output)
Builds the ouput which the tag must supply in Edit mode.


addToFieldSet

protected abstract void addToFieldSet(FieldDefinition fieldDefinition,
                                      OnPageFieldInstance fieldInstance)
Adds this OnPageFieldInstance to the appropriate set in the fieldDefinition

Parameters:
fieldDefinition -
fieldInstance -

getFieldDefinition

protected final FieldDefinition getFieldDefinition(javax.servlet.http.HttpServletRequest request)

isGroupedField

public boolean isGroupedField()
Does this field use a group of options rendered as separate fields such as a radio button or multiple checkboxes with the same name - default is false

Returns:

getGroupSize

public int getGroupSize()
Gets the default group size of one for non grouped fields

Returns:

getWrappedCommand

protected org.springframework.beans.BeanWrapper getWrappedCommand()
Returns:
the current command wrapped in a BeanWrapper.


Copyright © 2005-2007 Spring Layout Team. All Rights Reserved.