Revision 21299 branches/v2_0_0_prep/applications/appgvSIG/src/com/iver/cit/gvsig/project/documents/layout/commands/DefaultEditableFeatureSource.java
DefaultEditableFeatureSource.java | ||
---|---|---|
44 | 44 |
import java.util.ArrayList; |
45 | 45 |
import java.util.BitSet; |
46 | 46 |
|
47 |
import org.gvsig.fmap.drivers.exceptions.EditionCommandException; |
|
48 |
import org.gvsig.fmap.drivers.writing.commands.Command; |
|
49 |
import org.gvsig.fmap.drivers.writing.commands.CommandCollection; |
|
50 |
import org.gvsig.fmap.drivers.writing.commands.CommandRecord; |
|
51 |
import org.gvsig.fmap.drivers.writing.commands.MemoryCommandRecord; |
|
47 |
import org.gvsig.data.commands.AbstractCommand; |
|
48 |
import org.gvsig.data.commands.Command; |
|
49 |
import org.gvsig.data.commands.CommandsRecord; |
|
52 | 50 |
|
53 | 51 |
import com.iver.andami.PluginServices; |
54 | 52 |
import com.iver.cit.gvsig.project.documents.layout.fframes.FFrameGroup; |
... | ... | |
63 | 61 |
*/ |
64 | 62 |
public class DefaultEditableFeatureSource implements EditableFeatureSource { |
65 | 63 |
private ArrayList<IFFrame> fframes = new ArrayList<IFFrame>(); |
66 |
private CommandRecord cr; |
|
64 |
private CommandsRecord cr;
|
|
67 | 65 |
private BitSet invalidates = new BitSet(); |
68 | 66 |
private boolean complex = false; |
69 |
private CommandCollection commands = null; |
|
70 | 67 |
private int numAdd = 0; |
71 | 68 |
|
72 | 69 |
public DefaultEditableFeatureSource() { |
73 |
this.cr = new MemoryCommandRecord();
|
|
70 |
this.cr = new FrameCommandsRecord();
|
|
74 | 71 |
} |
75 | 72 |
|
76 | 73 |
/** |
... | ... | |
100 | 97 |
*/ |
101 | 98 |
public void addFFrame(IFFrame f) { |
102 | 99 |
int virtualIndex = doAddFFrame(f); |
103 |
Command command=new AddFFrameCommand(this, f, virtualIndex);
|
|
100 |
AbstractCommand command=new InsertFrameCommand(this, f, virtualIndex);
|
|
104 | 101 |
command.setDescription(f.getNameFFrame()); |
105 | 102 |
if (complex) { |
106 | 103 |
commands.add(command); |
107 | 104 |
} else { |
108 |
cr.pushCommand(command);
|
|
105 |
cr.add(command);
|
|
109 | 106 |
PluginServices.getMainFrame().enableControls(); |
110 | 107 |
} |
111 | 108 |
} |
... | ... | |
114 | 111 |
* Undo the last command added. |
115 | 112 |
* @throws EditionCommandException |
116 | 113 |
*/ |
117 |
public void undo() throws EditionCommandException {
|
|
114 |
public void undo() { |
|
118 | 115 |
if (moreUndoCommands()) { |
119 |
cr.undoCommand();
|
|
116 |
cr.undo(); |
|
120 | 117 |
} |
121 | 118 |
} |
122 | 119 |
|
... | ... | |
124 | 121 |
* Redo the last command undid. |
125 | 122 |
* @throws EditionCommandException |
126 | 123 |
*/ |
127 |
public void redo() throws EditionCommandException {
|
|
124 |
public void redo() { |
|
128 | 125 |
if (moreRedoCommands()) { |
129 |
cr.redoCommand();
|
|
126 |
cr.redo(); |
|
130 | 127 |
} |
131 | 128 |
} |
132 | 129 |
|
... | ... | |
159 | 156 |
} |
160 | 157 |
IFFrame frame=getFFrame(index); |
161 | 158 |
doRemoveFFrame(index); |
162 |
Command command=new RemoveFFrameCommand(this, index);
|
|
159 |
AbstractCommand command=new DeleteFrameCommand(this, index);
|
|
163 | 160 |
command.setDescription(frame.getNameFFrame()); |
164 | 161 |
if (complex) { |
165 | 162 |
commands.add(command); |
166 | 163 |
} else { |
167 |
cr.pushCommand(command);
|
|
164 |
cr.add(command);
|
|
168 | 165 |
PluginServices.getMainFrame().enableControls(); |
169 | 166 |
} |
170 | 167 |
} |
... | ... | |
186 | 183 |
if (posAnt==-1) |
187 | 184 |
return false; |
188 | 185 |
int pos = doModifyFFrame(posAnt, fnew); |
189 |
Command command=new ModifyFFrameCommand(this, fnew, posAnt, pos);
|
|
186 |
AbstractCommand command=new UpdateFrameCommand(this, fnew, posAnt, pos);
|
|
190 | 187 |
command.setDescription(fant.getNameFFrame()); |
191 | 188 |
if (complex) { |
192 | 189 |
commands.add(command); |
193 | 190 |
} else { |
194 |
cr.pushCommand(command);
|
|
191 |
cr.add(command);
|
|
195 | 192 |
PluginServices.getMainFrame().enableControls(); |
196 | 193 |
} |
197 | 194 |
|
... | ... | |
387 | 384 |
* |
388 | 385 |
* @return CommandRecord. |
389 | 386 |
*/ |
390 |
public CommandRecord getCommandRecord() { |
|
387 |
public CommandsRecord getCommandRecord() {
|
|
391 | 388 |
return cr; |
392 | 389 |
} |
393 | 390 |
|
Also available in: Unified diff