com.liquidatom.derbyscore.theme
Class ThemeElement

java.lang.Object
  extended by com.liquidatom.derbyscore.theme.ThemeElement
Direct Known Subclasses:
ImageElement, TextElement

@ThreadSafe
@Immutable
public abstract class ThemeElement
extends java.lang.Object

An abstract base class for theme elements such as text or images that can conditionally be rendered on the scoreboard.

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

Constructor Summary
protected ThemeElement(Theme theme, java.lang.String visibleConditionScript)
          Construct a new ThemeElement.
 
Method Summary
abstract  java.awt.Rectangle getPosition()
          Get the bounding rectangle into which this element should be rendered.
protected  Theme getTheme()
          Get the Theme which this element belongs too.
 java.lang.String getVisibleConditionScript()
          Get the javascript which should be evaluated to determine whether this element is visible or not.
 boolean isVisible(java.util.Map<java.lang.String,java.lang.Object> scope)
          Determine whether this element is visible or not.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ThemeElement

protected ThemeElement(Theme theme,
                       java.lang.String visibleConditionScript)
Construct a new ThemeElement.

Parameters:
theme - The theme which this element belongs to.
visibleConditionScript - An optional snippet of javascript which will be evaluated to determine whether we should render this element.
Method Detail

isVisible

public boolean isVisible(java.util.Map<java.lang.String,java.lang.Object> scope)
Determine whether this element is visible or not.

Parameters:
scope - The variables which should be exposed to the javascript engine.
Returns:
true if this element is visible, false otherwise.

getTheme

protected Theme getTheme()
Get the Theme which this element belongs too.

Returns:
The Theme which this element belongs too.

getVisibleConditionScript

public java.lang.String getVisibleConditionScript()
Get the javascript which should be evaluated to determine whether this element is visible or not.

Returns:
The javascript script which will be evaluated to determine whether this element is visible or not.

getPosition

public abstract java.awt.Rectangle getPosition()
Get the bounding rectangle into which this element should be rendered.

Returns:
The bounding rectangle into which this element should be rendered.