Class ComboBoxTag
- 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.ComboBoxTag
-
- All Implemented Interfaces:
ConditionalTag
,ListModelSupport
,org.apache.commons.jelly.Tag
public class ComboBoxTag extends InputComponentTag implements ListModelSupport
A specific input component tag that creates a combo box component.
A combo box displays a list of options from which the user can select one. 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. A component handler that wraps a combo box must maintain a single data object of the same type as the list model (i.e. the return value of the model'sgetType()
method).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 BeanContext
. 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 editable This boolean attribute determines whether the user can enter arbitrary text in the combo box's text field. If set to false , the user can only select one of the displayed options. For combo boxes that are editable the data value is not obtained from the list model, but will be the data entered by the user. yes - Version:
- $Id: ComboBoxTag.java 205 2012-01-29 18:29:57Z oheger $
- Author:
- Oliver Heger
-
-
Constructor Summary
Constructors Constructor Description ComboBoxTag()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected ComponentHandler<Object>
createComponentHandler(ComponentManager manager, boolean create)
Creates the combo 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.boolean
isEditable()
Returns a flag whether this combo box is editable.void
setEditable(boolean editable)
Setter method of the editable attribute.void
setListModel(ListModel model)
Sets the list model for this combo box.void
setModelRef(String modelRef)
Setter method of the modelRef 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
-
isEditable
public boolean isEditable()
Returns a flag whether this combo box is editable.- Returns:
- the editable flag
-
setEditable
public void setEditable(boolean editable)
Setter method of the editable attribute.- Parameters:
editable
- 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
-
createComponentHandler
protected ComponentHandler<Object> createComponentHandler(ComponentManager manager, boolean create) throws FormBuilderException, org.apache.commons.jelly.JellyTagException
Creates the combo box component.- Specified by:
createComponentHandler
in classInputComponentTag
- Parameters:
manager
- the component managercreate
- the create flag- Returns:
- the handler for the newly created component
- Throws:
FormBuilderException
- if an error occursorg.apache.commons.jelly.JellyTagException
- if the tag is incorrectly used
-
-