- Timestamp:
- 2020-10-11T12:39:49+02:00 (4 years ago)
- Location:
- trunk
- Files:
-
- 3 deleted
- 3 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/preferences/PreferenceTabbedPane.java
r17160 r17162 56 56 import org.openstreetmap.josm.gui.preferences.projection.ProjectionPreference; 57 57 import org.openstreetmap.josm.gui.preferences.remotecontrol.RemoteControlPreference; 58 import org.openstreetmap.josm.gui.preferences.server.ConnectionPreference;59 import org.openstreetmap.josm.gui.preferences.server.OverpassServerPreference;60 58 import org.openstreetmap.josm.gui.preferences.server.ProxyPreference; 61 59 import org.openstreetmap.josm.gui.preferences.server.ServerAccessPreference; … … 583 581 SETTINGS_FACTORIES.add(new LanguagePreference.Factory()); 584 582 585 SETTINGS_FACTORIES.add(new ConnectionPreference.Factory());586 583 SETTINGS_FACTORIES.add(new ServerAccessPreference.Factory()); 587 584 SETTINGS_FACTORIES.add(new ProxyPreference.Factory()); 588 SETTINGS_FACTORIES.add(new OverpassServerPreference.Factory());589 585 SETTINGS_FACTORIES.add(new MapPreference.Factory()); 590 586 SETTINGS_FACTORIES.add(new ProjectionPreference.Factory()); -
trunk/src/org/openstreetmap/josm/gui/preferences/server/OverpassServerPanel.java
r17161 r17162 12 12 import javax.swing.JPanel; 13 13 14 import org.openstreetmap.josm.gui.preferences.DefaultTabPreferenceSetting; 15 import org.openstreetmap.josm.gui.preferences.PreferenceSetting; 16 import org.openstreetmap.josm.gui.preferences.PreferenceSettingFactory; 17 import org.openstreetmap.josm.gui.preferences.PreferenceTabbedPane; 14 import org.openstreetmap.josm.actions.ExpertToggleAction; 18 15 import org.openstreetmap.josm.gui.widgets.HistoryComboBox; 19 16 import org.openstreetmap.josm.io.OverpassDownloadReader; … … 23 20 * Preferences related to Overpass API servers. 24 21 * 25 * @since 914222 * @since 17162 26 23 */ 27 public class OverpassServerP reference extends DefaultTabPreferenceSetting{24 public class OverpassServerPanel extends JPanel { 28 25 29 26 private final HistoryComboBox overpassServer = new HistoryComboBox(); 30 27 private final JCheckBox forMultiFetch = new JCheckBox(tr("Use Overpass server for object downloads")); 31 28 32 /** 33 * Factory used to create a new {@link OverpassServerPreference}. 34 */ 35 public static class Factory implements PreferenceSettingFactory { 36 @Override 37 public PreferenceSetting createPreferenceSetting() { 38 return new OverpassServerPreference(); 39 } 40 } 41 42 OverpassServerPreference() { 43 super(null, tr("Overpass server"), tr("Configure Overpass server")); 44 } 45 46 @Override 47 public void addGui(PreferenceTabbedPane gui) { 48 final JPanel panel = new JPanel(new GridBagLayout()); 49 29 OverpassServerPanel() { 30 super(new GridBagLayout()); 31 ExpertToggleAction.addVisibilitySwitcher(this); 32 final JPanel panel = this; 50 33 panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); 51 34 panel.add(new JLabel(tr("Overpass server: ")), GBC.std().insets(5, 5, 5, 5)); 52 35 panel.add(overpassServer, GBC.eop().fill(GBC.HORIZONTAL)); 36 panel.add(forMultiFetch, GBC.eop()); 37 panel.add(Box.createVerticalGlue(), GBC.eol().fill()); 38 } 39 40 /** 41 * Initializes the panel from preferences 42 */ 43 public final void initFromPreferences() { 53 44 overpassServer.setPossibleItems(OverpassDownloadReader.OVERPASS_SERVER_HISTORY.get()); 54 45 overpassServer.setText(OverpassDownloadReader.OVERPASS_SERVER.get()); 55 56 panel.add(forMultiFetch, GBC.eop());57 46 forMultiFetch.setSelected(OverpassDownloadReader.FOR_MULTI_FETCH.get()); 58 59 panel.add(Box.createVerticalGlue(), GBC.eol().fill());60 gui.createPreferenceTab(this).add(panel, GBC.eol().fill());61 47 } 62 48 63 @Override 64 public boolean ok() { 49 /** 50 * Saves the current values to the preferences 51 */ 52 public final void saveToPreferences() { 65 53 OverpassDownloadReader.OVERPASS_SERVER.put(overpassServer.getText()); 66 54 OverpassDownloadReader.OVERPASS_SERVER_HISTORY.put(overpassServer.getHistory()); 67 55 OverpassDownloadReader.FOR_MULTI_FETCH.put(forMultiFetch.isSelected()); 68 return false;69 }70 71 @Override72 public boolean isExpert() {73 return true;74 56 } 75 57 } -
trunk/src/org/openstreetmap/josm/gui/preferences/server/ProxyPreferencesPanel.java
r16438 r17162 192 192 193 193 // radio button "No proxy" 194 gc.gridx = 0; 195 gc.gridy = 0; 196 gc.fill = GridBagConstraints.HORIZONTAL; 197 gc.anchor = GridBagConstraints.NORTHWEST; 198 gc.weightx = 0.0; 199 pnl.add(rbProxyPolicy.get(ProxyPolicy.NO_PROXY), gc); 200 201 gc.gridx = 1; 202 gc.weightx = 1.0; 203 pnl.add(new JLabel(tr("No proxy")), gc); 194 rbProxyPolicy.get(ProxyPolicy.NO_PROXY).setText(tr("No proxy")); 195 pnl.add(rbProxyPolicy.get(ProxyPolicy.NO_PROXY), GBC.eop().anchor(GBC.NORTHWEST)); 204 196 205 197 // radio button "System settings" 206 gc.gridx = 0; 207 gc.gridy = 1; 208 gc.weightx = 0.0; 209 pnl.add(rbProxyPolicy.get(ProxyPolicy.USE_SYSTEM_SETTINGS), gc); 210 211 gc.gridx = 1; 212 gc.weightx = 1.0; 213 String msg; 214 if (DefaultProxySelector.willJvmRetrieveSystemProxies()) { 215 msg = tr("Use standard system settings"); 216 } else { 217 msg = tr("Use standard system settings (disabled. Start JOSM with <tt>-Djava.net.useSystemProxies=true</tt> to enable)"); 218 } 219 pnl.add(new JMultilineLabel("<html>" + msg + "</html>"), gc); 198 pnl.add(rbProxyPolicy.get(ProxyPolicy.USE_SYSTEM_SETTINGS), GBC.eol()); 199 rbProxyPolicy.get(ProxyPolicy.USE_SYSTEM_SETTINGS).setText(tr("Use standard system settings")); 200 if (!DefaultProxySelector.willJvmRetrieveSystemProxies()) { 201 String msg = tr("Use standard system settings (disabled. Start JOSM with <tt>-Djava.net.useSystemProxies=true</tt> to enable)"); 202 pnl.add(new JMultilineLabel("<html>" + msg + "</html>"), GBC.eop()); 203 } 220 204 221 205 // radio button http proxy 222 gc.gridx = 0; 223 gc.gridy = 2; 224 gc.weightx = 0.0; 225 pnl.add(rbProxyPolicy.get(ProxyPolicy.USE_HTTP_PROXY), gc); 226 227 gc.gridx = 1; 228 gc.weightx = 1.0; 229 pnl.add(new JLabel(tr("Manually configure a HTTP proxy")), gc); 206 rbProxyPolicy.get(ProxyPolicy.USE_HTTP_PROXY).setText(tr("Manually configure a HTTP proxy")); 207 pnl.add(rbProxyPolicy.get(ProxyPolicy.USE_HTTP_PROXY), GBC.eol()); 230 208 231 209 // the panel with the http proxy configuration parameters 232 gc.gridx = 1;233 gc.gridy = 3;234 gc.fill = GridBagConstraints.HORIZONTAL;235 gc.weightx = 1.0;236 gc.weighty = 0.0;237 210 pnlHttpProxyConfigurationPanel = buildHttpProxyConfigurationPanel(); 238 pnl.add(pnlHttpProxyConfigurationPanel, gc);211 pnl.add(pnlHttpProxyConfigurationPanel, GBC.eop().fill(GBC.HORIZONTAL)); 239 212 240 213 // radio button SOCKS proxy 241 gc.gridx = 0; 242 gc.gridy = 4; 243 gc.weightx = 0.0; 244 pnl.add(rbProxyPolicy.get(ProxyPolicy.USE_SOCKS_PROXY), gc); 245 246 gc.gridx = 1; 247 gc.weightx = 1.0; 248 pnl.add(new JLabel(tr("Use a SOCKS proxy")), gc); 214 pnl.add(rbProxyPolicy.get(ProxyPolicy.USE_SOCKS_PROXY), GBC.eol()); 215 rbProxyPolicy.get(ProxyPolicy.USE_SOCKS_PROXY).setText(tr("Use a SOCKS proxy")); 249 216 250 217 // the panel with the SOCKS configuration parameters 251 gc.gridx = 1;252 gc.gridy = 5;253 gc.fill = GridBagConstraints.BOTH;254 gc.anchor = GridBagConstraints.WEST;255 gc.weightx = 1.0;256 gc.weighty = 0.0;257 218 pnlSocksProxyConfigurationPanel = buildSocksProxyConfigurationPanel(); 258 pnl.add(pnlSocksProxyConfigurationPanel, gc);219 pnl.add(pnlSocksProxyConfigurationPanel, GBC.eop().fill(GBC.HORIZONTAL)); 259 220 260 221 return pnl; -
trunk/src/org/openstreetmap/josm/gui/preferences/server/ServerAccessPreference.java
r17160 r17162 10 10 import javax.swing.JPanel; 11 11 import javax.swing.JSeparator; 12 import javax.swing.JTabbedPane;13 12 14 13 import org.openstreetmap.josm.gui.help.HelpUtil; … … 39 38 /** the panel for messages notifier preferences */ 40 39 private final FeaturesPanel pnlFeaturesPreferences = new FeaturesPanel(); 40 private final OverpassServerPanel pnlOverpassPreferences = new OverpassServerPanel(); 41 41 42 42 private ServerAccessPreference() { 43 super( null, tr("OSM Server"), tr("Connection Settings for the OSM server."), false, new JTabbedPane());43 super(/* ICON(preferences/) */ "connection", tr("OSM Server"), tr("Connection Settings for the OSM server.")); 44 44 } 45 45 … … 61 61 panel.add(new JSeparator(), GBC.eop().fill(GBC.HORIZONTAL)); 62 62 panel.add(pnlFeaturesPreferences, GBC.eop().fill(GBC.HORIZONTAL)); 63 panel.add(new JSeparator(), GBC.eop().fill(GBC.HORIZONTAL)); 64 panel.add(pnlOverpassPreferences, GBC.eop().fill(GBC.HORIZONTAL)); 63 65 64 66 pnlApiUrlPreferences.initFromPreferences(); 65 67 pnlAuthPreferences.initFromPreferences(); 66 68 pnlFeaturesPreferences.initFromPreferences(); 69 pnlOverpassPreferences.initFromPreferences(); 67 70 addApiUrlChangeListener(pnlAuthPreferences); 68 71 … … 81 84 // save message notifications preferences. To be done after authentication preferences. 82 85 pnlFeaturesPreferences.saveToPreferences(); 86 pnlOverpassPreferences.saveToPreferences(); 83 87 return false; 84 88 }
Note:
See TracChangeset
for help on using the changeset viewer.