|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.Observable
org.openstreetmap.josm.gui.conflict.pair.ListMergeModel<T>
T
- the type of the list entriespublic abstract class ListMergeModel<T extends PrimitiveId>
ListMergeModel is a model for interactively comparing and merging two list of entries of type T. It maintains three lists of entries of type T:
ListMergeModel.EntriesTableModel
s and three ListSelectionModel
s:
JTable
which shows my entries.
See getMyTableModel()
getMySelectionModel()
PropertyChangeListener
s can register for property value changes of
#PROP_FROZEN
.
ListMergeModel is an abstract class. Three methods have to be implemented by subclasses:
ListMergeModel#cloneEntryForMergedList(Object)
- clones an entry of type TListMergeModel#isEqualEntry(Object, Object)
- checks whether two entries are equals setValueAt(DefaultTableModel, Object, int, int)
- handles values edited in
a JTable, dispatched from ListMergeModel.EntriesTableModel.setValueAt(Object, int, int)
ListMerger
.
ListMerger
Nested Class Summary | |
---|---|
class |
ListMergeModel.ComparePairListModel
|
protected class |
ListMergeModel.EntriesSelectionModel
This is the selection model to be used in a JTable which displays
an entry list managed by ListMergeModel . |
class |
ListMergeModel.EntriesTableModel
This an adapter between a JTable and one of the three entry lists
in the role ListRole managed by the ListMergeModel . |
Field Summary | |
---|---|
private ListMergeModel.ComparePairListModel |
comparePairListModel
|
protected java.util.HashMap<ListRole,java.util.ArrayList<T>> |
entries
|
static java.lang.String |
FROZEN_PROP
|
private boolean |
isFrozen
|
private java.util.List<java.beans.PropertyChangeListener> |
listeners
|
private static int |
MAX_DELETED_PRIMITIVE_IN_DIALOG
|
protected ListMergeModel.EntriesSelectionModel |
mergedEntriesSelectionModel
|
protected ListMergeModel.EntriesTableModel |
mergedEntriesTableModel
|
private java.util.Map<PrimitiveId,PrimitiveId> |
mergedMap
|
private DataSet |
myDataset
|
protected ListMergeModel.EntriesSelectionModel |
myEntriesSelectionModel
|
protected ListMergeModel.EntriesTableModel |
myEntriesTableModel
|
protected ListMergeModel.EntriesSelectionModel |
theirEntriesSelectionModel
|
protected ListMergeModel.EntriesTableModel |
theirEntriesTableModel
|
Constructor Summary | |
---|---|
ListMergeModel()
|
Method Summary | |
---|---|
void |
addPropertyChangeListener(java.beans.PropertyChangeListener listener)
|
protected void |
alertCopyFailedForDeletedPrimitives(java.util.List<PrimitiveId> deletedIds)
|
protected void |
buildMergedEntriesTableModel()
|
protected void |
buildMyEntriesTableModel()
|
protected void |
buildTheirEntriesTableModel()
|
void |
clearMerged()
|
protected abstract T |
cloneEntryForMergedList(T entry)
Creates a clone of an entry of type T suitable to be included in the list of merged entries |
private void |
copy(ListRole sourceRole,
int[] rows,
int position)
|
protected void |
copyAfterCurrent(ListRole source,
int[] rows,
int current)
Copies the nodes given by indices in rows from the list of nodes source to the
list of merged nodes. |
void |
copyAll(ListRole source)
|
protected void |
copyBeforeCurrent(ListRole source,
int[] rows,
int current)
Copies the nodes given by indices in rows from the list of nodes source to the
list of merged nodes. |
void |
copyMyAfterCurrent(int[] rows,
int current)
Copies the nodes given by indices in rows from the list of my nodes to the list of merged nodes. |
void |
copyMyBeforeCurrent(int[] rows,
int current)
Copies the nodes given by indices in rows from the list of my nodes to the list of merged nodes. |
void |
copyMyToEnd(int[] rows)
Copies the nodes given by indices in rows from the list of my nodes to the list of merged nodes. |
void |
copyMyToTop(int[] rows)
Copies the nodes given by indices in rows from the list of my nodes to the list of merged nodes. |
void |
copyTheirAfterCurrent(int[] rows,
int current)
Copies the nodes given by indices in rows from the list of my nodes to the list of merged nodes. |
void |
copyTheirBeforeCurrent(int[] rows,
int current)
Copies the nodes given by indices in rows from the list of their nodes to the list of merged nodes. |
void |
copyTheirToEnd(int[] rows)
Copies the nodes given by indices in rows from the list of their nodes to the list of merged nodes. |
void |
copyTheirToTop(int[] rows)
Copies the nodes given by indices in rows from the list of their nodes to the list of merged nodes. |
void |
copyToEnd(ListRole source,
int[] rows)
Copies the nodes given by indices in rows from the list of nodes in source to the list of merged nodes. |
protected void |
copyToTop(ListRole role,
int[] rows)
|
protected void |
fireFrozenChanged(boolean oldValue,
boolean newValue)
|
protected void |
fireModelDataChanged()
|
ListMergeModel.ComparePairListModel |
getComparePairListModel()
|
protected java.util.List<T> |
getMergedEntries()
|
int |
getMergedEntriesSize()
|
ListMergeModel.EntriesSelectionModel |
getMergedSelectionModel()
|
OsmPrimitivesTableModel |
getMergedTableModel()
|
protected java.util.List<T> |
getMyEntries()
|
int |
getMyEntriesSize()
|
OsmPrimitive |
getMyPrimitive(T entry)
|
OsmPrimitive |
getMyPrimitiveById(PrimitiveId entry)
|
ListMergeModel.EntriesSelectionModel |
getMySelectionModel()
|
OsmPrimitivesTableModel |
getMyTableModel()
|
protected java.util.List<T> |
getTheirEntries()
|
int |
getTheirEntriesSize()
|
ListMergeModel.EntriesSelectionModel |
getTheirSelectionModel()
|
OsmPrimitivesTableModel |
getTheirTableModel()
|
protected void |
initPopulate(OsmPrimitive my,
OsmPrimitive their,
java.util.Map<PrimitiveId,PrimitiveId> mergedMap)
|
abstract boolean |
isEqualEntry(T e1,
T e2)
checks whether two entries are equal. |
boolean |
isFrozen()
|
void |
moveDownMerged(int[] rows)
Moves the nodes given by indices in rows down by one position in the list of merged nodes. |
void |
moveUpMerged(int[] rows)
Moves the nodes given by indices in rows up by one position in the list of merged nodes. |
protected boolean |
myAndTheirEntriesEqual()
Replies true if the list of my entries and the list of their entries are equal |
void |
removeMerged(int[] rows)
Removes the nodes given by indices in rows from the list of merged nodes. |
void |
removePropertyChangeListener(java.beans.PropertyChangeListener listener)
|
void |
setFrozen(boolean isFrozen)
|
protected abstract void |
setValueAt(javax.swing.table.DefaultTableModel model,
java.lang.Object value,
int row,
int col)
Handles method dispatches from ListMergeModel.EntriesTableModel.setValueAt(Object, int, int) . |
Methods inherited from class java.util.Observable |
---|
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String FROZEN_PROP
private static final int MAX_DELETED_PRIMITIVE_IN_DIALOG
protected java.util.HashMap<ListRole,java.util.ArrayList<T extends PrimitiveId>> entries
protected ListMergeModel.EntriesTableModel myEntriesTableModel
protected ListMergeModel.EntriesTableModel theirEntriesTableModel
protected ListMergeModel.EntriesTableModel mergedEntriesTableModel
protected ListMergeModel.EntriesSelectionModel myEntriesSelectionModel
protected ListMergeModel.EntriesSelectionModel theirEntriesSelectionModel
protected ListMergeModel.EntriesSelectionModel mergedEntriesSelectionModel
private final java.util.List<java.beans.PropertyChangeListener> listeners
private boolean isFrozen
private final ListMergeModel.ComparePairListModel comparePairListModel
private DataSet myDataset
private java.util.Map<PrimitiveId,PrimitiveId> mergedMap
Constructor Detail |
---|
public ListMergeModel()
Method Detail |
---|
protected abstract T cloneEntryForMergedList(T entry)
entry
- the entry
public abstract boolean isEqualEntry(T e1, T e2)
e1
- the first entrye2
- the second entry
protected abstract void setValueAt(javax.swing.table.DefaultTableModel model, java.lang.Object value, int row, int col)
ListMergeModel.EntriesTableModel.setValueAt(Object, int, int)
.
model
- the table modelvalue
- the value to be setrow
- the row indexcol
- the column indexListMergeModel.EntriesTableModel.setValueAt(Object, int, int)
public OsmPrimitive getMyPrimitive(T entry)
entry
-
public final OsmPrimitive getMyPrimitiveById(PrimitiveId entry)
protected void buildMyEntriesTableModel()
protected void buildTheirEntriesTableModel()
protected void buildMergedEntriesTableModel()
protected java.util.List<T> getMergedEntries()
protected java.util.List<T> getMyEntries()
protected java.util.List<T> getTheirEntries()
public int getMyEntriesSize()
public int getMergedEntriesSize()
public int getTheirEntriesSize()
public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
protected void fireFrozenChanged(boolean oldValue, boolean newValue)
public void setFrozen(boolean isFrozen)
public boolean isFrozen()
public OsmPrimitivesTableModel getMyTableModel()
public OsmPrimitivesTableModel getTheirTableModel()
public OsmPrimitivesTableModel getMergedTableModel()
public ListMergeModel.EntriesSelectionModel getMySelectionModel()
public ListMergeModel.EntriesSelectionModel getTheirSelectionModel()
public ListMergeModel.EntriesSelectionModel getMergedSelectionModel()
protected void fireModelDataChanged()
protected void copyToTop(ListRole role, int[] rows)
public void copyMyToTop(int[] rows)
rows
- the indicespublic void copyTheirToTop(int[] rows)
rows
- the indicespublic void copyToEnd(ListRole source, int[] rows)
source
- the list of nodes to copy fromrows
- the indicespublic void copyMyToEnd(int[] rows)
rows
- the indicespublic void copyTheirToEnd(int[] rows)
rows
- the indicespublic void clearMerged()
protected final void initPopulate(OsmPrimitive my, OsmPrimitive their, java.util.Map<PrimitiveId,PrimitiveId> mergedMap)
protected void alertCopyFailedForDeletedPrimitives(java.util.List<PrimitiveId> deletedIds)
private void copy(ListRole sourceRole, int[] rows, int position)
public void copyAll(ListRole source)
protected void copyBeforeCurrent(ListRole source, int[] rows, int current)
source
to the
list of merged nodes. Inserts the nodes before row given by current.
source
- the list of nodes to copy fromrows
- the indicescurrent
- the row index before which the nodes are inserted
java.lang.IllegalArgumentException
- thrown, if current < 0 or >= #nodes in list of merged nodespublic void copyMyBeforeCurrent(int[] rows, int current)
rows
- the indicescurrent
- the row index before which the nodes are inserted
java.lang.IllegalArgumentException
- thrown, if current < 0 or >= #nodes in list of merged nodespublic void copyTheirBeforeCurrent(int[] rows, int current)
rows
- the indicescurrent
- the row index before which the nodes are inserted
java.lang.IllegalArgumentException
- thrown, if current < 0 or >= #nodes in list of merged nodesprotected void copyAfterCurrent(ListRole source, int[] rows, int current)
source
to the
list of merged nodes. Inserts the nodes after the row given by current.
source
- the list of nodes to copy fromrows
- the indicescurrent
- the row index after which the nodes are inserted
java.lang.IllegalArgumentException
- thrown, if current < 0 or >= #nodes in list of merged nodespublic void copyMyAfterCurrent(int[] rows, int current)
rows
- the indicescurrent
- the row index after which the nodes are inserted
java.lang.IllegalArgumentException
- thrown, if current < 0 or >= #nodes in list of merged nodespublic void copyTheirAfterCurrent(int[] rows, int current)
rows
- the indicescurrent
- the row index after which the nodes are inserted
java.lang.IllegalArgumentException
- thrown, if current < 0 or >= #nodes in list of merged nodespublic void moveUpMerged(int[] rows)
rows
- the indicespublic void moveDownMerged(int[] rows)
rows
- the indicespublic void removeMerged(int[] rows)
rows
- the indicesprotected boolean myAndTheirEntriesEqual()
public ListMergeModel.ComparePairListModel getComparePairListModel()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |