Deutsch

EventObserver

x3d
Interface EventObserver


public abstract interface EventObserver

Interface that must be implemented by applications that are registered for browser or field events

A x3d browser will use the interface to notify an observer whenever one of the defined events occurs.

 

Version:
1.0
Author:
Holger Grahn, Kristof Nast-Kolb, Bitmanagement Software

Field Summary
static int ANCHOR_CLICKED
          an anchor has been clicked
static int END_RENDERING
           
static int FIELD_CHANGED
          a field or eventOut has changed.
static int INITIALIZED
          The browser has completed the initial loading of the world.
static int LAST_IDENTIFIER
          The number of reserved identifier numbers for event conditions.
static int SHUTDOWN
          The currently loaded world is about to be unloaded.
static int START_RENDERING
           
static int URL_ERROR
          An error occurred in loading X3D from a URL call, because of a parsing / file format error, connection error or other failure
static int URL_LOADED
          a URL was loaded successfully.

 

Method Summary
 boolean onEvent(java.awt.Event event)
          This method is called from the X3D browser whenever an AWT event happens, see Component.handleEvent.
 boolean onEvent(int type, java.lang.Object object, java.lang.Object userData)
          This method is called from the X3D browser whenever one of the X3D or browser events happens.

 

Field Detail

INITIALIZED

public static final int INITIALIZED
The browser has completed the initial loading of the world. Event is generated just after the scene has been loaded and just before the first event has been sent

SHUTDOWN

public static final int SHUTDOWN
The currently loaded world is about to be unloaded. Called just before the scene is about to be unloaded. If another world is to replace this, then an initialize event will be generated following this one.

URL_ERROR

public static final int URL_ERROR
An error occurred in loading X3D from a URL call, because of a parsing / file format error, connection error or other failure

URL_LOADED

public static final int URL_LOADED
a URL was loaded successfully. field is the children field of the group node containing the loaded nodes.

FIELD_CHANGED

public static final int FIELD_CHANGED
a field or eventOut has changed. the

ANCHOR_CLICKED

public static final int ANCHOR_CLICKED
an anchor has been clicked

START_RENDERING

public static final int START_RENDERING

END_RENDERING

public static final int END_RENDERING

LAST_IDENTIFIER

public static final int LAST_IDENTIFIER
The number of reserved identifier numbers for event conditions. Any values above this are browser specific messages.

Method Detail

onEvent

public boolean onEvent(int type,
                       java.lang.Object object,
                       java.lang.Object userData)
This method is called from the X3D browser whenever one of the X3D or browser events happens.

The observer should not block the browser and must be implemented in a way that avoids dead locks with browser that use multithreading and synchronization.

Parameters:
type - The type of the event
object - The object that is associated with the event, Field or Node. object might be null for certain events, e.g. SHUTDOWN.
userdata - The userdata that was specified when registering for the event.
Returns:
true means that the event is handled and might cause the X3D browser to ignore the event, e.g. ANCHOR_CLICKED

onEvent

public boolean onEvent(java.awt.Event event)
This method is called from the X3D browser whenever an AWT event happens, see Component.handleEvent.

The observer should not block the browser and must be implemented in a way that avoids dead locks with browser that use multithreading and synchronization.

Parameters:
event - The awt event
Returns:
true if the event has been handled and no further action is necessary; false if the event is to be given to the browser