~yrke/tapaal/slimImageIcons-2

« back to all changes in this revision

Viewing changes to src/pipe/gui/undo/AddTimedInputArcCommand.java

  • Committer: Jiri Srba
  • Date: 2020-04-28 19:15:28 UTC
  • mfrom: (998.2.376 testbranch)
  • Revision ID: srba@cs.aau.dk-20200428191528-3xxjqa1r4jcob5ur
merged in lp:~yrke/tapaal/testbranch doing majour refactoring of the GUI

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
package pipe.gui.undo;
2
2
 
3
3
import pipe.dataLayer.DataLayer;
4
 
import pipe.gui.DrawingSurfaceImpl;
5
4
import pipe.gui.graphicElements.tapn.TimedInputArcComponent;
6
5
import dk.aau.cs.model.tapn.TimedArcPetriNet;
7
6
 
8
7
public class AddTimedInputArcCommand extends TAPNElementCommand {
9
8
        private final TimedInputArcComponent timedArc;
10
9
 
11
 
        public AddTimedInputArcCommand(TimedInputArcComponent timedArc,
12
 
                        TimedArcPetriNet tapn, DataLayer guiModel, DrawingSurfaceImpl view) {
13
 
                super(tapn, guiModel, view);
 
10
        public AddTimedInputArcCommand(TimedInputArcComponent timedArc, TimedArcPetriNet tapn, DataLayer guiModel) {
 
11
                super(tapn, guiModel);
14
12
                this.timedArc = timedArc;
15
13
        }
16
14
 
17
15
        @Override
18
16
        public void undo() {
19
 
                timedArc.delete();
20
 
                view.repaint();
 
17
                timedArc.underlyingTimedInputArc().delete();
 
18
 
 
19
                guiModel.removePetriNetObject(timedArc);
21
20
        }
22
21
 
23
22
        @Override
24
23
        public void redo() {
25
 
                timedArc.undelete(view);
 
24
                guiModel.addPetriNetObject(timedArc);
 
25
 
26
26
                tapn.add(timedArc.underlyingTimedInputArc());
27
 
                view.repaint();
28
27
        }
29
28
}