com.liquidatom.derbyscore.theme
Class TextElement

java.lang.Object
  extended by com.liquidatom.derbyscore.theme.ThemeElement
      extended by com.liquidatom.derbyscore.theme.TextElement

@ThreadSafe
@Immutable
public class TextElement
extends ThemeElement

Used to represent a snippet of text which will be conditionally rendered onto the scoreboard.

Author:
Russell Francis (russ@metro-six.com)

Constructor Summary
TextElement(Theme theme, java.lang.String visibleConditionScript, java.awt.Rectangle position, java.lang.String textScript, java.lang.String fontRef)
          Construct a new TextElement instance.
TextElement(Theme theme, java.lang.String visibleConditionScript, java.awt.Rectangle position, java.lang.String text, java.lang.String fontRef, java.awt.Color color)
          Construct a new TextElement instance.
 
Method Summary
 java.awt.Color getColor()
          The color to use when rendering this text.
 java.awt.Font getFont()
          Get the font which should be used to render this text.
 java.lang.String getFontRef()
          The unique label used to identify the font used when rendering this text.
 java.awt.Rectangle getPosition()
          Get a Rectangle describing the bounds which this text will be rendered into.
 java.lang.String getText(java.util.Map<java.lang.String,java.lang.Object> scope)
          Evaluate the text javascript and return the result.
 
Methods inherited from class com.liquidatom.derbyscore.theme.ThemeElement
getTheme, getVisibleConditionScript, isVisible
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TextElement

public TextElement(Theme theme,
                   java.lang.String visibleConditionScript,
                   java.awt.Rectangle position,
                   java.lang.String textScript,
                   java.lang.String fontRef)
Construct a new TextElement instance.

Parameters:
theme - The theme that this element is contained within.
visibleConditionScript - An optional snippet of javascript which will be evaluated to determine if this text should be rendered.
position - The bounding rectangle where this text should be rendered.
textScript - A snippet of javascript text which will be evaluated, the result will be rendered as text.
fontRef - A reference to the font used to render the text.

TextElement

public TextElement(Theme theme,
                   java.lang.String visibleConditionScript,
                   java.awt.Rectangle position,
                   java.lang.String text,
                   java.lang.String fontRef,
                   java.awt.Color color)
Construct a new TextElement instance.

Parameters:
theme - The theme that this element is contained within.
visibleConditionScript - An optional snippet of javascript which will be evaluated to determine if this text should be rendered.
position - The bounding rectangle where this text should be rendered.
textScript - A snippet of javascript text which will be evaluated, the result will be rendered as text.
fontRef - A reference to the font used to render the text.
color - The color used to render this text.
Method Detail

getFont

public java.awt.Font getFont()
Get the font which should be used to render this text.

Returns:
The font which should be used to render this text.

getText

public java.lang.String getText(java.util.Map<java.lang.String,java.lang.Object> scope)
Evaluate the text javascript and return the result.

Parameters:
scope - A map containing any variables which should be exposed to the evaluated script.
Returns:
The result of the script as a string.

getFontRef

public java.lang.String getFontRef()
The unique label used to identify the font used when rendering this text.

Returns:
The unique label used to identify the font used when rendering this text.

getColor

public java.awt.Color getColor()
The color to use when rendering this text.

Returns:
The color to use when rendering this text.

getPosition

public java.awt.Rectangle getPosition()
Get a Rectangle describing the bounds which this text will be rendered into.

Specified by:
getPosition in class ThemeElement
Returns:
A Rectangle describing the bounds which this text will be rendered into.