svn-gvsig-desktop / trunk / libraries / libDataSource / src / org / gvsig / data / vectorial / AbstractFeatureCollection.java @ 19670
History | View | Annotate | Download (1.1 KB)
1 | 19464 | vcaballero | package org.gvsig.data.vectorial; |
---|---|---|---|
2 | |||
3 | import java.util.Iterator; |
||
4 | |||
5 | import org.gvsig.data.IObservable; |
||
6 | 19487 | jpiera | import org.gvsig.data.vectorial.visitor.IFeaturesVisitor; |
7 | import org.gvsig.exceptions.BaseException; |
||
8 | 19464 | vcaballero | |
9 | public abstract class AbstractFeatureCollection implements IFeatureCollection{ |
||
10 | |||
11 | protected boolean modified=false; |
||
12 | public void update(IObservable obsevable, Object notification) { |
||
13 | if (modified){
|
||
14 | return;
|
||
15 | } |
||
16 | String type = ((IFeatureStoreNotification)notification).getType();
|
||
17 | if (type.equalsIgnoreCase(IFeatureStoreNotification.AFTER_INSERT) ||
|
||
18 | type.equalsIgnoreCase(IFeatureStoreNotification.AFTER_DELETE) || |
||
19 | type.equalsIgnoreCase(IFeatureStoreNotification.AFTER_UPDATE)){ |
||
20 | modified=true;
|
||
21 | } |
||
22 | } |
||
23 | 19487 | jpiera | |
24 | /*
|
||
25 | * (non-Javadoc)
|
||
26 | * @see org.gvsig.data.vectorial.visitor.IFeaturesVisitable#accept(org.gvsig.data.vectorial.visitor.IFeaturesVisitor)
|
||
27 | */
|
||
28 | public void accept(IFeaturesVisitor visitor) throws BaseException { |
||
29 | 19464 | vcaballero | Iterator iterator=iterator();
|
30 | while (iterator.hasNext()) {
|
||
31 | IFeature feature = (IFeature) iterator.next(); |
||
32 | visitor.visit(feature); |
||
33 | } |
||
34 | } |
||
35 | 19487 | jpiera | |
36 | |||
37 | 19464 | vcaballero | } |