Skip to main content

Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

GEF/GEF4/FX

< GEF‎ | GEF4
Revision as of 08:36, 12 May 2015 by Unnamed Poltroon (Talk)

Note to non-wiki readers: This documentation is generated from the Eclipse wiki - if you have corrections or additions it would be awesome if you added them in the original wiki page.


Introduction

The GEF4 FX component provides useful additions around JavaFX. It is internally composed out of two modules, namely FX and FX.UI. The FX module provides enhancements for JavaFX, which can also be used independent of the Eclipse UI, e.g. visual anchors, gesture listeners, a connection implementation, or an IGeometry-based shape implementation. The FX.UI component provides enhanced support for integrating JavaFX with SWT and the Eclipse UI.

FX

Anchors

  • package: org.eclipse.gef4.fx.anchors

To manage dynamic positioning of visuals in dependence of one another, the GEF4 FX component provides an anchor mechanism.

* IFXAnchor
* FXStaticAnchor
* FXChopBoxAnchor

In general, an anchor is associated with one anchorage visual and can provide positions for several anchored visuals.

FXChopBoxAnchor

The FXChopBoxAnchor uses reference points to compute the anchor position for the anchored visuals. One reference point is referred to as the anchorage reference point. This point is the same for every anchored. It is computed based on the geometry of the anchorage. In addition, every anchored specifies one reference point. One anchor position is computed for each pair of (anchorage-reference-point, anchored-reference-point). The following paragraphs describe the anchor computation in detail.

FXChopBoxAnchor

Here you can see how a connection is rendered with the FXChopBoxAnchor. The E letter shape is the anchorage visual. The blue point is the anchored visual. The green line is the connection from the anchored to the anchorage. Note that the connection is not drawn inside of the anchorage, but ends on its outline. We will see how this is implemented.

FXChopBoxAnchor

In addition to the previous screenshot, you can see the center point of the anchorage bounds here. When this point is inside of the anchorage, it is used as the anchorage reference point. If it would be used as the anchorage reference point in this case, then the connection would end at that point, i.e. in the middle of nowhere. That's why a better anchorage reference point has to be computed.

FXChopBoxAnchor

In order to find an anchorage reference point that actually is inside of the anchorage, the shape vertices of the anchorage are taken into consideration. You can see that the connection ends at one of those vertices. You may wonder how the vertex to use as the anchorage reference point is determined.

FXChopBoxAnchor

In addition to the vertices, you can see lines connecting the center of the bounds with each vertex. The lines indicate the distance of each vertex to the center. The vertex that is closest to the center is used as the anchorage reference point.

FXChopBoxAnchor

Two of the lines are highlighted and their distance is shown. The anchorage reference point is now determined (orange).

FXChopBoxAnchor

A second anchored reference point is added to demonstrate how the actual anchor position is determined. A line from each anchored reference point to the anchorage reference point is constructed and intersected with the anchorage's outline. The intersection point that is closest to the anchored reference point is used as the anchor position.

Gestures

  • package: org.eclipse.gef4.fx.gestures

Several atomic JavaFX events can form a gesture. The FX component provides a FXMouseDragGesture and a FXPinchSpreadGesture.

Listeners

  • package: org.eclipse.gef4.fx.listeners

The GEF4 FX component provides a VisualChangeListener which can be used to listen to visual changes of a JavaFX Node.

Nodes

  • package: org.eclipse.gef4.fx.nodes
* Adaptation of GEF4 Geometry to JavaFX Node: FXGeometryNode
* Connection abstraction using anchor mechanism: FXConnection

FX.UI

Canvas

  • package: org.eclipse.gef4.fx.ui.canvas

Controls

  • package: org.eclipse.gef4.fx.ui.controls

Gestures

  • package: org.eclipse.gef4.fx.ui.gestures

Back to the top