Statistics
| Revision:

svn-gvsig-desktop / tags / v1_0_2_Build_910 / libraries / libFMap / src / com / iver / cit / gvsig / fmap / edition / commands / AddRowCommand.java @ 11275

History | View | Annotate | Download (1.22 KB)

1 3652 fjp
package com.iver.cit.gvsig.fmap.edition.commands;
2
3
import java.io.IOException;
4
5
import com.iver.cit.gvsig.fmap.core.IRow;
6
import com.iver.cit.gvsig.fmap.drivers.DriverIOException;
7 5184 caballero
import com.iver.cit.gvsig.fmap.edition.EditionEvent;
8 3652 fjp
import com.iver.cit.gvsig.fmap.edition.IEditableSource;
9
10
/**
11
 * A?ade una geometr?a nueva al EditableFeatureSource
12
 */
13 4120 caballero
public class AddRowCommand extends AbstractCommand {
14 3652 fjp
        private IRow row;
15 4195 fjp
        private int calculatedIndex;
16 3652 fjp
        private IEditableSource efs;
17 5184 caballero
        private int sourceType=EditionEvent.GRAPHIC;
18 3652 fjp
19 5184 caballero
        public AddRowCommand(IEditableSource ef, IRow row, int calculatedIndex, int sourceType) {
20 4120 caballero
                super();
21 3652 fjp
                efs = ef;
22 4195 fjp
                this.calculatedIndex = calculatedIndex;
23 3652 fjp
                this.row = row;
24 5184 caballero
                this.sourceType=sourceType;
25 3652 fjp
        }
26
27
        /**
28
         * @throws IOException
29
         * @throws DriverIOException
30
         * @see com.iver.cit.gvsig.fmap.edition.Command#undo()
31
         */
32
        public void undo() throws DriverIOException, IOException {
33 5184 caballero
                efs.undoAddRow(calculatedIndex, sourceType);
34 3652 fjp
        }
35
36
        /**
37 3836 caballero
         * @throws IOException
38
         * @throws DriverIOException
39 3652 fjp
         * @see com.iver.cit.gvsig.fmap.edition.Command#redo()
40
         */
41
        public void redo() throws DriverIOException, IOException {
42 5184 caballero
                calculatedIndex=efs.doAddRow(row, sourceType);
43 3652 fjp
        }
44
45 4120 caballero
        public String getType() {
46
                return "Add";
47
        }
48 3652 fjp
}