com.tirsen.angkor.widget
Class TextLabel

java.lang.Object
  |
  +--com.tirsen.angkor.Component
        |
        +--com.tirsen.angkor.widget.TextLabel
All Implemented Interfaces:
java.io.Serializable, View

public class TextLabel
extends Component

Displays text to the user. Has the following functionality:

  • fetches data from a list of ValueModels.
  • the data is formated according to a Format.
  • if the format is not a MessageFormat only the data from the first model is used.
  • if the format is MessageFormat all values are fetched from all models.
  • if setting the as text it is specified according to the syntax of MessageFormat.
  • renders the format in a SPAN-tag with the correct id so it can easily be accessed while testing.
    Future functionality:
  • support for fonts.
  • support for rendering of png-images with the text according to a specified font on the server (as a truetype-file or an os-font).
  • support for cascading style sheets.

    Version:
    $Revision: 1.6 $
    Author:
    $Author: tirsen $
    See Also:
    Serialized Form

    Constructor Summary
    TextLabel()
               
    TextLabel(java.lang.String label)
               
    TextLabel(java.lang.String label, ValueModel model)
               
    TextLabel(ValueModel model)
               
     
    Method Summary
     void addModel(ValueModel model)
              Adds a model.
     java.text.Format getFormat()
               
     java.lang.String getFormattedText()
              Gets the text formatted correctly and with the values fetched from the models.
     void render(RenderContext context)
              Render this view on the given context if the view is visible.
     void setFormat(java.text.Format format)
              Sets a custom format.
     void setLabel(java.lang.String label)
               
     void setModel(ValueModel model)
              Sets a single model to fetch data from.
     java.lang.String toString()
               
     
    Methods inherited from class com.tirsen.angkor.Component
    allocateUniqueId, getAttribute, getContainer, getId, getRenderContext, getVisibleIndex, isDebugTables, isParsing, isVisible, parse, setAttribute, setContainer, setId, setVisible, uniqueId
     
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
     

    Constructor Detail

    TextLabel

    public TextLabel()

    TextLabel

    public TextLabel(java.lang.String label)

    TextLabel

    public TextLabel(ValueModel model)

    TextLabel

    public TextLabel(java.lang.String label,
                     ValueModel model)
    Method Detail

    setLabel

    public void setLabel(java.lang.String label)

    setModel

    public void setModel(ValueModel model)
    Sets a single model to fetch data from.


    addModel

    public void addModel(ValueModel model)
    Adds a model. If the format is not a MessageFormat only the first model is used.


    getFormattedText

    public java.lang.String getFormattedText()
    Gets the text formatted correctly and with the values fetched from the models.


    setFormat

    public void setFormat(java.text.Format format)
    Sets a custom format. For example a currency format or a date format.


    getFormat

    public java.text.Format getFormat()

    toString

    public java.lang.String toString()
    Overrides:
    toString in class java.lang.Object

    render

    public void render(RenderContext context)
                throws java.io.IOException
    Description copied from interface: View
    Render this view on the given context if the view is visible. Performed during render-phase.

    Specified by:
    render in interface View
    Specified by:
    render in class Component
    java.io.IOException
    See Also:
    View.setVisible(boolean), View.isVisible()


    Copyright © 2002-2002 . All Rights Reserved.