Statistics
| Revision:

root / branches / v2_0_0_prep / applications / appgvSIG / src / com / iver / cit / gvsig / project / documents / layout / commands / DeleteFrameCommand.java @ 24962

History | View | Annotate | Download (2.46 KB)

1 7304 caballero
/*
2
 * Created on 10-feb-2005
3
 *
4
 * gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
5
 *
6
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
7
 *
8
 * This program is free software; you can redistribute it and/or
9
 * modify it under the terms of the GNU General Public License
10
 * as published by the Free Software Foundation; either version 2
11
 * of the License, or (at your option) any later version.
12
 *
13
 * This program is distributed in the hope that it will be useful,
14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
 * GNU General Public License for more details.
17
 *
18
 * You should have received a copy of the GNU General Public License
19
 * along with this program; if not, write to the Free Software
20
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,
21
USA.
22
 *
23
 * For more information, contact:
24
 *
25
 *  Generalitat Valenciana
26
 *   Conselleria d'Infraestructures i Transport
27
 *   Av. Blasco Ib??ez, 50
28
 *   46010 VALENCIA
29
 *   SPAIN
30
 *
31
 *      +34 963862235
32
 *   gvsig@gva.es
33
 *      www.gvsig.gva.es
34
 *
35
 *    or
36
 *
37
 *   IVER T.I. S.A
38
 *   Salamanca 50
39
 *   46005 Valencia
40
 *   Spain
41
 *
42
 *   +34 963163400
43
 *   dac@iver.es
44
 */
45
package com.iver.cit.gvsig.project.documents.layout.commands;
46
47
48
import java.io.IOException;
49
50 24962 vcaballero
import org.gvsig.tools.undo.command.Command;
51
import org.gvsig.tools.undo.command.impl.AbstractCommand;
52 20994 jmvivo
53 7304 caballero
import com.iver.andami.PluginServices;
54 21299 vcaballero
import com.iver.cit.gvsig.project.documents.layout.fframes.IFFrame;
55 7304 caballero
56
57
58 21299 vcaballero
public class DeleteFrameCommand extends AbstractCommand {
59
        private FrameManager fm;
60 7304 caballero
        private int index;
61 24962 vcaballero
        public DeleteFrameCommand(FrameManager fm,IFFrame frame, String description) {
62
                super(description);
63 21299 vcaballero
                this.fm=fm;
64
                for (int i = 0; i < fm.getAllFFrames().length; i++) {
65
            if (fm.getFFrame(i).equals(frame)) {
66
                index=i;
67
            }
68
        }
69
}
70 7304 caballero
71
        /**
72
         * @throws DriverIOException
73
         * @throws IOException
74
         * @see com.iver.cit.gvsig.fmap.edition.Command#undo()
75
         */
76
        public void undo(){
77 21299 vcaballero
                fm.undoRemoveFFrame(index);
78 7304 caballero
        }
79
        /**
80
         * @throws IOException
81
         * @throws DriverIOException
82
         * @see com.iver.cit.gvsig.fmap.edition.Command#redo()
83
         */
84
        public void redo(){
85 21299 vcaballero
                fm.doRemoveFFrame(index);
86 7304 caballero
        }
87
88 24962 vcaballero
        public int getType() {
89
                return Command.DELETE;
90 7304 caballero
        }
91
92 21299 vcaballero
        public void execute() {
93
                if (fm.invalidates().get(index)) {
94
            return;
95
        }
96
//        IFFrame frame=fm.getFFrame(index);
97
        fm.doRemoveFFrame(index);
98
99
        }
100
101 7304 caballero
}