Class SourceEditor.ActiveSourcesModel
- java.lang.Object
-
- javax.swing.table.AbstractTableModel
-
- org.openstreetmap.josm.gui.preferences.SourceEditor.ActiveSourcesModel
-
- All Implemented Interfaces:
Serializable
,TableModel
,ReorderableModel<SourceEntry>
,ReorderableTableModel<SourceEntry>
- Enclosing class:
- SourceEditor
protected class SourceEditor.ActiveSourcesModel extends AbstractTableModel implements ReorderableTableModel<SourceEntry>
Table model of active sources.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private List<SourceEntry>
data
private DefaultListSelectionModel
selectionModel
-
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
-
-
Constructor Summary
Constructors Constructor Description ActiveSourcesModel(DefaultListSelectionModel selectionModel)
Constructs a newActiveSourcesModel
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addExtendedSourceEntries(List<ExtendedSourceEntry> sources)
Adds multiple sources.void
addSource(SourceEntry entry)
Adds an active source.Class<?>
getColumnClass(int column)
int
getColumnCount()
int
getRowCount()
Returns the number of rows in the list/table.DefaultListSelectionModel
getSelectionModel()
Returns the selection model.List<SourceEntry>
getSources()
Returns the active sources.SourceEntry
getValue(int index)
Get object value at given index.Object
getValueAt(int rowIndex, int columnIndex)
boolean
isCellEditable(int rowIndex, int columnIndex)
void
removeIdxs(Collection<Integer> idxs)
Removes the sources at given indexes.void
removeSelected()
Removes the selected sources.void
setActiveSources(Collection<? extends SourceEntry> sources)
Sets active sources.SourceEntry
setValue(int index, SourceEntry value)
Set object value at given index.void
setValueAt(Object aValue, int row, int column)
-
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getColumnName, getListeners, getTableModelListeners, removeTableModelListener
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.openstreetmap.josm.data.ReorderableModel
canMove, canMoveDown, canMoveUp, doMove
-
Methods inherited from interface org.openstreetmap.josm.gui.util.ReorderableTableModel
canMove, canMoveDown, canMoveDown, canMoveUp, canMoveUp, getSelectedIndices, move, moveDown, moveDown, moveUp, moveUp, selectedIndices
-
-
-
-
Field Detail
-
data
private transient List<SourceEntry> data
-
selectionModel
private final DefaultListSelectionModel selectionModel
-
-
Constructor Detail
-
ActiveSourcesModel
public ActiveSourcesModel(DefaultListSelectionModel selectionModel)
Constructs a newActiveSourcesModel
.- Parameters:
selectionModel
- selection model
-
-
Method Detail
-
getColumnCount
public int getColumnCount()
- Specified by:
getColumnCount
in interfaceTableModel
-
getRowCount
public int getRowCount()
Description copied from interface:ReorderableTableModel
Returns the number of rows in the list/table.- Specified by:
getRowCount
in interfaceReorderableTableModel<SourceEntry>
- Specified by:
getRowCount
in interfaceTableModel
- Returns:
- the number of rows in the list/table
- See Also:
ListModel.getSize()
,TableModel.getRowCount()
-
getValueAt
public Object getValueAt(int rowIndex, int columnIndex)
- Specified by:
getValueAt
in interfaceTableModel
-
isCellEditable
public boolean isCellEditable(int rowIndex, int columnIndex)
- Specified by:
isCellEditable
in interfaceTableModel
- Overrides:
isCellEditable
in classAbstractTableModel
-
getColumnClass
public Class<?> getColumnClass(int column)
- Specified by:
getColumnClass
in interfaceTableModel
- Overrides:
getColumnClass
in classAbstractTableModel
-
setValueAt
public void setValueAt(Object aValue, int row, int column)
- Specified by:
setValueAt
in interfaceTableModel
- Overrides:
setValueAt
in classAbstractTableModel
-
setActiveSources
public void setActiveSources(Collection<? extends SourceEntry> sources)
Sets active sources.- Parameters:
sources
- active sources
-
addSource
public void addSource(SourceEntry entry)
Adds an active source.- Parameters:
entry
- source to add
-
removeSelected
public void removeSelected()
Removes the selected sources.
-
removeIdxs
public void removeIdxs(Collection<Integer> idxs)
Removes the sources at given indexes.- Parameters:
idxs
- indexes to remove
-
addExtendedSourceEntries
public void addExtendedSourceEntries(List<ExtendedSourceEntry> sources)
Adds multiple sources.- Parameters:
sources
- source entries
-
getSources
public List<SourceEntry> getSources()
Returns the active sources.- Returns:
- the active sources
-
getSelectionModel
public DefaultListSelectionModel getSelectionModel()
Description copied from interface:ReorderableTableModel
Returns the selection model.- Specified by:
getSelectionModel
in interfaceReorderableTableModel<SourceEntry>
- Returns:
- the selection model (never null)
- See Also:
JList.getSelectionModel()
,JTable.getSelectionModel()
-
getValue
public SourceEntry getValue(int index)
Description copied from interface:ReorderableModel
Get object value at given index.- Specified by:
getValue
in interfaceReorderableModel<SourceEntry>
- Parameters:
index
- index- Returns:
- object value at given index
-
setValue
public SourceEntry setValue(int index, SourceEntry value)
Description copied from interface:ReorderableModel
Set object value at given index.- Specified by:
setValue
in interfaceReorderableModel<SourceEntry>
- Parameters:
index
- indexvalue
- new value- Returns:
- the value previously at the specified position
-
-