svn-gvsig-desktop / branches / v2_0_0_prep / extensions / org.gvsig.app.document.layout.app / org.gvsig.app.document.layout.app.mainplugin / src / main / java / org / gvsig / app / project / documents / layout / commands / FrameCommandsRecord.java @ 36648
History | View | Annotate | Download (2.96 KB)
1 |
/* gvSIG. Geographic Information System of the Valencian Government
|
---|---|
2 |
*
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department
|
4 |
* of the Valencian Government (CIT)
|
5 |
*
|
6 |
* This program is free software; you can redistribute it and/or
|
7 |
* modify it under the terms of the GNU General Public License
|
8 |
* as published by the Free Software Foundation; either version 2
|
9 |
* of the License, or (at your option) any later version.
|
10 |
*
|
11 |
* This program is distributed in the hope that it will be useful,
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14 |
* GNU General Public License for more details.
|
15 |
*
|
16 |
* You should have received a copy of the GNU General Public License
|
17 |
* along with this program; if not, write to the Free Software
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19 |
* MA 02110-1301, USA.
|
20 |
*
|
21 |
*/
|
22 |
package org.gvsig.app.project.documents.layout.commands; |
23 |
|
24 |
import org.gvsig.app.project.documents.layout.fframes.IFFrame; |
25 |
import org.gvsig.tools.undo.command.impl.DefaultUndoRedoCommandStack; |
26 |
|
27 |
/**
|
28 |
* Clase en memoria para registrar y gestionar los comandos que vamos
|
29 |
* realizando. La forma en que ha sido implementada esta clase, en vez de una
|
30 |
* ?nica lista para albergar los comandos de deshacer(undos) y los de
|
31 |
* rehacer(redos), se ha optado por dos pilas una para deshacer(undos) y otra
|
32 |
* para rehacer(redos), de esta forma : Cuando se a?ade un nuevo comando, se
|
33 |
* inserta este a la pila de deshacer(undos) y se borra de la de
|
34 |
* rehacer(redos). Si se realiza un deshacer se desapila este comando de la
|
35 |
* pila deshacer(undos) y se apila en la de rehacer(redos). Y de la misma
|
36 |
* forma cuando se realiza un rehacer se desapila este comando de la pila de
|
37 |
* rehacer(redos) y pasa a la de deshacer(undos).
|
38 |
*
|
39 |
* @author Vicente Caballero Navarro
|
40 |
*/
|
41 |
public class FrameCommandsRecord extends DefaultUndoRedoCommandStack { |
42 |
|
43 |
private FrameManager expansionManager;
|
44 |
|
45 |
public FrameCommandsRecord(FrameManager expansionManager) {
|
46 |
this.expansionManager = expansionManager;
|
47 |
} |
48 |
|
49 |
public void insert(IFFrame frame) { |
50 |
InsertFrameCommand command = |
51 |
new InsertFrameCommand(expansionManager, frame, frame.getName());
|
52 |
add(command); |
53 |
command.execute(); |
54 |
} |
55 |
|
56 |
public void delete(IFFrame frame) { |
57 |
DeleteFrameCommand command = |
58 |
new DeleteFrameCommand(expansionManager, frame, frame.getName());
|
59 |
add(command); |
60 |
command.execute(); |
61 |
} |
62 |
|
63 |
public void update(IFFrame frame, IFFrame oldFrame) { |
64 |
UpdateFrameCommand command = |
65 |
new UpdateFrameCommand(expansionManager, frame, oldFrame,
|
66 |
frame.getName()); |
67 |
add(command); |
68 |
command.execute(); |
69 |
} |
70 |
|
71 |
public void clear() { |
72 |
super.clear();
|
73 |
expansionManager.clear(); |
74 |
} |
75 |
|
76 |
public FrameManager getFrameManager() {
|
77 |
return expansionManager;
|
78 |
} |
79 |
|
80 |
} |