org.eclipse.gef.fx.swt.canvas

## Class FXCanvasEx

- java.lang.Object
- - org.eclipse.swt.widgets.Widget
  - - org.eclipse.swt.widgets.Control
    - - org.eclipse.swt.widgets.Scrollable
      - - org.eclipse.swt.widgets.Composite
        - - org.eclipse.swt.widgets.Canvas
          - - javafx.embed.swt.FXCanvas
            - - org.eclipse.gef.fx.swt.canvas.FXCanvasEx

All Implemented Interfaces:
  Drawable

    public class FXCanvasEx
    extends javafx.embed.swt.FXCanvas

A replacement of `FXCanvas` that fixes the following issues:

- JDK-8088147 - [SWT] FXCanvas: implement custom cursors [workaround for JavaSE-1.8 only, as fixed by SWTCursors in JavaSE-1.9]
- JDK-8161282 - FXCanvas does not forward horizontal mouse scroll events to the embedded scene. [workaround for JavaSE-1.8 only, as fixed by FXCanvas in JavaSE-1.9]
- JDK-8143596 - FXCanvas does not forward touch gestures to embedded scene. [workaround for JavaSE-1.8 only, as fixed by FXCanvas in JavaSE-1.9]
- JDK-8159227 - FXCanvas should properly forward consumption state of key events from SWT to embedded scene.
- JDK-8161587 - FXCanvas does not consistently render the scene graph when long running event handlers are used.
- JDK-8088862 - Provide possibility to traverse focus out of FX scene.

### Field Summary

### Fields inherited from class org.eclipse.swt.widgets.Control

`view`

### Constructor Summary

Constructors
Constructor and Description
`FXCanvasEx(Composite parent, int style)` Creates a new `FXCanvasEx` for the given parent and with the given style.

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`void` `addKeyListener(KeyListener listener)`
`void` `addListener(int eventType, Listener listener)`
`void` `addMouseWheelListener(MouseWheelListener listener)`
`static javafx.embed.swt.FXCanvas` `getFXCanvas(javafx.scene.Scene scene)` Returns the `FXCanvas` which contains the given `Scene`.
`javafx.stage.Window` `getStage()` Returns the stage `Window` hold by this `FXCanvas`.
`void` `removeKeyListener(KeyListener listener)`
`void` `removeListener(int eventType, Listener listener)`
`void` `removeMouseWheelListener(MouseWheelListener listener)`
`void` `setScene(javafx.scene.Scene newScene)`

### Methods inherited from class javafx.embed.swt.FXCanvas

`computeSize, getScene`

### Methods inherited from class org.eclipse.swt.widgets.Canvas

`drawBackground, getCaret, getIME, scroll, setCaret, setFont, setIME`

### Methods inherited from class org.eclipse.swt.widgets.Composite

`changed, checkSubclass, drawBackground, getBackgroundMode, getChildren, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, layout, setBackgroundMode, setFocus, setLayout, setLayoutDeferred, setTabList`

### Methods inherited from class org.eclipse.swt.widgets.Scrollable

`computeTrim, getClientArea, getHorizontalBar, getScrollbarsMode, getVerticalBar`

### Methods inherited from class org.eclipse.swt.widgets.Control

`addControlListener, addDragDetectListener, addFocusListener, addGestureListener, addHelpListener, addMenuDetectListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addPaintListener, addTouchListener, addTraverseListener, computeSize, dragDetect, dragDetect, forceFocus, getAccessible, getBackground, getBackgroundImage, getBorderWidth, getBounds, getCursor, getDragDetect, getEnabled, getFont, getForeground, getLayoutData, getLocation, getMenu, getMonitor, getOrientation, getParent, getRegion, getShell, getSize, getTextDirection, getToolTipText, getTouchEnabled, getVisible, internal_dispose_GC, internal_new_GC, isEnabled, isFocusControl, isReparentable, isVisible, moveAbove, moveBelow, pack, pack, print, redraw, redraw, removeControlListener, removeDragDetectListener, removeFocusListener, removeGestureListener, removeHelpListener, removeMenuDetectListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removePaintListener, removeTouchListener, removeTraverseListener, setBackground, setBackgroundImage, setBounds, setBounds, setCapture, setCursor, setDragDetect, setEnabled, setForeground, setLayoutData, setLocation, setLocation, setMenu, setOrientation, setParent, setRedraw, setRegion, setSize, setSize, setTextDirection, setToolTipText, setTouchEnabled, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, traverse, traverse, update`

### Methods inherited from class org.eclipse.swt.widgets.Widget

`addDisposeListener, checkWidget, dispose, getData, getData, getDisplay, getListeners, getStyle, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, reskin, setData, setData, toString`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Constructor Detail

#### FXCanvasEx

    public FXCanvasEx(Composite parent,
                      int style)

Creates a new `FXCanvasEx` for the given parent and with the given style.

Parameters:
  `parent` - The `Composite` to use as parent.
  `style` - A combination of SWT styles to be applied. Note that the `FXCanvas` constructor will set the `SWT.NO_BACKGROUND` style before passing it to the `Canvas` constructor.

### Method Detail

#### getFXCanvas

    public static javafx.embed.swt.FXCanvas getFXCanvas(javafx.scene.Scene scene)

Returns the `FXCanvas` which contains the given `Scene`. Therefore, it is only valid to call this method for a `Scene` which is embedded into an SWT application via `FXCanvas`.

Parameters:
  `scene` - The `Scene` for which to determine the surrounding `FXCanvas`.
Returns:
  The `FXCanvas` which contains the given `Scene`.

#### addKeyListener

    public void addKeyListener(KeyListener listener)

Overrides:
  `addKeyListener` in class `Control`

#### addListener

    public void addListener(int eventType,
                            Listener listener)

Overrides:
  `addListener` in class `Widget`

#### addMouseWheelListener

    public void addMouseWheelListener(MouseWheelListener listener)

Overrides:
  `addMouseWheelListener` in class `Control`

#### getStage

    public javafx.stage.Window getStage()

Returns the stage `Window` hold by this `FXCanvas`.

Returns:
  The stage `Window`.

#### removeKeyListener

    public void removeKeyListener(KeyListener listener)

Overrides:
  `removeKeyListener` in class `Control`

#### removeListener

    public void removeListener(int eventType,
                               Listener listener)

Overrides:
  `removeListener` in class `Widget`

#### removeMouseWheelListener

    public void removeMouseWheelListener(MouseWheelListener listener)

Overrides:
  `removeMouseWheelListener` in class `Control`

#### setScene

    public void setScene(javafx.scene.Scene newScene)

Overrides:
  `setScene` in class `javafx.embed.swt.FXCanvas`