Revision 21296 branches/v2_0_0_prep/libraries/libFMap_data/src/org/gvsig/data/commands/AbstractCommandsRecord.java
AbstractCommandsRecord.java | ||
---|---|---|
6 | 6 |
|
7 | 7 |
import org.gvsig.data.commands.implementation.AttributeCommand; |
8 | 8 |
import org.gvsig.data.commands.implementation.FeatureCommand; |
9 |
import org.gvsig.util.observer.DefaultObservable; |
|
9 | 10 |
import org.gvsig.util.observer.Observer; |
10 |
import org.gvsig.util.observer.DefaultObservable; |
|
11 | 11 |
|
12 | 12 |
/** |
13 | 13 |
* Clase en memoria para registrar y gestionar los comandos que vamos |
... | ... | |
29 | 29 |
private boolean refresh=true; |
30 | 30 |
private int undosCount=0; |
31 | 31 |
private DefaultObservable observable=new DefaultObservable(); |
32 |
private boolean complex=false; |
|
33 |
private CommandCollection collection=null; |
|
32 | 34 |
// private ComplexObservable observable=new ComplexObservable(); |
33 | 35 |
/* (non-Javadoc) |
34 | 36 |
* @see org.gvsig.data.commands.CommandsRecord#add(org.gvsig.data.commands.Command) |
35 | 37 |
*/ |
36 | 38 |
public void add(Command command){ |
37 |
undos.add(command); |
|
38 |
redos.clear(); |
|
39 |
refresh=true; |
|
40 |
observable.notifyObservers(this,new CommandNotification(command,CommandNotification.ADD)); |
|
39 |
if (complex){ |
|
40 |
collection.add(command); |
|
41 |
}else{ |
|
42 |
undos.add(command); |
|
43 |
redos.clear(); |
|
44 |
refresh=true; |
|
45 |
observable.notifyObservers(this,new CommandNotification(command,CommandNotification.ADD)); |
|
46 |
} |
|
41 | 47 |
} |
42 | 48 |
|
43 | 49 |
/* (non-Javadoc) |
... | ... | |
250 | 256 |
return commands; |
251 | 257 |
} |
252 | 258 |
|
259 |
public void endComplex(String description) { |
|
260 |
if (collection.isEmpty()) { |
|
261 |
complex = false; |
|
262 |
return; |
|
263 |
} |
|
264 |
complex=false; |
|
265 |
collection.setDescription(description); |
|
266 |
undos.add(collection); |
|
267 |
redos.clear(); |
|
268 |
refresh=true; |
|
269 |
observable.notifyObservers(this,new CommandNotification(collection,CommandNotification.ADD)); |
|
270 |
|
|
271 |
} |
|
272 |
|
|
273 |
public void startComplex() { |
|
274 |
collection=new CommandCollection(); |
|
275 |
complex=true; |
|
276 |
} |
|
277 |
|
|
253 | 278 |
} |
Also available in: Unified diff