Class ChangesetCacheManagerModel
- java.lang.Object
-
- javax.swing.table.AbstractTableModel
-
- org.openstreetmap.josm.gui.dialogs.changeset.ChangesetCacheManagerModel
-
- All Implemented Interfaces:
Serializable
,TableModel
,ChangesetCacheListener
public class ChangesetCacheManagerModel extends AbstractTableModel implements ChangesetCacheListener
This is the model for the changeset cache manager dialog.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static String
CHANGESET_IN_DETAIL_VIEW_PROP
the name of the property for the currently selected changeset in the detail viewprivate Changeset
changesetInDetailView
private List<Changeset>
data
private DefaultListSelectionModel
selectionModel
private PropertyChangeSupport
support
-
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
-
-
Constructor Summary
Constructors Constructor Description ChangesetCacheManagerModel(DefaultListSelectionModel selectionModel)
Creates a new ChangesetCacheManagerModel that is based on the selectionModel
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addPropertyChangeListener(PropertyChangeListener listener)
Adds a property change listener to this model.void
changesetCacheUpdated(ChangesetCacheEvent event)
Gets notified on changeset cache updatesint
getColumnCount()
int
getRowCount()
Set<Integer>
getSelectedChangesetIds()
Replies a set of ids of the selected changesetsList<Changeset>
getSelectedChangesets()
Replies the list of selected changesetsDefaultListSelectionModel
getSelectionModel()
Gets the selection model this table is based on.Changeset
getValueAt(int row, int column)
boolean
hasSelectedChangesets()
Replies true if there is at least one selected changesetvoid
init()
Initializes the data that is displayed using the changeset cache.void
removePropertyChangeListener(PropertyChangeListener listener)
Removes a property change listener from this model.void
setChangesetInDetailView(Changeset cs)
Sets the changeset currently displayed in the detail view.void
setSelectedChangesets(Collection<Changeset> selected)
Selects the changesets inselected
.protected void
sort()
void
tearDown()
Destroys and unregisters this model.-
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getColumnClass, getColumnName, getListeners, getTableModelListeners, isCellEditable, removeTableModelListener, setValueAt
-
-
-
-
Field Detail
-
CHANGESET_IN_DETAIL_VIEW_PROP
public static final String CHANGESET_IN_DETAIL_VIEW_PROP
the name of the property for the currently selected changeset in the detail view
-
selectionModel
private final DefaultListSelectionModel selectionModel
-
changesetInDetailView
private transient Changeset changesetInDetailView
-
support
private final PropertyChangeSupport support
-
-
Constructor Detail
-
ChangesetCacheManagerModel
public ChangesetCacheManagerModel(DefaultListSelectionModel selectionModel)
Creates a new ChangesetCacheManagerModel that is based on the selectionModel- Parameters:
selectionModel
- A new selection model that should be used.
-
-
Method Detail
-
addPropertyChangeListener
public void addPropertyChangeListener(PropertyChangeListener listener)
Adds a property change listener to this model.- Parameters:
listener
- The listener
-
removePropertyChangeListener
public void removePropertyChangeListener(PropertyChangeListener listener)
Removes a property change listener from this model.- Parameters:
listener
- The listener
-
setChangesetInDetailView
public void setChangesetInDetailView(Changeset cs)
Sets the changeset currently displayed in the detail view. Fires a property change event for the propertyCHANGESET_IN_DETAIL_VIEW_PROP
if necessary.- Parameters:
cs
- the changeset currently displayed in the detail view.
-
hasSelectedChangesets
public boolean hasSelectedChangesets()
Replies true if there is at least one selected changeset- Returns:
- true if there is at least one selected changeset
-
getSelectedChangesets
public List<Changeset> getSelectedChangesets()
Replies the list of selected changesets- Returns:
- the list of selected changesets
-
getSelectedChangesetIds
public Set<Integer> getSelectedChangesetIds()
Replies a set of ids of the selected changesets- Returns:
- a set of ids of the selected changesets
-
setSelectedChangesets
public void setSelectedChangesets(Collection<Changeset> selected)
Selects the changesets inselected
.- Parameters:
selected
- the collection of changesets to select. Ignored if empty.
-
getColumnCount
public int getColumnCount()
- Specified by:
getColumnCount
in interfaceTableModel
-
getRowCount
public int getRowCount()
- Specified by:
getRowCount
in interfaceTableModel
-
getValueAt
public Changeset getValueAt(int row, int column)
- Specified by:
getValueAt
in interfaceTableModel
-
init
public void init()
Initializes the data that is displayed using the changeset cache.
-
tearDown
public void tearDown()
Destroys and unregisters this model.
-
getSelectionModel
public DefaultListSelectionModel getSelectionModel()
Gets the selection model this table is based on.- Returns:
- The selection model.
-
sort
protected void sort()
-
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
-
-