Aviatrix3D
2.1.0

org.j3d.aviatrix3d.pipeline.graphics
Class GraphicsListenerMulticaster

java.lang.Object
  extended by org.j3d.aviatrix3d.pipeline.graphics.GraphicsListenerMulticaster
All Implemented Interfaces:
GraphicsResizeListener

public class GraphicsListenerMulticaster
extends java.lang.Object
implements GraphicsResizeListener

A class which implements efficient and thread-safe multi-cast event dispatching for the events defined in this package.

This class will manage an immutable structure consisting of a chain of event listeners and will dispatch events to those listeners. Because the structure is immutable, it is safe to use this API to add/remove listeners during the process of an event dispatch operation.

An example of how this class could be used to implement a new component which fires resize events:


 public myComponent extends Component {
   GraphicsResizeListener nodeListener = null;

   public void addNodeListener(GraphicsResizeListener l) {
     nodeListener = NodeListenerMulticaster.add(nodeListener, l);
   }

   public void removeNodeListener(GraphicsResizeListener l) {
     nodeListener = NodeListenerMulticaster.remove(nodeListener, l);
   }

   public void fireFieldChanged(int index) {
     if(nodeListener != null) {
       nodeListener.fieldChanged(index);
   }
 }
 

Version:
$Revision: 3.1 $
Author:
Justin Couch

Constructor Summary
GraphicsListenerMulticaster(GraphicsResizeListener a, GraphicsResizeListener b)
          Creates an event multicaster instance which chains listener-a with listener-b.
 
Method Summary
static GraphicsResizeListener add(GraphicsResizeListener a, GraphicsResizeListener b)
          Adds input-method-listener-a with input-method-listener-b and returns the resulting multicast listener.
 void graphicsDeviceResized(int x, int y, int width, int height)
          Notification that the graphics output device has changed dimensions to the given size.
 GraphicsResizeListener remove(GraphicsResizeListener oldl)
          Removes a listener from this multicaster and returns the resulting multicast listener.
static GraphicsResizeListener remove(GraphicsResizeListener l, GraphicsResizeListener oldl)
          Removes the old component-listener from component-listener-l and returns the resulting multicast listener.
static void setErrorReporter(org.j3d.util.ErrorReporter reporter)
          Register an error reporter with the engine so that any errors generated by the loading of script code can be reported in a nice, pretty fashion.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GraphicsListenerMulticaster

public GraphicsListenerMulticaster(GraphicsResizeListener a,
                                   GraphicsResizeListener b)
Creates an event multicaster instance which chains listener-a with listener-b. Input parameters a and b should not be null, though implementations may vary in choosing whether or not to throw NullPointerException in that case.

Parameters:
a - listener-a
b - listener-b
Method Detail

remove

public GraphicsResizeListener remove(GraphicsResizeListener oldl)
Removes a listener from this multicaster and returns the resulting multicast listener.

Parameters:
oldl - the listener to be removed

setErrorReporter

public static void setErrorReporter(org.j3d.util.ErrorReporter reporter)
Register an error reporter with the engine so that any errors generated by the loading of script code can be reported in a nice, pretty fashion. Setting a value of null will clear the currently set reporter. If one is already set, the new value replaces the old.

Parameters:
reporter - The instance to use or null

add

public static GraphicsResizeListener add(GraphicsResizeListener a,
                                         GraphicsResizeListener b)
Adds input-method-listener-a with input-method-listener-b and returns the resulting multicast listener.

Parameters:
a - input-method-listener-a
b - input-method-listener-b

remove

public static GraphicsResizeListener remove(GraphicsResizeListener l,
                                            GraphicsResizeListener oldl)
Removes the old component-listener from component-listener-l and returns the resulting multicast listener.

Parameters:
l - component-listener-l
oldl - the component-listener being removed

graphicsDeviceResized

public void graphicsDeviceResized(int x,
                                  int y,
                                  int width,
                                  int height)
Notification that the graphics output device has changed dimensions to the given size. Dimensions are in pixels.

Specified by:
graphicsDeviceResized in interface GraphicsResizeListener
Parameters:
x - The lower left x coordinate for the view
y - The lower left y coordinate for the view
width - The width of the viewport in pixels
height - The height of the viewport in pixels

Aviatrix3D
2.1.0

Latest Info from http://aviatrix3d.j3d.org/
Copyright © 2003 - 2009 j3d.org