Class SelectionSynchronizer
- java.lang.Object
-
- org.openstreetmap.josm.gui.history.SelectionSynchronizer
-
- All Implemented Interfaces:
EventListener
,ListSelectionListener
public class SelectionSynchronizer extends Object implements ListSelectionListener
Helper class to ensure that two (or more)JTable
s always have the same entries selected. The tables are usually displayed side-by-side.
-
-
Field Summary
Fields Modifier and Type Field Description private Set<ListSelectionModel>
participants
private boolean
preventRecursion
private BiFunction<Integer,ListSelectionModel,IntStream>
selectionIndexMapper
-
Constructor Summary
Constructors Constructor Description SelectionSynchronizer()
Constructs a newSelectionSynchronizer
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
participateInSynchronizedSelection(ListSelectionModel model)
AddListSelectionModel
of the table to participate in selection synchronization.(package private) void
setSelectionIndexMapper(BiFunction<Integer,ListSelectionModel,IntStream> selectionIndexMapper)
void
valueChanged(ListSelectionEvent e)
-
-
-
Field Detail
-
participants
private final Set<ListSelectionModel> participants
-
preventRecursion
private boolean preventRecursion
-
selectionIndexMapper
private BiFunction<Integer,ListSelectionModel,IntStream> selectionIndexMapper
-
-
Constructor Detail
-
SelectionSynchronizer
public SelectionSynchronizer()
Constructs a newSelectionSynchronizer
.
-
-
Method Detail
-
participateInSynchronizedSelection
public void participateInSynchronizedSelection(ListSelectionModel model)
AddListSelectionModel
of the table to participate in selection synchronization. Call this method for all tables that should have their selection synchronized.- Parameters:
model
- the selection model of the table
-
setSelectionIndexMapper
void setSelectionIndexMapper(BiFunction<Integer,ListSelectionModel,IntStream> selectionIndexMapper)
-
valueChanged
public void valueChanged(ListSelectionEvent e)
- Specified by:
valueChanged
in interfaceListSelectionListener
-
-