~tapaal-contributor/tapaal/disappearing-tokens-1940098

« back to all changes in this revision

Viewing changes to src/dk/aau/cs/gui/undo/AddPetriNetControlCommand.java

  • Committer: Kenneth Yrke Jørgensen
  • Date: 2011-04-12 09:50:16 UTC
  • mfrom: (329.1.188 tapaal-1.5)
  • Revision ID: mail@yrke.dk-20110412095016-e4hqdgab5596ja09
Merged with branch addning support for new 1.5 features

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
package dk.aau.cs.gui.undo;
 
2
 
 
3
import dk.aau.cs.gui.DrawingSurface;
 
4
import dk.aau.cs.gui.components.PetriNetElementControl;
 
5
 
 
6
public class AddPetriNetControlCommand extends Command {
 
7
        private PetriNetElementControl control;
 
8
        private DrawingSurface surface;
 
9
 
 
10
        public AddPetriNetControlCommand(PetriNetElementControl control,
 
11
                        DrawingSurface surface) {
 
12
                this.surface = surface;
 
13
                this.control = control;
 
14
        }
 
15
 
 
16
        @Override
 
17
        public void redo() {
 
18
                control.addChildControls();
 
19
                surface.add(control);
 
20
                // surface.surfaceChanged();
 
21
        }
 
22
 
 
23
        @Override
 
24
        public void undo() {
 
25
                control.removeChildControls();
 
26
                surface.remove(control);
 
27
                // surface.surfaceChanged();
 
28
        }
 
29
}