Class SelectionListDialog.SelectionListModel
java.lang.Object
javax.swing.AbstractListModel<OsmPrimitive>
org.openstreetmap.josm.gui.dialogs.SelectionListDialog.SelectionListModel
- All Implemented Interfaces:
Serializable,ListModel<OsmPrimitive>,DataSelectionListener,DataSetListener,MainLayerManager.ActiveLayerChangeListener
- Enclosing class:
- SelectionListDialog
static class SelectionListDialog.SelectionListModel
extends AbstractListModel<OsmPrimitive>
implements MainLayerManager.ActiveLayerChangeListener, DataSelectionListener, DataSetListener
The list model for the list of OSM primitives in the current JOSM selection.
The model also maintains a history of the last SELECTION_HISTORY_SIZE
JOSM selection.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.openstreetmap.josm.data.osm.DataSelectionListener
DataSelectionListener.AbstractSelectionEvent, DataSelectionListener.SelectionAddEvent, DataSelectionListener.SelectionChangeEvent, DataSelectionListener.SelectionRemoveEvent, DataSelectionListener.SelectionReplaceEvent, DataSelectionListener.SelectionToggleEvent -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate LinkedList<Collection<? extends OsmPrimitive>>private final List<OsmPrimitive>private static final intprivate final DefaultListSelectionModelFields inherited from class javax.swing.AbstractListModel
listenerList -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidCalled whenever the active or edit layer changed.voiddataChanged(DataChangedEvent event) Called after big changes in dataset.protected voidfireContentsChanged(Object source, int index0, int index1) getElementAt(int index) Replies a summary of the current JOSM selectionReplies the collection of OSM primitives currently selected in the view of this modelList<Collection<? extends OsmPrimitive>>Replies the history of JOSM selectionsintgetSize()booleanDetermines if no OSM primitives are currently selected.voidnodeMoved(NodeMovedEvent event) A node's coordinates were modified.voidMinor dataset change, currently only changeset id changed is supported, but can be extended in future.voidA bunch of primitives were added into the DataSet, or existing deleted/invisible primitives were resurrected.voidA bunch of primitives were removed from the DataSet, or preexisting primitives were marked as deleted.voidA relation's members have changed.voidremember(Collection<? extends OsmPrimitive> selection) Remembers a JOSM selection the history of JOSM selectionsvoidCalled whenever the selection is changed.voidsetJOSMSelection(Collection<? extends OsmPrimitive> selection) Sets the collection of currently selected OSM objectsvoidSets the OSM primitives to be selected in the view of this modelvoidsort()Sorts the current elements in the selectionvoidtagsChanged(TagsChangedEvent event) There was some change in the tag set of a primitive.voidupdate(Collection<? extends OsmPrimitive> toUpdate) Triggers a refresh of the view for all primitives intoUpdatewhich are currently displayed in the viewvoidA way's node list was changed.Methods inherited from class javax.swing.AbstractListModel
addListDataListener, fireIntervalAdded, fireIntervalRemoved, getListDataListeners, getListeners, removeListDataListenerMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.openstreetmap.josm.data.osm.event.DataSetListener
dataChangedIndividualEvents
-
Field Details
-
SELECTION_HISTORY_SIZE
- See Also:
-
history
-
selection
-
selectionModel
-
-
Constructor Details
-
SelectionListModel
SelectionListModel(DefaultListSelectionModel selectionModel) Constructor- Parameters:
selectionModel- the selection model used in the list
-
-
Method Details
-
getJOSMSelectionSummary
Replies a summary of the current JOSM selection- Returns:
- a summary of the current JOSM selection
-
remember
Remembers a JOSM selection the history of JOSM selections- Parameters:
selection- the JOSM selection. Ignored if null or empty.
-
getSelectionHistory
Replies the history of JOSM selections- Returns:
- history of JOSM selections
-
getElementAt
- Specified by:
getElementAtin interfaceListModel<OsmPrimitive>
-
getSize
- Specified by:
getSizein interfaceListModel<OsmPrimitive>
-
isSelectionEmpty
Determines if no OSM primitives are currently selected.- Returns:
trueif no OSM primitives are currently selected- Since:
- 10383
-
getSelected
Replies the collection of OSM primitives currently selected in the view of this model- Returns:
- chosen elements in the view
-
setSelected
Sets the OSM primitives to be selected in the view of this model- Parameters:
sel- the collection of primitives to select
-
fireContentsChanged
- Overrides:
fireContentsChangedin classAbstractListModel<OsmPrimitive>
-
setJOSMSelection
Sets the collection of currently selected OSM objects- Parameters:
selection- the collection of currently selected OSM objects
-
update
Triggers a refresh of the view for all primitives intoUpdatewhich are currently displayed in the view- Parameters:
toUpdate- the collection of primitives to update
-
sort
Sorts the current elements in the selection -
activeOrEditLayerChanged
Description copied from interface:MainLayerManager.ActiveLayerChangeListenerCalled whenever the active or edit layer changed.You can be sure that this layer is still contained in this set.
Listeners are called in the EDT thread and you can manipulate the layer manager in the current thread.
- Specified by:
activeOrEditLayerChangedin interfaceMainLayerManager.ActiveLayerChangeListener- Parameters:
e- The change event.
-
selectionChanged
Description copied from interface:DataSelectionListenerCalled whenever the selection is changed. You get notified about the new selection, the elements that were added and removed and the layer that triggered the event.- Specified by:
selectionChangedin interfaceDataSelectionListener- Parameters:
event- The selection change event.- See Also:
-
dataChanged
Description copied from interface:DataSetListenerCalled after big changes in dataset. Usually other events are stopped using Dataset.beginUpdate() and after operation is completed (Dataset.endUpdate()),DataSetListener.dataChanged(DataChangedEvent event)is called.- Specified by:
dataChangedin interfaceDataSetListener- Parameters:
event- data change event
-
nodeMoved
Description copied from interface:DataSetListenerA node's coordinates were modified.- Specified by:
nodeMovedin interfaceDataSetListener- Parameters:
event- The event for the node that was moved.
-
otherDatasetChange
Description copied from interface:DataSetListenerMinor dataset change, currently only changeset id changed is supported, but can be extended in future.- Specified by:
otherDatasetChangein interfaceDataSetListener- Parameters:
event- the event for data modification
-
relationMembersChanged
Description copied from interface:DataSetListenerA relation's members have changed.- Specified by:
relationMembersChangedin interfaceDataSetListener- Parameters:
event- The event for the relation that was modified.
-
tagsChanged
Description copied from interface:DataSetListenerThere was some change in the tag set of a primitive. It can have been a tag addition, tag removal or change in tag value.- Specified by:
tagsChangedin interfaceDataSetListener- Parameters:
event- the event for the primitive, whose tags were affected.
-
wayNodesChanged
Description copied from interface:DataSetListenerA way's node list was changed.- Specified by:
wayNodesChangedin interfaceDataSetListener- Parameters:
event- The event for the way that was modified.
-
primitivesAdded
Description copied from interface:DataSetListenerA bunch of primitives were added into the DataSet, or existing deleted/invisible primitives were resurrected.- Specified by:
primitivesAddedin interfaceDataSetListener- Parameters:
event- An event for an collection of newly-visible primitives
-
primitivesRemoved
Description copied from interface:DataSetListenerA bunch of primitives were removed from the DataSet, or preexisting primitives were marked as deleted.- Specified by:
primitivesRemovedin interfaceDataSetListener- Parameters:
event- An event for an collection of newly-invisible primitives
-