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>dataprivate javax.swing.DefaultListSelectionModelselectionModel
-
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 voidaddExtendedSourceEntries(java.util.List<ExtendedSourceEntry> sources)Adds multiple sources.voidaddSource(SourceEntry entry)Adds an active source.java.lang.Class<?>getColumnClass(int column)intgetColumnCount()intgetRowCount()Returns the number of rows in the list/table.javax.swing.DefaultListSelectionModelgetSelectionModel()Returns the selection model.java.util.List<SourceEntry>getSources()Returns the active sources.SourceEntrygetValue(int index)Get object value at given index.java.lang.ObjectgetValueAt(int rowIndex, int columnIndex)booleanisCellEditable(int rowIndex, int columnIndex)voidremoveIdxs(java.util.Collection<java.lang.Integer> idxs)Removes the sources at given indexes.voidremoveSelected()Removes the selected sources.voidsetActiveSources(java.util.Collection<? extends SourceEntry> sources)Sets active sources.SourceEntrysetValue(int index, SourceEntry value)Set object value at given index.voidsetValueAt(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:
getColumnCountin interfacejavax.swing.table.TableModel
-
getRowCount
public int getRowCount()
Description copied from interface:ReorderableTableModelReturns the number of rows in the list/table.- Specified by:
getRowCountin interfaceReorderableTableModel<SourceEntry>- Specified by:
getRowCountin 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:
getValueAtin interfacejavax.swing.table.TableModel
-
isCellEditable
public boolean isCellEditable(int rowIndex, int columnIndex)
- Specified by:
isCellEditablein interfacejavax.swing.table.TableModel- Overrides:
isCellEditablein classjavax.swing.table.AbstractTableModel
-
getColumnClass
public java.lang.Class<?> getColumnClass(int column)
- Specified by:
getColumnClassin interfacejavax.swing.table.TableModel- Overrides:
getColumnClassin classjavax.swing.table.AbstractTableModel
-
setValueAt
public void setValueAt(java.lang.Object aValue, int row, int column)
- Specified by:
setValueAtin interfacejavax.swing.table.TableModel- Overrides:
setValueAtin 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:ReorderableTableModelReturns the selection model.- Specified by:
getSelectionModelin interfaceReorderableTableModel<SourceEntry>- Returns:
- the selection model (never null)
- See Also:
JList.getSelectionModel(),JTable.getSelectionModel()
-
getValue
public SourceEntry getValue(int index)
Description copied from interface:ReorderableModelGet object value at given index.- Specified by:
getValuein interfaceReorderableModel<SourceEntry>- Parameters:
index- index- Returns:
- object value at given index
-
setValue
public SourceEntry setValue(int index, SourceEntry value)
Description copied from interface:ReorderableModelSet object value at given index.- Specified by:
setValuein interfaceReorderableModel<SourceEntry>- Parameters:
index- indexvalue- new value- Returns:
- the value previously at the specified position
-
-