~tapaal-contributor/tapaal/display-shared-places-transitions-1879126

« back to all changes in this revision

Viewing changes to src/pipe/gui/undo/AddPetriNetObjectEdit.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
 
/*
2
 
 * AddPetriNetObjectEdit.java
3
 
 */
4
 
 
5
 
package pipe.gui.undo;
6
 
 
7
 
import pipe.dataLayer.DataLayer;
8
 
import pipe.gui.DrawingSurfaceImpl;
9
 
import pipe.gui.graphicElements.PetriNetObject;
10
 
import dk.aau.cs.gui.undo.Command;
11
 
 
12
 
/**
13
 
 * 
14
 
 * @author corveau
15
 
 */
16
 
public class AddPetriNetObjectEdit extends Command {
17
 
 
18
 
        PetriNetObject pnObject;
19
 
        DataLayer model;
20
 
        DrawingSurfaceImpl view;
21
 
 
22
 
        /** Creates a new instance of placeWeightEdit */
23
 
        public AddPetriNetObjectEdit(PetriNetObject _pnObject,
24
 
                        DrawingSurfaceImpl _view, DataLayer _model) {
25
 
                pnObject = _pnObject;
26
 
                view = _view;
27
 
                model = _model;
28
 
        }
29
 
 
30
 
        /** */
31
 
        @Override
32
 
        public void undo() {
33
 
                pnObject.delete();
34
 
                view.repaint();
35
 
        }
36
 
 
37
 
        /** */
38
 
        @Override
39
 
        public void redo() {
40
 
                pnObject.undelete(view);
41
 
                view.repaint();
42
 
        }
43
 
 
44
 
        @Override
45
 
        public String toString() {
46
 
                return super.toString() + " \"" + pnObject.getName() + "\"";
47
 
        }
48
 
 
49
 
}