net.sourceforge.spark.framework
Class SPARK

java.lang.Object
  extended bynet.sourceforge.spark.framework.SPARK

public final class SPARK
extends java.lang.Object

The SPARK class is an integral part of the framework and the kit. It is used to handle Widget registration, mouse focus and keyboard focus. $Source: /cvsroot/spark/spark/source/java/net/sourceforge/spark/framework/SPARK.java,v $

 $Log: SPARK.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:
net.sourceforge.spark.widgets.SPARKFactory, net.sourceforge.spark.widgets.Widget

Field Summary
private static SPARKFactory FACTORY
          The factory used to create new widget instances.
private static Widget KEYBOARD_FOCUS
          The widget that currently has the keyboard focus.
private static Widget MOUSE_FOCUS
          The widget that currently has the mouse focus.
private static java.util.Vector REGISTERED_TYPES
          A list of all valid widget types.
static java.util.Vector REGISTERED_WIDGETS
          A set of widgets that have been registered globally.
 
Constructor Summary
private SPARK()
          This is a singleton, static only class.
 
Method Summary
static void deregisterWidget(Widget in_widget)
          Remove a widget from the global registration list.
static void deregisterWidgetType(java.lang.String in_type)
          Remove a widget type frome the allowed type list.
static SPARKFactory getFactory()
          Get the factory to be used to create new widget instances.
static void handleKeyboardEvent(org.w3c.dom.svg.SVGEvent evt)
          Pass the given Keyboard Event to the widget with keyboard focus.
static void handleMouseEvent(org.w3c.dom.svg.SVGEvent evt)
          Pass the given Mouse Event to the widget with mouse focus.
static boolean isWidget(java.lang.String in_type)
          Test to see if a given string defines a currently registered widget type.
static void registerWidget(Widget in_widget)
          Add a widget to the global registration list.
static void registerWidgetType(java.lang.String in_type)
          Add a widget type to the allowed type list.
static void releaseKeyboardFocus(Widget in_widget)
          Release the widget from global keyboard focus only if it has current keyboard focus.
static boolean releaseMouseFocus(Widget in_widget)
          Release the widget from global mouse focus.
static void requestKeyboardFocus(Widget in_widget)
          Let a widget request keyboard focus.
static boolean requestMouseFocus(Widget in_widget)
          Let a widget request mouse focus.
static void setFactory(SPARKFactory in_factory)
          Set the factory to be used to create new widget instances.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MOUSE_FOCUS

private static Widget MOUSE_FOCUS
The widget that currently has the mouse focus.


KEYBOARD_FOCUS

private static Widget KEYBOARD_FOCUS
The widget that currently has the keyboard focus.


REGISTERED_TYPES

private static java.util.Vector REGISTERED_TYPES
A list of all valid widget types.


REGISTERED_WIDGETS

public static java.util.Vector REGISTERED_WIDGETS
A set of widgets that have been registered globally.


FACTORY

private static SPARKFactory FACTORY
The factory used to create new widget instances.

Constructor Detail

SPARK

private SPARK()
This is a singleton, static only class.

Method Detail

requestMouseFocus

public static boolean requestMouseFocus(Widget in_widget)
Let a widget request mouse focus. If another widget already has mouse focus this action will fail.

Parameters:
in_widget - The widget requesting keyboard focus.
Returns:
If the widget successfully retrieved mouse focus.

releaseMouseFocus

public static boolean releaseMouseFocus(Widget in_widget)
Release the widget from global mouse focus.

Parameters:
in_widget - The widget to be removed from focus.
Returns:
True if the widget had the mouse focus and it was removed successfully.

handleMouseEvent

public static void handleMouseEvent(org.w3c.dom.svg.SVGEvent evt)
Pass the given Mouse Event to the widget with mouse focus.


requestKeyboardFocus

public static void requestKeyboardFocus(Widget in_widget)
Let a widget request keyboard focus. Keyboard Focus will always be granted.

Parameters:
in_widget - The widget requesting keyboard focus.

releaseKeyboardFocus

public static void releaseKeyboardFocus(Widget in_widget)
Release the widget from global keyboard focus only if it has current keyboard focus.

Parameters:
in_widget - The widget.

handleKeyboardEvent

public static void handleKeyboardEvent(org.w3c.dom.svg.SVGEvent evt)
Pass the given Keyboard Event to the widget with keyboard focus.


registerWidgetType

public static void registerWidgetType(java.lang.String in_type)
Add a widget type to the allowed type list.

Parameters:
in_type - The type to be added.

deregisterWidgetType

public static void deregisterWidgetType(java.lang.String in_type)
Remove a widget type frome the allowed type list.

Parameters:
in_type - The type to be removed.

isWidget

public static boolean isWidget(java.lang.String in_type)
Test to see if a given string defines a currently registered widget type.

Parameters:
in_type - The type to test.
Returns:
True if that type has been registered.

registerWidget

public static void registerWidget(Widget in_widget)
Add a widget to the global registration list.

Parameters:
in_widget - The widget to be added.

deregisterWidget

public static void deregisterWidget(Widget in_widget)
Remove a widget from the global registration list.

Parameters:
in_widget - The widget to be removed.

setFactory

public static void setFactory(SPARKFactory in_factory)
Set the factory to be used to create new widget instances.

Parameters:
in_factory - The factory.

getFactory

public static SPARKFactory getFactory()
Get the factory to be used to create new widget instances.