svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.compat.cdc / org.gvsig.fmap.dal / org.gvsig.fmap.dal.impl / src / main / java / org / gvsig / fmap / dal / feature / impl / undo / command / FTypeUpdateCommand.java @ 40559
History | View | Annotate | Download (4.01 KB)
1 | 40559 | jjdelcerro | /**
|
---|---|---|---|
2 | * gvSIG. Desktop Geographic Information System.
|
||
3 | 40435 | jjdelcerro | *
|
4 | 40559 | jjdelcerro | * Copyright (C) 2007-2013 gvSIG Association.
|
5 | 40435 | jjdelcerro | *
|
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 | 40559 | jjdelcerro | * as published by the Free Software Foundation; either version 3
|
9 | 40435 | jjdelcerro | * 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 | 40559 | jjdelcerro | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19 | * MA 02110-1301, USA.
|
||
20 | 40435 | jjdelcerro | *
|
21 | 40559 | jjdelcerro | * For any additional information, do not hesitate to contact us
|
22 | * at info AT gvsig.com, or visit our website www.gvsig.com.
|
||
23 | 40435 | jjdelcerro | */
|
24 | /* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
||
25 | *
|
||
26 | * Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
|
||
27 | *
|
||
28 | * This program is free software; you can redistribute it and/or
|
||
29 | * modify it under the terms of the GNU General Public License
|
||
30 | * as published by the Free Software Foundation; either version 2
|
||
31 | * of the License, or (at your option) any later version.
|
||
32 | *
|
||
33 | * This program is distributed in the hope that it will be useful,
|
||
34 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
35 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
36 | * GNU General Public License for more details.
|
||
37 | *
|
||
38 | * You should have received a copy of the GNU General Public License
|
||
39 | * along with this program; if not, write to the Free Software
|
||
40 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
||
41 | *
|
||
42 | * For more information, contact:
|
||
43 | *
|
||
44 | * Generalitat Valenciana
|
||
45 | * Conselleria d'Infraestructures i Transport
|
||
46 | * Av. Blasco Ib??ez, 50
|
||
47 | * 46010 VALENCIA
|
||
48 | * SPAIN
|
||
49 | *
|
||
50 | * +34 963862235
|
||
51 | * gvsig@gva.es
|
||
52 | * www.gvsig.gva.es
|
||
53 | *
|
||
54 | * or
|
||
55 | *
|
||
56 | * IVER T.I. S.A
|
||
57 | * Salamanca 50
|
||
58 | * 46005 Valencia
|
||
59 | * Spain
|
||
60 | *
|
||
61 | * +34 963163400
|
||
62 | * dac@iver.es
|
||
63 | */
|
||
64 | package org.gvsig.fmap.dal.feature.impl.undo.command; |
||
65 | |||
66 | import org.gvsig.fmap.dal.feature.FeatureType; |
||
67 | import org.gvsig.fmap.dal.feature.impl.FeatureTypeManager; |
||
68 | import org.gvsig.tools.undo.RedoException; |
||
69 | import org.gvsig.tools.undo.UndoException; |
||
70 | |||
71 | |||
72 | /**
|
||
73 | * DOCUMENT ME!
|
||
74 | *
|
||
75 | * @author Vicente Caballero Navarro
|
||
76 | */
|
||
77 | public class FTypeUpdateCommand extends AbstractFTypeCommand { |
||
78 | private FeatureType oldType;
|
||
79 | private int position=-1; |
||
80 | |||
81 | public FTypeUpdateCommand(FeatureTypeManager expansionManager,
|
||
82 | FeatureType type, FeatureType oldType, String description) {
|
||
83 | super(expansionManager, type, description);
|
||
84 | this.oldType = oldType;
|
||
85 | } |
||
86 | |||
87 | /* (non-Javadoc)
|
||
88 | * @see org.gvsig.fmap.dal.commands.Command#undo()
|
||
89 | */
|
||
90 | public void undo() throws UndoException { |
||
91 | // if (expansionManager.contains(oldFeature.getReference())) {
|
||
92 | // expansionManager.deleteLastFeature(feature.getReference());
|
||
93 | // } else {
|
||
94 | // expansionManager.delete(type.getId());
|
||
95 | // }
|
||
96 | |||
97 | expansionManager.restore(oldType.getId(),position); |
||
98 | } |
||
99 | |||
100 | /* (non-Javadoc)
|
||
101 | * @see org.gvsig.fmap.dal.commands.Command#redo()
|
||
102 | */
|
||
103 | public void redo() throws RedoException { |
||
104 | execute(); |
||
105 | } |
||
106 | |||
107 | public int getType() { |
||
108 | return UPDATE;
|
||
109 | } |
||
110 | |||
111 | /* (non-Javadoc)
|
||
112 | * @see org.gvsig.fmap.dal.commands.Command#execute()
|
||
113 | */
|
||
114 | public void execute() { |
||
115 | // Si la geometr?a no ha sido modificada
|
||
116 | // if (!expansionManager.contains(oldType.getId())) {
|
||
117 | // if (expansionManager.delete(oldType.getId())!=null){
|
||
118 | // expansionManager.add(type);
|
||
119 | // } else {
|
||
120 | position = expansionManager.update(type, oldType); |
||
121 | // }
|
||
122 | } |
||
123 | |||
124 | public FeatureType getOldFeatureType() {
|
||
125 | return oldType;
|
||
126 | } |
||
127 | } |