~tapaal-contributor/tapaal/update-zoom-percentage-on-ctrl+scroll-1785023

« back to all changes in this revision

Viewing changes to src/pipe/gui/graphicElements/tapn/TimedInputArcComponent.java

Merged bzr merge lp:~yrke/tapaal/placetransitionobjecthandler-refactor with cleanup 
and refactorings of elements and handlers

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
        public TimedInputArcComponent(PlaceTransitionObject source) {
35
35
                super(source);
36
36
                init();
37
 
        }
38
 
 
39
 
        private void init() {
40
 
                timeInterval = "[0,inf)";
41
 
                updateLabel(true);
 
37
 
 
38
                //XXX: se note in funcation
 
39
                addMouseHandler();
 
40
 
42
41
        }
43
42
 
44
43
        public TimedInputArcComponent(TimedOutputArcComponent arc) {
45
44
                super(arc);
46
45
                init();
 
46
 
 
47
                //XXX: se note in funcation
 
48
                addMouseHandler();
 
49
 
47
50
        }
48
51
 
49
52
        public TimedInputArcComponent(TimedOutputArcComponent arc, String guard) {
50
53
                super(arc);
51
54
                timeInterval = guard;
52
55
                updateLabel(true);
 
56
 
 
57
                //XXX: se note in funcation
 
58
                addMouseHandler();
 
59
 
 
60
        }
 
61
 
 
62
        private void init() {
 
63
                timeInterval = "[0,inf)";
 
64
                updateLabel(true);
 
65
        }
 
66
 
 
67
        private void addMouseHandler() {
 
68
                //XXX: kyrke 2018-09-06, this is bad as we leak "this", think its ok for now, as it alwas constructed when
 
69
                //XXX: handler is called. Make static constructor and add handler from there, to make it safe.
 
70
                mouseHandler = new TimedArcHandler(this);
53
71
        }
54
72
 
55
73
        @Override
147
165
        }
148
166
 
149
167
        @Override
150
 
        public TimedInputArcComponent copy() {
151
 
                return new TimedInputArcComponent(new TimedOutputArcComponent(this), timeInterval);
152
 
        }
153
 
 
154
 
        @Override
155
 
        public TimedInputArcComponent paste(double despX, double despY, boolean toAnotherView) {
156
 
                TimedOutputArcComponent copy = new TimedOutputArcComponent(this);
157
 
                copy.setSource(this.getSource());
158
 
                copy.setTarget(this.getTarget());
159
 
                TimedInputArcComponent timedCopy = new TimedInputArcComponent(copy.paste(despX, despY, toAnotherView), timeInterval);
160
 
                return timedCopy;
161
 
        }
162
 
 
163
 
        @Override
164
168
        public void setLabelPosition() {
165
169
                /*label.setPosition((int) (myPath.midPoint.x + nameOffsetX)
166
170
                                + label.getWidth() / 2 - 4, (int) (myPath.midPoint.y + nameOffsetY)
188
192
                arc.getSource().addConnectFrom(arc);
189
193
                arc.getTarget().addConnectTo(arc);
190
194
                
191
 
                TimedArcHandler timedArcHandler = new TimedArcHandler((DrawingSurfaceImpl)getParent(), arc);
192
 
                arc.addMouseListener(timedArcHandler);
193
 
                //arc.addMouseWheelListener(timedArcHandler);
194
 
                arc.addMouseMotionListener(timedArcHandler);
195
 
                
196
195
                arc.setGuiModel(guiModel);
197
196
                
198
197
                return arc;