1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.vectomatic.client.rep.command;
19
20 import org.vectomatic.client.rep.RepApplication;
21 import org.vectomatic.client.rep.controller.RepresentationController;
22 import org.vectomatic.common.rpc.Representation;
23
24
25
26
27 public class ResizeDrawingCommand extends CommandBase {
28 private RepresentationController _controller;
29 private int _width;
30 private int _height;
31
32 public ResizeDrawingCommand(RepApplication app, RepresentationController controller, int width, int height) {
33 super(app);
34 _controller = controller;
35 _width = width;
36 _height = height;
37 }
38
39 public String getDescription() {
40 return _app.getConstants().resizeDrawingCommand();
41 }
42
43 public void execute() {
44 run();
45 }
46
47 public void unexecute() {
48 run();
49 }
50
51 private void run() {
52 Representation rep = _controller.getCurrentRep();
53 int width = rep.getWidth();
54 int height = rep.getHeight();
55 rep.setWidth(_width);
56 rep.setHeight(_height);
57 _width = width;
58 _height = height;
59 }
60
61 }