Class SourceEditor.ActiveSourcesModel
- java.lang.Object
-
- javax.swing.table.AbstractTableModel
-
- org.openstreetmap.josm.gui.preferences.SourceEditor.ActiveSourcesModel
-
- All Implemented Interfaces:
java.io.Serializable
,javax.swing.table.TableModel
,ReorderableModel<SourceEntry>
,ReorderableTableModel<SourceEntry>
- Enclosing class:
- SourceEditor
protected class SourceEditor.ActiveSourcesModel extends javax.swing.table.AbstractTableModel implements ReorderableTableModel<SourceEntry>
Table model of active sources.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<SourceEntry>
data
private javax.swing.DefaultListSelectionModel
selectionModel
-
Constructor Summary
Constructors Constructor Description ActiveSourcesModel(javax.swing.DefaultListSelectionModel selectionModel)
Constructs a newActiveSourcesModel
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addExtendedSourceEntries(java.util.List<ExtendedSourceEntry> sources)
Adds multiple sources.void
addSource(SourceEntry entry)
Adds an active source.java.lang.Class<?>
getColumnClass(int column)
int
getColumnCount()
int
getRowCount()
Returns the number of rows in the list/table.javax.swing.DefaultListSelectionModel
getSelectionModel()
Returns the selection model.java.util.List<SourceEntry>
getSources()
Returns the active sources.SourceEntry
getValue(int index)
Get object value at given index.java.lang.Object
getValueAt(int rowIndex, int columnIndex)
boolean
isCellEditable(int rowIndex, int columnIndex)
void
removeIdxs(java.util.Collection<java.lang.Integer> idxs)
Removes the sources at given indexes.void
removeSelected()
Removes the selected sources.void
setActiveSources(java.util.Collection<? extends SourceEntry> sources)
Sets active sources.SourceEntry
setValue(int index, SourceEntry value)
Set object value at given index.void
setValueAt(java.lang.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 java.util.List<SourceEntry> data
-
selectionModel
private final javax.swing.DefaultListSelectionModel selectionModel
-
-
Constructor Detail
-
ActiveSourcesModel
public ActiveSourcesModel(javax.swing.DefaultListSelectionModel selectionModel)
Constructs a newActiveSourcesModel
.- Parameters:
selectionModel
- selection model
-
-
Method Detail
-
getColumnCount
public int getColumnCount()
- Specified by:
getColumnCount
in interfacejavax.swing.table.TableModel
-
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 interfacejavax.swing.table.TableModel
- Returns:
- the number of rows in the list/table
- See Also:
ListModel.getSize()
,TableModel.getRowCount()
-
getValueAt
public java.lang.Object getValueAt(int rowIndex, int columnIndex)
- Specified by:
getValueAt
in interfacejavax.swing.table.TableModel
-
isCellEditable
public boolean isCellEditable(int rowIndex, int columnIndex)
- Specified by:
isCellEditable
in interfacejavax.swing.table.TableModel
- Overrides:
isCellEditable
in classjavax.swing.table.AbstractTableModel
-
getColumnClass
public java.lang.Class<?> getColumnClass(int column)
- Specified by:
getColumnClass
in interfacejavax.swing.table.TableModel
- Overrides:
getColumnClass
in classjavax.swing.table.AbstractTableModel
-
setValueAt
public void setValueAt(java.lang.Object aValue, int row, int column)
- Specified by:
setValueAt
in interfacejavax.swing.table.TableModel
- Overrides:
setValueAt
in classjavax.swing.table.AbstractTableModel
-
setActiveSources
public void setActiveSources(java.util.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(java.util.Collection<java.lang.Integer> idxs)
Removes the sources at given indexes.- Parameters:
idxs
- indexes to remove
-
addExtendedSourceEntries
public void addExtendedSourceEntries(java.util.List<ExtendedSourceEntry> sources)
Adds multiple sources.- Parameters:
sources
- source entries
-
getSources
public java.util.List<SourceEntry> getSources()
Returns the active sources.- Returns:
- the active sources
-
getSelectionModel
public javax.swing.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
-
-