org.openstreetmap.josm.gui.conflict.pair
Class ListMergeModel.EntriesTableModel

java.lang.Object
  extended by javax.swing.table.AbstractTableModel
      extended by javax.swing.table.DefaultTableModel
          extended by org.openstreetmap.josm.gui.conflict.pair.ListMergeModel.EntriesTableModel
Type Parameters:
T -
All Implemented Interfaces:
java.io.Serializable, javax.swing.table.TableModel, OsmPrimitivesTableModel
Enclosing class:
ListMergeModel<T extends PrimitiveId>

public class ListMergeModel.EntriesTableModel
extends javax.swing.table.DefaultTableModel
implements OsmPrimitivesTableModel

This an adapter between a JTable and one of the three entry lists in the role ListRole managed by the ListMergeModel. From the point of view of the JTable it is a TableModel.

See Also:
ListMergeModel.getMyTableModel(), ListMergeModel.getTheirTableModel(), ListMergeModel.getMergedTableModel(), Serialized Form

Field Summary
private  ListRole role
           
 
Fields inherited from class javax.swing.table.DefaultTableModel
columnIdentifiers, dataVector
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
ListMergeModel.EntriesTableModel(ListRole role)
           
 
Method Summary
protected  java.util.ArrayList<T> getEntries()
           
 ListMergeModel<T> getListMergeModel()
           
protected  java.util.ArrayList<T> getOppositeEntries()
          replies the opposite list of entries with respect to the current ComparePairType
 OsmPrimitive getReferredPrimitive(int idx)
           
 ListRole getRole()
           
 int getRowCount()
           
 java.lang.Object getValueAt(int row, int column)
           
 boolean isCellEditable(int row, int column)
           
 boolean isIncludedInOppositeList(int row)
          replies true if the entry at the current position is present in the opposite list of the current ComparePairType.
 boolean isParticipatingInCurrentComparePair()
          replies true if the ListRole of this ListMergeModel.EntriesTableModel participates in the current ComparePairType
 boolean isSamePositionInOppositeList(int row)
          replies true if the entry at row is equal to the entry at the same position in the opposite list of the current ComparePairType.
 void setValueAt(java.lang.Object value, int row, int col)
           
 
Methods inherited from class javax.swing.table.DefaultTableModel
addColumn, addColumn, addColumn, addRow, addRow, convertToVector, convertToVector, getColumnCount, getColumnName, getDataVector, insertRow, insertRow, moveRow, newDataAvailable, newRowsAdded, removeRow, rowsRemoved, setColumnCount, setColumnIdentifiers, setColumnIdentifiers, setDataVector, setDataVector, setNumRows, setRowCount
 
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getColumnClass, 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 javax.swing.table.TableModel
addTableModelListener, getColumnClass, getColumnCount, getColumnName, removeTableModelListener
 

Field Detail

role

private final ListRole role
Constructor Detail

ListMergeModel.EntriesTableModel

public ListMergeModel.EntriesTableModel(ListRole role)
Parameters:
role - the role
Method Detail

getRowCount

public int getRowCount()
Specified by:
getRowCount in interface javax.swing.table.TableModel
Overrides:
getRowCount in class javax.swing.table.DefaultTableModel

getValueAt

public java.lang.Object getValueAt(int row,
                                   int column)
Specified by:
getValueAt in interface javax.swing.table.TableModel
Overrides:
getValueAt in class javax.swing.table.DefaultTableModel

isCellEditable

public boolean isCellEditable(int row,
                              int column)
Specified by:
isCellEditable in interface javax.swing.table.TableModel
Overrides:
isCellEditable in class javax.swing.table.DefaultTableModel

setValueAt

public void setValueAt(java.lang.Object value,
                       int row,
                       int col)
Specified by:
setValueAt in interface javax.swing.table.TableModel
Overrides:
setValueAt in class javax.swing.table.DefaultTableModel

getListMergeModel

public ListMergeModel<T> getListMergeModel()

isParticipatingInCurrentComparePair

public boolean isParticipatingInCurrentComparePair()
replies true if the ListRole of this ListMergeModel.EntriesTableModel participates in the current ComparePairType

Returns:
true, if the if the ListRole of this ListMergeModel.EntriesTableModel participates in the current ComparePairType
See Also:
ListMergeModel.ComparePairListModel.getSelectedComparePair()

isSamePositionInOppositeList

public boolean isSamePositionInOppositeList(int row)
replies true if the entry at row is equal to the entry at the same position in the opposite list of the current ComparePairType.

Parameters:
row - the row number
Returns:
true if the entry at row is equal to the entry at the same position in the opposite list of the current ComparePairType
Throws:
java.lang.IllegalStateException - thrown, if this model is not participating in the current ComparePairType
See Also:
ComparePairType.getOppositeRole(ListRole), getRole(), getOppositeEntries()

isIncludedInOppositeList

public boolean isIncludedInOppositeList(int row)
replies true if the entry at the current position is present in the opposite list of the current ComparePairType.

Parameters:
row - the current row
Returns:
true if the entry at the current position is present in the opposite list of the current ComparePairType.
Throws:
java.lang.IllegalStateException - thrown, if this model is not participating in the current ComparePairType
See Also:
ComparePairType.getOppositeRole(ListRole), getRole(), getOppositeEntries()

getEntries

protected java.util.ArrayList<T> getEntries()

getOppositeEntries

protected java.util.ArrayList<T> getOppositeEntries()
replies the opposite list of entries with respect to the current ComparePairType

Returns:
the opposite list of entries

getRole

public ListRole getRole()

getReferredPrimitive

public OsmPrimitive getReferredPrimitive(int idx)
Specified by:
getReferredPrimitive in interface OsmPrimitivesTableModel


JOSM