Merge lp:~tapaal-contributor/tapaal/undo-redo-update-scrollbar-1875174 into lp:tapaal

Proposed by Peter Haahr Taankvist
Status: Merged
Approved by: Jiri Srba
Approved revision: 1049
Merged at revision: 1049
Proposed branch: lp:~tapaal-contributor/tapaal/undo-redo-update-scrollbar-1875174
Merge into: lp:tapaal
Diff against target: 55 lines (+7/-2)
2 files modified
src/pipe/gui/canvas/DrawingSurfaceImpl.java (+1/-1)
src/pipe/gui/undo/TranslatePetriNetObjectEdit.java (+6/-1)
To merge this branch: bzr merge lp:~tapaal-contributor/tapaal/undo-redo-update-scrollbar-1875174
Reviewer Review Type Date Requested Status
Jiri Srba Approve
Kenneth Yrke Jørgensen code Approve
Review via email: mp+383301@code.launchpad.net

Commit message

Now revalidates the drawingsurface after undoing movement of pnobjects.

To post a comment you must log in.
Revision history for this message
Jiri Srba (srba) wrote :

Works fine and can be approved for merge to trunk. Please, prepare also a separate branch for merge to 3.6.

Revision history for this message
Kenneth Yrke Jørgensen (yrke) :
review: Approve (code)
Revision history for this message
Jiri Srba (srba) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/pipe/gui/canvas/DrawingSurfaceImpl.java'
--- src/pipe/gui/canvas/DrawingSurfaceImpl.java 2020-04-18 13:18:51 +0000
+++ src/pipe/gui/canvas/DrawingSurfaceImpl.java 2020-05-02 15:34:44 +0000
@@ -675,7 +675,7 @@
675 public void translateSelection(ArrayList<PetriNetObject> objects, int transX, int transY) {675 public void translateSelection(ArrayList<PetriNetObject> objects, int transX, int transY) {
676 tabContent.getUndoManager().newEdit(); // new "transaction""676 tabContent.getUndoManager().newEdit(); // new "transaction""
677 for (PetriNetObject pnobject : objects) {677 for (PetriNetObject pnobject : objects) {
678 tabContent.getUndoManager().addEdit(new TranslatePetriNetObjectEdit(pnobject, transX, transY));678 tabContent.getUndoManager().addEdit(new TranslatePetriNetObjectEdit(pnobject, transX, transY, this));
679 }679 }
680 }680 }
681}681}
682682
=== modified file 'src/pipe/gui/undo/TranslatePetriNetObjectEdit.java'
--- src/pipe/gui/undo/TranslatePetriNetObjectEdit.java 2011-09-22 13:02:33 +0000
+++ src/pipe/gui/undo/TranslatePetriNetObjectEdit.java 2020-05-02 15:34:44 +0000
@@ -4,6 +4,7 @@
44
5package pipe.gui.undo;5package pipe.gui.undo;
66
7import pipe.gui.canvas.DrawingSurfaceImpl;
7import pipe.gui.graphicElements.PetriNetObject;8import pipe.gui.graphicElements.PetriNetObject;
8import dk.aau.cs.gui.undo.Command;9import dk.aau.cs.gui.undo.Command;
910
@@ -16,25 +17,29 @@
16 PetriNetObject pnObject;17 PetriNetObject pnObject;
17 Integer transX;18 Integer transX;
18 Integer transY;19 Integer transY;
20 DrawingSurfaceImpl ds;
1921
20 /** Creates a new instance of */22 /** Creates a new instance of */
21 public TranslatePetriNetObjectEdit(PetriNetObject _pnObject,23 public TranslatePetriNetObjectEdit(PetriNetObject _pnObject,
22 Integer _transX, Integer _transY) {24 Integer _transX, Integer _transY, DrawingSurfaceImpl drawingSurface) {
23 pnObject = _pnObject;25 pnObject = _pnObject;
24 transX = _transX;26 transX = _transX;
25 transY = _transY;27 transY = _transY;
28 ds = drawingSurface;
26 }29 }
2730
28 /** */31 /** */
29 @Override32 @Override
30 public void undo() {33 public void undo() {
31 pnObject.translate(-transX, -transY);34 pnObject.translate(-transX, -transY);
35 ds.updatePreferredSize();
32 }36 }
3337
34 /** */38 /** */
35 @Override39 @Override
36 public void redo() {40 public void redo() {
37 pnObject.translate(transX, transY);41 pnObject.translate(transX, transY);
42 ds.updatePreferredSize();
38 }43 }
3944
40 @Override45 @Override

Subscribers

People subscribed via source and target branches