|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.arsdigita.bebop.Completable
com.arsdigita.bebop.SimpleComponent
com.arsdigita.bebop.TextStylable
com.arsdigita.bebop.BlockStylable
com.arsdigita.bebop.Label
A text label. The label can be used to generate either some static,
fixed text or a new text string for every request. To set a new
text string for each request, use the setLabel(String,PageState)
method.
Field Summary | |
static String |
BOLD
|
static String |
ITALIC
|
static String |
versionId
|
Fields inherited from class com.arsdigita.bebop.BlockStylable |
ABSBOTTOM, ABSMIDDLE, BASELINE, BOTTOM, CENTER, FULL_WIDTH, INSERT, LEFT, MIDDLE, RIGHT, TEXTTOP, TOP |
Fields inherited from class com.arsdigita.bebop.SimpleComponent |
m_attr |
Fields inherited from interface com.arsdigita.bebop.Component |
BEBOP_XML_NS, CLASS, ID, ON_CLICK, STYLE |
Constructor Summary | |
Label()
Creates a new Label with empty text. |
|
Label(GlobalizedMessage label)
Creates a new label with the specified text. |
|
Label(GlobalizedMessage label,
boolean escaping)
Creates a new label with the specified text and output escaping turned on if escaping is
true . |
|
Label(PrintListener l)
Creates a new Label that uses the print listener
to generate output. |
|
Label(String label)
Creates a new Label with the specified text. |
|
Label(String label,
boolean escaping)
Creates a new Label with the specified text and
output escaping turned on if escaping is
true . |
|
Label(String label,
String fontWeight)
Creates a new label with the specified text and fontweight. |
Method Summary | |
void |
addPrintListener(PrintListener listener)
Adds a print listener. |
protected Label |
firePrintEvent(PageState state)
|
void |
generateXML(PageState state,
Element parent)
Adds [J]DOM nodes for this component. |
String |
getFontWeight()
|
GlobalizedMessage |
getGlobalizedMessage()
This should really be getLabel(), but since it was marked STABLE I can't change its return type. |
GlobalizedMessage |
getGlobalizedMessage(PageState state)
This should really be getLabel(), but since it was marked STABLE I can't change its return type. |
String |
getLabel()
Deprecated. Use getGlobalizedMessage() |
String |
getLabel(PageState state)
. |
boolean |
getOutputEscaping()
|
void |
removePrintListener(PrintListener listener)
Removes a previously added print listener. |
void |
setFontWeight(String fontWeight)
|
void |
setLabel(GlobalizedMessage label)
Sets the default text for this Label. |
void |
setLabel(GlobalizedMessage label,
PageState state)
Sets the text for this label using a GlobalizedMessage. |
void |
setLabel(String label)
Sets new default text for this Label. |
void |
setLabel(String label,
PageState state)
Sets new request-specific text for this Label to use on this request. |
void |
setOutputEscaping(boolean escaping)
Controls whether output is escaped during transformation, by default true. |
Methods inherited from class com.arsdigita.bebop.BlockStylable |
setBorder, setBorder, setBorderColor, setHorizontalAlignment, setMargin, setMargin, setPadding, setPadding, setVerticalAlignment |
Methods inherited from class com.arsdigita.bebop.TextStylable |
setBackgroundColor, setColor |
Methods inherited from class com.arsdigita.bebop.SimpleComponent |
children, clone, exportAttributes, getAttribute, getClassAttr, getIdAttr, getKey, getMetaDataAttribute, getStyleAttr, hasAttributes, isLocked, isVisible, lock, register, register, respond, setAttribute, setClassAttr, setIdAttr, setKey, setMetaDataAttribute, setStyleAttr, setVisible |
Methods inherited from class com.arsdigita.bebop.Completable |
addCompletionListener, fireCompletionEvent |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final String versionId
public static final String BOLD
public static final String ITALIC
Constructor Detail |
public Label()
Label
with empty text.
public Label(String label)
Label
with the specified text.
label
- the text to displaypublic Label(String label, boolean escaping)
Label
with the specified text and
output escaping turned on if escaping
is
true
.
The setting foroutput escaping affects how markup in
the label
is handled. For example:
label
- the text to displaypublic Label(GlobalizedMessage label)
Creates a new label with the specified text.
label
- the text to displaypublic Label(GlobalizedMessage label, boolean escaping)
Creates a new label with the specified text and
output escaping turned on if escaping
is
true
.
label
- the text to displayescaping
- Whether or not to perform output escapingpublic Label(PrintListener l)
Label
that uses the print listener
to generate output.
l
- the print listener used to produce outputpublic Label(String label, String fontWeight)
label
- The text to displayfontWeight
- The fontWeight e.g., Label.BOLDMethod Detail |
public String getLabel(PageState state)
If possible,
derived classes should override getLabel()
instead,
which is called from this method. As long as we don't have a
static method to obtain ApplicationContext, this is a way to
get the RequestContext (that is, to determine the locale). When
ApplicationContext gets available, that will become the
suggested way for overriding code to get context.
state
- the current page state
public String getLabel()
getGlobalizedMessage()
public GlobalizedMessage getGlobalizedMessage()
This should really be getLabel(), but since it was marked STABLE I can't change its return type.
public GlobalizedMessage getGlobalizedMessage(PageState state)
This should really be getLabel(), but since it was marked STABLE I can't change its return type.
public void setLabel(String label)
label
- The new label text; will be used as a key into the
current ResourceBundle if possible, or displayed literally.public void setLabel(String label, PageState state)
label
- The new label text; will be used as a key into the
current ResourceBundle if possible, or displayed literally.state
- the page statepublic void setLabel(GlobalizedMessage label, PageState state)
label
- The GlobalizedMessage containing the label
text or the lookup key to use in the ResourceBundlestate
- the current page state; if null, sets the
default text for all requests.public void setLabel(GlobalizedMessage label)
label
- The GlobalizedMessage containing the label
text or the lookup key to use in the ResourceBundlepublic final boolean getOutputEscaping()
public final void setOutputEscaping(boolean escaping)
public final String getFontWeight()
public void setFontWeight(String fontWeight)
public void addPrintListener(PrintListener listener) throws IllegalStateException, IllegalArgumentException
PrintListener
is expected to modify the
target of the PrintEvent
.
listener
- the print listener
IlegalArgumentException
- if listener
is null.
IllegalStateException
- if a print listener has previously been
added.
IllegalArgumentException
public void removePrintListener(PrintListener listener) throws IllegalArgumentException
listener
is
not the listener that was added with addPrintListener
, an IllegalArgumentException will be thrown.
listener
- the listener that was added with
addPrintListener
IllegalArgumentException
- if listener
is not the
currently registered print listener or is null
.public void generateXML(PageState state, Element parent)
SimpleComponent
generateXML
in interface Component
generateXML
in class SimpleComponent
protected Label firePrintEvent(PageState state)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |