org.loom.tags
Class AbstractFormInputTag

java.lang.Object
  extended by javax.servlet.jsp.tagext.SimpleTagSupport
      extended by org.loom.tags.AbstractTag
          extended by org.loom.tags.AbstractDecoratedTag
              extended by org.loom.tags.AbstractHtmlTag
                  extended by org.loom.tags.AbstractFormFieldTag
                      extended by org.loom.tags.AbstractFormInputTag
All Implemented Interfaces:
javax.servlet.jsp.tagext.DynamicAttributes, javax.servlet.jsp.tagext.JspTag, javax.servlet.jsp.tagext.SimpleTag, FormInputTag, HtmlTag, LoomTag
Direct Known Subclasses:
AbstractOptionsTag, AbstractTextFieldTag, InputCheckboxTag, InputFileTag, InputImageTag

public abstract class AbstractFormInputTag
extends AbstractFormFieldTag
implements FormInputTag

Parent class for any form field associated to a form input parameter. Docs about the HTML fields can be found here


Nested Class Summary
static class AbstractFormInputTag.LabelPosition
           
 
Field Summary
protected  java.lang.String value
          when specified, use this value instead of the action property value
 
Fields inherited from class org.loom.tags.AbstractDecoratedTag
decorator
 
Fields inherited from class org.loom.tags.AbstractTag
expressionLanguageProxy, loomServletRequestFactory, out, repository, request, response
 
Constructor Summary
AbstractFormInputTag()
           
 
Method Summary
 java.lang.String getLabelCssClass()
          As of #LOOM-95, modified to propagate all the applied CSS classes to the surrounding label
 AbstractFormInputTag.LabelPosition getLabelPosition()
           
protected  java.lang.Boolean getRenderAsText()
           
protected  java.lang.Boolean getRenderLabel()
           
 java.lang.String getTranslatedLabel()
           
protected  java.util.Set<PropertyValidator> getValidators()
          Lazily initializes the list of Validators asociated to this field.
 java.lang.String getValue()
          Calculates this tag value.
 boolean hasError()
           
protected  void initTag()
          Initializes the tag attributes
 boolean isBound()
           
 boolean isEscapeHTML()
           
 boolean isTranslateLabel()
           
protected  void printParentAttributes()
          Prints this instance attributes
 java.lang.String renderAsText()
          Gets this item value as String, to show when renderAsText is true By default, it returns the tag value
 void setAddTranslatedName(boolean addTranslatedName)
           
 void setBound(boolean bound)
           
 void setEscapeHTML(boolean escapeRenderAsText)
           
 void setLabelClass(java.lang.String labelClass)
          CSS styles to be applied to the surrounding label but not to the input component.
 void setLabelPos(java.lang.String labelPosition)
          Position of the label for this field.
protected  void setLabelPosition(AbstractFormInputTag.LabelPosition position)
           
 void setRenderAsText(java.lang.Boolean renderAsText)
           
 void setRenderErrorDisplayComponent(java.lang.Boolean renderError)
           
 void setRenderLabel(java.lang.Boolean renderLabel)
           
 void setTranslateLabel(boolean translateLabel)
           
 void setValue(java.lang.String value)
           
 boolean shouldRenderAsText()
           
 boolean shouldRenderError()
           
 boolean shouldRenderLabel()
           
 
Methods inherited from class org.loom.tags.AbstractFormFieldTag
getForm, getHelpLine, getLabel, getNormalizedName, getTabindex, isDisabled, setAlt, setDisabled, setForm, setHelpLine, setLabel, setName, setTabindex, setType
 
Methods inherited from class org.loom.tags.AbstractHtmlTag
addCssClass, getAccesskey, getCssBuilder, getCssClass, getDir, getId, getLang, getName, getStyle, getTitle, getTranslatedTitle, identify, isCssProcessed, isIf, isTranslateTitle, renderTag, setAccesskey, setCssClass, setCssProcessed, setDir, setId, setIf, setLang, setStyle, setTitle, setTranslateTitle
 
Methods inherited from class org.loom.tags.AbstractDecoratedTag
doTag, getDecorator, getDecoratorInstance, setDecorator
 
Methods inherited from class org.loom.tags.AbstractTag
createWriterWrapper, doBody, doBufferedBody, doTagImpl, endTag, evaluateExpression, getActionProperty, getAncestorWithClass, getBufferedBody, getExtendedAttributes, getMessagesRepository, getPageContext, getRequest, getResponse, getScopedAttribute, getWriter, removeScopedAttribute, setDynamicAttribute, setExtendedAttribute, setJspContext, setRequest, setResponse, setScopedAttribute, setWriter
 
Methods inherited from class javax.servlet.jsp.tagext.SimpleTagSupport
findAncestorWithClass, getJspBody, getJspContext, getParent, setJspBody, setParent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.loom.tags.HtmlTag
addCssClass, getCssBuilder
 
Methods inherited from interface org.loom.tags.LoomTag
getExtendedAttributes, getRequest, getScopedAttribute, setExtendedAttribute, setScopedAttribute
 

Field Detail

value

@Attribute
protected java.lang.String value
when specified, use this value instead of the action property value

Constructor Detail

AbstractFormInputTag

public AbstractFormInputTag()
Method Detail

initTag

protected void initTag()
Description copied from class: AbstractTag
Initializes the tag attributes

Overrides:
initTag in class AbstractFormFieldTag

printParentAttributes

protected void printParentAttributes()
                              throws java.io.IOException,
                                     javax.servlet.jsp.JspException
Description copied from class: AbstractFormFieldTag
Prints this instance attributes

Overrides:
printParentAttributes in class AbstractFormFieldTag
Throws:
java.io.IOException
javax.servlet.jsp.JspException

getTranslatedLabel

public java.lang.String getTranslatedLabel()
Returns:
if translateLabel == false, the label as is. Else, the result of calling MessagesRepository.guessString(label)

getValue

public java.lang.String getValue()
Calculates this tag value. If this tag has an associated error message, return the request value prior to conversion. Else, extract the property value and convert to String.


renderAsText

public java.lang.String renderAsText()
Gets this item value as String, to show when renderAsText is true By default, it returns the tag value


hasError

public boolean hasError()
Returns:
true if this component has any validation error associated

getValidators

protected java.util.Set<PropertyValidator> getValidators()
Lazily initializes the list of Validators asociated to this field.

Returns:
The validator list, empty if none.

getLabelCssClass

public java.lang.String getLabelCssClass()
As of #LOOM-95, modified to propagate all the applied CSS classes to the surrounding label

Returns:
the css classes to apply to the surrounding label

setRenderLabel

public void setRenderLabel(java.lang.Boolean renderLabel)

setRenderErrorDisplayComponent

public void setRenderErrorDisplayComponent(java.lang.Boolean renderError)

shouldRenderLabel

public boolean shouldRenderLabel()
Returns:
true if the component or the form are set to renderLabel

shouldRenderAsText

public boolean shouldRenderAsText()
Returns:
true if the component or the form are set to renderAsText

shouldRenderError

public boolean shouldRenderError()
Returns:
true if the component or the form are set to renderError display component

setValue

public void setValue(java.lang.String value)

getLabelPosition

public AbstractFormInputTag.LabelPosition getLabelPosition()

setLabelPos

@Attribute
public void setLabelPos(java.lang.String labelPosition)
Position of the label for this field. Valid values are "left" (default for almost all field types) and "right" (default for checkboxes and radio buttons)


setLabelPosition

protected void setLabelPosition(AbstractFormInputTag.LabelPosition position)

setRenderAsText

public void setRenderAsText(java.lang.Boolean renderAsText)

isTranslateLabel

public boolean isTranslateLabel()

setTranslateLabel

public void setTranslateLabel(boolean translateLabel)

setAddTranslatedName

public void setAddTranslatedName(boolean addTranslatedName)

isEscapeHTML

public boolean isEscapeHTML()

setEscapeHTML

public void setEscapeHTML(boolean escapeRenderAsText)

getRenderLabel

protected java.lang.Boolean getRenderLabel()

getRenderAsText

protected java.lang.Boolean getRenderAsText()

setLabelClass

@Attribute
public void setLabelClass(java.lang.String labelClass)
CSS styles to be applied to the surrounding label but not to the input component. This is useful when using grid systems such as 960gs or YUI-Grid


isBound

public boolean isBound()

setBound

public void setBound(boolean bound)