org.openstreetmap.josm.gui.conflict.tags
Class TagConflictResolverModel

java.lang.Object
  extended by javax.swing.table.AbstractTableModel
      extended by javax.swing.table.DefaultTableModel
          extended by org.openstreetmap.josm.gui.conflict.tags.TagConflictResolverModel
All Implemented Interfaces:
java.io.Serializable, javax.swing.table.TableModel

public class TagConflictResolverModel
extends javax.swing.table.DefaultTableModel

See Also:
Serialized Form

Field Summary
private  java.util.HashMap<java.lang.String,MultiValueResolutionDecision> decisions
           
private  java.util.List<java.lang.String> displayedKeys
           
private  java.util.Set<java.lang.String> keysWithConflicts
           
static java.lang.String NUM_CONFLICTS_PROP
           
private  int numConflicts
           
private  boolean showTagsWithConflictsOnly
           
private  boolean showTagsWithMultiValuesOnly
           
private  java.beans.PropertyChangeSupport support
           
private  TagCollection tags
           
 
Fields inherited from class javax.swing.table.DefaultTableModel
columnIdentifiers, dataVector
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
TagConflictResolverModel()
           
 
Method Summary
 void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
           
 TagCollection getAllResolutions()
           
 MultiValueResolutionDecision getDecision(int row)
           
 int getNumConflicts()
           
 int getNumDecisions()
           
 TagCollection getResolution()
           
 int getRowCount()
           
 java.lang.Object getValueAt(int row, int column)
           
 boolean isCellEditable(int row, int column)
           
 boolean isResolvedCompletely()
          Replies true if each MultiValueResolutionDecision is decided.
 void populate(TagCollection tags, java.util.Set<java.lang.String> keysWithConflicts)
          Populates the model with the tags for which conflicts are to be resolved.
 void prepareDefaultTagDecisions()
          Prepare the default decisions for the current model
protected  void rebuild()
          initializes the model from the current tags
protected  void refreshNumConflicts()
           
 void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
           
protected  void setNumConflicts(int numConflicts)
           
 void setShowTagsWithConflictsOnly(boolean showTagsWithConflictsOnly)
          Sets whether all tags or only tags with conflicts are displayed
 void setShowTagsWithMultiValuesOnly(boolean showTagsWithMultiValuesOnly)
          Sets whether all conflicts or only conflicts with multiple values are displayed
 void setValueAt(java.lang.Object value, int row, int column)
           
protected  void sort()
           
 
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
 

Field Detail

NUM_CONFLICTS_PROP

public static final java.lang.String NUM_CONFLICTS_PROP

tags

private TagCollection tags

displayedKeys

private java.util.List<java.lang.String> displayedKeys

keysWithConflicts

private java.util.Set<java.lang.String> keysWithConflicts

decisions

private java.util.HashMap<java.lang.String,MultiValueResolutionDecision> decisions

numConflicts

private int numConflicts

support

private java.beans.PropertyChangeSupport support

showTagsWithConflictsOnly

private boolean showTagsWithConflictsOnly

showTagsWithMultiValuesOnly

private boolean showTagsWithMultiValuesOnly
Constructor Detail

TagConflictResolverModel

public TagConflictResolverModel()
Method Detail

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)

setNumConflicts

protected void setNumConflicts(int numConflicts)

refreshNumConflicts

protected void refreshNumConflicts()

sort

protected void sort()

rebuild

protected void rebuild()
initializes the model from the current tags


populate

public void populate(TagCollection tags,
                     java.util.Set<java.lang.String> keysWithConflicts)
Populates the model with the tags for which conflicts are to be resolved.

Parameters:
tags - the tag collection with the tags. Must not be null.
keysWithConflicts - the set of tag keys with conflicts
Throws:
java.lang.IllegalArgumentException - thrown if tags is null

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 column)
Specified by:
setValueAt in interface javax.swing.table.TableModel
Overrides:
setValueAt in class javax.swing.table.DefaultTableModel

isResolvedCompletely

public boolean isResolvedCompletely()
Replies true if each MultiValueResolutionDecision is decided.

Returns:
true if each MultiValueResolutionDecision is decided; false otherwise

getNumConflicts

public int getNumConflicts()

getNumDecisions

public int getNumDecisions()

getResolution

public TagCollection getResolution()

getAllResolutions

public TagCollection getAllResolutions()

getDecision

public MultiValueResolutionDecision getDecision(int row)

setShowTagsWithConflictsOnly

public void setShowTagsWithConflictsOnly(boolean showTagsWithConflictsOnly)
Sets whether all tags or only tags with conflicts are displayed

Parameters:
showTagsWithConflictsOnly - if true, only tags with conflicts are displayed

setShowTagsWithMultiValuesOnly

public void setShowTagsWithMultiValuesOnly(boolean showTagsWithMultiValuesOnly)
Sets whether all conflicts or only conflicts with multiple values are displayed

Parameters:
showTagsWithMultiValuesOnly - if true, only tags with multiple values are displayed

prepareDefaultTagDecisions

public void prepareDefaultTagDecisions()
Prepare the default decisions for the current model



JOSM