1 | // License: GPL. For details, see LICENSE file.
|
---|
2 | package org.openstreetmap.josm.gui.preferences.server;
|
---|
3 |
|
---|
4 | import static org.openstreetmap.josm.tools.I18n.tr;
|
---|
5 |
|
---|
6 | import org.openstreetmap.josm.gui.preferences.PreferenceSetting;
|
---|
7 | import org.openstreetmap.josm.gui.preferences.PreferenceSettingFactory;
|
---|
8 | import org.openstreetmap.josm.gui.preferences.PreferenceTabbedPane;
|
---|
9 | import org.openstreetmap.josm.gui.preferences.SubPreferenceSetting;
|
---|
10 | import org.openstreetmap.josm.gui.preferences.TabPreferenceSetting;
|
---|
11 |
|
---|
12 | /**
|
---|
13 | * Authentication sub-preferences in server preferences.
|
---|
14 | * @since 6523
|
---|
15 | */
|
---|
16 | public final class AuthenticationPreference implements SubPreferenceSetting {
|
---|
17 |
|
---|
18 | /**
|
---|
19 | * Factory used to create a new {@code AuthenticationPreference}.
|
---|
20 | */
|
---|
21 | public static class Factory implements PreferenceSettingFactory {
|
---|
22 | @Override
|
---|
23 | public PreferenceSetting createPreferenceSetting() {
|
---|
24 | return new AuthenticationPreference();
|
---|
25 | }
|
---|
26 | }
|
---|
27 |
|
---|
28 | AuthenticationPreferencesPanel pnlAuthPreferences;
|
---|
29 |
|
---|
30 | private AuthenticationPreference() {
|
---|
31 | super();
|
---|
32 | }
|
---|
33 |
|
---|
34 | @Override
|
---|
35 | public void addGui(PreferenceTabbedPane gui) {
|
---|
36 | pnlAuthPreferences = new AuthenticationPreferencesPanel();
|
---|
37 | gui.getServerPreference().addApiUrlChangeListener(pnlAuthPreferences);
|
---|
38 | gui.getServerPreference().addSubTab(this, tr("Authentication"),
|
---|
39 | pnlAuthPreferences.getVerticalScrollPane(),
|
---|
40 | tr("Configure your identity and how to authenticate at the OSM server"));
|
---|
41 | }
|
---|
42 |
|
---|
43 | @Override
|
---|
44 | public boolean ok() {
|
---|
45 | pnlAuthPreferences.saveToPreferences();
|
---|
46 | return false;
|
---|
47 | }
|
---|
48 |
|
---|
49 | @Override
|
---|
50 | public boolean isExpert() {
|
---|
51 | return false;
|
---|
52 | }
|
---|
53 |
|
---|
54 | @Override
|
---|
55 | public TabPreferenceSetting getTabPreferenceSetting(PreferenceTabbedPane gui) {
|
---|
56 | return gui.getServerPreference();
|
---|
57 | }
|
---|
58 | }
|
---|