Class ListBoxTag
- java.lang.Object
-
- org.apache.commons.jelly.TagSupport
-
- net.sf.jguiraffe.gui.builder.components.tags.FormBaseTag
-
- net.sf.jguiraffe.gui.builder.components.tags.ComponentBaseTag
-
- net.sf.jguiraffe.gui.builder.components.tags.InputComponentTag
-
- net.sf.jguiraffe.gui.builder.components.tags.ListBoxTag
-
- All Implemented Interfaces:
ConditionalTag
,ListModelSupport
,ScrollSizeSupport
,org.apache.commons.jelly.Tag
public class ListBoxTag extends InputComponentTag implements ListModelSupport, ScrollSizeSupport
A specific input component tag that creates a list box component.
A list box displays a list of options from which the user can select one or many, depending on the style of the list. The options to be displayed are obtained from a
ListModel
object, which is set either by a tag in this tag's body or by specifying the model's name in themodelRef
attribute. The data type of a component handler that wraps a list box must be based on the data type of the list model (i.e. the return value of the model'sgetType()
method): For single selection lists it is a single object of this type, for multi selection lists it is an array of this type.The following table lists all attributes that are supported by this tag (in addition to the default attributes that are allowed for all input component tags):
Attribute Description Optional modelRef With this attribute the name of the list model can be supplied. It is then fetched from the current bean context. So a list model with this name must have been created before, either directly by the calling client or by another tag that has already been executed. If this attribute is not defined, a list model must be set by a nested tag. yes multi This boolean attribute determines whether the user can select only one or multiple of the options displayed by the list. Note that this attribute has impact of the data managed by the list's component handler (and thus on the corresponding form bean property). yes scrollWidth Here the preferred width of the scroll pane enclosing the list can be specified as a number with unit (e.g. "1.5cm"). If specified, the scroll pane will have exactly this preferred width. Otherwise, the width is determined by the preferred width of the list. yes scrollHeight Here the preferred height of the scroll pane enclosing the list can be specified as a number with unit (e.g. "10dlu"). If specified, the scroll pane will have exactly this preferred height. Otherwise, the height is determined by the preferred height of the list. yes - Version:
- $Id: ListBoxTag.java 205 2012-01-29 18:29:57Z oheger $
- Author:
- Oliver Heger
-
-
Constructor Summary
Constructors Constructor Description ListBoxTag()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected ComponentHandler<?>
createComponentHandler(ComponentManager manager, boolean create)
Creates the list box component.ListModel
getListModel()
Returns the list model to be used by this combo box.String
getModelRef()
Returns the name of the model to use.NumberWithUnit
getPreferredScrollHeight()
Returns the preferred scroll height.NumberWithUnit
getPreferredScrollWidth()
Returns the preferred scroll width.String
getScrollHeight()
Returns the scroll height specification as a string.String
getScrollWidth()
Returns the scroll width specification as a string.boolean
isMulti()
Returns a flag whether the list box allows multi-selection.void
setListModel(ListModel model)
Sets the list model for this combo box.void
setModelRef(String modelRef)
Setter method of the modelRef attribute.void
setMulti(boolean multi)
Setter method of themulti
attribute.void
setScrollHeight(String scrollHeight)
Set method of thescrollHeight
attribute.void
setScrollWidth(String scrollWidth)
Set method of thescrollWidth
attribute.-
Methods inherited from class net.sf.jguiraffe.gui.builder.components.tags.InputComponentTag
addToGroups, checkName, createFieldHandler, getComponent, getComponentHandler, getComponentType, getDisplayName, getFieldValidator, getFormValidator, getGroups, getPropertyName, getReadTransformer, getTypeName, getWriteTransformer, handleGroups, insertField, isNoField, process, processBeforeBody, setComponentType, setDisplayName, setDisplayNamegrp, setDisplayNameres, setFieldValidator, setFormValidator, setGroups, setNoField, setPropertyName, setReadTransformer, setTypeName, setWriteTransformer
-
Methods inherited from class net.sf.jguiraffe.gui.builder.components.tags.ComponentBaseTag
getBackColor, getBackgroundColor, getConstraints, getFont, getFontRef, getForeColor, getForegroundColor, getName, getToolTipData, insertComponent, setBackColor, setConstraints, setFont, setFontRef, setForeColor, setName, setTooltip, setTooltipres, setTooltipresgrp
-
Methods inherited from class net.sf.jguiraffe.gui.builder.components.tags.FormBaseTag
canProcess, canProcess, convertToClass, convertToNumberWithUnit, convertToNumberWithUnit, doTag, findContainer, getBuilderData, getBuilderData, getIfName, getResourceText, getResourceText, getUnlessName, setIfName, setUnlessName
-
Methods inherited from class org.apache.commons.jelly.TagSupport
findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, getBody, getBodyText, getBodyText, getContext, getParent, invokeBody, isEscapeText, isTrim, setBody, setContext, setEscapeText, setParent, setTrim, trimBody
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.sf.jguiraffe.gui.builder.components.tags.ListModelSupport
getContext
-
-
-
-
Method Detail
-
isMulti
public boolean isMulti()
Returns a flag whether the list box allows multi-selection.- Returns:
- the multiple selection flag
-
setMulti
public void setMulti(boolean multi)
Setter method of themulti
attribute.- Parameters:
multi
- the attribute value
-
getModelRef
public String getModelRef()
Returns the name of the model to use.- Specified by:
getModelRef
in interfaceListModelSupport
- Returns:
- the list model's name in the jelly context
-
setModelRef
public void setModelRef(String modelRef)
Setter method of the modelRef attribute.- Parameters:
modelRef
- the attribute value
-
getListModel
public ListModel getListModel()
Returns the list model to be used by this combo box.- Specified by:
getListModel
in interfaceListModelSupport
- Returns:
- the list model
-
setListModel
public void setListModel(ListModel model)
Sets the list model for this combo box. This method is intended to be called by nested tags.- Specified by:
setListModel
in interfaceListModelSupport
- Parameters:
model
- the list model
-
getScrollWidth
public String getScrollWidth()
Returns the scroll width specification as a string.- Returns:
- the scroll width specification
-
setScrollWidth
public void setScrollWidth(String scrollWidth)
Set method of thescrollWidth
attribute.- Parameters:
scrollWidth
- the attribute's value
-
getScrollHeight
public String getScrollHeight()
Returns the scroll height specification as a string.- Returns:
- the scroll height specification
-
setScrollHeight
public void setScrollHeight(String scrollHeight)
Set method of thescrollHeight
attribute.- Parameters:
scrollHeight
- the attribute's value
-
getPreferredScrollWidth
public NumberWithUnit getPreferredScrollWidth()
Returns the preferred scroll width. This value is calculated from the string-based scroll width specification during tag processing. If no scroll width has been specified, this method returnsNumberWithUnit.ZERO
.- Specified by:
getPreferredScrollWidth
in interfaceScrollSizeSupport
- Returns:
- the preferred scroll width
-
getPreferredScrollHeight
public NumberWithUnit getPreferredScrollHeight()
Returns the preferred scroll height. This value is calculated from the string-based scroll height specification during tag processing. If no scroll height has been specified, this method returnsNumberWithUnit.ZERO
.- Specified by:
getPreferredScrollHeight
in interfaceScrollSizeSupport
- Returns:
- the preferred scroll height
-
createComponentHandler
protected ComponentHandler<?> createComponentHandler(ComponentManager manager, boolean create) throws FormBuilderException, org.apache.commons.jelly.JellyTagException
Creates the list box component.- Specified by:
createComponentHandler
in classInputComponentTag
- Parameters:
manager
- the component managercreate
- the create flag- Returns:
- the component handler for the newly created list box
- Throws:
FormBuilderException
- if an error occursorg.apache.commons.jelly.JellyTagException
- if this tag is incorrectly used
-
-