Class TextData
- java.lang.Object
-
- net.sf.jguiraffe.gui.builder.components.tags.TextData
-
- Direct Known Subclasses:
TextIconData
public class TextData extends Object
A helper class that provides some functionality for components that can display an internationalized text.
This class supports several ways for defining a text that can be displayed by a component. The text can be directly defined or by specifying a resource ID and an optional resource group. Tags that want to support these features for defining texts can create an instance of this class and route their attribute setter methods to this instance.
There is an additional method to find out whether text is defined at all. With the
getCaption()
method the final text can be retrieved no matter how it was specified. This should greatly simplify the implementation of tags with text attributes that can be internationalized.- Version:
- $Id: TextData.java 205 2012-01-29 18:29:57Z oheger $
- Author:
- Oliver Heger
-
-
Constructor Summary
Constructors Constructor Description TextData(FormBaseTag t)
Creates a new instance ofTextData
and initializes it with the given tag.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getCaption()
Returns the final text of the associated component.String
getResgrp()
Returns the resource group for the text.FormBaseTag
getTag()
Returns the associated tag.String
getText()
Returns the text.String
getTextres()
Returns the resource ID.boolean
isDefined()
Checks whether this object is defined.void
setResgrp(String resgrp)
Sets the resource group.void
setText(String text)
Sets the text.void
setTextres(String textres)
Sets the resource ID of the text.
-
-
-
Constructor Detail
-
TextData
public TextData(FormBaseTag t)
Creates a new instance ofTextData
and initializes it with the given tag.- Parameters:
t
- the associated tag
-
-
Method Detail
-
getTag
public FormBaseTag getTag()
Returns the associated tag.- Returns:
- the tag
-
getText
public String getText()
Returns the text.- Returns:
- the text
-
setText
public void setText(String text)
Sets the text.- Parameters:
text
- the text to set
-
getResgrp
public String getResgrp()
Returns the resource group for the text.- Returns:
- the resource group
-
setResgrp
public void setResgrp(String resgrp)
Sets the resource group. The text can be defined either directly or by specifying a resource group (optional) and a resource ID.- Parameters:
resgrp
- the resource group
-
getTextres
public String getTextres()
Returns the resource ID.- Returns:
- the text resource ID
-
setTextres
public void setTextres(String textres)
Sets the resource ID of the text. The text can be defined either directly or by specifying a resource group (optional) and a resource ID.- Parameters:
textres
- the text resource ID
-
getCaption
public String getCaption()
Returns the final text of the associated component. This method can deal with all supported ways of defining the text.- Returns:
- the final text of this component
-
isDefined
public boolean isDefined()
Checks whether this object is defined. To be defined either a direct text or a text resource must be specified.- Returns:
- a flag whether this object is defined
-
-