Skip to content
Snippets Groups Projects
Commit 297e5941 authored by Johannes Eder's avatar Johannes Eder
Browse files

<Sub-system>: <Summary>

*

Issue-Ref: 4015
Issue-Url: https://af3-developer.fortiss.org/issues/4015



Signed-off-by: default avatarJohannes Eder <eder@fortiss.org>
parent c152f123
No related branches found
No related tags found
1 merge request!1204015
DiamondContentVisualBase.java a81e76e85706ad38b6c22bbcd1cc5a5696737e3d GREEN
LineLinkGraph.java 85a06a553f88f7b9fb4bd9c06411725d9fb160fc GREEN
LineLinkVisualBase.java 74968c18bb68859bc795ed9a3b0693d1787e0806 GREEN
LineSegment.java a8658ec5bcd930d417a148861831b9ebb70bb37d GREEN
LineLinkVisualBase.java b21eefe578d20555bca2522c4ed7096ed0a8d6e5 YELLOW
LineSegment.java 0eb65adbd2320b32688989f72b83d598c5a45404 YELLOW
RectangularBorderLocation.java 824472c353534d1094ae4f735a30a231b885f050 GREEN
RectangularContentAnchorageVisualBase.java 39981dc29cac42d77c6ffe855ecc8ccad1689230 GREEN
RectangularContentVisualBase.java aeeda282f330180b1f339e3230810eccea2e7e7b GREEN
......
......@@ -70,7 +70,8 @@ public abstract class LineLinkVisualBase extends LinkVisualBase {
double nx = bp.getX() + chg.getDeltaX();
double ny = bp.getY() + chg.getDeltaY();
segments.add(new LineSegment(bpModel, sx, sy, nx, ny, getInvisibleSelectionLineWidth(),
feedbackSize, false, false, 0, getLabelText(i, pts + 1)));
feedbackSize, false, false, 0, getLabelText(i, pts + 1),
getSimluationLabelText(i, pts + 1)));
sx = nx;
sy = ny;
bpModel = getBendPointModel(i);
......@@ -80,7 +81,8 @@ public abstract class LineLinkVisualBase extends LinkVisualBase {
.applyToPoint(getEndAnchorPoint());
segments.add(new LineSegment(bpModel, sx, sy, endPoint.getX(), endPoint.getY(),
getInvisibleSelectionLineWidth(), 0, showArrowOnLastSegment(), useLineArrow(),
getArrowLength(), getLabelText(pts, pts + 1)));
getArrowLength(), getLabelText(pts, pts + 1),
getSimluationLabelText(pts, pts + 1)));
endFeedbackHandle.setX(endPoint.getX() - fs2);
endFeedbackHandle.setY(endPoint.getY() - fs2);
endFeedbackHandle.setWidth(feedbackSize);
......@@ -90,7 +92,8 @@ public abstract class LineLinkVisualBase extends LinkVisualBase {
int numberOfSegs = segments.size();
for(int i = 0; i < numberOfSegs; i++) {
LineSegment ls = segments.get(i);
ls.addLinkNodes(layers, bundle, getLabelText(i, numberOfSegs));
ls.addLinkNodes(layers, bundle, getLabelText(i, numberOfSegs),
getSimluationLabelText(i, numberOfSegs));
}
linesAddedToSceneGraph = true;
}
......@@ -156,14 +159,16 @@ public abstract class LineLinkVisualBase extends LinkVisualBase {
// handle bend points
for(int i = 0; i < pts; i++) {
Point2D ep = getFeedbackChangeForBendPoint(i).applyToPoint(getBendPointLocation(i));
segments.get(segIndex).update(sp, ep, feedbackSize, 0, getLabelText(i, pts));
segments.get(segIndex).update(sp, ep, feedbackSize, 0, getLabelText(i, pts),
getSimluationLabelText(i, pts));
sp = ep;
segIndex++;
}
// end point
Point2D ep = getFeedbackChangeForBendPoint(END_OF_LINK_BEND_POINT_INDEX)
.applyToPoint(getEndAnchorPoint());
segments.get(segIndex).update(sp, ep, 0, getArrowLength(), getLabelText(pts, pts));
segments.get(segIndex).update(sp, ep, 0, getArrowLength(), getLabelText(pts, pts),
getSimluationLabelText(pts, pts));
endFeedbackHandle.setX(ep.getX() - fs2);
endFeedbackHandle.setY(ep.getY() - fs2);
endFeedbackHandle.setWidth(feedbackSize);
......@@ -360,6 +365,19 @@ public abstract class LineLinkVisualBase extends LinkVisualBase {
return null;
}
/**
* 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 getSimluationLabelText(int currentSegment, int lastSegment) {
return null;
}
/** Returns the {@link LinkMVCBundle}. */
private LinkMVCBundle getLinkBundle() {
return (LinkMVCBundle)getMVCBundle();
......
......@@ -47,19 +47,26 @@ final class LineSegment {
private final LinkArrowWidget arrowWidget;
/** Stores the label. */
private Text label;
/** Stores the simulation label */
private Text simulationLabel;
/** Offset of simulation label in y direction. */
private final int SIMULATION_OFFSET = 1;
/** Constructor. */
/**
* Constructor.
*
*/
public LineSegment(double sx, double sy, double ex, double ey, double clickableWidth,
double markerSize, boolean showArrow, boolean useLineArrow, double arrowLength,
String labelText) {
String labelText, String simulationLabelText) {
this(null, sx, sy, ex, ey, clickableWidth, markerSize, showArrow, useLineArrow, arrowLength,
labelText);
labelText, simulationLabelText);
}
/** Constructor. */
public LineSegment(Object bendPointModel, double sx, double sy, double ex, double ey,
double clickableWidth, double feedbackSize, boolean showArrow, boolean useLineArrow,
double arrowLength, String labelText) {
double arrowLength, String labelText, String simulationLabelText) {
this.bendPointModel = bendPointModel;
this.visibleLine = new Line(sx, sy, ex, ey);
......@@ -85,6 +92,14 @@ final class LineSegment {
} else {
label = null;
}
if(simulationLabelText != null) {
simulationLabel = new Text(labelText);
simulationLabel.setTextAlignment(TextAlignment.CENTER);
simulationLabel.setTextOrigin(VPos.TOP);
simulationLabel.setFill(Color.RED);
} else {
simulationLabel = null;
}
}
/** Returns the bend point model. */
......@@ -108,12 +123,14 @@ final class LineSegment {
}
/** Adds the link nodes of this segment to the link layer node. */
public void addLinkNodes(DiagramLayers layers, ILinkMVCBundle bundle, String labelText) {
public void addLinkNodes(DiagramLayers layers, ILinkMVCBundle bundle, String labelText,
String simulationLabelText) {
ILayer visualLayer = layers.getLinkLayer();
visualLayer.add(visibleLine, bundle);
if(arrowWidget != null) {
visualLayer.add(arrowWidget, bundle);
}
if(label != null) {
label.setText(labelText);
double lx = (visibleLine.getStartX() + visibleLine.getEndX() -
......@@ -122,11 +139,26 @@ final class LineSegment {
label.setX(lx);
label.setY(ly);
layers.getTextLayer().add(label, bundle);
if(simulationLabel != null) {
setSimulationLabel(simulationLabelText, lx, ly,
label.getBoundsInLocal().getHeight());
layers.getTextLayer().add(simulationLabel, bundle);
}
}
ILayer interactionLayer = layers.getLinkInteractionLayer();
interactionLayer.add(clickableLine, bundle);
}
/**
* Sets the text of the simulation label below the label of the line.
*/
private void setSimulationLabel(String simulationLabelText, double lx, double ly,
double yOffset) {
simulationLabel.setText(simulationLabelText);
simulationLabel.setX(lx);
simulationLabel.setY(ly + yOffset + SIMULATION_OFFSET);
}
/** Removes the link nodes of this segment from the link layer node. */
public void removeLinkNodes(DiagramLayers layers) {
ILayer visualLayer = layers.getLinkLayer();
......@@ -137,6 +169,9 @@ final class LineSegment {
if(label != null) {
layers.getTextLayer().remove(label);
}
if(simulationLabel != null) {
layers.getTextLayer().remove(simulationLabel);
}
ILayer interactionLayer = layers.getLinkInteractionLayer();
interactionLayer.remove(clickableLine);
}
......@@ -166,7 +201,7 @@ final class LineSegment {
/** Updates the line segment. */
public void update(Point2D sp, Point2D ep, double feedbackSize, double arrowLength,
String labelText) {
String labelText, String simulationLabelText) {
double sx = sp.getX();
double sy = sp.getY();
visibleLine.setStartX(sx);
......@@ -196,6 +231,10 @@ final class LineSegment {
double ly = (sy + ey) / 2;
label.setX(lx);
label.setY(ly);
if(simulationLabel != null) {
setSimulationLabel(simulationLabelText, lx, ly,
label.getBoundsInLocal().getHeight());
}
}
}
......@@ -210,5 +249,8 @@ final class LineSegment {
if(label != null) {
label.setMouseTransparent(transparent);
}
if(simulationLabel != null) {
simulationLabel.setMouseTransparent(transparent);
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment