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

« back to all changes in this revision

Viewing changes to src/pipe/gui/undo/AddTimedPlaceCommand.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 pipe.gui.undo;
 
2
 
 
3
import pipe.dataLayer.DataLayer;
 
4
import pipe.dataLayer.TimedPlaceComponent;
 
5
import pipe.gui.DrawingSurfaceImpl;
 
6
import dk.aau.cs.model.tapn.TimedArcPetriNet;
 
7
 
 
8
public class AddTimedPlaceCommand extends TAPNElementCommand {
 
9
        final TimedPlaceComponent timedPlace;
 
10
 
 
11
        public AddTimedPlaceCommand(TimedPlaceComponent timedPlace,
 
12
                        TimedArcPetriNet tapn, DataLayer guiModel, DrawingSurfaceImpl view) {
 
13
                super(tapn, guiModel, view);
 
14
                this.timedPlace = timedPlace;
 
15
        }
 
16
 
 
17
        @Override
 
18
        public void undo() {
 
19
                tapn.remove(timedPlace.underlyingPlace());
 
20
                timedPlace.delete();
 
21
                view.repaint();
 
22
        }
 
23
 
 
24
        @Override
 
25
        public void redo() {
 
26
                timedPlace.undelete(view);
 
27
                tapn.add(timedPlace.underlyingPlace());
 
28
                view.repaint();
 
29
        }
 
30
}