~yrke/tapaal/slimImageIcons-2

« back to all changes in this revision

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