Class LabelTag
- java.lang.Object
-
- org.apache.commons.jelly.TagSupport
-
- All Implemented Interfaces:
ConditionalTag
,IconSupport
,org.apache.commons.jelly.Tag
public class LabelTag extends TextIconTag
A tag class for creating labels.
This tag will create a simple label and add it to the enclosing container object. Because a label does not gather any user input, it is not added to the current form object. The following attributes are supported by label tags:
Attribute Description Optional text
With this attribute the label's text can directly be set. yes textres
Defines the resource ID for the label's text. The real text is resolved using the current resource manager and the current locale. yes resgrp
Specifies the resource group of the label's text. If set, this resource group is used when resolving the label's text as defined by the textres
attribute. If undefined, the form builder's default resource group will be used.yes alignment
Defines the relative position of the label's icon to its text. This can be one of the literal names of the TextIconAlignment
class.yes mnemonic
Here a mnemonic for this label can be specified. If the user enters this key, the associated component will be focused (if supported by the platform). yes mnemonicres
This attribute defines the mnemonic as a resource, which makes sense for i18n applications. yes componentref
With this attribute the name of an associated component can be specified. If set and if supported by the current platform, the label can be used to focus this component. There must be a component with the name given here. yes The label tag supports an icon, which can be defined by an
IconTag
in the tag's body. If a label is associated with another component (by using thecomponentref
attribute), it is possible to obtain the text from the display name of this component. This is automatically done if neither a text nor an icon is defined. This is a very convenient way of creating a label. If thecomponentref
attribute is undefined, a text or an icon must be defined; otherwise an exception will be thrown.- Version:
- $Id: LabelTag.java 205 2012-01-29 18:29:57Z oheger $
- Author:
- Oliver Heger
-
-
Constructor Summary
Constructors Constructor Description LabelTag()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Object
createComponent(ComponentManager manager, boolean create)
Creates the label component.String
getComponentref()
Returns the name of the component this label is associated with.void
setComponentref(String component)
Setter method of the componentref attribute.-
Methods inherited from class net.sf.jguiraffe.gui.builder.components.tags.TextIconTag
checkAttributes, getTextIconData, setAlignment, setIcon, setMnemonic, setMnemonicres, setResgrp, setText, setTextres
-
Methods inherited from class net.sf.jguiraffe.gui.builder.components.tags.SimpleComponentTag
getComponent, process, processBeforeBody
-
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
-
-
-
-
Method Detail
-
getComponentref
public String getComponentref()
Returns the name of the component this label is associated with.- Returns:
- the associated component
-
setComponentref
public void setComponentref(String component)
Setter method of the componentref attribute.- Parameters:
component
- the attribute value
-
createComponent
protected Object createComponent(ComponentManager manager, boolean create) throws org.apache.commons.jelly.MissingAttributeException, FormBuilderException
Creates the label component.- Specified by:
createComponent
in classSimpleComponentTag
- Parameters:
manager
- the component managercreate
- the create flag- Returns:
- the new label component
- Throws:
org.apache.commons.jelly.MissingAttributeException
- if required attributes are missingFormBuilderException
- if an error occurs creating the component
-
-