T
- the type of the list entriespublic abstract class ListMergeModel<T extends PrimitiveId> extends java.util.Observable
TableModel
s and three ListSelectionModel
s:
JTable
which shows my entries.
See getMyTableModel()
and getMySelectionModel()
PropertyChangeListener
s can register for property value changes of
FROZEN_PROP
.
ListMergeModel is an abstract class. Three methods have to be implemented by subclasses:
cloneEntryForMergedList(T)
- clones an entry of type TisEqualEntry(T, T)
- checks whether two entries are equals setValueAt(DefaultTableModel, Object, int, int)
- handles values edited in
a JTable, dispatched from TableModel.setValueAt(Object, int, int)
ListMerger
.ListMerger
Modifier and Type | Class and Description |
---|---|
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 . |
Modifier and Type | Field and Description |
---|---|
private ListMergeModel.ComparePairListModel |
comparePairListModel |
protected java.util.Map<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 and Description |
---|
ListMergeModel() |
Modifier and Type | Method and Description |
---|---|
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
TableModel.setValueAt(Object, int, int) . |
public static final java.lang.String FROZEN_PROP
private static final int MAX_DELETED_PRIMITIVE_IN_DIALOG
protected java.util.Map<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 java.util.Map<PrimitiveId,PrimitiveId> mergedMap
public ListMergeModel()
protected abstract T cloneEntryForMergedList(T entry)
entry
- the entrypublic abstract boolean isEqualEntry(T e1, T e2)
e1
- the first entrye2
- the second entryprotected abstract void setValueAt(javax.swing.table.DefaultTableModel model, java.lang.Object value, int row, int col)
TableModel.setValueAt(Object, int, int)
.model
- the table modelvalue
- the value to be setrow
- the row indexcol
- the column indexTableModel.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 final void setFrozen(boolean isFrozen)
public final 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()
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)
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 insertedjava.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 insertedjava.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 insertedjava.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 insertedjava.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 insertedjava.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 insertedjava.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()