Revision 21299 branches/v2_0_0_prep/applications/appgvSIG/src/com/iver/cit/gvsig/project/documents/layout/LayoutKeyEvent.java

View differences:

LayoutKeyEvent.java
4 4
import java.awt.event.KeyEvent;
5 5
import java.awt.geom.Rectangle2D;
6 6

  
7
import org.gvsig.fmap.drivers.exceptions.EditionCommandException;
8

  
9 7
import com.iver.andami.PluginServices;
10 8
import com.iver.andami.ui.mdiManager.IWindow;
11 9
import com.iver.cit.gvsig.project.documents.layout.fframes.IFFrame;
......
40 38
	}
41 39
	public static boolean paste(Layout layout) {
42 40
		IFFrame copyFFrame = null;
43
		layout.getLayoutContext().getEFS().startComplexCommand();
41
		layout.getLayoutContext().getEFS().startComplex();
44 42
		for (int i = 0; i < selectFFrames.length; i++) {
45 43
			copyFFrame = selectFFrames[i].cloneFFrame(layout);
46 44
			if (i == 0)
......
48 46
			else
49 47
				layout.getLayoutContext().addFFrame(copyFFrame, false, true);
50 48
		}
51
		layout.getLayoutContext().getEFS().endComplexCommand(
49
		layout.getLayoutContext().getEFS().endComplex(
52 50
				PluginServices.getText(layout, "paste_elements"));
53 51
		layout.getLayoutContext().callLayoutDrawListeners();
54 52
		return true;
55 53
	}
56 54
	public static boolean undo(Layout layout) {
57
		try {
58
			layout.getLayoutContext().getEFS().undo();
59
		} catch (EditionCommandException e) {
60
			e.printStackTrace();
61
		}
55
		layout.getLayoutContext().getEFS().undo();
62 56
		layout.getLayoutContext().updateFFrames();
63 57
		layout.getLayoutContext().callLayoutDrawListeners();
64 58
		PluginServices.getMainFrame().enableControls();
65 59
		return true;
66 60
	}
67 61
	public static boolean redo(Layout layout) {
68
		try {
69
			layout.getLayoutContext().getEFS().redo();
70
		} catch (EditionCommandException e) {
71
			e.printStackTrace();
72
		}
62
		layout.getLayoutContext().getEFS().redo();
73 63
		layout.getLayoutContext().updateFFrames();
74 64
		layout.getLayoutContext().callLayoutDrawListeners();
75 65
		PluginServices.getMainFrame().enableControls();
......
128 118
			if (e.getKeyCode()==KeyEvent.VK_LEFT || e.getKeyCode()==KeyEvent.VK_RIGHT || e.getKeyCode()==KeyEvent.VK_UP || e.getKeyCode()==KeyEvent.VK_DOWN) {
129 119
				if (fframes.length==0)
130 120
					return false;
131
				layout.getLayoutContext().getEFS().startComplexCommand();
121
				layout.getLayoutContext().getEFS().startComplex();
132 122
			for (int i = 0; i < fframes.length; i++) {
133 123
				IFFrame fframeAux = fframes[i].cloneFFrame(layout);
134 124
				Rectangle2D r = getRectMove(fframes[i]
135 125
						.getBoundingBox(layout.getLayoutControl().getAT()), difX, difY);
136 126
				fframeAux.setBoundBox(FLayoutUtilities.toSheetRect(r,
137 127
						layout.getLayoutControl().getAT()));
138
				layout.getLayoutContext().getEFS().modifyFFrame(fframes[i], fframeAux);
128
				layout.getLayoutContext().getEFS().update(fframes[i], fframeAux);
139 129
			}
140
			layout.getLayoutContext().getEFS().endComplexCommand(
130
			layout.getLayoutContext().getEFS().endComplex(
141 131
					PluginServices.getText(this, "move_elements"));
142 132
			layout.getLayoutContext().updateFFrames();
143 133
			layout.getLayoutControl().refresh();

Also available in: Unified diff