Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • af3/kernel
  • diewald/kernel
2 results
Show changes
Showing
with 166 additions and 102 deletions
......@@ -9,6 +9,7 @@
*******************************************************************************/
package org.fortiss.tooling.common.ui.javafx.lwfxef;
import static java.lang.Math.abs;
import static java.lang.Math.ceil;
import static java.lang.Math.max;
import static java.lang.Math.min;
......@@ -117,6 +118,7 @@ public class DiagramViewer {
// selection feedback rectangle
mouseDragRectangle.setFill(Color.TRANSPARENT);
mouseDragRectangle.setStroke(Color.ORANGERED);
// TODO (SB): Magic constant
mouseDragRectangle.getStrokeDashArray().addAll(15.0, 5.0);
mouseDragRectangle.setMouseTransparent(true);
// viewer pane
......@@ -556,13 +558,13 @@ public class DiagramViewer {
return;
}
Point2D location = locationInDiagram;
double x = Math.min(mouseDragRectangleStartLocation.getX(), location.getX());
double x = min(mouseDragRectangleStartLocation.getX(), location.getX());
mouseDragRectangle.setX(x);
double w = Math.abs(mouseDragRectangleStartLocation.getX() - location.getX());
double w = abs(mouseDragRectangleStartLocation.getX() - location.getX());
mouseDragRectangle.setWidth(w);
double y = Math.min(mouseDragRectangleStartLocation.getY(), location.getY());
double y = min(mouseDragRectangleStartLocation.getY(), location.getY());
mouseDragRectangle.setY(y);
double h = Math.abs(mouseDragRectangleStartLocation.getY() - location.getY());
double h = abs(mouseDragRectangleStartLocation.getY() - location.getY());
mouseDragRectangle.setHeight(h);
}
......@@ -572,10 +574,10 @@ public class DiagramViewer {
return;
}
Point2D location = locationInDiagram;
double x = Math.min(mouseDragRectangleStartLocation.getX(), location.getX());
double w = Math.abs(mouseDragRectangleStartLocation.getX() - location.getX());
double y = Math.min(mouseDragRectangleStartLocation.getY(), location.getY());
double h = Math.abs(mouseDragRectangleStartLocation.getY() - location.getY());
double x = min(mouseDragRectangleStartLocation.getX(), location.getX());
double w = abs(mouseDragRectangleStartLocation.getX() - location.getX());
double y = min(mouseDragRectangleStartLocation.getY(), location.getY());
double h = abs(mouseDragRectangleStartLocation.getY() - location.getY());
layers.getVisualFeedbackLayer().remove(mouseDragRectangle);
Rectangle2D selectionRect = new Rectangle2D(x, y, w, h);
// remove old selection
......
Change.java e907a516f1369013cbb3d5d002b1ddb69cd5cc25 YELLOW
ChangeSet.java 363c4fcdad1709e6f7ccad4205a53b22c976b50d YELLOW
DefaultModelModifier.java bfa32a76ce226ec84a173201553b87d6317b84b1 YELLOW
Change.java e907a516f1369013cbb3d5d002b1ddb69cd5cc25 GREEN
ChangeSet.java 363c4fcdad1709e6f7ccad4205a53b22c976b50d GREEN
DefaultModelModifier.java bfa32a76ce226ec84a173201553b87d6317b84b1 GREEN
IClickController.java c0270e99d918aef14612d46f3e84905d3a6bdd8c YELLOW
IController.java 6ba069977e7588f97187916c23a0e37f7cb91059 YELLOW
IControllerFactory.java 85b86eda643489f2a03454eae5383915ecf27f83 YELLOW
IDragController.java c1f311d2ae9ed684c8a7cd85e9ed1f85e79658d1 YELLOW
IKeyPressController.java dc8fe2a7c441866122e8c7b3114fd12d17f0b051 YELLOW
IClickController.java c0270e99d918aef14612d46f3e84905d3a6bdd8c GREEN
IController.java 6ba069977e7588f97187916c23a0e37f7cb91059 GREEN
IControllerFactory.java 85b86eda643489f2a03454eae5383915ecf27f83 GREEN
IDragController.java c1f311d2ae9ed684c8a7cd85e9ed1f85e79658d1 GREEN
IKeyPressController.java dc8fe2a7c441866122e8c7b3114fd12d17f0b051 GREEN
AnchorageContentControllerBase.java da56b10cbf2711b5da69f0b59f43eacbe54f4eea YELLOW
ClickControllerBase.java 8e5861ed5f9318008ad0fdd5497ed320cd5bd647 YELLOW
ContentAnchorageMoveControllerBase.java c18e7915ce23e124757f5b736086ecc46694800a YELLOW
ControllerBase.java 309e9ee3f3a255b5a06fed8f1b4d4ec8bf88f101 YELLOW
DefaultDiagramController.java 0e083b89a08f63967102a384d66ebc1d64d203af YELLOW
DelegatingContentAnchorageController.java 2e3b1b4e14402a3503233f816b21ef3e4aa09edc YELLOW
DragControllerBase.java b15ff874304f679fe494d85f57cc8cbe4d0d1d15 YELLOW
DraggingUtils.java 95117e2ea4c36b6c6a31f8088bb95b484e0e6612 YELLOW
LinkControllerBase.java 392cb79cb42e9f878c665d47053b0795c3768603 YELLOW
MoveControllerBase.java 38d632e31f5e27d112ecdd4933e3a331378180d0 YELLOW
ResizableContentControllerBase.java 898500d389b035f8138308d496d2d24be501c719 YELLOW
AnchorageContentControllerBase.java da56b10cbf2711b5da69f0b59f43eacbe54f4eea GREEN
ClickControllerBase.java 8e5861ed5f9318008ad0fdd5497ed320cd5bd647 GREEN
ContentAnchorageMoveControllerBase.java c18e7915ce23e124757f5b736086ecc46694800a GREEN
ControllerBase.java 309e9ee3f3a255b5a06fed8f1b4d4ec8bf88f101 GREEN
DefaultDiagramController.java 0e083b89a08f63967102a384d66ebc1d64d203af GREEN
DelegatingContentAnchorageController.java 2e3b1b4e14402a3503233f816b21ef3e4aa09edc GREEN
DragControllerBase.java b15ff874304f679fe494d85f57cc8cbe4d0d1d15 GREEN
DraggingUtils.java 95117e2ea4c36b6c6a31f8088bb95b484e0e6612 GREEN
LinkControllerBase.java 392cb79cb42e9f878c665d47053b0795c3768603 GREEN
MoveControllerBase.java 38d632e31f5e27d112ecdd4933e3a331378180d0 GREEN
ResizableContentControllerBase.java 898500d389b035f8138308d496d2d24be501c719 GREEN
CircularResizableContentControllerBase.java daf05a58eac298462a5f092503e506575b31dff1 YELLOW
CurveLinkBendPointControllerBase.java 4d119cd640b864f2193ea5c1a7f816310b7a57a4 YELLOW
EllipticResizableContentControllerBase.java 42bcbdbf29c1cf2b71177e55f74358d1517d623f YELLOW
CircularResizableContentControllerBase.java daf05a58eac298462a5f092503e506575b31dff1 GREEN
CurveLinkBendPointControllerBase.java 4d119cd640b864f2193ea5c1a7f816310b7a57a4 GREEN
EllipticResizableContentControllerBase.java 42bcbdbf29c1cf2b71177e55f74358d1517d623f GREEN
DiamondResizableContentControllerBase.java 31f227e88205bd2e131326bdddd8421991b47d79 YELLOW
RectangularContentAnchorageMoveController.java c119b011f5a38933cee07b8082fcd44c6c3b0037 YELLOW
RectangularResizableContentControllerBase.java 262b083e4e0ce842b0bb8fbb594585e9f0d2f678 YELLOW
RhomboidContentAnchorageMoveController.java fbd40ce483f99c18cfa94076374f572bb72c2646 YELLOW
RhomboidResizableContentControllerBase.java 863b9eae49bad18f71b20c8cde4b0f350348aa27 YELLOW
DiamondResizableContentControllerBase.java 31f227e88205bd2e131326bdddd8421991b47d79 GREEN
RectangularContentAnchorageMoveController.java c119b011f5a38933cee07b8082fcd44c6c3b0037 GREEN
RectangularResizableContentControllerBase.java 262b083e4e0ce842b0bb8fbb594585e9f0d2f678 GREEN
RhomboidContentAnchorageMoveController.java fbd40ce483f99c18cfa94076374f572bb72c2646 GREEN
RhomboidResizableContentControllerBase.java 863b9eae49bad18f71b20c8cde4b0f350348aa27 GREEN
IModelChangeListener.java 241a583a3517ad504ad0a2d5a8f4d98afee8fd8b YELLOW
IModelChangeProvider.java bc7622c4af211e3ee470d12b80d04a92880f0d38 YELLOW
IModelFactory.java 3b6a1cb2779af0215a2637c40428b42600ef4ffb YELLOW
ModelChangeProviderBase.java eb5ad0363e30f727a70c42edb3d781acb6e6add6 YELLOW
ModelFactoryBase.java 6d0e1e5658c592f3f98d3bcf68bdbb54a506c489 YELLOW
IModelChangeListener.java 241a583a3517ad504ad0a2d5a8f4d98afee8fd8b GREEN
IModelChangeProvider.java bc7622c4af211e3ee470d12b80d04a92880f0d38 GREEN
IModelFactory.java 3b6a1cb2779af0215a2637c40428b42600ef4ffb GREEN
ModelChangeProviderBase.java eb5ad0363e30f727a70c42edb3d781acb6e6add6 GREEN
ModelFactoryBase.java 6d0e1e5658c592f3f98d3bcf68bdbb54a506c489 GREEN
IAngleLayout.java 4993d53870c2a71dc63e8a99ceb47df6cfec3801 YELLOW
ILayout.java e6fd2a1ac953a18c8ea8951e594e44a1c0fc8d92 YELLOW
IOffsetLayout.java 440551f07a2af2ceb000b14177cc2351cb1b7f52 YELLOW
IPointsLayout.java be1c706ae6e782d6ac960e02e6855f8d2118914b YELLOW
ISideLayout.java 20b14640a7424a013338e6683b9f4cf6e62f01e1 YELLOW
IXYLayout.java e3e007db33846621bf6844621360b5881f7f6023 YELLOW
IAngleLayout.java 4993d53870c2a71dc63e8a99ceb47df6cfec3801 GREEN
ILayout.java e6fd2a1ac953a18c8ea8951e594e44a1c0fc8d92 GREEN
IOffsetLayout.java 440551f07a2af2ceb000b14177cc2351cb1b7f52 GREEN
IPointsLayout.java be1c706ae6e782d6ac960e02e6855f8d2118914b GREEN
ISideLayout.java 20b14640a7424a013338e6683b9f4cf6e62f01e1 GREEN
IXYLayout.java e3e007db33846621bf6844621360b5881f7f6023 GREEN
IAnchorageMVCBundle.java 17671d1ef6ecc4d1b4b98cf9d83016b31455346d YELLOW
IContentAnchorageMVCBundle.java c3bd9eb5266d0f87b16cdd16aeaadbfa6eeb49de YELLOW
IContentMVCBundle.java f84f8e59af85d022c2019d271d957821c5c55d3f YELLOW
IContentMVCBundleWithParent.java 890ffcacb493fda5ead5b7f74dc7ae1637077526 YELLOW
IDiagramAnchorageMVCBundle.java c49ef7ca7457ea9d4557251263779b403f79e69c YELLOW
IDiagramMVCBundle.java 354facfc00887726a6d7553d40824b7171865330 YELLOW
ILinkMVCBundle.java a2b1527f98ed642def2346190f6a71016ca674af YELLOW
IMVCBundle.java 19a6cc6bc96c42dd98dca24288a050ff0ba04734 YELLOW
IMVCBundlePart.java 6ddc90167a6ee7410876150e1785840f6ad32912 YELLOW
MVCBundleTag.java cf428833f24caccd74945119cf906b19daa3d63b YELLOW
IAnchorageMVCBundle.java 17671d1ef6ecc4d1b4b98cf9d83016b31455346d GREEN
IContentAnchorageMVCBundle.java c3bd9eb5266d0f87b16cdd16aeaadbfa6eeb49de GREEN
IContentMVCBundle.java f84f8e59af85d022c2019d271d957821c5c55d3f GREEN
IContentMVCBundleWithParent.java 890ffcacb493fda5ead5b7f74dc7ae1637077526 GREEN
IDiagramAnchorageMVCBundle.java c49ef7ca7457ea9d4557251263779b403f79e69c GREEN
IDiagramMVCBundle.java 354facfc00887726a6d7553d40824b7171865330 GREEN
ILinkMVCBundle.java a2b1527f98ed642def2346190f6a71016ca674af GREEN
IMVCBundle.java 19a6cc6bc96c42dd98dca24288a050ff0ba04734 GREEN
IMVCBundlePart.java 6ddc90167a6ee7410876150e1785840f6ad32912 GREEN
MVCBundleTag.java cf428833f24caccd74945119cf906b19daa3d63b GREEN
AnchorageMVCBundleBase.java 63dc967da3342d402603adcc005344ce89386ea8 YELLOW
ContentAnchorageMVCBundle.java 1a517903c6400203cb7850502671e01d715f2453 YELLOW
ContentMVCBundle.java ee8a2c7780b64d61cf3e196437ce5ab07ad29e7c YELLOW
DiagramAnchorageMVCBundle.java b0f12259bbb8ccbf68b0774eb76c060188f4fea2 YELLOW
DiagramMVCBundle.java 46860e820c67f985cd75704b9084948df1939ee8 YELLOW
LinkMVCBundle.java b8246cd0e6f6ff53b377a9a0c4d1c8e4aa6371c4 YELLOW
MVCBundleBase.java 0a1b561e6ed5a5b4a3d2fdf52e2e5839c770193b YELLOW
MVCBundlePartBase.java 9e56b3799f14fe63649a09130edbdef083b87fdc YELLOW
AnchorageMVCBundleBase.java 63dc967da3342d402603adcc005344ce89386ea8 GREEN
ContentAnchorageMVCBundle.java 1a517903c6400203cb7850502671e01d715f2453 GREEN
ContentMVCBundle.java ee8a2c7780b64d61cf3e196437ce5ab07ad29e7c GREEN
DiagramAnchorageMVCBundle.java b0f12259bbb8ccbf68b0774eb76c060188f4fea2 GREEN
DiagramMVCBundle.java 46860e820c67f985cd75704b9084948df1939ee8 GREEN
LinkMVCBundle.java b8246cd0e6f6ff53b377a9a0c4d1c8e4aa6371c4 GREEN
MVCBundleBase.java 0a1b561e6ed5a5b4a3d2fdf52e2e5839c770193b GREEN
MVCBundlePartBase.java 9e56b3799f14fe63649a09130edbdef083b87fdc GREEN
IAnchorageVisual.java e742212c132db1e2309650f5d6e40bc79c2ff85a YELLOW
IContentAnchorageVisual.java 3a3ceb675820f151aa678b6caa0f1ae833da1b7f YELLOW
IContentVisual.java 1052ece1f6172799204b1d7524398766c3b7a12e YELLOW
IDiagramAnchorageVisual.java ae0895912fe735147ccd11b7f466a7a5b61c3ca5 YELLOW
ILinkVisual.java 8f9bd6cf7c423a78d67fab0a20ba2dad2dfbd55e YELLOW
IVisual.java 400569502788bf2efff3de84f2c53b65256b3fc4 YELLOW
IVisualFactory.java 39253dc705f7f73ddbb83d050232a19219d54e71 YELLOW
IAnchorageVisual.java e742212c132db1e2309650f5d6e40bc79c2ff85a GREEN
IContentAnchorageVisual.java 3a3ceb675820f151aa678b6caa0f1ae833da1b7f GREEN
IContentVisual.java 1052ece1f6172799204b1d7524398766c3b7a12e GREEN
IDiagramAnchorageVisual.java ae0895912fe735147ccd11b7f466a7a5b61c3ca5 GREEN
ILinkVisual.java 8f9bd6cf7c423a78d67fab0a20ba2dad2dfbd55e GREEN
IVisual.java 400569502788bf2efff3de84f2c53b65256b3fc4 GREEN
IVisualFactory.java 39253dc705f7f73ddbb83d050232a19219d54e71 GREEN
ContentAnchorageVisualBase.java 6722629a940e9f8d973d2176bc3855932d7fa35a YELLOW
ContentVisualBase.java b061d42fc27e980023980d070961d0814702237d YELLOW
DiagramAnchorageVisualBase.java 05c235152bc79187f0fc9b041435da7968654a78 YELLOW
LinkVisualBase.java 909b933b38b7651cac901d767115e173983bef26 YELLOW
MVCBundlePartWithEffectsBase.java 6f6fbbb065950ad3acd4dc1fbfdd1348874e51d2 YELLOW
VisualBase.java a2daf2d8f8450559450ddf5bbc93d3f948c189dd YELLOW
ContentAnchorageVisualBase.java 6722629a940e9f8d973d2176bc3855932d7fa35a GREEN
ContentVisualBase.java d232c6cb7bc54b2430379379eb2985f5a2e12cd3 RED
DiagramAnchorageVisualBase.java 05c235152bc79187f0fc9b041435da7968654a78 GREEN
LinkVisualBase.java 909b933b38b7651cac901d767115e173983bef26 GREEN
MVCBundlePartWithEffectsBase.java 6f6fbbb065950ad3acd4dc1fbfdd1348874e51d2 GREEN
VisualBase.java 8d6e74d5c74703dad12847cd5c913fa72707a84a RED
......@@ -41,6 +41,7 @@ public abstract class ContentVisualBase extends VisualBase implements IContentVi
protected final Text text = new Text();
/** The icon of this visual. */
protected final ImageView icon = new ImageView();
// TODO (SB): Magic constant
/** The expanded / collapsed indicator widget. */
protected final ExpandCollapseWidget expandCollapseWidget =
new ExpandCollapseWidget(0, 0, 20, 20, 3);
......@@ -79,6 +80,7 @@ public abstract class ContentVisualBase extends VisualBase implements IContentVi
/** Returns the insets of the text label. */
protected Insets getTextInsets() {
// TODO (SB): Magic constant
return new Insets(10, 10, 10, 10);
}
......@@ -250,12 +252,14 @@ public abstract class ContentVisualBase extends VisualBase implements IContentVi
/** Returns the inset for the plus/minus sign of the expand/collapse widget. */
protected double getExpandCollapseWidgetInset() {
// TODO (SB): Magic constant
return 3;
}
/** Returns the location for the expand/collapse widget. */
protected Rectangle2D getExpandCollapseWidgetRectangle() {
Rectangle2D b = getCurrentBounds();
// TODO (SB): Magic constant
return new Rectangle2D(b.getWidth() - 20, 6, 14, 14);
}
......
......@@ -85,6 +85,7 @@ public abstract class VisualBase extends MVCBundlePartWithEffectsBase implements
protected void createHoverEffect(DiagramLayers layers) {
Color shadow = getHoverShadowColor();
if(shadow != null && visualShape != null) {
// TODO (SB): Magic constant
visualShape.setEffect(new DropShadow(10, 3, 3, shadow));
}
// handle hover text
......@@ -280,6 +281,7 @@ public abstract class VisualBase extends MVCBundlePartWithEffectsBase implements
/** Returns the opacity of the content visual. */
protected double getOpacity() {
// TODO (SB): Magic constant
return 0.8;
}
......@@ -290,6 +292,7 @@ public abstract class VisualBase extends MVCBundlePartWithEffectsBase implements
/** Returns the width of the border. */
protected double getBorderWidth() {
// TODO (SB): Magic constant
return 2;
}
......@@ -320,6 +323,7 @@ public abstract class VisualBase extends MVCBundlePartWithEffectsBase implements
/** Returns the size of the hit area as an outset of the visible rectangle. */
protected double getHitAreaOutset() {
// TODO (SB): Magic constant
return 10;
}
......
CircularContentAnchorageVisualBase.java de227ce8a2a14eb4df7bdcf43b82d98f6ff17045 YELLOW
CircularContentVisualBase.java cc3caea328e36e90069b915e413c8e7e9522a939 YELLOW
CircularContentAnchorageVisualBase.java e1d3f982239beb38120c7eda6ecf319ab2779f9c RED
CircularContentVisualBase.java cc3caea328e36e90069b915e413c8e7e9522a939 GREEN
CircularDiagramAnchorageVisualBase.java 7a3b92fb1b135c218b9a5e16506acfc74a6b5468 YELLOW
CurveLinkVisualBase.java 0b8706214320d715966c86a5242ad21c8bf5a315 YELLOW
CurveSegment.java 445bc2607cb70ae1c788c27ba9fc637dd7df4956 YELLOW
EllipticBorderLocation.java 1e9b3d42c7fcd5495004fb30b0c499096a839967 YELLOW
EllipticContentVisualBase.java dc2fddc9cfe5605bc8a5d09dd862845e360b23f5 YELLOW
CurveLinkVisualBase.java 5ce3086769004a9eb6800d7eb58379d831ff74b1 GREEN
CurveSegment.java 0e7f70e9526a74aaec2bec4f4fc16295521cf5f2 GREEN
EllipticBorderLocation.java 1e9b3d42c7fcd5495004fb30b0c499096a839967 GREEN
EllipticContentVisualBase.java dc2fddc9cfe5605bc8a5d09dd862845e360b23f5 GREEN
......@@ -84,6 +84,7 @@ public abstract class CircularContentAnchorageVisualBase extends ContentAnchorag
/** Returns the insets of the filled circle subtracted from {@link #getDimensions()}. */
protected double getInset() {
// TODO (SB): Magic constant
return 2;
}
......
......@@ -65,7 +65,7 @@ public abstract class CurveLinkVisualBase extends LinkVisualBase {
for(int i = 2; i < pts; i += 3) {
Point2D ep = getBendPointLocation(i);
makeCurve(sp, cp1, cp2, ep, getInvisibleSelectionLineWidth(), markerSize, markerSize,
false, true, 0);
false, true, 0, getLabelText(i, pts + 1));
sp = ep;
cp1 = getBendPointLocation(i + 1);
cp2 = getBendPointLocation(i + 2);
......@@ -76,14 +76,16 @@ public abstract class CurveLinkVisualBase extends LinkVisualBase {
.applyToPoint(getEndAnchorPoint());
// Last bend point is not selectable => set its feedback rectangle size to 0
makeCurve(sp, cp1, cp2, ep, getInvisibleSelectionLineWidth(), 0, markerSize,
showArrowOnLastSegment(), useLineArrow(), getArrowLength());
showArrowOnLastSegment(), useLineArrow(), getArrowLength(),
getLabelText(pts, pts + 1));
endFeedbackHandle.setX(ep.getX() - ms2);
endFeedbackHandle.setY(ep.getY() - ms2);
endFeedbackHandle.setWidth(markerSize);
endFeedbackHandle.setHeight(markerSize);
for(CurveSegment cs : segments) {
cs.addLinkNodes(layers, linkBundle);
cs.addLinkNodes(layers, linkBundle,
getLabelText(segments.indexOf(cs), segments.size()));
}
curvesAddedToSceneGraph = true;
}
......@@ -133,7 +135,8 @@ public abstract class CurveLinkVisualBase extends LinkVisualBase {
// handle bend points
for(int i = 2; i < pts; i += 3) {
Point2D ep = getFeedbackChangeForBendPoint(i).applyToPoint(getBendPointLocation(i));
segments.get(segIndex).update(sp, cp1, cp2, ep, markerSize, markerSize, 0);
segments.get(segIndex).update(sp, cp1, cp2, ep, markerSize, markerSize, 0,
getLabelText(i, pts));
sp = ep;
cp1 = getFeedbackChangeForBendPoint(i + 1).applyToPoint(getBendPointLocation(i + 1));
cp2 = getFeedbackChangeForBendPoint(i + 2).applyToPoint(getBendPointLocation(i + 2));
......@@ -142,7 +145,8 @@ public abstract class CurveLinkVisualBase extends LinkVisualBase {
// end point
Point2D ep = getFeedbackChangeForBendPoint(END_OF_LINK_BEND_POINT_INDEX)
.applyToPoint(getEndAnchorPoint());
segments.get(segIndex).update(sp, cp1, cp2, ep, 0, markerSize, getArrowLength());
segments.get(segIndex).update(sp, cp1, cp2, ep, 0, markerSize, getArrowLength(),
getLabelText(pts, pts));
endFeedbackHandle.setX(ep.getX() - ms2);
endFeedbackHandle.setY(ep.getY() - ms2);
endFeedbackHandle.setWidth(markerSize);
......@@ -338,10 +342,10 @@ public abstract class CurveLinkVisualBase extends LinkVisualBase {
/** Creates the curve segment. */
private void makeCurve(Point2D sp, Point2D cp1, Point2D cp2, Point2D ep, double selWidth,
double bpMarkerSize, double cpMarkerSize, boolean showArrow, boolean useLineArrow,
double arrowLength) {
double arrowLength, String labelText) {
CurveSegment segVis = new CurveSegment(sp.getX(), sp.getY(), cp1.getX(), cp1.getY(),
cp2.getX(), cp2.getY(), ep.getX(), ep.getY(), selWidth, bpMarkerSize, cpMarkerSize,
showArrow, useLineArrow, arrowLength);
showArrow, useLineArrow, arrowLength, labelText);
segments.add(segVis);
}
......@@ -448,4 +452,17 @@ public abstract class CurveLinkVisualBase extends LinkVisualBase {
cs.setMouseTransparent(true);
}
}
/**
* Returns the label text.
*
* @param currentSegment
* the current segment
* @param lastSegment
* the last index of a segment
* @return the label text for the current segment or null for no label
*/
protected String getLabelText(int currentSegment, int lastSegment) {
return null;
}
}
......@@ -13,6 +13,7 @@ import static javafx.scene.paint.Color.BLACK;
import static javafx.scene.paint.Color.GRAY;
import static javafx.scene.paint.Color.RED;
import static javafx.scene.paint.Color.TRANSPARENT;
import static javafx.scene.paint.Color.WHITE;
import static javafx.scene.shape.StrokeLineCap.BUTT;
import static javafx.scene.shape.StrokeLineJoin.ROUND;
......@@ -21,11 +22,17 @@ import org.fortiss.tooling.common.ui.javafx.lwfxef.DiagramLayers.ILayer;
import org.fortiss.tooling.common.ui.javafx.lwfxef.mvc.ILinkMVCBundle;
import org.fortiss.tooling.common.ui.javafx.lwfxef.visual.widgets.LinkArrowWidget;
import javafx.geometry.Insets;
import javafx.geometry.Point2D;
import javafx.scene.control.Label;
import javafx.scene.layout.Background;
import javafx.scene.layout.BackgroundFill;
import javafx.scene.layout.CornerRadii;
import javafx.scene.paint.Paint;
import javafx.scene.shape.CubicCurve;
import javafx.scene.shape.Line;
import javafx.scene.shape.Rectangle;
import javafx.scene.text.TextAlignment;
/**
* This class encapsulates {@link CubicCurve}s usually needed for every segment: a visible one, a
......@@ -48,12 +55,14 @@ final class CurveSegment {
private final Line helperEnd;
/** The arrow widget for curved links. */
private final LinkArrowWidget arrowWidget;
/** Stores the label. */
private Label label;
/** Constructor. */
public CurveSegment(double sx, double sy, double c1x, double c1y, double c2x, double c2y,
double ex, double ey, double selectionStrokeWidth, double bendPointFeedbackSize,
double controlPointFeedbackSize, boolean showArrow, boolean useLineArrow,
double arrowLength) {
double arrowLength, String labelText) {
visibleCurve = new CubicCurve(sx, sy, c1x, c1y, c2x, c2y, ex, ey);
visibleCurve.setStroke(BLACK);
visibleCurve.setFill(null);
......@@ -93,6 +102,12 @@ final class CurveSegment {
} else {
arrowWidget = null;
}
if(labelText != null) {
label = new Label(labelText);
label.setTextAlignment(TextAlignment.CENTER);
} else {
label = null;
}
}
/** Returns the visible curve. */
......@@ -145,7 +160,8 @@ final class CurveSegment {
/** Updates the segment coordinates. */
public void update(Point2D sp, Point2D cp1, Point2D cp2, Point2D ep,
double bendPointFeedbackSize, double controlPointFeedbackSize, double arrowLength) {
double bendPointFeedbackSize, double controlPointFeedbackSize, double arrowLength,
String labelText) {
double sx = sp.getX();
double sy = sp.getY();
visibleCurve.setStartX(sx);
......@@ -196,16 +212,29 @@ final class CurveSegment {
if(arrowWidget != null) {
arrowWidget.update(ex, ey, c2x, c2y, arrowLength);
}
if(label != null) {
label.setText(labelText);
double lx = (sx + ex - label.getBoundsInLocal().getWidth()) / 2;
double ly = (sy + ey) / 2;
label.setLayoutX(lx);
label.setLayoutY(ly);
}
}
/** Adds the link nodes of this segment to the link layer node. */
public void addLinkNodes(DiagramLayers layers, ILinkMVCBundle bundle) {
public void addLinkNodes(DiagramLayers layers, ILinkMVCBundle bundle, String labelText) {
ILayer linkLayer = layers.getLinkLayer();
linkLayer.add(visibleCurve, bundle);
linkLayer.add(clickableCurve, bundle);
if(arrowWidget != null) {
linkLayer.add(arrowWidget, bundle);
}
if(label != null) {
label.setText(labelText);
label.setBackground(
new Background(new BackgroundFill(WHITE, new CornerRadii(0), new Insets(0))));
layers.getTextLayer().add(label, bundle);
}
}
/** Removes the link nodes of this segment from the link layer node. */
......@@ -216,6 +245,9 @@ final class CurveSegment {
if(arrowWidget != null) {
linkLayer.remove(arrowWidget);
}
if(label != null) {
layers.getTextLayer().remove(label);
}
}
/** Adds the feedback nodes of this segment to the feedback layer node. */
......@@ -246,5 +278,8 @@ final class CurveSegment {
if(arrowWidget != null) {
arrowWidget.setMouseTransparent(transparent);
}
if(label != null) {
label.setMouseTransparent(transparent);
}
}
}
DiamondContentVisualBase.java 214dc886dba3f26a6404db5c521715466ce85522 YELLOW
LineLinkGraph.java 85a06a553f88f7b9fb4bd9c06411725d9fb160fc YELLOW
LineLinkVisualBase.java 41cee7c8258cb65080bfce2a5d785772305a8119 YELLOW
LineSegment.java a8658ec5bcd930d417a148861831b9ebb70bb37d YELLOW
RectangularBorderLocation.java 824472c353534d1094ae4f735a30a231b885f050 YELLOW
RectangularContentAnchorageVisualBase.java 39981dc29cac42d77c6ffe855ecc8ccad1689230 YELLOW
RectangularContentVisualBase.java ccd23400a7ac47573127a39bc68c55c82baa44ad YELLOW
RectangularDiagramAnchorageVisualBase.java 1259d6d110becca9ae02c754036c6693f00de683 YELLOW
RhomboidContentVisualBase.java 7a91e401034acc629179fb1a45416cd519f617d7 YELLOW
DiamondContentVisualBase.java de349d41b84b2063f74c03ff5ad7290855e997f7 RED
LineLinkGraph.java 85a06a553f88f7b9fb4bd9c06411725d9fb160fc GREEN
LineLinkVisualBase.java 5529031f89a96ad0322f011e89dad1ece785bc03 RED
LineSegment.java a8658ec5bcd930d417a148861831b9ebb70bb37d GREEN
RectangularBorderLocation.java 824472c353534d1094ae4f735a30a231b885f050 GREEN
RectangularContentAnchorageVisualBase.java 39981dc29cac42d77c6ffe855ecc8ccad1689230 GREEN
RectangularContentVisualBase.java aee9ac3dbd53ce89539252d9984ed103d955be2f RED
RectangularDiagramAnchorageVisualBase.java 1259d6d110becca9ae02c754036c6693f00de683 GREEN
RhomboidContentVisualBase.java 0c3820cbfd3763c3cb6b1a0cba5cc71d8eecea73 RED
......@@ -190,6 +190,7 @@ public abstract class DiamondContentVisualBase extends ContentVisualBase {
@Override
protected DiagramCoordinate getTextAnchorLocation() {
DiagramCoordinate textAnchorLocation = super.getTextAnchorLocation();
// TODO (SB): Magic constant
return textAnchorLocation.add(getCurrentBounds().getWidth() / 5, 0);
}
}