Changeset 17160 in josm for trunk/src/org/openstreetmap/josm/gui/preferences/server/ServerAccessPreference.java
- Timestamp:
- 2020-10-11T11:23:04+02:00 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/preferences/server/ServerAccessPreference.java
r13431 r17160 4 4 import static org.openstreetmap.josm.tools.I18n.tr; 5 5 6 import java.awt.BorderLayout;7 import java.awt.GridBagConstraints;8 6 import java.awt.GridBagLayout; 9 import java.awt.Insets;10 7 import java.beans.PropertyChangeListener; 11 8 9 import javax.swing.Box; 12 10 import javax.swing.JPanel; 11 import javax.swing.JSeparator; 13 12 import javax.swing.JTabbedPane; 14 13 … … 18 17 import org.openstreetmap.josm.gui.preferences.PreferenceSettingFactory; 19 18 import org.openstreetmap.josm.gui.preferences.PreferenceTabbedPane; 19 import org.openstreetmap.josm.tools.GBC; 20 20 21 21 /** … … 36 36 /** indicates whether to use the default OSM URL or not */ 37 37 private final OsmApiUrlInputPanel pnlApiUrlPreferences = new OsmApiUrlInputPanel(); 38 private final AuthenticationPreferencesPanel pnlAuthPreferences = new AuthenticationPreferencesPanel(); 39 /** the panel for messages notifier preferences */ 40 private final FeaturesPanel pnlFeaturesPreferences = new FeaturesPanel(); 38 41 39 42 private ServerAccessPreference() { 40 super(/* ICON(preferences/) */ "connection", tr("Connection Settings"), 41 tr("Connection Settings for the OSM server."), false, new JTabbedPane()); 42 } 43 44 /** 45 * Builds the tabbed pane with the server preferences 46 * 47 * @return panel with server preferences tabs 48 */ 49 private JPanel buildTabbedServerPreferences() { 50 JPanel pnl = new JPanel(new BorderLayout()); 51 pnl.add(getTabPane(), BorderLayout.CENTER); 52 return pnl; 53 } 54 55 /** 56 * Builds the panel for entering the server access preferences 57 * 58 * @return preferences panel for server settings 59 */ 60 private JPanel buildContentPanel() { 61 JPanel pnl = new JPanel(new GridBagLayout()); 62 GridBagConstraints gc = new GridBagConstraints(); 63 64 // the checkbox for the default UL 65 gc.fill = GridBagConstraints.HORIZONTAL; 66 gc.anchor = GridBagConstraints.NORTHWEST; 67 gc.weightx = 1.0; 68 gc.insets = new Insets(0, 0, 0, 0); 69 pnl.add(pnlApiUrlPreferences, gc); 70 71 // the remaining access properties 72 gc.gridy = 1; 73 gc.fill = GridBagConstraints.BOTH; 74 gc.weightx = 1.0; 75 gc.weighty = 1.0; 76 gc.insets = new Insets(10, 0, 3, 3); 77 pnl.add(buildTabbedServerPreferences(), gc); 78 79 HelpUtil.setHelpContext(pnl, HelpUtil.ht("/Preferences/Connection")); 80 return pnl; 43 super(null, tr("OSM Server"), tr("Connection Settings for the OSM server."), false, new JTabbedPane()); 81 44 } 82 45 … … 92 55 @Override 93 56 public void addGui(PreferenceTabbedPane gui) { 94 GridBagConstraints gc = new GridBagConstraints();95 gc.fill = GridBagConstraints.BOTH;96 gc.weightx = 1.0;97 gc.weighty = 1.0;98 gc.anchor = GridBagConstraints.NORTHWEST;99 gui.createPreferenceTab(this).add(buildContentPanel(), gc);57 JPanel panel = new JPanel(new GridBagLayout()); 58 panel.add(pnlApiUrlPreferences, GBC.eop().fill(GBC.HORIZONTAL)); 59 panel.add(new JSeparator(), GBC.eop().fill(GBC.HORIZONTAL)); 60 panel.add(pnlAuthPreferences, GBC.eop().fill(GBC.HORIZONTAL)); 61 panel.add(new JSeparator(), GBC.eop().fill(GBC.HORIZONTAL)); 62 panel.add(pnlFeaturesPreferences, GBC.eop().fill(GBC.HORIZONTAL)); 100 63 101 64 pnlApiUrlPreferences.initFromPreferences(); 65 pnlAuthPreferences.initFromPreferences(); 66 pnlFeaturesPreferences.initFromPreferences(); 67 addApiUrlChangeListener(pnlAuthPreferences); 68 69 HelpUtil.setHelpContext(panel, HelpUtil.ht("/Preferences/Connection")); 70 panel.add(Box.createVerticalGlue(), GBC.eol().fill()); 71 gui.createPreferenceTab(this).add(panel, GBC.eol().fill()); 102 72 } 103 73 … … 108 78 public boolean ok() { 109 79 pnlApiUrlPreferences.saveToPreferences(); 80 pnlAuthPreferences.saveToPreferences(); 81 // save message notifications preferences. To be done after authentication preferences. 82 pnlFeaturesPreferences.saveToPreferences(); 110 83 return false; 111 84 }
Note:
See TracChangeset
for help on using the changeset viewer.