Class ChangesetListModel
- java.lang.Object
-
- javax.swing.AbstractListModel<E>
-
- javax.swing.DefaultListModel<Changeset>
-
- org.openstreetmap.josm.gui.dialogs.changeset.ChangesetListModel
-
- All Implemented Interfaces:
Serializable
,ListModel<Changeset>
,ChangesetCacheListener
- Direct Known Subclasses:
ChangesetInSelectionListModel
,ChangesetsInActiveDataLayerListModel
public class ChangesetListModel extends DefaultListModel<Changeset> implements ChangesetCacheListener
This is the model that backs a list of changesets- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private List<Changeset>
data
private DefaultListSelectionModel
selectionModel
private Storage<Changeset>
shownChangesets
-
Fields inherited from class javax.swing.AbstractListModel
listenerList
-
-
Constructor Summary
Constructors Constructor Description ChangesetListModel(DefaultListSelectionModel selectionModel)
Creates a newChangesetListModel
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
changesetCacheUpdated(ChangesetCacheEvent event)
Gets notified on changeset cache updatesChangeset
getElementAt(int idx)
Set<Integer>
getSelectedChangesetIds()
Gets the IDs of the changesets that are selectedSet<Changeset>
getSelectedChangesets()
Gets the list of changesets that are currently selectedList<Changeset>
getSelectedOpenChangesets()
Replies the selected open changesetsint
getSize()
boolean
hasSelectedOpenChangesets()
Replies true if there is at least one selected open changesetvoid
initFromChangesetIds(Collection<Integer> ids)
Loads this list with the given changesetsvoid
initFromDataSet(DataSet ds)
Loads this list with the given changesetsvoid
initFromPrimitives(Collection<? extends OsmPrimitive> primitives)
Loads this list with the given changesetsprotected void
setChangesets(Collection<Changeset> changesets)
void
setSelectedChangesets(Collection<Changeset> changesets)
Sets the changesets to selectprotected void
sort()
private void
updateModel()
-
Methods inherited from class javax.swing.DefaultListModel
add, addAll, addAll, addElement, capacity, clear, contains, copyInto, elementAt, elements, ensureCapacity, firstElement, get, indexOf, indexOf, insertElementAt, isEmpty, lastElement, lastIndexOf, lastIndexOf, remove, removeAllElements, removeElement, removeElementAt, removeRange, set, setElementAt, setSize, size, toArray, toString, trimToSize
-
Methods inherited from class javax.swing.AbstractListModel
addListDataListener, fireContentsChanged, fireIntervalAdded, fireIntervalRemoved, getListDataListeners, getListeners, removeListDataListener
-
-
-
-
Field Detail
-
shownChangesets
private final transient Storage<Changeset> shownChangesets
-
selectionModel
private final DefaultListSelectionModel selectionModel
-
-
Constructor Detail
-
ChangesetListModel
public ChangesetListModel(DefaultListSelectionModel selectionModel)
Creates a newChangesetListModel
- Parameters:
selectionModel
- The selection model to use for this list
-
-
Method Detail
-
getSelectedChangesets
public Set<Changeset> getSelectedChangesets()
Gets the list of changesets that are currently selected- Returns:
- The selected changesets
-
getSelectedChangesetIds
public Set<Integer> getSelectedChangesetIds()
Gets the IDs of the changesets that are selected- Returns:
- The selected ids
-
setSelectedChangesets
public void setSelectedChangesets(Collection<Changeset> changesets)
Sets the changesets to select- Parameters:
changesets
- The changesets
-
setChangesets
protected void setChangesets(Collection<Changeset> changesets)
-
updateModel
private void updateModel()
-
initFromChangesetIds
public void initFromChangesetIds(Collection<Integer> ids)
Loads this list with the given changesets- Parameters:
ids
- The ids of the changesets to display
-
initFromPrimitives
public void initFromPrimitives(Collection<? extends OsmPrimitive> primitives)
Loads this list with the given changesets- Parameters:
primitives
- The primitives of which the changesets should be displayed
-
initFromDataSet
public void initFromDataSet(DataSet ds)
Loads this list with the given changesets- Parameters:
ds
- The data set to get all changesets from
-
getElementAt
public Changeset getElementAt(int idx)
- Specified by:
getElementAt
in interfaceListModel<Changeset>
- Overrides:
getElementAt
in classDefaultListModel<Changeset>
-
getSize
public int getSize()
-
sort
protected void sort()
-
hasSelectedOpenChangesets
public boolean hasSelectedOpenChangesets()
Replies true if there is at least one selected open changeset- Returns:
- true if there is at least one selected open changeset
-
getSelectedOpenChangesets
public List<Changeset> getSelectedOpenChangesets()
Replies the selected open changesets- Returns:
- the selected open changesets
-
changesetCacheUpdated
public void changesetCacheUpdated(ChangesetCacheEvent event)
Description copied from interface:ChangesetCacheListener
Gets notified on changeset cache updates- Specified by:
changesetCacheUpdated
in interfaceChangesetCacheListener
- Parameters:
event
- The event that happened
-
-