Xj3D 2.0 VRML/X3D Code API

org.xj3d.ui.swt.browser.ogl
Class BrowserComposite

java.lang.Object
  extended by org.eclipse.swt.widgets.Widget
      extended by org.eclipse.swt.widgets.Control
          extended by org.eclipse.swt.widgets.Scrollable
              extended by org.eclipse.swt.widgets.Composite
                  extended by org.xj3d.ui.swt.browser.ogl.BrowserComposite
All Implemented Interfaces:
java.util.EventListener, org.eclipse.swt.events.DisposeListener, org.eclipse.swt.events.KeyListener, org.eclipse.swt.events.ShellListener, org.eclipse.swt.graphics.Drawable, org.eclipse.swt.internal.SWTEventListener, org.eclipse.ui.IPartListener2, BrowserComponent, BrowserCoreListener
Direct Known Subclasses:
X3DBrowserComposite

public abstract class BrowserComposite
extends org.eclipse.swt.widgets.Composite
implements BrowserComponent, BrowserCoreListener, org.eclipse.swt.events.ShellListener, org.eclipse.swt.events.DisposeListener, org.eclipse.swt.events.KeyListener, org.eclipse.ui.IPartListener2

Common SWT implementation of the browser component for use in either SAI or EAI, that wraps the functionality of an X3D browser into a convenient, easy to use form.

This base class needs to be extended to provide the SAI or EAI-specific implementation interfaces, as well as any startup required for either of those environments, such as scripting engines etc.

Version:
$Revision: 1.25 $
Author:
Rex Melton

Field Summary
protected  OGLStandardBrowserCore browserCore
          The internal browser core
protected  CursorManager cursorManager
          The manager of cursors
protected  LocationToolbar locToolbar
          The toolbar holding location information
protected  OGLBrowserCanvas mainCanvas
          The canvas used to display the world
protected  MessageBuffer messageBuffer
          Area to push error messages to
protected  NavigationToolbar navToolbar
          The toolbar holding navigation information
protected  StatusBar statusBar
          The status bar
 
Fields inherited from class org.eclipse.swt.widgets.Control
handle
 
Constructor Summary
protected BrowserComposite(org.eclipse.swt.widgets.Composite parentComposite, org.eclipse.ui.part.ViewPart viewPart, BrowserConfig parameters)
          Create an instance of a Composite configured per the arguments.
 
Method Summary
 void browserDisposed()
          The browser has been disposed by the user calling the dispose method on the ExternalBrowser instance.
 void browserInitialized(VRMLScene scene)
          Ignored.
 void browserShutdown()
          Ignored.
 void destroy()
          Called to instruct the component instance to destroy itself and any used resources.
 BrowserCore getBrowserCore()
          Get the core browser implementation.
 java.lang.Object getCanvas()
          Get the SWT component holding this browser.
 boolean getElumensMode()
          Is Elumens mode enabled?
 ErrorReporter getErrorReporter()
          Fetch the error handler so that application code can post messages too.
 int getRendererType()
          Get the renderer type.
 void keyPressed(org.eclipse.swt.events.KeyEvent ke)
          Notification that a key is pressed.
 void keyReleased(org.eclipse.swt.events.KeyEvent ke)
          Notification that a key is released.
 void partActivated(org.eclipse.ui.IWorkbenchPartReference partRef)
          Ignored.
 void partBroughtToTop(org.eclipse.ui.IWorkbenchPartReference partRef)
          Ignored.
 void partClosed(org.eclipse.ui.IWorkbenchPartReference partRef)
          Ignored.
 void partDeactivated(org.eclipse.ui.IWorkbenchPartReference partRef)
          Ignored.
 void partHidden(org.eclipse.ui.IWorkbenchPartReference partRef)
          Notification that the referenced part was hidden.
 void partInputChanged(org.eclipse.ui.IWorkbenchPartReference partRef)
          Ignored.
 void partOpened(org.eclipse.ui.IWorkbenchPartReference partRef)
          Ignored.
 void partVisible(org.eclipse.ui.IWorkbenchPartReference partRef)
          Notification that the referenced part was made visible.
 void setElumensMode(boolean enabled)
          Enable elumens mode.
 void setLayout(org.eclipse.swt.widgets.Layout layout)
          Do nothing, we do our own layout
 void setMinimumFrameInterval(int millis, boolean userSet)
          Set the minimum frame interval time to limit the CPU resources taken up by the 3D renderer.
 void shellActivated(org.eclipse.swt.events.ShellEvent evt)
          Ignored.
 void shellClosed(org.eclipse.swt.events.ShellEvent evt)
          Ignored.
 void shellDeactivated(org.eclipse.swt.events.ShellEvent evt)
          Ignored.
 void shellDeiconified(org.eclipse.swt.events.ShellEvent evt)
          The shell has changed from a minimized to a normal state.
 void shellIconified(org.eclipse.swt.events.ShellEvent evt)
          The shell has changed from a normal state to minimized.
 void start()
          Called to instruct the component instance to start rendering now.
 void stop()
          Called to instruct the component instance to stop and suspend its state.
 int supportedSpecificationVersion()
          Get the spec version that is supported.
 void urlLoadFailed(java.lang.String msg)
          Ignored.
 void widgetDisposed(org.eclipse.swt.events.DisposeEvent evt)
          Notification we're being disposed of.
 
Methods inherited from class org.eclipse.swt.widgets.Composite
changed, checkSubclass, computeSize, getBackgroundMode, getChildren, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, setBackgroundMode, setFocus, setLayoutDeferred, setTabList
 
Methods inherited from class org.eclipse.swt.widgets.Scrollable
computeTrim, getClientArea, getHorizontalBar, getVerticalBar
 
Methods inherited from class org.eclipse.swt.widgets.Control
addControlListener, addFocusListener, addHelpListener, addKeyListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addPaintListener, addTraverseListener, computeSize, forceFocus, getAccessible, getBackground, getBackgroundImage, getBorderWidth, getBounds, getEnabled, getFont, getForeground, getLayoutData, getLocation, getMenu, getMonitor, getParent, getShell, getSize, getToolTipText, getVisible, internal_dispose_GC, internal_new_GC, isEnabled, isFocusControl, isReparentable, isVisible, moveAbove, moveBelow, pack, pack, redraw, redraw, removeControlListener, removeFocusListener, removeHelpListener, removeKeyListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removePaintListener, removeTraverseListener, setBackground, setBackgroundImage, setBounds, setBounds, setCapture, setCursor, setEnabled, setFont, setForeground, setLayoutData, setLocation, setLocation, setMenu, setParent, setRedraw, setSize, setSize, setToolTipText, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, update
 
Methods inherited from class org.eclipse.swt.widgets.Widget
addDisposeListener, addListener, checkWidget, dispose, getData, getData, getDisplay, getStyle, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, setData, setData, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

cursorManager

protected CursorManager cursorManager
The manager of cursors


navToolbar

protected NavigationToolbar navToolbar
The toolbar holding navigation information


locToolbar

protected LocationToolbar locToolbar
The toolbar holding location information


statusBar

protected StatusBar statusBar
The status bar


messageBuffer

protected MessageBuffer messageBuffer
Area to push error messages to


mainCanvas

protected OGLBrowserCanvas mainCanvas
The canvas used to display the world


browserCore

protected OGLStandardBrowserCore browserCore
The internal browser core

Constructor Detail

BrowserComposite

protected BrowserComposite(org.eclipse.swt.widgets.Composite parentComposite,
                           org.eclipse.ui.part.ViewPart viewPart,
                           BrowserConfig parameters)
Create an instance of a Composite configured per the arguments.

Parameters:
parentComposite - the SWT Composite widget that this will be added to
viewPart - The Eclipse ViewPart that this browser is associated with. May be null if the browser is running standalone in SWT.
parameters - The object containing the browser's configuration parameters
Method Detail

setLayout

public void setLayout(org.eclipse.swt.widgets.Layout layout)
Do nothing, we do our own layout

Overrides:
setLayout in class org.eclipse.swt.widgets.Composite

keyPressed

public void keyPressed(org.eclipse.swt.events.KeyEvent ke)
Notification that a key is pressed. Ignored

Specified by:
keyPressed in interface org.eclipse.swt.events.KeyListener
Parameters:
ke - The event that caused this method to be called

keyReleased

public void keyReleased(org.eclipse.swt.events.KeyEvent ke)
Notification that a key is released.

Specified by:
keyReleased in interface org.eclipse.swt.events.KeyListener
Parameters:
ke - The event that caused this method to be called

shellActivated

public void shellActivated(org.eclipse.swt.events.ShellEvent evt)
Ignored. The shell has been given focus.

Specified by:
shellActivated in interface org.eclipse.swt.events.ShellListener
Parameters:
evt - The shell event that caused the method to be called.

shellClosed

public void shellClosed(org.eclipse.swt.events.ShellEvent evt)
Ignored. The shell is being closed.

Specified by:
shellClosed in interface org.eclipse.swt.events.ShellListener
Parameters:
evt - The shell event that caused the method to be called.

shellDeactivated

public void shellDeactivated(org.eclipse.swt.events.ShellEvent evt)
Ignored. The shell has lost focus.

Specified by:
shellDeactivated in interface org.eclipse.swt.events.ShellListener
Parameters:
evt - The shell event that caused the method to be called.

shellDeiconified

public void shellDeiconified(org.eclipse.swt.events.ShellEvent evt)
The shell has changed from a minimized to a normal state. Restore the browser frame rate to normal if it is visible.

Specified by:
shellDeiconified in interface org.eclipse.swt.events.ShellListener
Parameters:
evt - The shell event that caused the method to be called.

shellIconified

public void shellIconified(org.eclipse.swt.events.ShellEvent evt)
The shell has changed from a normal state to minimized. Throttle back the browser frame rate.

Specified by:
shellIconified in interface org.eclipse.swt.events.ShellListener
Parameters:
evt - The window event that caused the method to be called.

widgetDisposed

public void widgetDisposed(org.eclipse.swt.events.DisposeEvent evt)
Notification we're being disposed of. Notify the browser's Canvas to clean up in anticipation of it's dispose method being called through the normal swt chain of destruction. Notify the ImageLoader and CursorManager to dispose of their graphics resources.

Specified by:
widgetDisposed in interface org.eclipse.swt.events.DisposeListener

supportedSpecificationVersion

public int supportedSpecificationVersion()
Get the spec version that is supported.

Specified by:
supportedSpecificationVersion in interface BrowserComponent
Returns:
a number representing the spec major version

getCanvas

public java.lang.Object getCanvas()
Get the SWT component holding this browser.

Specified by:
getCanvas in interface BrowserComponent
Returns:
The component

getRendererType

public int getRendererType()
Get the renderer type.

Specified by:
getRendererType in interface BrowserComponent
Returns:
The BrowserCore type

getBrowserCore

public BrowserCore getBrowserCore()
Get the core browser implementation.

Specified by:
getBrowserCore in interface BrowserComponent
Returns:
the BrowserCore

getErrorReporter

public ErrorReporter getErrorReporter()
Fetch the error handler so that application code can post messages too.

Specified by:
getErrorReporter in interface BrowserComponent
Returns:
The current error handler instance

setMinimumFrameInterval

public void setMinimumFrameInterval(int millis,
                                    boolean userSet)
Set the minimum frame interval time to limit the CPU resources taken up by the 3D renderer. By default it will use all of them. The second parameter is used to control whether this is a user-set hard minimum or something set by the browser internals. User set values are always treated as the minimum unless the browser internals set a value that is a slower framerate than the user set. If the browser then sets a faster framerate than the user set value, the user value is used instead.

Specified by:
setMinimumFrameInterval in interface BrowserComponent
Parameters:
millis - The minimum time in milleseconds.
userSet - true if this is an end-user set minimum

start

public void start()
Called to instruct the component instance to start rendering now.

Specified by:
start in interface BrowserComponent

stop

public void stop()
Called to instruct the component instance to stop and suspend its state. The renderer should stop at this point.

Specified by:
stop in interface BrowserComponent

destroy

public void destroy()
Called to instruct the component instance to destroy itself and any used resources. It will not be used again.

Specified by:
destroy in interface BrowserComponent

browserShutdown

public void browserShutdown()
Ignored. Notification that the browser is shutting down the current content.

Specified by:
browserShutdown in interface BrowserCoreListener

browserDisposed

public void browserDisposed()
The browser has been disposed by the user calling the dispose method on the ExternalBrowser instance. Release our reference to the browser core so that when this control is disposed, we don't bother with releasing browser resources.

Specified by:
browserDisposed in interface BrowserCoreListener

urlLoadFailed

public void urlLoadFailed(java.lang.String msg)
Ignored. The browser tried to load a URL and failed.

Specified by:
urlLoadFailed in interface BrowserCoreListener
Parameters:
msg - An error message to go with the failure

browserInitialized

public void browserInitialized(VRMLScene scene)
Ignored. Notification that a world has been loaded into the browser.

Specified by:
browserInitialized in interface BrowserCoreListener
Parameters:
scene - The new scene that has been loaded

partActivated

public void partActivated(org.eclipse.ui.IWorkbenchPartReference partRef)
Ignored. Notification that the referenced part has been activated.

Specified by:
partActivated in interface org.eclipse.ui.IPartListener2
Parameters:
partRef - Reference object for the part that was activated.

partBroughtToTop

public void partBroughtToTop(org.eclipse.ui.IWorkbenchPartReference partRef)
Ignored. Notification that the referenced part was brought to the top.

Specified by:
partBroughtToTop in interface org.eclipse.ui.IPartListener2
Parameters:
partRef - Reference object for the part that was brought to the top.

partClosed

public void partClosed(org.eclipse.ui.IWorkbenchPartReference partRef)
Ignored. Notification that the referenced part was closed.

Specified by:
partClosed in interface org.eclipse.ui.IPartListener2
Parameters:
partRef - Reference object for the part that was closed.

partDeactivated

public void partDeactivated(org.eclipse.ui.IWorkbenchPartReference partRef)
Ignored. Notification that the referenced part was deactivated.

Specified by:
partDeactivated in interface org.eclipse.ui.IPartListener2
Parameters:
partRef - Reference object for the part that was deactivated.

partHidden

public void partHidden(org.eclipse.ui.IWorkbenchPartReference partRef)
Notification that the referenced part was hidden. Used to throttle CPU usage while the browser is not visible on screen.

Specified by:
partHidden in interface org.eclipse.ui.IPartListener2
Parameters:
partRef - Reference object for the part that was hidden.

partInputChanged

public void partInputChanged(org.eclipse.ui.IWorkbenchPartReference partRef)
Ignored. Notification that the referenced part was hidden.

Specified by:
partInputChanged in interface org.eclipse.ui.IPartListener2
Parameters:
partRef - Reference object for the part that was hidden.

partOpened

public void partOpened(org.eclipse.ui.IWorkbenchPartReference partRef)
Ignored. Notification that the referenced part was hidden.

Specified by:
partOpened in interface org.eclipse.ui.IPartListener2
Parameters:
partRef - Reference object for the part that was hidden.

partVisible

public void partVisible(org.eclipse.ui.IWorkbenchPartReference partRef)
Notification that the referenced part was made visible. Used to establish rendering and event model CPU related parameters.

Specified by:
partVisible in interface org.eclipse.ui.IPartListener2
Parameters:
partRef - Reference object for the part that was made visible.

setElumensMode

public void setElumensMode(boolean enabled)
Enable elumens mode.

Parameters:
enabled - Whether the mode is enabled.

getElumensMode

public boolean getElumensMode()
Is Elumens mode enabled?

Returns:
Whether the mode is enabled.

Xj3D 2.0 VRML/X3D Code API

Copyright © 2001 - 2006 Web3D Consortium