Revision 24962 branches/v2_0_0_prep/applications/appgvSIG/src/com/iver/cit/gvsig/project/documents/layout/LayoutKeyEvent.java
LayoutKeyEvent.java | ||
---|---|---|
4 | 4 |
import java.awt.event.KeyEvent; |
5 | 5 |
import java.awt.geom.Rectangle2D; |
6 | 6 |
|
7 |
import org.gvsig.tools.undo.RedoException; |
|
8 |
import org.gvsig.tools.undo.UndoException; |
|
9 |
|
|
7 | 10 |
import com.iver.andami.PluginServices; |
8 | 11 |
import com.iver.andami.ui.mdiManager.IWindow; |
9 | 12 |
import com.iver.cit.gvsig.project.documents.layout.fframes.IFFrame; |
... | ... | |
38 | 41 |
} |
39 | 42 |
public static boolean paste(Layout layout) { |
40 | 43 |
IFFrame copyFFrame = null; |
41 |
layout.getLayoutContext().getFrameCommandsRecord().startComplex(); |
|
44 |
layout.getLayoutContext().getFrameCommandsRecord().startComplex(PluginServices.getText(layout, "paste_elements"));
|
|
42 | 45 |
for (int i = 0; i < selectFFrames.length; i++) { |
43 | 46 |
copyFFrame = selectFFrames[i].cloneFFrame(layout); |
44 | 47 |
if (i == 0) |
... | ... | |
46 | 49 |
else |
47 | 50 |
layout.getLayoutContext().addFFrame(copyFFrame, false, true); |
48 | 51 |
} |
49 |
layout.getLayoutContext().getFrameCommandsRecord().endComplex( |
|
50 |
PluginServices.getText(layout, "paste_elements")); |
|
52 |
layout.getLayoutContext().getFrameCommandsRecord().endComplex(); |
|
51 | 53 |
layout.getLayoutContext().callLayoutDrawListeners(); |
52 | 54 |
return true; |
53 | 55 |
} |
54 | 56 |
public static boolean undo(Layout layout) { |
55 |
layout.getLayoutContext().getFrameCommandsRecord().undo(); |
|
57 |
LayoutContext lcontext=layout.getLayoutContext(); |
|
58 |
try { |
|
59 |
lcontext.getFrameCommandsRecord().undo(); |
|
60 |
} catch (UndoException e) { |
|
61 |
e.printStackTrace(); |
|
62 |
} |
|
56 | 63 |
layout.getLayoutContext().updateFFrames(); |
57 | 64 |
layout.getLayoutContext().callLayoutDrawListeners(); |
58 | 65 |
PluginServices.getMainFrame().enableControls(); |
59 | 66 |
return true; |
60 | 67 |
} |
61 | 68 |
public static boolean redo(Layout layout) { |
62 |
layout.getLayoutContext().getFrameCommandsRecord().redo(); |
|
63 |
layout.getLayoutContext().updateFFrames(); |
|
64 |
layout.getLayoutContext().callLayoutDrawListeners(); |
|
69 |
LayoutContext lcontext=layout.getLayoutContext(); |
|
70 |
try { |
|
71 |
lcontext.getFrameCommandsRecord().redo(); |
|
72 |
} catch (RedoException e) { |
|
73 |
e.printStackTrace(); |
|
74 |
} |
|
75 |
lcontext.updateFFrames(); |
|
76 |
lcontext.callLayoutDrawListeners(); |
|
65 | 77 |
PluginServices.getMainFrame().enableControls(); |
66 | 78 |
return true; |
67 | 79 |
} |
... | ... | |
118 | 130 |
if (e.getKeyCode()==KeyEvent.VK_LEFT || e.getKeyCode()==KeyEvent.VK_RIGHT || e.getKeyCode()==KeyEvent.VK_UP || e.getKeyCode()==KeyEvent.VK_DOWN) { |
119 | 131 |
if (fframes.length==0) |
120 | 132 |
return false; |
121 |
layout.getLayoutContext().getFrameCommandsRecord().startComplex(); |
|
133 |
layout.getLayoutContext().getFrameCommandsRecord().startComplex(PluginServices.getText(this, "move_elements"));
|
|
122 | 134 |
for (int i = 0; i < fframes.length; i++) { |
123 | 135 |
IFFrame fframeAux = fframes[i].cloneFFrame(layout); |
124 | 136 |
Rectangle2D r = getRectMove(fframes[i] |
... | ... | |
127 | 139 |
layout.getLayoutControl().getAT())); |
128 | 140 |
layout.getLayoutContext().getFrameCommandsRecord().update(fframes[i], fframeAux); |
129 | 141 |
} |
130 |
layout.getLayoutContext().getFrameCommandsRecord().endComplex( |
|
131 |
PluginServices.getText(this, "move_elements")); |
|
142 |
layout.getLayoutContext().getFrameCommandsRecord().endComplex(); |
|
132 | 143 |
layout.getLayoutContext().updateFFrames(); |
133 | 144 |
layout.getLayoutControl().refresh(); |
134 | 145 |
} |
Also available in: Unified diff