Statistics
| Revision:

root / trunk / libraries / libFMap / src / com / iver / cit / gvsig / fmap / edition / commands / RemoveRowCommand.java @ 18621

History | View | Annotate | Download (1.24 KB)

1
package com.iver.cit.gvsig.fmap.edition.commands;
2

    
3
import java.io.IOException;
4

    
5
import com.hardcode.gdbms.driver.exceptions.ReadDriverException;
6
import com.iver.cit.gvsig.exceptions.commands.EditionCommandException;
7
import com.iver.cit.gvsig.fmap.drivers.DriverIOException;
8
import com.iver.cit.gvsig.fmap.edition.EditableAdapter;
9
import com.iver.cit.gvsig.fmap.edition.EditionEvent;
10

    
11
public class RemoveRowCommand extends AbstractCommand {
12

    
13
        private EditableAdapter efs;
14
        private int index;
15
        private int sourceType=EditionEvent.GRAPHIC;
16
        public RemoveRowCommand(EditableAdapter ef,int i,int sourceType){
17
                super();
18
                efs=ef;
19
                index=i;
20
                this.sourceType=sourceType;
21
        }
22

    
23
        /**
24
         * @throws DriverIOException
25
         * @throws IOException
26
         * @see com.iver.cit.gvsig.fmap.edition.Command#undo()
27
         */
28
        public void undo() throws EditionCommandException {
29
                efs.undoRemoveRow(index,sourceType);
30
        }
31
        /**
32
         * @throws IOException
33
         * @throws DriverIOException
34
         * @see com.iver.cit.gvsig.fmap.edition.Command#redo()
35
         */
36
        public void redo() throws EditionCommandException {
37
                try {
38
                        efs.doRemoveRow(index,sourceType);
39
                } catch (ReadDriverException e) {
40
                        throw new EditionCommandException(efs.getWriter().getName(),e);
41
                } 
42
        }
43

    
44
        public String getType() {
45
                return "Remove";
46
        }
47
}