29
29
import pipe.gui.Zoomer;
30
30
import pipe.gui.graphicElements.AnnotationNote;
31
31
import pipe.gui.graphicElements.Arc;
32
import pipe.gui.graphicElements.Note;
33
32
import pipe.gui.graphicElements.PetriNetObject;
34
33
import pipe.gui.graphicElements.Place;
35
34
import pipe.gui.graphicElements.PlaceTransitionObject;
36
import pipe.gui.graphicElements.Transition;
37
35
import pipe.gui.graphicElements.tapn.TimedInhibitorArcComponent;
38
36
import pipe.gui.graphicElements.tapn.TimedInputArcComponent;
39
37
import pipe.gui.graphicElements.tapn.TimedOutputArcComponent;
40
38
import pipe.gui.graphicElements.tapn.TimedPlaceComponent;
41
39
import pipe.gui.graphicElements.tapn.TimedTransitionComponent;
42
40
import pipe.gui.graphicElements.tapn.TimedTransportArcComponent;
43
import pipe.gui.handler.AnimationHandler;
44
import pipe.gui.handler.AnnotationNoteHandler;
45
import pipe.gui.handler.ArcHandler;
46
import pipe.gui.handler.LabelHandler;
47
import pipe.gui.handler.PlaceHandler;
48
import pipe.gui.handler.TAPNTransitionHandler;
49
import pipe.gui.handler.TimedArcHandler;
50
import pipe.gui.handler.TransitionHandler;
51
import pipe.gui.handler.TransportArcHandler;
52
41
import dk.aau.cs.gui.NameGenerator;
53
42
import dk.aau.cs.io.queries.TAPNQueryLoader;
54
43
import dk.aau.cs.model.tapn.Constant;
406
395
nameGenerator.updateIndicesForAllModels(nameInput);
407
396
TimedTransitionComponent transitionComponent = new TimedTransitionComponent(
408
positionXInput, positionYInput, idInput, nameInput,
397
positionXInput, positionYInput, idInput,
409
398
nameOffsetXInput, nameOffsetYInput, true,
410
399
infiniteServer, angle, priority);
411
400
transitionComponent.setUnderlyingTransition(t);
745
734
private void addListeners(PetriNetObject newObject, Template template) {
746
if (newObject != null) {
747
if (newObject.getMouseListeners().length == 0) {
748
if (newObject instanceof Place) {
750
if (newObject instanceof TimedPlaceComponent) {
752
LabelHandler labelHandler = new LabelHandler(((Place) newObject).getNameLabel(), (Place) newObject);
753
((Place) newObject).getNameLabel().addMouseListener(labelHandler);
754
((Place) newObject).getNameLabel().addMouseMotionListener(labelHandler);
755
((Place) newObject).getNameLabel().addMouseWheelListener(labelHandler);
757
PlaceHandler placeHandler = new PlaceHandler(drawingSurface, (Place) newObject, template.guiModel(), template.model());
758
newObject.addMouseListener(placeHandler);
759
newObject.addMouseWheelListener(placeHandler);
760
newObject.addMouseMotionListener(placeHandler);
763
LabelHandler labelHandler = new LabelHandler(((Place) newObject).getNameLabel(), (Place) newObject);
764
((Place) newObject).getNameLabel().addMouseListener(labelHandler);
765
((Place) newObject).getNameLabel().addMouseMotionListener(labelHandler);
766
//((Place) newObject).getNameLabel().addMouseWheelListener(labelHandler);
768
PlaceHandler placeHandler = new PlaceHandler(drawingSurface, (Place) newObject);
769
newObject.addMouseListener(placeHandler);
770
//newObject.addMouseWheelListener(placeHandler);
771
newObject.addMouseMotionListener(placeHandler);
774
} else if (newObject instanceof Transition) {
775
TransitionHandler transitionHandler;
776
if (newObject instanceof TimedTransitionComponent) {
777
transitionHandler = new TAPNTransitionHandler(drawingSurface, (Transition) newObject, template.guiModel(), template.model());
779
transitionHandler = new TransitionHandler(drawingSurface, (Transition) newObject);
782
LabelHandler labelHandler = new LabelHandler(((Transition) newObject).getNameLabel(), (Transition) newObject);
783
((Transition) newObject).getNameLabel().addMouseListener(labelHandler);
784
((Transition) newObject).getNameLabel().addMouseMotionListener(labelHandler);
785
((Transition) newObject).getNameLabel().addMouseWheelListener(labelHandler);
787
newObject.addMouseListener(transitionHandler);
788
newObject.addMouseMotionListener(transitionHandler);
789
newObject.addMouseWheelListener(transitionHandler);
791
newObject.addMouseListener(new AnimationHandler());
793
} else if (newObject instanceof Arc) {
794
LabelHandler labelHandler = new LabelHandler(((Arc) newObject).getNameLabel(), (Arc) newObject);
795
((Arc) newObject).getNameLabel().addMouseListener(labelHandler);
796
((Arc) newObject).getNameLabel().addMouseMotionListener(labelHandler);
797
((Arc) newObject).getNameLabel().addMouseWheelListener(labelHandler);
798
/* CB - Joakim Byg add timed arcs */
799
if (newObject instanceof TimedInputArcComponent) {
800
if (newObject instanceof TimedTransportArcComponent) {
801
TransportArcHandler transportArcHandler = new TransportArcHandler(drawingSurface, (Arc) newObject);
802
newObject.addMouseListener(transportArcHandler);
803
//newObject.addMouseWheelListener(transportArcHandler);
804
newObject.addMouseMotionListener(transportArcHandler);
806
TimedArcHandler timedArcHandler = new TimedArcHandler(drawingSurface, (Arc) newObject);
807
newObject.addMouseListener(timedArcHandler);
808
//newObject.addMouseWheelListener(timedArcHandler);
809
newObject.addMouseMotionListener(timedArcHandler);
813
ArcHandler arcHandler = new ArcHandler(drawingSurface,(Arc) newObject);
814
newObject.addMouseListener(arcHandler);
815
//newObject.addMouseWheelListener(arcHandler);
816
newObject.addMouseMotionListener(arcHandler);
818
} else if (newObject instanceof AnnotationNote) {
819
AnnotationNoteHandler noteHandler = new AnnotationNoteHandler(drawingSurface, (AnnotationNote) newObject);
820
newObject.addMouseListener(noteHandler);
821
newObject.addMouseMotionListener(noteHandler);
822
((Note) newObject).getNote().addMouseListener(noteHandler);
823
((Note) newObject).getNote().addMouseMotionListener(noteHandler);
826
newObject.zoomUpdate(drawingSurface.getZoom());
829
newObject.setGuiModel(template.guiModel());
735
drawingSurface.addPNListeners(newObject, drawingSurface, template.guiModel());