File: /Users/shatabdi/Education/GitHub/se450_project/src/model/commands/ShapeGroupCommand.java
1 package model.commands;
2
3 import controller.interfaces.ICommand;
4 import controller.interfaces.IUndoable;
5 import model.shape.GroupShape;
6
7 public class ShapeGroupCommand implements ICommand, IUndoable {
8 GroupShape groupShape;
9
10 public ShapeGroupCommand(GroupShape groupShape) {
11 this.groupShape = groupShape;
12 }
13
14 @Override
15 public void redo() {
16 groupShape.redo();
17 }
18
19 @Override
20 public void run() {
21 boolean result = !CommandHistory.shapesSelected.getList().isEmpty();
22 if (result) {
23 groupShape.group();
24 CommandHistory.add(this);
25 }
26 }
27
28 @Override
29 public void undo() {
30 groupShape.undo();
31 }
32
33 }
34