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

« back to all changes in this revision

Viewing changes to src/pipe/gui/handler/PlaceTransitionObjectHandler.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:
44
44
 
45
45
public class PlaceTransitionObjectHandler extends PetriNetObjectHandler {
46
46
        private static final String ERROR_MSG_TWO_ARCS = "We do not allow two arcs from a place to a transition or a transition to a place.";
47
 
        private DataLayer guiModel;
48
 
        private TimedArcPetriNet model;
49
 
 
50
 
        public PlaceTransitionObjectHandler(Container contentpane,
51
 
                        PlaceTransitionObject obj, DataLayer guiModel,
52
 
                        TimedArcPetriNet model) {
53
 
                this(contentpane, obj);
54
 
                this.guiModel = guiModel;
55
 
                this.model = model;
56
 
        }
57
47
 
58
48
        // constructor passing in all required objects
59
 
        public PlaceTransitionObjectHandler(Container contentpane,
60
 
                        PlaceTransitionObject obj) {
61
 
                super(contentpane, obj);
 
49
        public PlaceTransitionObjectHandler(PlaceTransitionObject obj) {
 
50
                super(obj);
62
51
                enablePopup = true;
63
52
        }
64
53
 
65
54
        private void createArc(Arc newArc, PlaceTransitionObject currentObject) {
66
55
                newArc.setZoom(CreateGui.getDrawingSurface().getZoom());
67
 
                contentPane.add(newArc);
 
56
                //Need to be casted to cointainer, as we only add it to the canvas but not the model
 
57
                ((Container)CreateGui.getDrawingSurface()).add(newArc);
68
58
                currentObject.addConnectFrom(newArc);
69
59
                CreateGui.getDrawingSurface().createArc = newArc;
70
60
                // addPetriNetObject a handler for shift & esc actions drawing arc
115
105
                                boolean isInPreSet = false;
116
106
                                if (currentObject instanceof Place) {
117
107
                                        isInPreSet = true;
118
 
                                        Arc arc = new TimedTransportArcComponent(currentObject, 1,
119
 
                                                        isInPreSet);
 
108
                                        Arc arc = new TimedTransportArcComponent(currentObject, 1, isInPreSet);
120
109
                                        createArc(arc, currentObject);
121
110
                                }
122
111
                                break;
135
124
                super.mouseReleased(e);
136
125
 
137
126
                PlaceTransitionObject currentObject = (PlaceTransitionObject) myObject;
138
 
                
139
 
                if (view.createArc == null){
 
127
 
 
128
                Arc createArc = view.createArc;
 
129
                if (createArc == null){
140
130
                        //If we have no arc, we have nothing to do
141
131
                        return;
142
132
                }
143
133
 
144
134
                //Check if the mouse was moved since key down event, and we are looking at the target
145
135
                //Break the drawing if this is the case
146
 
                Arc createArc = view.createArc; 
147
 
                if (createArc != null && currentObject != createArc.getSource()){
148
 
                if (createArc.getTarget() == null) {
149
 
                        cleanupArc(createArc, view);
150
 
                        return;
151
 
                }
 
136
                if (currentObject != createArc.getSource()){
 
137
                        if (createArc.getTarget() == null) {
 
138
                                cleanupArc(createArc, view);
 
139
                                return;
 
140
                        }
152
141
                }
153
142
                
154
143
                switch (app.getMode()) {
163
152
                                                                ((TimedTransitionComponent) createTAPNInhibitorArc
164
153
                                                                                .getTarget()).underlyingTransition(),
165
154
                                                                TimeInterval.ZERO_INF);
166
 
                                                model.add(tia);
 
155
                                                view.getModel().add(tia);
167
156
                                                createTAPNInhibitorArc.setUnderlyingArc(tia);
168
157
                                                createTAPNInhibitorArc.updateLabel(true);
169
158
                                        } catch (RequireException ex) {
183
172
                                        createTAPNInhibitorArc.getTransition().updateConnected();
184
173
 
185
174
                                        // Evil hack to prevent the arc being added to GuiView twice
186
 
                                        contentPane.remove(createTAPNInhibitorArc);
 
175
                                        //Need to be casted to cointainer, as we only add it to the canvas but not the model
 
176
                                        ((Container)CreateGui.getDrawingSurface()).remove(createTAPNInhibitorArc);
187
177
 
188
 
                                        guiModel.addArc(createTAPNInhibitorArc);
 
178
                                        view.getGuiModel().addArc(createTAPNInhibitorArc);
189
179
 
190
180
                                        view.addNewPetriNetObject(createTAPNInhibitorArc);
191
181
 
192
 
                                        undoManager.addNewEdit(new AddTimedInhibitorArcCommand(
193
 
                                                        createTAPNInhibitorArc, model, guiModel, view));
 
182
                                        undoManager.addNewEdit(
 
183
                                                        new AddTimedInhibitorArcCommand(createTAPNInhibitorArc, view.getModel(), view.getGuiModel(), view)
 
184
                                        );
194
185
 
195
186
                                        freeArc(createTAPNInhibitorArc);
196
187
                                }
200
191
 
201
192
                        Arc transportArcToCreate = view.createArc;
202
193
 
203
 
                                if (currentObject != transportArcToCreate.getSource()) {
204
 
 
205
 
                                        transportArcToCreate.setSelectable(true);
206
 
 
207
 
                                        // This is the first step
208
 
                                        if (transportArcToCreate.getSource() instanceof Place) {
209
 
 
210
 
                                                // mikaelhm - Dont allow a transport arc from place to
211
 
                                                // transition if there is another arc.
212
 
                                                boolean existsArc = false;
213
 
 
214
 
                                                // Check if arc has leagal target
215
 
                                                PlaceTransitionObject target = transportArcToCreate
216
 
                                                                .getTarget();
217
 
                                                if (!(target instanceof Transition && target != null)) {
218
 
                                                        System.err.println("Error creating transport arc, invalid target");
219
 
                                                        transportArcToCreate.delete();
220
 
                                                        break;
221
 
                                                }
222
 
 
223
 
                                                Iterator<Arc> arcsFrom = transportArcToCreate
224
 
                                                                .getSource().getConnectFromIterator();
225
 
                                                // search for pre-existent arcs from transportArcToCreate's source to
226
 
                                                // transportArcToCreate's target
227
 
                                                while (arcsFrom.hasNext()) {
228
 
                                                        Arc someArc = (arcsFrom.next());
229
 
                                                        if (someArc == transportArcToCreate) {
230
 
                                                                break;
231
 
                                                        } else if (someArc.getSource() == transportArcToCreate.getSource() && someArc.getTarget() == currentObject) {
232
 
                                                                existsArc = true;
233
 
 
234
 
                                                                if (someArc instanceof TimedInhibitorArcComponent) {
235
 
                                                                        // user has drawn a transport arc where there is
236
 
                                                                        // a TAPNInhibitorArc arc already - This does not make sense.
237
 
                                                                        cleanupArc(transportArcToCreate, view);
238
 
                                                                        System.out.println(ERROR_MSG_TWO_ARCS);
239
 
                                                                        JOptionPane.showMessageDialog(
240
 
                                                                                                        CreateGui.getApp(),
241
 
                                                                                                        ERROR_MSG_TWO_ARCS,
242
 
                                                                                                        "Error",
243
 
                                                                                                        JOptionPane.ERROR_MESSAGE);
244
 
 
245
 
                                                                } else if (someArc instanceof TimedTransportArcComponent) {
246
 
                                                                        // user has drawn a transport arc where there is
247
 
                                                                        // a transport arc already - We do not allow that.
248
 
                                                                        cleanupArc(transportArcToCreate, view);
249
 
                                                                        System.out.println(ERROR_MSG_TWO_ARCS);
250
 
                                                                        JOptionPane.showMessageDialog(CreateGui
251
 
                                                                                        .getApp(), ERROR_MSG_TWO_ARCS,
252
 
                                                                                        "Error", JOptionPane.ERROR_MESSAGE);
253
 
 
254
 
                                                                } else if (someArc instanceof TimedOutputArcComponent) {
255
 
                                                                        // user has drawn a transport arc where there is
256
 
                                                                        // a normal arc already - We do not allow that.
257
 
                                                                        cleanupArc(transportArcToCreate, view);
258
 
                                                                        System.out.println(ERROR_MSG_TWO_ARCS);
259
 
                                                                        JOptionPane.showMessageDialog(CreateGui
260
 
                                                                                        .getApp(), ERROR_MSG_TWO_ARCS,
261
 
                                                                                        "Error", JOptionPane.ERROR_MESSAGE);
262
 
 
263
 
                                                                }
264
 
                                                                break;
265
 
                                                        }
266
 
                                                }
267
 
                                                if (existsArc) {
268
 
                                                        transportArcToCreate.delete();
269
 
                                                        break;
270
 
                                                }
271
 
 
272
 
                                                int groupMaxCounter = 0;
273
 
 
274
 
                                                for (Object pt : transportArcToCreate.getTarget()
275
 
                                                                .getPostset()) {
276
 
                                                        if (pt instanceof TimedTransportArcComponent) {
277
 
                                                                if (((TimedTransportArcComponent) pt).getGroupNr() > groupMaxCounter) {
278
 
                                                                        groupMaxCounter = ((TimedTransportArcComponent) pt).getGroupNr();
279
 
                                                                }
280
 
                                                        }
281
 
                                                }
282
 
 
283
 
                                                ((TimedTransportArcComponent) transportArcToCreate).setGroupNr(groupMaxCounter + 1);
284
 
 
285
 
                                                currentObject.addConnectTo(transportArcToCreate);
286
 
 
287
 
                                                // Evil hack to prevent the arc being added to GuiView
288
 
                                                // twice
289
 
                                                contentPane.remove(transportArcToCreate);
290
 
 
291
 
                                                guiModel.addArc((TimedOutputArcComponent) transportArcToCreate);
292
 
                                                view.addNewPetriNetObject(transportArcToCreate);
293
 
 
294
 
                                                freeArc(transportArcToCreate);
295
 
                                                
296
 
                                                // Create the next arc
297
 
                                                TimedTransportArcComponent arc2 = new TimedTransportArcComponent(currentObject, groupMaxCounter + 1, false);
298
 
                                                
299
 
                                                //Update the partners for the arcs
300
 
                                                TimedTransportArcComponent arc1 = ((TimedTransportArcComponent) transportArcToCreate);
301
 
                                                
302
 
                                                arc2.setConnectedTo(arc1);
303
 
                                                arc1.setConnectedTo(arc2);
304
 
                                                                                
305
 
                                                //Draw part 2 of the transport arc
306
 
                                                createArc(arc2, currentObject);
307
 
                                                
308
 
 
309
 
                                        } else if (transportArcToCreate.getSource() instanceof Transition) {
310
 
                                                
311
 
                                                TimedTransportArcComponent arc2 = (TimedTransportArcComponent) transportArcToCreate;
312
 
                                                TimedTransportArcComponent arc1 = arc2.getConnectedTo();
313
 
                                                
314
 
                                                dk.aau.cs.model.tapn.TransportArc ta;
315
 
                                                try {
316
 
                                                        ta = new dk.aau.cs.model.tapn.TransportArc(
317
 
                                                                        ((TimedPlaceComponent) arc1.getSource()).underlyingPlace(),
318
 
                                                                        ((TimedTransitionComponent) arc2.getSource()).underlyingTransition(),
319
 
                                                                        ((TimedPlaceComponent) arc2.getTarget()).underlyingPlace(),
320
 
                                                                        TimeInterval.ZERO_INF);
321
 
                                                        model.add(ta);
322
 
                                                        ((TimedTransportArcComponent) transportArcToCreate).setUnderlyingArc(ta);
323
 
                                                        arc1.setUnderlyingArc(ta);
324
 
                                                        arc1.updateLabel(true);
325
 
                                                        ((TimedTransportArcComponent) transportArcToCreate).updateLabel(true);
326
 
                                                } catch (RequireException ex) {
327
 
                                                        cleanupArc(arc1, view);
328
 
                                                        cleanupArc(arc2, view);
 
194
                        if (currentObject != transportArcToCreate.getSource()) {
 
195
 
 
196
                                transportArcToCreate.setSelectable(true);
 
197
 
 
198
                                // This is the first step
 
199
                                if (transportArcToCreate.getSource() instanceof Place) {
 
200
 
 
201
                                        // mikaelhm - Dont allow a transport arc from place to
 
202
                                        // transition if there is another arc.
 
203
                                        boolean existsArc = false;
 
204
 
 
205
                                        // Check if arc has leagal target
 
206
                                        PlaceTransitionObject target = transportArcToCreate.getTarget();
 
207
                                        if (!(target instanceof Transition)) {
 
208
                                                transportArcToCreate.delete();
 
209
                                                break;
 
210
                                        }
 
211
 
 
212
                                        Iterator<Arc> arcsFrom = transportArcToCreate.getSource().getConnectFromIterator();
 
213
                                        // search for pre-existent arcs from transportArcToCreate's source to
 
214
                                        // transportArcToCreate's target
 
215
                                        while (arcsFrom.hasNext()) {
 
216
                                                Arc someArc = (arcsFrom.next());
 
217
                                                if (someArc == transportArcToCreate) {
 
218
                                                        break;
 
219
                                                } else if (someArc.getSource() == transportArcToCreate.getSource() && someArc.getTarget() == currentObject) {
 
220
                                                        existsArc = true;
 
221
 
 
222
                                                        // There already is a arc between this place and transition
 
223
                                                        cleanupArc(transportArcToCreate, view);
329
224
                                                        JOptionPane.showMessageDialog(
330
 
                                                                                        CreateGui.getApp(),
331
 
                                                                                        "There was an error drawing the arc. Possible problems:\n"
332
 
                                                                                                        + " - There is already an arc between the source place and transition\n"
333
 
                                                                                                        + " - There is already an arc between the transtion and the target place\n"
334
 
                                                                                                        + " - You are attempting to draw an arc between a shared transition and a shared place",
335
 
                                                                                        "Error", JOptionPane.ERROR_MESSAGE);
336
 
                                                        break;
337
 
                                                }
338
 
 
339
 
                                                // Evil hack to prevent the arc being added to GuiView
340
 
                                                // twice
341
 
                                                contentPane.remove(arc2);
342
 
 
343
 
                                                guiModel.addArc(arc2);
344
 
                                                view.addNewPetriNetObject(arc2);
345
 
                                                
346
 
                                                currentObject.addConnectTo(arc2);
347
 
                                                
348
 
                                                undoManager.newEdit();
349
 
 
350
 
                                                undoManager.addEdit(
351
 
                                                                new AddTransportArcCommand(
352
 
                                                                                arc2,
353
 
                                                                                arc2.underlyingTransportArc(), 
354
 
                                                                                model, 
355
 
                                                                                guiModel, 
356
 
                                                                                view));
357
 
 
358
 
                                                freeArc(transportArcToCreate);
359
 
 
360
 
                                                arc2.setGroupNr(arc1.getGroupNr());
361
 
                                        }
362
 
 
 
225
                                                                        CreateGui.getApp(),
 
226
                                                                        ERROR_MSG_TWO_ARCS,
 
227
                                                                        "Error",
 
228
                                                                        JOptionPane.ERROR_MESSAGE);
 
229
                                                }
 
230
                                        }
 
231
                                        if (existsArc) {
 
232
                                                transportArcToCreate.delete();
 
233
                                                break;
 
234
                                        }
 
235
 
 
236
                                        int groupMaxCounter = 0;
 
237
 
 
238
                                        for (Object pt : transportArcToCreate.getTarget().getPostset()) {
 
239
                                                if (pt instanceof TimedTransportArcComponent) {
 
240
                                                        if (((TimedTransportArcComponent) pt).getGroupNr() > groupMaxCounter) {
 
241
                                                                groupMaxCounter = ((TimedTransportArcComponent) pt).getGroupNr();
 
242
                                                        }
 
243
                                                }
 
244
                                        }
 
245
 
 
246
                                        ((TimedTransportArcComponent) transportArcToCreate).setGroupNr(groupMaxCounter + 1);
 
247
 
 
248
                                        currentObject.addConnectTo(transportArcToCreate);
 
249
 
 
250
                                        // Evil hack to prevent the arc being added to GuiView twice
 
251
                                        //Need to be casted to cointainer, as we only add it to the canvas but not the model
 
252
                                        ((Container) CreateGui.getDrawingSurface()).remove(transportArcToCreate);
 
253
 
 
254
                                        view.getGuiModel().addArc((TimedOutputArcComponent) transportArcToCreate);
 
255
                                        view.addNewPetriNetObject(transportArcToCreate);
 
256
 
 
257
                                        freeArc(transportArcToCreate);
 
258
 
 
259
                                        // Create the next arc
 
260
                                        TimedTransportArcComponent arc2 = new TimedTransportArcComponent(currentObject, groupMaxCounter + 1, false);
 
261
 
 
262
                                        //Update the partners for the arcs
 
263
                                        TimedTransportArcComponent arc1 = ((TimedTransportArcComponent) transportArcToCreate);
 
264
 
 
265
                                        arc2.setConnectedTo(arc1);
 
266
                                        arc1.setConnectedTo(arc2);
 
267
 
 
268
                                        //Draw part 2 of the transport arc
 
269
                                        createArc(arc2, currentObject);
 
270
 
 
271
 
 
272
                                } else if (transportArcToCreate.getSource() instanceof Transition) {
 
273
 
 
274
                                        TimedTransportArcComponent arc2 = (TimedTransportArcComponent) transportArcToCreate;
 
275
                                        TimedTransportArcComponent arc1 = arc2.getConnectedTo();
 
276
 
 
277
                                        dk.aau.cs.model.tapn.TransportArc ta;
 
278
                                        try {
 
279
                                                ta = new dk.aau.cs.model.tapn.TransportArc(
 
280
                                                                ((TimedPlaceComponent) arc1.getSource()).underlyingPlace(),
 
281
                                                                ((TimedTransitionComponent) arc2.getSource()).underlyingTransition(),
 
282
                                                                ((TimedPlaceComponent) arc2.getTarget()).underlyingPlace(),
 
283
                                                                TimeInterval.ZERO_INF);
 
284
                                                view.getModel().add(ta);
 
285
                                                ((TimedTransportArcComponent) transportArcToCreate).setUnderlyingArc(ta);
 
286
                                                arc1.setUnderlyingArc(ta);
 
287
                                                arc1.updateLabel(true);
 
288
                                                ((TimedTransportArcComponent) transportArcToCreate).updateLabel(true);
 
289
                                        } catch (RequireException ex) {
 
290
                                                cleanupArc(arc1, view);
 
291
                                                cleanupArc(arc2, view);
 
292
                                                JOptionPane.showMessageDialog(
 
293
                                                                CreateGui.getApp(),
 
294
                                                                "There was an error drawing the arc. Possible problems:\n"
 
295
                                                                                + " - There is already an arc between the source place and transition\n"
 
296
                                                                                + " - There is already an arc between the transtion and the target place\n"
 
297
                                                                                + " - You are attempting to draw an arc between a shared transition and a shared place",
 
298
                                                                "Error", JOptionPane.ERROR_MESSAGE);
 
299
                                                break;
 
300
                                        }
 
301
 
 
302
                                        // Evil hack to prevent the arc being added to GuiView twice
 
303
                                        //Need to be casted to cointainer, as we only add it to the canvas but not the model
 
304
                                        ((Container) CreateGui.getDrawingSurface()).remove(arc2);
 
305
 
 
306
                                        view.getGuiModel().addArc(arc2);
 
307
                                        view.addNewPetriNetObject(arc2);
 
308
 
 
309
                                        currentObject.addConnectTo(arc2);
 
310
 
 
311
                                        undoManager.newEdit();
 
312
 
 
313
                                        undoManager.addEdit(
 
314
                                                        new AddTransportArcCommand(
 
315
                                                                        arc2,
 
316
                                                                        arc2.underlyingTransportArc(),
 
317
                                                                        view.getModel(),
 
318
                                                                        view.getGuiModel(),
 
319
                                                                        view));
 
320
 
 
321
                                        freeArc(transportArcToCreate);
 
322
 
 
323
                                        arc2.setGroupNr(arc1.getGroupNr());
363
324
                                }
364
325
 
 
326
                        }
 
327
 
365
328
 
366
329
                        break;
367
330
                case TAPNARC:
380
343
                                                TimedOutputArcComponent outputArc = (TimedOutputArcComponent) timedArcToCreate;
381
344
                                                
382
345
                                                try {
383
 
                                                        if(hasArcFromTransitionToPlace(model,((TimedTransitionComponent) outputArc.getSource()), ((TimedPlaceComponent) outputArc.getTarget()))){
 
346
                                                        if(hasArcFromTransitionToPlace(view.getModel(),((TimedTransitionComponent) outputArc.getSource()), ((TimedPlaceComponent) outputArc.getTarget()))){
384
347
                                                                throw new RequireException(ERROR_MSG_TWO_ARCS);
385
348
                                                        }
386
349
                                                        
387
350
                                                        dk.aau.cs.model.tapn.TimedOutputArc timedOutputArc = new TimedOutputArc(
388
351
                                                                        ((TimedTransitionComponent) outputArc.getSource()).underlyingTransition(),
389
352
                                                                        ((TimedPlaceComponent) outputArc.getTarget()).underlyingPlace());
390
 
                                                        model.add(timedOutputArc);
 
353
                                                        view.getModel().add(timedOutputArc);
391
354
                                                        outputArc.setUnderlyingArc(timedOutputArc);
392
355
                                                        outputArc.updateLabel(true);
393
356
                                                } catch (RequireException ex) {
402
365
                                                }
403
366
                                                currentObject.addConnectTo(timedArcToCreate);
404
367
 
405
 
                                                // Evil hack to prevent the arc being added to GuiView
406
 
                                                // twice
407
 
                                                contentPane.remove(timedArcToCreate);
 
368
                                                // Evil hack to prevent the arc being added to GuiView twice
 
369
                                                //Need to be casted to cointainer, as we only add it to the canvas but not the model
 
370
                                                ((Container)CreateGui.getDrawingSurface()).remove(timedArcToCreate);
408
371
 
409
 
                                                guiModel.addArc((TimedOutputArcComponent) timedArcToCreate);
 
372
                                                view.getGuiModel().addArc((TimedOutputArcComponent) timedArcToCreate);
410
373
                                                view.addNewPetriNetObject(timedArcToCreate);
411
374
                                                
412
375
                                                undoManager.newEdit(); // new "transaction""
413
376
                                                
414
377
                                                undoManager.addEdit(new AddTimedOutputArcCommand(
415
378
                                                                (TimedOutputArcComponent) timedArcToCreate,
416
 
                                                                model, guiModel, view));
 
379
                                                                view.getModel(), view.getGuiModel(), view));
417
380
 
418
381
                                                // else source is a place (not transition)
419
382
                                        } else {
421
384
                                                // Set underlying TimedInputArc
422
385
                                                TimedInputArcComponent timedArc = (TimedInputArcComponent) timedArcToCreate;
423
386
                                                try {
424
 
                                                        if(hasArcFromPlaceToTransition(model,((TimedPlaceComponent) timedArc.getSource()), ((TimedTransitionComponent) timedArc.getTarget()))){
 
387
                                                        if(hasArcFromPlaceToTransition(view.getModel(),((TimedPlaceComponent) timedArc.getSource()), ((TimedTransitionComponent) timedArc.getTarget()))){
425
388
                                                                throw new RequireException("Cannot have two arcs between the same place and transition");
426
389
                                                        }
427
390
                                                        
429
392
                                                                        ((TimedPlaceComponent) timedArc.getSource()).underlyingPlace(),
430
393
                                                                        ((TimedTransitionComponent) timedArc.getTarget()).underlyingTransition(),
431
394
                                                                        TimeInterval.ZERO_INF);
432
 
                                                        model.add(tia);
 
395
                                                        view.getModel().add(tia);
433
396
                                                        timedArc.setUnderlyingArc(tia);
434
397
                                                        timedArc.updateLabel(true);
435
398
                                                } catch (RequireException ex) {
447
410
                                                currentObject.addConnectTo(timedArcToCreate);
448
411
                                                timedArcToCreate.getTransition().updateConnected();
449
412
 
450
 
                                                // Evil hack to prevent the arc being added to GuiView
451
 
                                                // twice
452
 
                                                contentPane.remove(timedArcToCreate);
453
 
                                                guiModel
454
 
                                                                .addArc((TimedOutputArcComponent) timedArcToCreate);
 
413
                                                // Evil hack to prevent the arc being added to GuiView twice
 
414
                                                //Need to be casted to cointainer, as we only add it to the canvas but not the model
 
415
                                                ((Container)CreateGui.getDrawingSurface()).remove(timedArcToCreate);
 
416
                                                view.getGuiModel().addArc((TimedOutputArcComponent) timedArcToCreate);
455
417
                                                view.addNewPetriNetObject(timedArcToCreate);
456
418
 
457
419
                                                undoManager.newEdit(); // new "transaction""
458
420
 
459
421
                                                undoManager.addEdit(new AddTimedInputArcCommand(
460
422
                                                                (TimedInputArcComponent) timedArcToCreate,
461
 
                                                                model, guiModel, view));
 
423
                                                                view.getModel(), view.getGuiModel(), view));
462
424
 
463
425
                                        }
464
426