net.sourceforge.spark.framework
Class Widget

java.lang.Object
  extended bynet.sourceforge.spark.framework.Widget
All Implemented Interfaces:
CommandHolder, org.w3c.dom.events.EventListener
Direct Known Subclasses:
Atom, Container

public abstract class Widget
extends java.lang.Object
implements CommandHolder, org.w3c.dom.events.EventListener

The root Widget class type. All SPARK Widgets inherit from this class.

The Widget class implements the CommandHolder interface.

$Source: /cvsroot/spark/spark/source/java/net/sourceforge/spark/framework/Widget.java,v $
 $Log: Widget.java,v $
 Revision 1.2  2005/07/24 04:03:28  afettes
 no message

 Revision 1.1  2005/07/24 03:55:32  afettes
 Initial commit to CVS.
 

Version:
$Revision: 1.2 $ - $Date: 2005/07/24 04:03:28 $
Author:
$Author: afettes $, Alastair Fettes
See Also:
CommandHolder, Command

Field Summary
 java.lang.String ID
          The widgets unique ID.
private  java.util.Vector m_vpCommands
          List of Commands that this Widget holds.
 java.lang.String TYPE
          The widgets unique type.
 
Constructor Summary
Widget(java.lang.String id, java.lang.String type)
          Create a new Widget class with the given id.
 
Method Summary
 void addCommand(Command in_command)
          Add a command to this widget to be executed.
abstract  java.lang.Object getState()
          Retrieve the state of the widget.
 void handleEvent(org.w3c.dom.events.Event evt)
          This method is called whenever an event occurs of the type for which the EventListener interface was registered.
 void removeCommand(Command in_command)
          Remove a command from this Widget.
protected  void runCommands()
          Execute the list of commands that this command hold is holding.
abstract  void setState(java.lang.Object in_state)
          Set the state of this widget.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_vpCommands

private java.util.Vector m_vpCommands
List of Commands that this Widget holds.


ID

public final java.lang.String ID
The widgets unique ID.


TYPE

public final java.lang.String TYPE
The widgets unique type.

Constructor Detail

Widget

public Widget(java.lang.String id,
              java.lang.String type)
Create a new Widget class with the given id.

Parameters:
id - The id.
Method Detail

getState

public abstract java.lang.Object getState()
Retrieve the state of the widget.

Returns:
The current state of the widget.

setState

public abstract void setState(java.lang.Object in_state)
Set the state of this widget.

Parameters:
in_state - The new state for the widget.

addCommand

public void addCommand(Command in_command)
Add a command to this widget to be executed.

Specified by:
addCommand in interface CommandHolder
Parameters:
in_command - The Command to add.

removeCommand

public void removeCommand(Command in_command)
Remove a command from this Widget.

Specified by:
removeCommand in interface CommandHolder
Parameters:
in_command - The Command to remove.

runCommands

protected void runCommands()
Execute the list of commands that this command hold is holding.


handleEvent

public void handleEvent(org.w3c.dom.events.Event evt)
This method is called whenever an event occurs of the type for which the EventListener interface was registered. From org.w3c.dom.events.EventListener

Specified by:
handleEvent in interface org.w3c.dom.events.EventListener
Parameters:
evt - The Event contains contextual information about the event. It also contains the stopPropagation and preventDefault methods which are used in determining the event's flow and default action.