1 | // License: GPL. For details, see LICENSE file.
|
---|
2 | package org.openstreetmap.josm.gui.preferences.advanced;
|
---|
3 |
|
---|
4 | import static org.openstreetmap.josm.tools.I18n.tr;
|
---|
5 |
|
---|
6 | import java.awt.Component;
|
---|
7 | import java.awt.Dimension;
|
---|
8 | import java.util.List;
|
---|
9 |
|
---|
10 | import javax.swing.JPanel;
|
---|
11 |
|
---|
12 | import org.openstreetmap.josm.gui.ExtendedDialog;
|
---|
13 | import org.openstreetmap.josm.tools.WindowGeometry;
|
---|
14 |
|
---|
15 | /**
|
---|
16 | * Abstract superclass of {@link ListEditor} and {@link AbstractTableListEditor}.
|
---|
17 | * @param <T> type of elements
|
---|
18 | * @since 9505
|
---|
19 | */
|
---|
20 | public abstract class AbstractListEditor<T> extends ExtendedDialog {
|
---|
21 |
|
---|
22 | protected final transient PrefEntry entry;
|
---|
23 |
|
---|
24 | /**
|
---|
25 | * Constructs a new {@code AbstractListEditor}.
|
---|
26 | * @param parent The parent element that will be used for position and maximum size
|
---|
27 | * @param title The text that will be shown in the window titlebar
|
---|
28 | * @param entry Preference entry
|
---|
29 | */
|
---|
30 | public AbstractListEditor(Component parent, String title, PrefEntry entry) {
|
---|
31 | super(parent, title, new String[] {tr("OK"), tr("Cancel")});
|
---|
32 | this.entry = entry;
|
---|
33 | setButtonIcons(new String[] {"ok.png", "cancel.png"});
|
---|
34 | setRememberWindowGeometry(getClass().getName() + ".geometry", WindowGeometry.centerInWindow(parent, new Dimension(500, 350)));
|
---|
35 | }
|
---|
36 |
|
---|
37 | /**
|
---|
38 | * Returns the list of values.
|
---|
39 | * @return The list of values.
|
---|
40 | */
|
---|
41 | public abstract List<T> getData();
|
---|
42 |
|
---|
43 | protected abstract JPanel build();
|
---|
44 | }
|
---|