1 | // License: GPL. For details, see LICENSE file.
|
---|
2 | package org.openstreetmap.josm.gui.dialogs.relation.actions;
|
---|
3 |
|
---|
4 | /**
|
---|
5 | * This interface can be used to register the event listeners for a
|
---|
6 | * {@link AbstractRelationEditorAction}.
|
---|
7 | * <p>
|
---|
8 | * It holds common constants that are often used.
|
---|
9 | *
|
---|
10 | * @author Michael Zangl
|
---|
11 | * @since 14027
|
---|
12 | */
|
---|
13 | @FunctionalInterface
|
---|
14 | public interface IRelationEditorUpdateOn {
|
---|
15 | /**
|
---|
16 | * Update when the member table contents change
|
---|
17 | */
|
---|
18 | IRelationEditorUpdateOn MEMBER_TABLE_CHANGE = (editor, action) -> editor.getMemberTableModel()
|
---|
19 | .addTableModelListener(action);
|
---|
20 | /**
|
---|
21 | * Update upon a member table selection change
|
---|
22 | */
|
---|
23 | IRelationEditorUpdateOn MEMBER_TABLE_SELECTION = (editor, action) -> editor.getMemberTable().getSelectionModel()
|
---|
24 | .addListSelectionListener(action);
|
---|
25 |
|
---|
26 | /**
|
---|
27 | * Update when a tag of the relation changed
|
---|
28 | */
|
---|
29 | IRelationEditorUpdateOn TAG_CHANGE = (editor, action) -> editor.getTagModel().addPropertyChangeListener(action);
|
---|
30 |
|
---|
31 | /**
|
---|
32 | * Update when a relation changed
|
---|
33 | */
|
---|
34 | IRelationEditorUpdateOn SELECTION_TABLE_CHANGE = (editor, action) -> editor.getSelectionTableModel()
|
---|
35 | .addTableModelListener(action);
|
---|
36 |
|
---|
37 | /**
|
---|
38 | * Registers the given action as listener on the relation editor.
|
---|
39 | * @param editor The relation editor to register the listeners on
|
---|
40 | * @param action The action that should be registered
|
---|
41 | */
|
---|
42 | void register(IRelationEditorActionAccess editor, AbstractRelationEditorAction action);
|
---|
43 | }
|
---|