Class ChangesetCacheManagerModel
- java.lang.Object
-
- javax.swing.table.AbstractTableModel
-
- org.openstreetmap.josm.gui.dialogs.changeset.ChangesetCacheManagerModel
-
- All Implemented Interfaces:
java.io.Serializable,javax.swing.table.TableModel,ChangesetCacheListener
public class ChangesetCacheManagerModel extends javax.swing.table.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 java.lang.StringCHANGESET_IN_DETAIL_VIEW_PROPthe name of the property for the currently selected changeset in the detail viewprivate ChangesetchangesetInDetailViewprivate java.util.List<Changeset>dataprivate javax.swing.DefaultListSelectionModelselectionModelprivate ChangesetCacheTableRowSortersorterprivate java.beans.PropertyChangeSupportsupport
-
Constructor Summary
Constructors Constructor Description ChangesetCacheManagerModel(javax.swing.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 voidaddPropertyChangeListener(java.beans.PropertyChangeListener listener)Adds a property change listener to this model.voidchangesetCacheUpdated(ChangesetCacheEvent event)Gets notified on changeset cache updatesintgetColumnCount()intgetRowCount()java.util.Set<java.lang.Integer>getSelectedChangesetIds()Replies a set of ids of the selected changesetsjava.util.List<Changeset>getSelectedChangesets()Replies the list of selected changesetsjavax.swing.DefaultListSelectionModelgetSelectionModel()Gets the selection model this table is based on.ChangesetgetValueAt(int row, int column)booleanhasSelectedChangesets()Replies true if there is at least one selected changesetvoidinit()Initializes the data that is displayed using the changeset cache.voidremovePropertyChangeListener(java.beans.PropertyChangeListener listener)Removes a property change listener from this model.(package private) voidsetChangesetCacheTableRowSorter(ChangesetCacheTableRowSorter sorter)voidsetChangesetInDetailView(Changeset cs)Sets the changeset currently displayed in the detail view.voidsetSelectedChangesets(java.util.Collection<Changeset> selected)Selects the changesets inselected.protected voidsort()voidtearDown()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 java.lang.String CHANGESET_IN_DETAIL_VIEW_PROP
the name of the property for the currently selected changeset in the detail view
-
selectionModel
private final javax.swing.DefaultListSelectionModel selectionModel
-
sorter
private transient ChangesetCacheTableRowSorter sorter
-
changesetInDetailView
private transient Changeset changesetInDetailView
-
support
private final java.beans.PropertyChangeSupport support
-
-
Constructor Detail
-
ChangesetCacheManagerModel
public ChangesetCacheManagerModel(javax.swing.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(java.beans.PropertyChangeListener listener)
Adds a property change listener to this model.- Parameters:
listener- The listener
-
removePropertyChangeListener
public void removePropertyChangeListener(java.beans.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_PROPif 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 java.util.List<Changeset> getSelectedChangesets()
Replies the list of selected changesets- Returns:
- the list of selected changesets
-
getSelectedChangesetIds
public java.util.Set<java.lang.Integer> getSelectedChangesetIds()
Replies a set of ids of the selected changesets- Returns:
- a set of ids of the selected changesets
-
setSelectedChangesets
public void setSelectedChangesets(java.util.Collection<Changeset> selected)
Selects the changesets inselected.- Parameters:
selected- the collection of changesets to select. Ignored if empty.
-
getColumnCount
public int getColumnCount()
- Specified by:
getColumnCountin interfacejavax.swing.table.TableModel
-
getRowCount
public int getRowCount()
- Specified by:
getRowCountin interfacejavax.swing.table.TableModel
-
getValueAt
public Changeset getValueAt(int row, int column)
- Specified by:
getValueAtin interfacejavax.swing.table.TableModel
-
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 javax.swing.DefaultListSelectionModel getSelectionModel()
Gets the selection model this table is based on.- Returns:
- The selection model.
-
sort
protected void sort()
-
setChangesetCacheTableRowSorter
void setChangesetCacheTableRowSorter(ChangesetCacheTableRowSorter sorter)
-
changesetCacheUpdated
public void changesetCacheUpdated(ChangesetCacheEvent event)
Description copied from interface:ChangesetCacheListenerGets notified on changeset cache updates- Specified by:
changesetCacheUpdatedin interfaceChangesetCacheListener- Parameters:
event- The event that happened
-
-