org.apache.tapestry.binding
Class ListenerBinding

java.lang.Object
  |
  +--org.apache.tapestry.binding.AbstractBinding
        |
        +--org.apache.tapestry.binding.ListenerBinding
All Implemented Interfaces:
IActionListener, IBinding, ILocatable

public class ListenerBinding
extends AbstractBinding
implements IActionListener

A very specialized binding that can be used as an IActionListener, executing a script in a scripting language, via Bean Scripting Framework.

Since:
3.0
Version:
$Id: ListenerBinding.java,v 1.6 2003/05/28 13:41:37 hlship Exp $
Author:
Howard Lewis Ship

Constructor Summary
ListenerBinding(IComponent component, String language, String script, ILocation location)
           
 
Method Summary
 void actionTriggered(IComponent component, IRequestCycle cycle)
          A ListenerBinding is also a IActionListener.
 boolean getBoolean()
          Always returns true.
 double getDouble()
          Gets the value of the Binding using getObject() and coerces it to a double.
 int getInt()
          Gets the value of the Binding using getObject() and coerces it to an int.
 Object getObject()
          Returns this.
 String getString()
          Returns the underlying script.
 
Methods inherited from class org.apache.tapestry.binding.AbstractBinding
createReadOnlyBindingException, getLocation, getObject, isInvariant, isWrapper, setBoolean, setDouble, setInt, setObject, setString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ListenerBinding

public ListenerBinding(IComponent component,
                       String language,
                       String script,
                       ILocation location)
Method Detail

getBoolean

public boolean getBoolean()
Always returns true.
Overrides:
getBoolean in class AbstractBinding
Following copied from interface: org.apache.tapestry.IBinding
See Also:
Tapestry.evaluateBoolean(Object)

getInt

public int getInt()
Description copied from interface: IBinding
Gets the value of the Binding using IBinding.getObject() and coerces it to an int. Strings will be parsed, and other java.lang.Number classes will have intValue() invoked.
Overrides:
getInt in class AbstractBinding
Following copied from interface: org.apache.tapestry.IBinding
Throws:
ClassCastException - if the binding's value is not of a usable class.
NullValueForBindingException - if the binding's value is null.

getDouble

public double getDouble()
Description copied from interface: IBinding
Gets the value of the Binding using IBinding.getObject() and coerces it to a double. Strings will be parsed, and other java.lang.Number classes will have doubleValue() invoked.
Overrides:
getDouble in class AbstractBinding
Following copied from interface: org.apache.tapestry.IBinding
Throws:
ClassCastException - if the binding's value is not of a usable class.
NullValueForBindingException - if the binding's value is null.

getString

public String getString()
Returns the underlying script.
Overrides:
getString in class AbstractBinding

getObject

public Object getObject()
Returns this.

actionTriggered

public void actionTriggered(IComponent component,
                            IRequestCycle cycle)
A ListenerBinding is also a IActionListener. It registers a number of beans with the BSF manager and invokes the script.

Registers the following bean:

Specified by:
actionTriggered in interface IActionListener
Following copied from interface: org.apache.tapestry.IActionListener
Parameters:
action - The component which was "triggered".
cycle - The request cycle in which the component was triggered.