public class DefaultFeatureSelection extends AbstractFeatureSet implements FeatureSelection
| Modifier and Type | Class and Description |
|---|---|
class |
DefaultFeatureSelection.RemoveFromFeatureSelectionException |
LOG| Constructor and Description |
|---|
DefaultFeatureSelection()
Constructor used by the persistence manager.
|
DefaultFeatureSelection(DefaultFeatureStore featureStore)
Creates a DefaultFeatureSelection, with a FeatureStore.
|
DefaultFeatureSelection(FeatureStore featureStore,
FeatureSelectionHelper helper)
Creates a new Selection with the total size of Features from which the
selection will be performed.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addObserver(Observer obsrvr) |
void |
beginComplexNotification()
Sets the Observable in complex notification mode.
|
protected void |
clearFeatureReferences() |
Object |
clone()
Creates a copy of the object.
|
void |
delete(Feature feature)
Deletes a
Feature from this FeatureSet. |
void |
deleteObserver(Observer obsrvr) |
void |
deleteObservers() |
boolean |
deselect(Feature feature)
Removes a feature from the selection.
|
boolean |
deselect(Feature feature,
boolean undoable) |
boolean |
deselect(FeatureReference reference)
Removes a feature from the selection.
|
boolean |
deselect(FeatureReference reference,
boolean undoable) |
boolean |
deselect(FeatureSet features)
Removes a DataSet of features from the selection.
|
boolean |
deselect(FeatureSet features,
boolean undoable) |
void |
deselectAll()
Deselects all values.
|
void |
deselectAll(boolean undoable) |
void |
disableNotifications()
Disable the notification of events to registered Observers.
|
void |
dispose()
Disposes the current object, to allow it to close and dispose any used
resources.
|
protected void |
doAccept(Visitor visitor,
long firstValueIndex,
long elements) |
protected void |
doDispose() |
void |
enableNotifications()
Enable (default) the notification of events to registered Observers.
|
void |
endComplexNotification()
Ends the complex notification mode.
|
DisposableIterator |
fastIterator(long index)
Returns the list of selected values, or the deselected ones if the
selection has been reversed.
|
DisposableIterator |
fastIterator(long index,
long elements) |
FeatureCommandsStack |
getCommands() |
DefaultFeatureReferenceSelection.SelectionData |
getData() |
FeatureType |
getDefaultFeatureType()
Returns the default
FeatureType of this FeatureSet. |
FeatureStore |
getFeatureStore() |
List |
getFeatureTypes()
Returns a list of the
FeatureType(s) in this FeatureSet. |
long |
getSelectedCount()
Returns the number of selected values.
|
long |
getSize()
Returns the number of
Feature(s) contained in this FeatureSet. |
void |
insert(EditableFeature feature)
Inserts a new feature in this set.
|
boolean |
isReversed() |
boolean |
isSelected(Feature feature)
Returns if a feature is selected.
|
boolean |
isSelected(FeatureReference reference)
Returns if a feature is selected.
|
DisposableIterator |
iterator(long index)
Returns the list of selected values, or the deselected ones if the
selection has been reversed.
|
DisposableIterator |
iterator(long index,
long elements) |
void |
loadFromState(PersistentState state)
Set the state of the object from the state passed as parameter.
|
Iterator |
referenceIterator()
Returns an unmodifiable Iterator of selected feature references.
|
static void |
registerPersistent() |
void |
reverse()
Reverses the selection.
|
void |
saveToState(PersistentState ps)
Saves the internal state of the object on the provided
PersistentState object.
|
boolean |
select(Feature feature)
Adds a feature to the selection.
|
boolean |
select(Feature feature,
boolean undoable) |
boolean |
select(FeatureReference reference)
Adds a feature to the selection.
|
boolean |
select(FeatureReference reference,
boolean undoable) |
boolean |
select(FeatureSet features)
Adds a DataSet of features to the selection.
|
boolean |
select(FeatureSet features,
boolean undoable) |
void |
selectAll()
Selects all values.
|
void |
update(EditableFeature feature)
Updates a
Feature with the given EditableFeature. |
void |
update(Observable o,
Object o1)
Called whenever a
Observable object is changed and this
Observer has registered on it to receive notifications. |
accept, doAccept, fastIterator, first, getDynObjectSet, getDynObjectSet, isEmpty, isFromStore, iteratoraccept, doAcceptacceptequals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaccept, isFromStoreaccept, accept, fastIterator, first, getDynObjectSet, getDynObjectSet, isEmpty, iteratorpublic DefaultFeatureSelection(DefaultFeatureStore featureStore) throws DataException
featureStore - the FeatureStore to load Features fromDataException - if there is an error while getting the total number
of Features of the Store.AbstractSetBasedDataSelection#DefaultSelection(int)public DefaultFeatureSelection(FeatureStore featureStore, FeatureSelectionHelper helper) throws DataException
featureStore - the FeatureStore of the selected FeatureReferenceshelper - to get some information of the StoreDataException - if there is an error while getting the total number
of Features of the Store.public DefaultFeatureSelection()
loadFromState(PersistentState) to set the values of the internal
attributes that this class needs to work.public FeatureStore getFeatureStore()
getFeatureStore in class AbstractFeatureSetpublic FeatureCommandsStack getCommands()
public void enableNotifications()
ComplexObservableenableNotifications in interface ComplexObservablepublic void disableNotifications()
ComplexObservabledisableNotifications in interface ComplexObservablepublic boolean isReversed()
public long getSelectedCount()
FeatureReferenceSelectiongetSelectedCount in interface FeatureReferenceSelectionpublic DefaultFeatureReferenceSelection.SelectionData getData()
public boolean select(FeatureReference reference)
FeatureReferenceSelectionselect in interface FeatureReferenceSelectionreference - the selected feature referencepublic boolean select(FeatureReference reference, boolean undoable)
public boolean deselect(FeatureReference reference)
FeatureReferenceSelectiondeselect in interface FeatureReferenceSelectionreference - the deselected feature referencepublic boolean deselect(FeatureReference reference, boolean undoable)
public Iterator referenceIterator()
FeatureReferenceSelectionreferenceIterator in interface FeatureReferenceSelectionpublic void selectAll()
throws DataException
FeatureReferenceSelectionselectAll in interface FeatureReferenceSelectionDataException - if there is an error selecting all valuespublic void deselectAll()
throws DataException
FeatureReferenceSelectiondeselectAll in interface FeatureReferenceSelectionDataException - if there is an error deselecting all valuespublic void deselectAll(boolean undoable)
throws DataException
DataExceptionpublic boolean isSelected(FeatureReference reference)
FeatureReferenceSelectionisSelected in interface FeatureReferenceSelectionreference - to checkpublic void reverse()
FeatureReferenceSelectionreverse in interface FeatureReferenceSelectionpublic void dispose()
DisposableNOTE:After calling this method, the object may not be usable anymore.
dispose in interface Disposablepublic void update(Observable o, Object o1)
ObserverObservable object is changed and this
Observer has registered on it to receive notifications.
Implementations of this method will be called for each simple notification or, if a complex notification is created, for each of the child notifications.
In the latter case, don't assume any ordering in the notification between
this Observer and other Observers listening to the same
Observable.
In a complex notification scenario, if you want to receive only the
complex notification and not each of the child notifications, just
implement the ComplexObserver and prepare this method
implementation to handle receiving DefaultComplexNotification instances
as well as direct notification objects.
public void addObserver(Observer obsrvr)
addObserver in interface Observablepublic void deleteObserver(Observer obsrvr)
deleteObserver in interface Observablepublic void deleteObservers()
deleteObservers in interface Observablepublic void beginComplexNotification()
ComplexObservablebeginComplexNotification in interface ComplexObservablepublic void endComplexNotification()
ComplexObservable
If a observer is a ComplexObserver, it will be notified with a
single DefaultComplexNotification instead of each of the notifications.
Some important notes to take into account when calling this method.
Observer is processing a notification another Observer is
registered to the source Observable, it won't get any of the
notifications currently being notified, but future ones.endComplexNotification in interface ComplexObservablepublic void saveToState(PersistentState ps) throws PersistenceException
PersistentsaveToState in interface PersistentPersistenceExceptionpublic boolean select(Feature feature)
FeatureSelectionselect in interface FeatureSelectionfeature - the selected featurepublic boolean select(Feature feature, boolean undoable)
feature - undoable - if the action must be undoableselect(Feature)public boolean select(FeatureSet features) throws DataException
FeatureSelectionselect in interface FeatureSelectionfeatures - the selected featuresDataException - if there is an error reading the FeatureSet valuespublic boolean select(FeatureSet features, boolean undoable) throws DataException
features - undoable - if the action must be undoableDataExceptionselect(FeatureSet)public boolean deselect(Feature feature)
FeatureSelectiondeselect in interface FeatureSelectionfeature - the deselected featurepublic boolean deselect(Feature feature, boolean undoable)
feature - undoable - if the action must be undoabledeselect(Feature)public boolean deselect(FeatureSet features) throws DataException
FeatureSelectiondeselect in interface FeatureSelectionfeatures - the deselected featuresDataException - if there is an error reading the FeatureSet valuespublic boolean deselect(FeatureSet features, boolean undoable) throws DataException
features - undoable - if the action must be undoableDataExceptiondeselect(FeatureSet)public boolean isSelected(Feature feature)
FeatureSelectionisSelected in interface FeatureSelectionfeature - to checkpublic FeatureType getDefaultFeatureType()
FeatureSetFeatureType of this FeatureSet.getDefaultFeatureType in interface FeatureSetFeatureType in this FeatureSet.public List getFeatureTypes()
FeatureSetFeatureType(s) in this FeatureSet.getFeatureTypes in interface FeatureSetFeatureType(s) in this FeatureSet.public long getSize()
throws DataException
FeatureSetFeature(s) contained in this FeatureSet.
The value returned by this method won't be accurate when
the FeatureStore is being edited and this set's features
are modified, added or deleted.getSize in interface FeatureSetFeature(s) contained in this FeatureSet.DataExceptionpublic DisposableIterator iterator(long index)
iterator in interface FeatureSetindex - index of first element to be returned from the iterator (by a
call to the next method).DataSet.accept(org.gvsig.tools.visitor.Visitor),
FeatureSet.accept(org.gvsig.tools.visitor.Visitor, long),
FeatureSet.fastIterator(),
FeatureSet.fastIterator(long)public DisposableIterator iterator(long index, long elements)
iterator in interface FeatureSetpublic DisposableIterator fastIterator(long index)
fastIterator in interface FeatureSetindex - position in which the iterator is initially located.DataSet.accept(org.gvsig.tools.visitor.Visitor),
FeatureSet.accept(org.gvsig.tools.visitor.Visitor, long)public DisposableIterator fastIterator(long index, long elements)
fastIterator in interface FeatureSetprotected void clearFeatureReferences()
public void delete(Feature feature) throws DataException
FeatureSetFeature from this FeatureSet.DisposableIterator from this store that was still in use will be
unsafe. Use Iterator.remove() instead.delete in interface FeatureSetfeature - the Feature to delete.DataExceptionpublic void insert(EditableFeature feature) throws DataException
FeatureSetEditableFeature as it has not been stored yet.DisposableIterator from this store that was still in use can will not
reflect this change.insert in interface FeatureSetfeature - the EditableFeature to insert.DataExceptionpublic void update(EditableFeature feature) throws DataException
FeatureSetFeature with the given EditableFeature.DisposableIterator from this store that was still in use can will not
reflect this change.update in interface FeatureSetfeature - an instance of EditableFeature with which to update
the associated Feature.DataExceptionpublic void loadFromState(PersistentState state) throws PersistenceException
PersistentloadFromState in interface PersistentPersistenceExceptionprotected void doDispose()
throws BaseException
BaseExceptionpublic static void registerPersistent()
public Object clone() throws CloneNotSupportedException
Cloneableclone in class ObjectCloneNotSupportedException - if the instance of the object cannot
be cloned. As this is extending Cloneable so
its sure it implements it, so this exception may be used for problems
on specific object instances.Object#clone()}.protected void doAccept(Visitor visitor, long firstValueIndex, long elements) throws BaseException
doAccept in class AbstractFeatureSetBaseException