1
1
package pipe.gui.graphicElements.tapn;
3
import java.awt.BasicStroke;
4
3
import java.awt.Container;
5
import java.awt.Graphics;
6
import java.awt.Graphics2D;
7
import java.awt.Polygon;
8
import java.awt.RenderingHints;
9
import java.awt.geom.AffineTransform;
10
4
import java.util.Hashtable;
12
6
import javax.swing.BoxLayout;
14
import pipe.dataLayer.DataLayer;
15
8
import pipe.gui.CreateGui;
16
import pipe.gui.DrawingSurfaceImpl;
17
10
import pipe.gui.Grid;
19
11
import pipe.gui.Zoomer;
20
12
import pipe.gui.graphicElements.Arc;
21
13
import pipe.gui.graphicElements.ArcPath;
22
import pipe.gui.graphicElements.NameLabel;
23
14
import pipe.gui.graphicElements.PlaceTransitionObject;
24
15
import pipe.gui.handler.ArcHandler;
25
16
import pipe.gui.undo.ArcTimeIntervalEdit;
30
21
import dk.aau.cs.model.tapn.TimedArcPetriNet;
31
22
import dk.aau.cs.model.tapn.Weight;
34
* <b>Arc</b> - Petri-Net Normal Arc Class
37
* <a href="..\PNMLSchema\index.html">PNML - Petri-Net XMLSchema
41
* <a href="..\..\..\UML\dataLayer.html">UML - PNML Package </a>
45
24
public class TimedOutputArcComponent extends Arc {
51
30
private dk.aau.cs.model.tapn.TimedOutputArc outputArc;
54
* Create Petri-Net Arc object
56
* @param startPositionXInput
57
* Start X-axis Position
58
* @param startPositionYInput
59
* Start Y-axis Position
60
* @param endPositionXInput
62
* @param endPositionYInput
32
public TimedOutputArcComponent(PlaceTransitionObject sourceInput, PlaceTransitionObject targetInput, int weightInput, String idInput) {
33
super(sourceInput, targetInput, weightInput, idInput);
71
38
public TimedOutputArcComponent(double startPositionXInput,
72
39
double startPositionYInput, double endPositionXInput,
73
40
double endPositionYInput, PlaceTransitionObject sourceInput,
74
41
PlaceTransitionObject targetInput, int weightInput, String idInput,
75
42
boolean taggedInput) {
76
super(startPositionXInput, startPositionYInput, endPositionXInput,
77
endPositionYInput, sourceInput, targetInput, weightInput,
80
//XXX: se note in funcation
43
this(sourceInput, targetInput, weightInput, idInput);
87
49
public TimedOutputArcComponent(PlaceTransitionObject newSource) {
90
//XXX: se note in funcation
94
53
public TimedOutputArcComponent(TimedOutputArcComponent arc) {
97
myPath = new ArcPath(this);
98
for (int i = 0; i <= arc.myPath.getEndIndex(); i++) {
99
myPath.addPoint(arc.myPath.getPoint(i).getX(), arc.myPath.getPoint(i).getY(), arc.myPath.getPointType(i),zoom);
55
super(arc.getSource(), arc.getTarget(), 0, null);
57
myPath = new ArcPath(this, arc.myPath);
102
59
this.updateBounds();
104
61
this.setSource(arc.getSource());
105
62
this.setTarget(arc.getTarget());
106
this.updateNameOffsetX(arc.getNameOffsetXObject());
107
this.updateNameOffsetY(arc.getNameOffsetYObject());
63
this.setNameOffsetX(arc.getNameOffsetXObject());
64
this.setNameOffsetY(arc.getNameOffsetYObject());
108
65
this.getNameLabel().setPosition(
109
Grid.getModifiedX((int) (arc.getNameLabel().getXPosition() + Zoomer.getZoomedValue(this.nameOffsetX, zoom))),
110
Grid.getModifiedY((int) (arc.getNameLabel().getYPosition() + Zoomer.getZoomedValue(this.nameOffsetY, zoom))));
66
Grid.getModifiedX((int) (arc.getNameLabel().getXPosition() + Zoomer.getZoomedValue(getNameOffsetX(), getZoom()))),
67
Grid.getModifiedY((int) (arc.getNameLabel().getYPosition() + Zoomer.getZoomedValue(getNameOffsetY(), getZoom()))));
112
//XXX: se note in funcation
116
private void addMouseHandler() {
72
protected void addMouseHandler() {
117
73
//XXX: kyrke 2018-09-06, this is bad as we leak "this", think its ok for now, as it alwas constructed when
118
74
//XXX: handler is called. Make static constructor and add handler from there, to make it safe.
119
75
mouseHandler = new ArcHandler(this);
135
91
public void updateLabel(boolean displayConstantNames) {
137
pnName.setText(getWeight().toString(displayConstantNames)+" " + pnName.getText());
92
getNameLabel().setText("");
93
getNameLabel().setText(getWeight().toString(displayConstantNames)+" " + getNameLabel().getText());
138
94
setLabelPosition();
142
public void delete() {
143
if (outputArc != null)
148
97
public void showTimeIntervalEditor() {
149
98
EscapableDialog guiDialog = new EscapableDialog(CreateGui.getApp(), "Edit Arc", true);
181
130
newCopyArc.setTarget(oldToNewMapping.get(this.getTarget()));
182
131
newCopyArc.setUnderlyingArc(tapn.getOutputArcFromTransitionAndPlace(tapn.getTransitionByName(outputArc.source().name()), tapn.getPlaceByName(outputArc.destination().name())));
184
newCopyArc.getSource().addConnectFrom(newCopyArc);
185
newCopyArc.getTarget().addConnectTo(newCopyArc);
187
133
return newCopyArc;