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

Difference between revisions of "GEF/GEF4/FX"

< GEF‎ | GEF4
(FXChopBoxAnchor)
Line 21: Line 21:
 
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.
 
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.
  
[[Image:GEF4FX-FXChopBoxAnchor-000.png|400px|FXChopBoxAnchor]]
+
[[Image:GEF4FX-FXChopBoxAnchor-000.png|300px|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.
 
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.
  
[[Image:GEF4FX-FXChopBoxAnchor-001.png|FXChopBoxAnchor]]
+
[[Image:GEF4FX-FXChopBoxAnchor-001.png|300px|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.
 
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.
  
[[Image:GEF4FX-FXChopBoxAnchor-002.png|FXChopBoxAnchor]]
+
[[Image:GEF4FX-FXChopBoxAnchor-002.png|300px|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.
 
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.
  
[[Image:GEF4FX-FXChopBoxAnchor-003.png|FXChopBoxAnchor]]
+
[[Image:GEF4FX-FXChopBoxAnchor-003.png|300px|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.
 
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.
  
[[Image:GEF4FX-FXChopBoxAnchor-005.png|FXChopBoxAnchor]]
+
[[Image:GEF4FX-FXChopBoxAnchor-005.png|300px|FXChopBoxAnchor]]
  
 
Two of the lines are highlighted and their distance is shown. The anchorage reference point is now determined (orange).
 
Two of the lines are highlighted and their distance is shown. The anchorage reference point is now determined (orange).
  
[[Image:GEF4FX-FXChopBoxAnchor-006.png|FXChopBoxAnchor]]
+
[[Image:GEF4FX-FXChopBoxAnchor-006.png|300px|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.
 
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.

Revision as of 07:17, 12 May 2015

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 for JavaFX, like visual anchors, gesture listeners, a connection implementation, or an IGeometry-based shape implementation.

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

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

Listeners

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

Nodes

* Adaptation of GEF4 Geometry to JavaFX Node: FXGeometryNode
* Connection abstraction using anchor mechanism: FXConnection

Back to the top