Package org.eclipse.gef.fx.swt.controls
Class FXControlAdapter<T extends Control>
java.lang.Object
javafx.scene.Node
javafx.scene.Parent
javafx.scene.layout.Region
org.eclipse.gef.fx.swt.controls.FXControlAdapter<T>
- Type Parameters:
T
- The SWT Control class which is wrapped by thisFXControlAdapter
.
- All Implemented Interfaces:
javafx.css.Styleable
,javafx.event.EventTarget
The FXControlAdapter can be used to embed SWT controls into a JavaFX scene
graph.
-
Property Summary
Properties inherited from class javafx.scene.layout.Region
background, border, cacheShape, centerShape, height, insets, maxHeight, maxWidth, minHeight, minWidth, opaqueInsets, padding, prefHeight, prefWidth, scaleShape, shape, snapToPixel, width
Properties inherited from class javafx.scene.Parent
needsLayout
Properties inherited from class javafx.scene.Node
accessibleHelp, accessibleRoleDescription, accessibleRole, accessibleText, blendMode, boundsInLocal, boundsInParent, cacheHint, cache, clip, cursor, depthTest, disabled, disable, effectiveNodeOrientation, effect, eventDispatcher, focused, focusTraversable, hover, id, inputMethodRequests, layoutBounds, layoutX, layoutY, localToParentTransform, localToSceneTransform, managed, mouseTransparent, nodeOrientation, onContextMenuRequested, onDragDetected, onDragDone, onDragDropped, onDragEntered, onDragExited, onDragOver, onInputMethodTextChanged, onKeyPressed, onKeyReleased, onKeyTyped, onMouseClicked, onMouseDragEntered, onMouseDragExited, onMouseDragged, onMouseDragOver, onMouseDragReleased, onMouseEntered, onMouseExited, onMouseMoved, onMousePressed, onMouseReleased, onRotate, onRotationFinished, onRotationStarted, onScrollFinished, onScroll, onScrollStarted, onSwipeDown, onSwipeLeft, onSwipeRight, onSwipeUp, onTouchMoved, onTouchPressed, onTouchReleased, onTouchStationary, onZoomFinished, onZoom, onZoomStarted, opacity, parent, pickOnBounds, pressed, rotate, rotationAxis, scaleX, scaleY, scaleZ, scene, style, translateX, translateY, translateZ, viewOrder, visible
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
FXControlAdapter.IControlFactory<T extends Control>
TheFXControlAdapter.IControlFactory
can be used in conjunction withFXControlAdapter
to create the wrapped SWTControl
when the surroundingFXCanvas
changes. -
Field Summary
Fields inherited from class javafx.scene.layout.Region
USE_COMPUTED_SIZE, USE_PREF_SIZE
Fields inherited from class javafx.scene.Node
BASELINE_OFFSET_SAME_AS_HEIGHT
-
Constructor Summary
ConstructorDescriptionFXControlAdapter
(FXControlAdapter.IControlFactory<T> controlFactory) Creates a newFXControlAdapter
which uses the givenFXControlAdapter.IControlFactory
for the creation of the SWTControl
.FXControlAdapter
(T control) Creates a newFXControlAdapter
which wraps the given SWTControl
. -
Method Summary
Modifier and TypeMethodDescriptionprotected double
computeMaxHeight
(double width) protected double
computeMaxWidth
(double height) protected double
computeMinHeight
(double width) protected double
computeMinWidth
(double height) protected double
computePrefHeight
(double width) protected double
computePrefWidth
(double height) void
dispose()
Deactivates thisFXControlAdapter
, so that the SWTControl
will not be re-created when theFXCanvas
changes.protected javafx.collections.ObservableList<javafx.scene.Node>
We do not manage children.Returns the SWTControl
that is wrapped by thisFXControlAdapter
.protected javafx.embed.swt.FXCanvas
getFXCanvas
(javafx.scene.Node node) Returns theFXCanvas
which embeds theScene
which contains the givenNode
.protected javafx.embed.swt.FXCanvas
getFXCanvas
(Control control) Returns the firstFXCanvas
which is found by walking up the widget hierarchy of the givenControl
.protected void
hookControl
(T control) Hooks the givenControl
into the JavaFX scene graph, for example, registering event forwarding from SWT to JavaFX.protected void
init()
Initializes thisFXControlAdapter
.protected void
Registers JavaFX listeners for forwarding JavaFX state to SWT.protected void
registerSwtToFXEventForwarders
(javafx.embed.swt.FXCanvas newCanvas) Registers SWT to JavaFX event forwarders for the givenFXCanvas
.void
relocate
(double paramDouble1, double paramDouble2) void
resize
(double width, double height) protected void
setCanvas
(javafx.embed.swt.FXCanvas newCanvas) Changes theFXCanvas
in which theControl
is hooked.protected void
setControl
(T control) Sets theControl
of thisFXControlAdapter
to the given value andhooks
orunhooks
theControl
, respectively.protected void
unhookControl
(T control) Unhooks the givenControl
from the JavaFX scene graph, for example, unregistering event forwarding from SWT to JavaFX.protected void
Unregisters the listeners which have previously been registered duringregisterListeners()
.protected void
Unregisters the event forwarders which have previously been registered duringregisterSwtToFXEventForwarders(FXCanvas)
.void
Methods inherited from class javafx.scene.layout.Region
backgroundProperty, borderProperty, cacheShapeProperty, centerShapeProperty, getBackground, getBorder, getClassCssMetaData, getCssMetaData, getHeight, getInsets, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getOpaqueInsets, getPadding, getPrefHeight, getPrefWidth, getShape, getUserAgentStylesheet, getWidth, heightProperty, insetsProperty, isCacheShape, isCenterShape, isResizable, isScaleShape, isSnapToPixel, layoutInArea, layoutInArea, layoutInArea, layoutInArea, maxHeight, maxHeightProperty, maxWidth, maxWidthProperty, minHeight, minHeightProperty, minWidth, minWidthProperty, opaqueInsetsProperty, paddingProperty, positionInArea, positionInArea, prefHeight, prefHeightProperty, prefWidth, prefWidthProperty, scaleShapeProperty, setBackground, setBorder, setCacheShape, setCenterShape, setHeight, setMaxHeight, setMaxSize, setMaxWidth, setMinHeight, setMinSize, setMinWidth, setOpaqueInsets, setPadding, setPrefHeight, setPrefSize, setPrefWidth, setScaleShape, setShape, setSnapToPixel, setWidth, shapeProperty, snappedBottomInset, snappedLeftInset, snappedRightInset, snappedTopInset, snapPosition, snapPositionX, snapPositionY, snapSize, snapSizeX, snapSizeY, snapSpace, snapSpaceX, snapSpaceY, snapToPixelProperty, widthProperty
Methods inherited from class javafx.scene.Parent
getBaselineOffset, getChildrenUnmodifiable, getManagedChildren, getStylesheets, isNeedsLayout, layout, layoutChildren, lookup, needsLayoutProperty, queryAccessibleAttribute, requestLayout, requestParentLayout, setNeedsLayout, updateBounds
Methods inherited from class javafx.scene.Node
accessibleHelpProperty, accessibleRoleDescriptionProperty, accessibleRoleProperty, accessibleTextProperty, addEventFilter, addEventHandler, applyCss, autosize, blendModeProperty, boundsInLocalProperty, boundsInParentProperty, buildEventDispatchChain, cacheHintProperty, cacheProperty, clipProperty, computeAreaInScreen, contains, contains, cursorProperty, depthTestProperty, disabledProperty, disableProperty, effectiveNodeOrientationProperty, effectProperty, eventDispatcherProperty, executeAccessibleAction, fireEvent, focusedProperty, focusTraversableProperty, getAccessibleHelp, getAccessibleRole, getAccessibleRoleDescription, getAccessibleText, getBlendMode, getBoundsInLocal, getBoundsInParent, getCacheHint, getClip, getContentBias, getCursor, getDepthTest, getEffect, getEffectiveNodeOrientation, getEventDispatcher, getId, getInitialCursor, getInitialFocusTraversable, getInputMethodRequests, getLayoutBounds, getLayoutX, getLayoutY, getLocalToParentTransform, getLocalToSceneTransform, getNodeOrientation, getOnContextMenuRequested, getOnDragDetected, getOnDragDone, getOnDragDropped, getOnDragEntered, getOnDragExited, getOnDragOver, getOnInputMethodTextChanged, getOnKeyPressed, getOnKeyReleased, getOnKeyTyped, getOnMouseClicked, getOnMouseDragEntered, getOnMouseDragExited, getOnMouseDragged, getOnMouseDragOver, getOnMouseDragReleased, getOnMouseEntered, getOnMouseExited, getOnMouseMoved, getOnMousePressed, getOnMouseReleased, getOnRotate, getOnRotationFinished, getOnRotationStarted, getOnScroll, getOnScrollFinished, getOnScrollStarted, getOnSwipeDown, getOnSwipeLeft, getOnSwipeRight, getOnSwipeUp, getOnTouchMoved, getOnTouchPressed, getOnTouchReleased, getOnTouchStationary, getOnZoom, getOnZoomFinished, getOnZoomStarted, getOpacity, getParent, getProperties, getPseudoClassStates, getRotate, getRotationAxis, getScaleX, getScaleY, getScaleZ, getScene, getStyle, getStyleableParent, getStyleClass, getTransforms, getTranslateX, getTranslateY, getTranslateZ, getTypeSelector, getUserData, getViewOrder, hasProperties, hoverProperty, idProperty, inputMethodRequestsProperty, intersects, intersects, isCache, isDisable, isDisabled, isFocused, isFocusTraversable, isHover, isManaged, isMouseTransparent, isPickOnBounds, isPressed, isVisible, layoutBoundsProperty, layoutXProperty, layoutYProperty, localToParent, localToParent, localToParent, localToParent, localToParent, localToParentTransformProperty, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToSceneTransformProperty, localToScreen, localToScreen, localToScreen, localToScreen, localToScreen, lookupAll, managedProperty, mouseTransparentProperty, nodeOrientationProperty, notifyAccessibleAttributeChanged, onContextMenuRequestedProperty, onDragDetectedProperty, onDragDoneProperty, onDragDroppedProperty, onDragEnteredProperty, onDragExitedProperty, onDragOverProperty, onInputMethodTextChangedProperty, onKeyPressedProperty, onKeyReleasedProperty, onKeyTypedProperty, onMouseClickedProperty, onMouseDragEnteredProperty, onMouseDragExitedProperty, onMouseDraggedProperty, onMouseDragOverProperty, onMouseDragReleasedProperty, onMouseEnteredProperty, onMouseExitedProperty, onMouseMovedProperty, onMousePressedProperty, onMouseReleasedProperty, onRotateProperty, onRotationFinishedProperty, onRotationStartedProperty, onScrollFinishedProperty, onScrollProperty, onScrollStartedProperty, onSwipeDownProperty, onSwipeLeftProperty, onSwipeRightProperty, onSwipeUpProperty, onTouchMovedProperty, onTouchPressedProperty, onTouchReleasedProperty, onTouchStationaryProperty, onZoomFinishedProperty, onZoomProperty, onZoomStartedProperty, opacityProperty, parentProperty, parentToLocal, parentToLocal, parentToLocal, parentToLocal, parentToLocal, pickOnBoundsProperty, pressedProperty, pseudoClassStateChanged, removeEventFilter, removeEventHandler, requestFocus, resizeRelocate, rotateProperty, rotationAxisProperty, scaleXProperty, scaleYProperty, scaleZProperty, sceneProperty, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, screenToLocal, screenToLocal, screenToLocal, setAccessibleHelp, setAccessibleRole, setAccessibleRoleDescription, setAccessibleText, setBlendMode, setCache, setCacheHint, setClip, setCursor, setDepthTest, setDisable, setDisabled, setEffect, setEventDispatcher, setEventHandler, setFocused, setFocusTraversable, setHover, setId, setInputMethodRequests, setLayoutX, setLayoutY, setManaged, setMouseTransparent, setNodeOrientation, setOnContextMenuRequested, setOnDragDetected, setOnDragDone, setOnDragDropped, setOnDragEntered, setOnDragExited, setOnDragOver, setOnInputMethodTextChanged, setOnKeyPressed, setOnKeyReleased, setOnKeyTyped, setOnMouseClicked, setOnMouseDragEntered, setOnMouseDragExited, setOnMouseDragged, setOnMouseDragOver, setOnMouseDragReleased, setOnMouseEntered, setOnMouseExited, setOnMouseMoved, setOnMousePressed, setOnMouseReleased, setOnRotate, setOnRotationFinished, setOnRotationStarted, setOnScroll, setOnScrollFinished, setOnScrollStarted, setOnSwipeDown, setOnSwipeLeft, setOnSwipeRight, setOnSwipeUp, setOnTouchMoved, setOnTouchPressed, setOnTouchReleased, setOnTouchStationary, setOnZoom, setOnZoomFinished, setOnZoomStarted, setOpacity, setPickOnBounds, setPressed, setRotate, setRotationAxis, setScaleX, setScaleY, setScaleZ, setStyle, setTranslateX, setTranslateY, setTranslateZ, setUserData, setViewOrder, setVisible, snapshot, snapshot, startDragAndDrop, startFullDrag, styleProperty, toBack, toFront, toString, translateXProperty, translateYProperty, translateZProperty, usesMirroring, viewOrderProperty, visibleProperty
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface javafx.css.Styleable
getStyleableNode
-
Constructor Details
-
FXControlAdapter
Creates a newFXControlAdapter
which uses the givenFXControlAdapter.IControlFactory
for the creation of the SWTControl
.- Parameters:
controlFactory
- TheFXControlAdapter.IControlFactory
to use to create the SWTControl
.
-
FXControlAdapter
Creates a newFXControlAdapter
which wraps the given SWTControl
.- Parameters:
control
- The SWTControl
to wrap in thisFXControlAdapter
.
-
-
Method Details
-
computeMaxHeight
protected double computeMaxHeight(double width) - Overrides:
computeMaxHeight
in classjavafx.scene.layout.Region
-
computeMaxWidth
protected double computeMaxWidth(double height) - Overrides:
computeMaxWidth
in classjavafx.scene.layout.Region
-
computeMinHeight
protected double computeMinHeight(double width) - Overrides:
computeMinHeight
in classjavafx.scene.layout.Region
-
computeMinWidth
protected double computeMinWidth(double height) - Overrides:
computeMinWidth
in classjavafx.scene.layout.Region
-
computePrefHeight
protected double computePrefHeight(double width) - Overrides:
computePrefHeight
in classjavafx.scene.layout.Region
-
computePrefWidth
protected double computePrefWidth(double height) - Overrides:
computePrefWidth
in classjavafx.scene.layout.Region
-
dispose
public void dispose()Deactivates thisFXControlAdapter
, so that the SWTControl
will not be re-created when theFXCanvas
changes. -
getChildren
protected javafx.collections.ObservableList<javafx.scene.Node> getChildren()We do not manage children. Therefore, it is illegal to alter the children list in any way.- Overrides:
getChildren
in classjavafx.scene.Parent
-
getControl
Returns the SWTControl
that is wrapped by thisFXControlAdapter
.- Returns:
- The SWT
Control
that is wrapped by thisFXControlAdapter
.
-
getFXCanvas
Returns the firstFXCanvas
which is found by walking up the widget hierarchy of the givenControl
. If noFXCanvas
can be found,null
is returned. -
getFXCanvas
protected javafx.embed.swt.FXCanvas getFXCanvas(javafx.scene.Node node) Returns theFXCanvas
which embeds theScene
which contains the givenNode
.- Parameters:
node
- TheNode
for which the embeddingFXCanvas
is determined.- Returns:
- The
FXCanvas
which embeds theScene
which contains the givenNode
.
-
hookControl
Hooks the givenControl
into the JavaFX scene graph, for example, registering event forwarding from SWT to JavaFX.- Parameters:
control
- TheControl
which is wrapped by thisFXControlAdapter
.- See Also:
-
init
protected void init()Initializes thisFXControlAdapter
. Per default, thisFXControlAdapter
is added to the focus traversal cycle and JavaFX listeners are registered for forwarding JavaFX state to SWT.- See Also:
-
registerListeners
protected void registerListeners()Registers JavaFX listeners for forwarding JavaFX state to SWT. Among other things, this registers a listener forScene
changes which will then hook the SWTControl
to theFXCanvas
of the newScene
.- See Also:
-
registerSwtToFXEventForwarders
protected void registerSwtToFXEventForwarders(javafx.embed.swt.FXCanvas newCanvas) Registers SWT to JavaFX event forwarders for the givenFXCanvas
.- Parameters:
newCanvas
- TheFXCanvas
for which event forwarding is registered.- See Also:
-
relocate
public void relocate(double paramDouble1, double paramDouble2) - Overrides:
relocate
in classjavafx.scene.Node
-
resize
public void resize(double width, double height) - Overrides:
resize
in classjavafx.scene.layout.Region
-
setCanvas
protected void setCanvas(javafx.embed.swt.FXCanvas newCanvas) Changes theFXCanvas
in which theControl
is hooked. AnFXControlAdapter.IControlFactory
has to be available for re-creating theControl
within the newFXCanvas
, otherwise an exception is thrown.- Parameters:
newCanvas
- The newFXCanvas
for theControl
.- Throws:
IllegalArgumentException
- when theFXCanvas
is changed, but noFXControlAdapter.IControlFactory
is available.- See Also:
-
setControl
Sets theControl
of thisFXControlAdapter
to the given value andhooks
orunhooks
theControl
, respectively.- Parameters:
control
- The newControl
for thisFXControlAdapter
.- See Also:
-
unhookControl
Unhooks the givenControl
from the JavaFX scene graph, for example, unregistering event forwarding from SWT to JavaFX.- Parameters:
control
- TheControl
which is wrapped by thisFXControlAdapter
.- See Also:
-
unregisterListeners
protected void unregisterListeners()Unregisters the listeners which have previously been registered duringregisterListeners()
. -
unregisterSwtToFXEventForwarders
protected void unregisterSwtToFXEventForwarders()Unregisters the event forwarders which have previously been registered duringregisterSwtToFXEventForwarders(FXCanvas)
. -
updateSwtBounds
public void updateSwtBounds()Updates thebounds
of theControl
which is wrapped by thisFXControlAdapter
. This method is automatically called when thisFXControlAdapter
isrelocated
orresized
.
-