Class ListModelItemTag

  • All Implemented Interfaces:
    ConditionalTag, org.apache.commons.jelly.Tag

    public class ListModelItemTag
    extends FormBaseTag

    A tag handler class that creates an item for a list model.

    Tags of this class can appear in the body of a TextListModelTag tag. Each tag defines one item of the model with a mandatory display text (which can be set either directly or through a resource definition) and an optional value. The following table lists all supported attributes:

    Attribute Description Optional
    text Defines the display text of this model item directly. exactly one of these
    textres Allows to define the display text of this model item from a resource property. If no resource group is specified, the builder's default resource will be used.
    resgrp Sets the resource group to use to resolve the resource provided by the textres attribute. yes
    value The corresponding value of this list model item. This can be an arbitrary object. yes
    valueRef Using this attribute the value of the corresponding list item can be specified as a reference. It will be looked up in the current BeanContext. This way the full power of the dependency injection framework can be used for creating and initializing Java objects. If both the value and the valueRef attributes are specified, the value attribute takes precedence. yes

    Version:
    $Id: ListModelItemTag.java 205 2012-01-29 18:29:57Z oheger $
    Author:
    Oliver Heger
    • Constructor Detail

      • ListModelItemTag

        public ListModelItemTag()
        Creates a new instance of ListModelItemTag.
    • Method Detail

      • getTextData

        public TextData getTextData()
        Returns the text data object with the definition of the display text.
        Returns:
        the display text data
      • setText

        public void setText​(String s)
        Setter method of the text attribute.
        Parameters:
        s - the attribute value
      • setTextres

        public void setTextres​(String s)
        Setter method of the textres attribute.
        Parameters:
        s - the attribute value
      • setResgrp

        public void setResgrp​(String s)
        Setter method of the resgrp attribute.
        Parameters:
        s - the attribute value
      • getValue

        public Object getValue()
        Returns the value of this list item.
        Returns:
        the value (can be null )
      • setValue

        public void setValue​(Object v)
        Setter method of the value attribute.
        Parameters:
        v - the attribute value
      • getValueRef

        public String getValueRef()
        Returns the reference to the value.
        Returns:
        the reference name of the value bean
      • setValueRef

        public void setValueRef​(String valueRef)
        Set method of the valueRef attribute
        Parameters:
        valueRef - the attribute value
      • process

        protected void process()
                        throws org.apache.commons.jelly.JellyTagException
        Executes this tag.
        Specified by:
        process in class FormBaseTag
        Throws:
        org.apache.commons.jelly.JellyTagException - if this tag is used incorrectly
      • fetchValue

        protected Object fetchValue()
        Returns the value of this item. This method is called by process(). It inspects the attributes value and valueRef and processes them correspondingly.
        Returns:
        the value of this item (can be null if unspecified)