public class AutoCompletionManager extends Object implements DataSetListener
Modifier and Type | Field and Description |
---|---|
protected boolean |
dirty
If the dirty flag is set true, a rebuild is necessary.
|
protected DataSet |
ds
The data set that is managed
|
protected static Set<String> |
presetRoleCache
the same as roleCache but for the preset roles
can be accessed directly
|
protected static MultiMap<String,String> |
presetTagCache
the same as tagCache but for the preset keys and values
can be accessed directly
|
protected Set<String> |
roleCache
the cached list of member roles
only accessed by getRoleCache(), rebuild() and cacheRelationMemberRoles()
use getRoleCache() accessor
|
protected MultiMap<String,String> |
tagCache
the cached tags given by a tag key and a list of values for this tag
only accessed by getTagCache(), rebuild() and cachePrimitiveTags()
use getTagCache() accessor
|
Constructor and Description |
---|
AutoCompletionManager(DataSet ds) |
Modifier and Type | Method and Description |
---|---|
static void |
cachePresets(Collection<TaggingPreset> presets)
Initialize the cache for presets.
|
protected void |
cachePrimitives(Collection<? extends OsmPrimitive> primitives) |
protected void |
cachePrimitiveTags(OsmPrimitive primitive)
make sure, the keys and values of all tags held by primitive are
in the auto completion cache
|
protected void |
cacheRelationMemberRoles(Relation relation)
Caches all member roles of the relation
relation |
void |
dataChanged(DataChangedEvent event)
Called after big changes in dataset.
|
protected List<String> |
getDataKeys()
replies the keys held by the cache
|
protected List<String> |
getDataValues(String key)
replies the auto completion values allowed for a specific key.
|
List<AutoCompletionListItem> |
getKeys()
Returns the currently cached tag keys.
|
List<String> |
getMemberRoles()
Replies the list of member roles
|
protected List<String> |
getPresetKeys() |
protected static List<String> |
getPresetValues(String key) |
protected Set<String> |
getRoleCache() |
protected MultiMap<String,String> |
getTagCache() |
List<AutoCompletionListItem> |
getValues(List<String> keys)
Returns the currently cached tag values for a given list of tag keys.
|
List<AutoCompletionListItem> |
getValues(String key)
Returns the currently cached tag values for a given tag key.
|
void |
nodeMoved(NodeMovedEvent event)
A node's coordinates were modified.
|
void |
otherDatasetChange(AbstractDatasetChangedEvent event)
Minor dataset change, currently only changeset id changed is supported, but can
be extended in future.
|
void |
populateWithKeys(AutoCompletionList list)
Populates the an
AutoCompletionList with the currently cached tag keys |
void |
populateWithMemberRoles(AutoCompletionList list)
Populates the an
AutoCompletionList with the currently cached
member roles. |
void |
populateWithTagValues(AutoCompletionList list,
List<String> keys)
Populates the an
AutoCompletionList with the currently cached
values for some given tags |
void |
populateWithTagValues(AutoCompletionList list,
String key)
Populates the an
AutoCompletionList with the currently cached
values for a tag |
void |
primitivesAdded(PrimitivesAddedEvent event)
Implementation of the DataSetListener interface
|
void |
primitivesRemoved(PrimitivesRemovedEvent event)
A bunch of primitives were removed from the DataSet, or preexisting
primitives were marked as deleted.
|
protected void |
rebuild()
initializes the cache from the primitives in the dataset
|
void |
relationMembersChanged(RelationMembersChangedEvent event)
A relation's members have changed.
|
void |
tagsChanged(TagsChangedEvent event)
There was some change in the tag set of a primitive.
|
void |
wayNodesChanged(WayNodesChangedEvent event)
A way's node list was changed.
|
protected boolean dirty
protected MultiMap<String,String> tagCache
protected static final MultiMap<String,String> presetTagCache
protected Set<String> roleCache
protected static final Set<String> presetRoleCache
public AutoCompletionManager(DataSet ds)
protected MultiMap<String,String> getTagCache()
protected Set<String> getRoleCache()
protected void rebuild()
protected void cachePrimitives(Collection<? extends OsmPrimitive> primitives)
protected void cachePrimitiveTags(OsmPrimitive primitive)
primitive
- an OSM primitiveprotected void cacheRelationMemberRoles(Relation relation)
relation
relation
- the relationpublic static void cachePresets(Collection<TaggingPreset> presets)
protected List<String> getDataKeys()
protected List<String> getPresetKeys()
protected List<String> getDataValues(String key)
getKeys()
.key
- protected static List<String> getPresetValues(String key)
public List<String> getMemberRoles()
public void populateWithMemberRoles(AutoCompletionList list)
AutoCompletionList
with the currently cached
member roles.list
- the list to populatepublic void populateWithKeys(AutoCompletionList list)
AutoCompletionList
with the currently cached tag keyslist
- the list to populatepublic void populateWithTagValues(AutoCompletionList list, String key)
AutoCompletionList
with the currently cached
values for a taglist
- the list to populatekey
- the tag keypublic void populateWithTagValues(AutoCompletionList list, List<String> keys)
AutoCompletionList
with the currently cached
values for some given tagslist
- the list to populatekeys
- the tag keyspublic List<AutoCompletionListItem> getKeys()
public List<AutoCompletionListItem> getValues(String key)
key
- the tag keypublic List<AutoCompletionListItem> getValues(List<String> keys)
keys
- the tag keyspublic void primitivesAdded(PrimitivesAddedEvent event)
primitivesAdded
in interface DataSetListener
event
- An event for an collection of newly-visible primitivespublic void primitivesRemoved(PrimitivesRemovedEvent event)
DataSetListener
primitivesRemoved
in interface DataSetListener
event
- An event for an collection of newly-invisible primitivespublic void tagsChanged(TagsChangedEvent event)
DataSetListener
tagsChanged
in interface DataSetListener
event
- the event for the primitive, whose tags were affected.public void nodeMoved(NodeMovedEvent event)
DataSetListener
nodeMoved
in interface DataSetListener
event
- The event for the node that was moved.public void wayNodesChanged(WayNodesChangedEvent event)
DataSetListener
wayNodesChanged
in interface DataSetListener
event
- The event for the way that was modified.public void relationMembersChanged(RelationMembersChangedEvent event)
DataSetListener
relationMembersChanged
in interface DataSetListener
event
- The event for the relation that was modified.public void otherDatasetChange(AbstractDatasetChangedEvent event)
DataSetListener
otherDatasetChange
in interface DataSetListener
event
- the event for data modificationpublic void dataChanged(DataChangedEvent event)
DataSetListener
DataSetListener.dataChanged(DataChangedEvent event)
is called.dataChanged
in interface DataSetListener