Class TagConflictResolverModel
- java.lang.Object
-
- javax.swing.table.AbstractTableModel
-
- javax.swing.table.DefaultTableModel
-
- org.openstreetmap.josm.gui.conflict.tags.TagConflictResolverModel
-
- All Implemented Interfaces:
Serializable
,TableModel
public class TagConflictResolverModel extends DefaultTableModel
This model holds the information about tags that are currently conflicting and the decision of the user regarding them.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private Map<String,MultiValueResolutionDecision>
decisions
private List<String>
displayedKeys
private Set<String>
keysWithConflicts
static String
NUM_CONFLICTS_PROP
private int
numConflicts
private boolean
showTagsWithConflictsOnly
private boolean
showTagsWithMultiValuesOnly
private 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
Constructors Constructor Description TagConflictResolverModel()
Constructs a newTagConflictResolverModel
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
actOnDecisions(BiConsumer<String,MultiValueResolutionDecision> action)
Perform an action on all decisions, useful to perform a global decision (keep all, keep none, etc.)void
addPropertyChangeListener(PropertyChangeListener listener)
TagCollection
getAllResolutions()
MultiValueResolutionDecision
getDecision(int row)
Returns the conflict resolution decision at the given row.String
getKey(int row)
Returns the OSM key at the given row.Set<String>
getKeysWithConflicts()
Returns the set of keys in conflict.int
getNumConflicts()
Gets the number of remaining conflicts.int
getNumDecisions()
Gets the number of decisions the user can takeTagCollection
getResolution()
int
getRowCount()
Object
getValueAt(int row, int column)
boolean
isCellEditable(int row, int column)
boolean
isResolvedCompletely()
Replies true if eachMultiValueResolutionDecision
is decided.void
populate(TagCollection tags, Set<String> keysWithConflicts)
Populates the model with the tags for which conflicts are to be resolved.(package private) void
populate(TagCollection tags, Set<String> keysWithConflicts, boolean fireEvent)
Populates the model with the tags for which conflicts are to be resolved.void
prepareDefaultTagDecisions()
Prepare the default decisions for the current model(package private) void
prepareDefaultTagDecisions(boolean fireEvent)
Prepare the default decisions for the current modelvoid
rebuild()
initializes the model from the current tags(package private) void
rebuild(boolean fireEvent)
initializes the model from the current tagsprotected void
refreshNumConflicts()
void
removePropertyChangeListener(PropertyChangeListener listener)
protected void
setNumConflicts(int numConflicts)
void
setShowTagsWithConflictsOnly(boolean showTagsWithConflictsOnly)
Sets whether all tags or only tags with conflicts are displayedvoid
setShowTagsWithMultiValuesOnly(boolean showTagsWithMultiValuesOnly)
Sets whether all conflicts or only conflicts with multiple values are displayedvoid
setValueAt(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
-
-
-
-
Field Detail
-
NUM_CONFLICTS_PROP
public static final String NUM_CONFLICTS_PROP
-
tags
private transient TagCollection tags
-
displayedKeys
private List<String> displayedKeys
-
keysWithConflicts
private final Set<String> keysWithConflicts
-
decisions
private transient Map<String,MultiValueResolutionDecision> decisions
-
numConflicts
private int numConflicts
-
support
private final PropertyChangeSupport support
-
showTagsWithConflictsOnly
private boolean showTagsWithConflictsOnly
-
showTagsWithMultiValuesOnly
private boolean showTagsWithMultiValuesOnly
-
-
Constructor Detail
-
TagConflictResolverModel
public TagConflictResolverModel()
Constructs a newTagConflictResolverModel
.
-
-
Method Detail
-
addPropertyChangeListener
public void addPropertyChangeListener(PropertyChangeListener listener)
-
removePropertyChangeListener
public void removePropertyChangeListener(PropertyChangeListener listener)
-
setNumConflicts
protected void setNumConflicts(int numConflicts)
-
refreshNumConflicts
protected void refreshNumConflicts()
-
sort
protected void sort()
-
rebuild
public void rebuild()
initializes the model from the current tags
-
rebuild
void rebuild(boolean fireEvent)
initializes the model from the current tags- Parameters:
fireEvent
-true
to callfireTableDataChanged
(can be a slow operation)- Since:
- 11626
-
populate
public void populate(TagCollection tags, Set<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:
IllegalArgumentException
- if tags is null
-
populate
void populate(TagCollection tags, Set<String> keysWithConflicts, boolean fireEvent)
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 conflictsfireEvent
-true
to callfireTableDataChanged
(can be a slow operation)- Throws:
IllegalArgumentException
- if tags is null- Since:
- 11626
-
getKey
public final String getKey(int row)
Returns the OSM key at the given row.- Parameters:
row
- The table row- Returns:
- the OSM key at the given row.
- Since:
- 6616
-
getRowCount
public int getRowCount()
- Specified by:
getRowCount
in interfaceTableModel
- Overrides:
getRowCount
in classDefaultTableModel
-
getValueAt
public Object getValueAt(int row, int column)
- Specified by:
getValueAt
in interfaceTableModel
- Overrides:
getValueAt
in classDefaultTableModel
-
isCellEditable
public boolean isCellEditable(int row, int column)
- Specified by:
isCellEditable
in interfaceTableModel
- Overrides:
isCellEditable
in classDefaultTableModel
-
setValueAt
public void setValueAt(Object value, int row, int column)
- Specified by:
setValueAt
in interfaceTableModel
- Overrides:
setValueAt
in classDefaultTableModel
-
isResolvedCompletely
public boolean isResolvedCompletely()
Replies true if eachMultiValueResolutionDecision
is decided.- Returns:
- true if each
MultiValueResolutionDecision
is decided; false otherwise
-
getNumConflicts
public int getNumConflicts()
Gets the number of remaining conflicts.- Returns:
- The number
-
getNumDecisions
public int getNumDecisions()
Gets the number of decisions the user can take- Returns:
- The number of decisions
-
getResolution
public TagCollection getResolution()
-
getAllResolutions
public TagCollection getAllResolutions()
-
getDecision
public MultiValueResolutionDecision getDecision(int row)
Returns the conflict resolution decision at the given row.- Parameters:
row
- The table row- Returns:
- the conflict resolution decision at the given 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
-
prepareDefaultTagDecisions
void prepareDefaultTagDecisions(boolean fireEvent)
Prepare the default decisions for the current model- Parameters:
fireEvent
-true
to callfireTableDataChanged
(can be a slow operation)- Since:
- 11626
-
getKeysWithConflicts
public final Set<String> getKeysWithConflicts()
Returns the set of keys in conflict.- Returns:
- the set of keys in conflict.
- Since:
- 6616
-
actOnDecisions
public final void actOnDecisions(BiConsumer<String,MultiValueResolutionDecision> action)
Perform an action on all decisions, useful to perform a global decision (keep all, keep none, etc.)- Parameters:
action
- action to perform on decision- Since:
- 18007
-
-