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, iterator
accept, doAccept
accept
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
accept, isFromStore
accept, accept, fastIterator, first, getDynObjectSet, getDynObjectSet, isEmpty, iterator
public 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 AbstractFeatureSet
public FeatureCommandsStack getCommands()
public void enableNotifications()
ComplexObservable
enableNotifications
in interface ComplexObservable
public void disableNotifications()
ComplexObservable
disableNotifications
in interface ComplexObservable
public boolean isReversed()
public long getSelectedCount()
FeatureReferenceSelection
getSelectedCount
in interface FeatureReferenceSelection
public DefaultFeatureReferenceSelection.SelectionData getData()
public boolean select(FeatureReference reference)
FeatureReferenceSelection
select
in interface FeatureReferenceSelection
reference
- the selected feature referencepublic boolean select(FeatureReference reference, boolean undoable)
public boolean deselect(FeatureReference reference)
FeatureReferenceSelection
deselect
in interface FeatureReferenceSelection
reference
- the deselected feature referencepublic boolean deselect(FeatureReference reference, boolean undoable)
public Iterator referenceIterator()
FeatureReferenceSelection
referenceIterator
in interface FeatureReferenceSelection
public void selectAll() throws DataException
FeatureReferenceSelection
selectAll
in interface FeatureReferenceSelection
DataException
- if there is an error selecting all valuespublic void deselectAll() throws DataException
FeatureReferenceSelection
deselectAll
in interface FeatureReferenceSelection
DataException
- if there is an error deselecting all valuespublic void deselectAll(boolean undoable) throws DataException
DataException
public boolean isSelected(FeatureReference reference)
FeatureReferenceSelection
isSelected
in interface FeatureReferenceSelection
reference
- to checkpublic void reverse()
FeatureReferenceSelection
reverse
in interface FeatureReferenceSelection
public void dispose()
Disposable
NOTE:After calling this method, the object may not be usable anymore.
dispose
in interface Disposable
public void update(Observable o, Object o1)
Observer
Observable
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 Observer
s 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 Observable
public void deleteObserver(Observer obsrvr)
deleteObserver
in interface Observable
public void deleteObservers()
deleteObservers
in interface Observable
public void beginComplexNotification()
ComplexObservable
beginComplexNotification
in interface ComplexObservable
public 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 ComplexObservable
public void saveToState(PersistentState ps) throws PersistenceException
Persistent
saveToState
in interface Persistent
PersistenceException
public boolean select(Feature feature)
FeatureSelection
select
in interface FeatureSelection
feature
- 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
FeatureSelection
select
in interface FeatureSelection
features
- 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 undoableDataException
select(FeatureSet)
public boolean deselect(Feature feature)
FeatureSelection
deselect
in interface FeatureSelection
feature
- 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
FeatureSelection
deselect
in interface FeatureSelection
features
- 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 undoableDataException
deselect(FeatureSet)
public boolean isSelected(Feature feature)
FeatureSelection
isSelected
in interface FeatureSelection
feature
- to checkpublic FeatureType getDefaultFeatureType()
FeatureSet
FeatureType
of this FeatureSet.getDefaultFeatureType
in interface FeatureSet
FeatureType
in this FeatureSet.public List getFeatureTypes()
FeatureSet
FeatureType
(s) in this FeatureSet.getFeatureTypes
in interface FeatureSet
FeatureType
(s) in this FeatureSet.public long getSize() throws DataException
FeatureSet
Feature
(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 FeatureSet
Feature
(s) contained in this FeatureSet.DataException
public DisposableIterator iterator(long index)
iterator
in interface FeatureSet
index
- 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 FeatureSet
public DisposableIterator fastIterator(long index)
fastIterator
in interface FeatureSet
index
- 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 FeatureSet
protected void clearFeatureReferences()
public void delete(Feature feature) throws DataException
FeatureSet
Feature
from this FeatureSet.DisposableIterator
from this store that was still in use will be
unsafe. Use Iterator.remove()
instead.delete
in interface FeatureSet
feature
- the Feature
to delete.DataException
public void insert(EditableFeature feature) throws DataException
FeatureSet
EditableFeature
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 FeatureSet
feature
- the EditableFeature
to insert.DataException
public void update(EditableFeature feature) throws DataException
FeatureSet
Feature
with the given EditableFeature
.DisposableIterator
from this store that was still in use can will not
reflect this change.update
in interface FeatureSet
feature
- an instance of EditableFeature
with which to update
the associated Feature
.DataException
public void loadFromState(PersistentState state) throws PersistenceException
Persistent
loadFromState
in interface Persistent
PersistenceException
protected void doDispose() throws BaseException
BaseException
public static void registerPersistent()
public Object clone() throws CloneNotSupportedException
Cloneable
clone
in class Object
CloneNotSupportedException
- 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 AbstractFeatureSet
BaseException