com.sun.j3d.exp.swing
Class JCanvas3D.InternalCanvas3D

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Canvas
          extended by javax.media.j3d.Canvas3D
              extended by com.sun.j3d.exp.swing.JCanvas3D.InternalCanvas3D
All Implemented Interfaces:
AutoOffScreenCanvas3D, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible
Enclosing class:
JCanvas3D

static class JCanvas3D.InternalCanvas3D
extends Canvas3D
implements AutoOffScreenCanvas3D

This class is the internal Canvas3D that is used and sent to Java 3D. It is remote controlled through JCanvas3D and is modified to be able to tell the lightweight component when refreshes are needed.


Nested Class Summary
 
Nested classes/interfaces inherited from class java.awt.Canvas
java.awt.Canvas.AccessibleAWTCanvas
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
(package private)  boolean addNotifyFlag
          flag used to sort a call to addnotify() from user and from the lightweight component.
(package private)  java.awt.image.BufferedImage bi
          the bufferedImage that will be displayed as the result of the computations.
protected  boolean canvasCrashed
          flag indicating that the canvas crashed in a way or an other, making swing to wait for the swap for much too long.
(package private)  boolean imageReadyBis
          flag used to know when image can be painted or not.
(package private)  JCanvas3D lwCanvas
          This is the lightweight canvas that is linked to that offscreen canvas.
private static int MAX_WAIT_LOOPS
           
private static long MAX_WAIT_TIME
           
(package private)  JCanvas3D.ResizeThread resizeThread
          If delayed resizing is selected, a thread handling resising will be started.
(package private)  boolean waitingForSwap
          Flag to indicate that the component is waiting for the canvas to acomplish its swap, and that the component has to be notified when done.
 
Fields inherited from class javax.media.j3d.Canvas3D
FIELD_ALL, FIELD_LEFT, FIELD_RIGHT
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
JCanvas3D.InternalCanvas3D(java.awt.GraphicsConfiguration graphicsConfiguration, JCanvas3D lwCanvas)
          Creates a new instance of JCanvas3D.
 
Method Summary
 void addNotify()
          Canvas3D uses the addNotify callback to track when it is added to a container.
 java.awt.Container getParent()
          Normally, returns the parent of that component.
 void postRender()
          Blocks the retrieval of the render buffer.
 void postSwap()
          Retrieves the buffer from canvas, if possible, and calls/notifies component to be repainted, if necessary.
protected  void processComponentEvent(java.awt.event.ComponentEvent e)
          Overriden so that the JComponent can access it.
protected  void processFocusEvent(java.awt.event.FocusEvent e)
          Overriden so that the JComponent can access it.
protected  void processInputMethodEvent(java.awt.event.InputMethodEvent e)
          Overriden so that the JComponent can access it.
protected  void processKeyEvent(java.awt.event.KeyEvent e)
          Overriden so that the JComponent can access it.
protected  void processMouseEvent(java.awt.event.MouseEvent e)
          Overriden so that the JComponent can access it.
protected  void processMouseMotionEvent(java.awt.event.MouseEvent e)
          Overriden so that the JComponent can access it.
protected  void processMouseWheelEvent(java.awt.event.MouseWheelEvent e)
          Overriden so that the JComponent can access it.
(package private)  void waitForSwap()
          If the Canvas is in a state that forbids the retrieving of the buffer, wait a bit before trying again.
 
Methods inherited from class javax.media.j3d.Canvas3D
getBounds, getBounds, getCenterEyeInImagePlate, getDoubleBufferAvailable, getDoubleBufferEnable, getGraphics2D, getGraphicsContext3D, getHeight, getImagePlateToVworld, getInverseVworldProjection, getLeftEyeInImagePlate, getLeftManualEyeInImagePlate, getLocation, getLocation, getLocationOnScreen, getMonoscopicViewPolicy, getOffScreenBuffer, getOffScreenLocation, getOffScreenLocation, getPhysicalHeight, getPhysicalWidth, getPixelLocationFromImagePlate, getPixelLocationInImagePlate, getPixelLocationInImagePlate, getRightEyeInImagePlate, getRightManualEyeInImagePlate, getSceneAntialiasingAvailable, getScreen3D, getSize, getSize, getStereoAvailable, getStereoEnable, getView, getVworldProjection, getVworldToImagePlate, getWidth, getX, getY, isOffScreen, isRendererRunning, isShadingLanguageSupported, paint, preRender, queryProperties, removeNotify, renderField, renderOffScreenBuffer, setDoubleBufferEnable, setLeftManualEyeInImagePlate, setMonoscopicViewPolicy, setOffScreenBuffer, setOffScreenLocation, setOffScreenLocation, setRightManualEyeInImagePlate, setStereoEnable, startRenderer, stopRenderer, swap, waitForOffScreenRendering
 
Methods inherited from class java.awt.Canvas
createBufferStrategy, createBufferStrategy, getAccessibleContext, getBufferStrategy, update
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, deliverEvent, disable, disableEvents, dispatchEvent, doLayout, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAlignmentX, getAlignmentY, getBackground, getBaseline, getBaselineResizeBehavior, getColorModel, getComponentAt, getComponentAt, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeys, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getListeners, getLocale, getMaximumSize, getMinimumSize, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getPeer, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusCycleRoot, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, paramString, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, processEvent, processHierarchyBoundsEvent, processHierarchyEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFont, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MAX_WAIT_LOOPS

private static final int MAX_WAIT_LOOPS
See Also:
Constant Field Values

MAX_WAIT_TIME

private static final long MAX_WAIT_TIME
See Also:
Constant Field Values

bi

java.awt.image.BufferedImage bi
the bufferedImage that will be displayed as the result of the computations.


lwCanvas

JCanvas3D lwCanvas
This is the lightweight canvas that is linked to that offscreen canvas.


resizeThread

JCanvas3D.ResizeThread resizeThread
If delayed resizing is selected, a thread handling resising will be started.


addNotifyFlag

boolean addNotifyFlag
flag used to sort a call to addnotify() from user and from the lightweight component. Lightweight component calls addNotify() so that the rendering begins and uses normal routines, but this is a method that user must not call.


canvasCrashed

protected boolean canvasCrashed
flag indicating that the canvas crashed in a way or an other, making swing to wait for the swap for much too long.


imageReadyBis

boolean imageReadyBis
flag used to know when image can be painted or not. This is to avoid component potentially displaying a buffer with an unfinished blit. There is already a flag (imageReady) in Canvas3D that does this but it can't be used because of restrictions. This flag is not really fine grained, being set from end of postRender() to end of postSwap()


waitingForSwap

boolean waitingForSwap
Flag to indicate that the component is waiting for the canvas to acomplish its swap, and that the component has to be notified when done.

Constructor Detail

JCanvas3D.InternalCanvas3D

public JCanvas3D.InternalCanvas3D(java.awt.GraphicsConfiguration graphicsConfiguration,
                                  JCanvas3D lwCanvas)
Creates a new instance of JCanvas3D. Resize mode is set to RESIZE_IMMEDIATELY and validation delay to 100ms.

Parameters:
graphicsConfiguration - The graphics configuration to be used.
lwCanvas - the lightweight canvas that is linked to that heavyweight canvas.
Method Detail

addNotify

public void addNotify()
Canvas3D uses the addNotify callback to track when it is added to a container. Subclasses of Canvas3D that override this method need to call super.addNotify() in their addNotify() method for Java 3D to function properly.

Overrides:
addNotify in class Canvas3D

getParent

public java.awt.Container getParent()
Normally, returns the parent of that component. As the canvas ought to never be added to any component, it has no parent. Java 3D expects it to have a parent for some operations, so we in fact cheat it by returning the parent of the lightweight component.

Overrides:
getParent in class java.awt.Component
Returns:
the parent of the lightweight component, if any. Returns null if the component is not created or if it has no parent.

postRender

public void postRender()
Blocks the retrieval of the render buffer.

Overrides:
postRender in class Canvas3D

postSwap

public void postSwap()
Retrieves the buffer from canvas, if possible, and calls/notifies component to be repainted, if necessary.

Overrides:
postSwap in class Canvas3D

processComponentEvent

protected void processComponentEvent(java.awt.event.ComponentEvent e)
Overriden so that the JComponent can access it.

Overrides:
processComponentEvent in class java.awt.Component
Parameters:
e -

processFocusEvent

protected void processFocusEvent(java.awt.event.FocusEvent e)
Overriden so that the JComponent can access it.

Overrides:
processFocusEvent in class java.awt.Component
Parameters:
e -

processInputMethodEvent

protected void processInputMethodEvent(java.awt.event.InputMethodEvent e)
Overriden so that the JComponent can access it.

Overrides:
processInputMethodEvent in class java.awt.Component
Parameters:
e -

processKeyEvent

protected void processKeyEvent(java.awt.event.KeyEvent e)
Overriden so that the JComponent can access it.

Overrides:
processKeyEvent in class java.awt.Component
Parameters:
e -

processMouseEvent

protected void processMouseEvent(java.awt.event.MouseEvent e)
Overriden so that the JComponent can access it.

Overrides:
processMouseEvent in class java.awt.Component
Parameters:
e -

processMouseMotionEvent

protected void processMouseMotionEvent(java.awt.event.MouseEvent e)
Overriden so that the JComponent can access it.

Overrides:
processMouseMotionEvent in class java.awt.Component
Parameters:
e -

processMouseWheelEvent

protected void processMouseWheelEvent(java.awt.event.MouseWheelEvent e)
Overriden so that the JComponent can access it.

Overrides:
processMouseWheelEvent in class java.awt.Component
Parameters:
e -

waitForSwap

void waitForSwap()
If the Canvas is in a state that forbids the retrieving of the buffer, wait a bit before trying again.



Copyright 1996-2008 Sun Microsystems, Inc. All Rights Reserved. Use is subject to license terms.