Changeset 9485 in josm for trunk/src/org
- Timestamp:
- 2016-01-16T13:50:05+01:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/preferences/server/OsmApiUrlInputPanel.java
r9353 r9485 16 16 import java.net.MalformedURLException; 17 17 import java.net.URL; 18 import java.util.Arrays; 18 19 19 20 import javax.swing.AbstractAction; … … 28 29 29 30 import org.openstreetmap.josm.Main; 31 import org.openstreetmap.josm.data.preferences.CollectionProperty; 30 32 import org.openstreetmap.josm.gui.SideButton; 31 33 import org.openstreetmap.josm.gui.help.HelpUtil; 32 34 import org.openstreetmap.josm.gui.widgets.AbstractTextComponentValidator; 33 import org.openstreetmap.josm.gui.widgets. JosmTextField;35 import org.openstreetmap.josm.gui.widgets.HistoryComboBox; 34 36 import org.openstreetmap.josm.gui.widgets.SelectAllOnFocusGainedDecorator; 35 37 import org.openstreetmap.josm.io.OsmApi; … … 49 51 private JLabel lblValid; 50 52 private JLabel lblApiUrl; 51 private JosmTextFieldtfOsmServerUrl;53 private HistoryComboBox tfOsmServerUrl; 52 54 private transient ApiUrlValidator valOsmServerUrl; 53 55 private SideButton btnTest; 54 56 /** indicates whether to use the default OSM URL or not */ 55 57 private JCheckBox cbUseDefaultServerUrl; 58 private final CollectionProperty SERVER_URL_HISTORY = new CollectionProperty("osm-server.url-history", Arrays.asList( 59 "http://api06.dev.openstreetmap.org/api", "http://master.apis.dev.openstreetmap.org/api")); 56 60 57 61 private transient ApiUrlPropagator propagator; … … 87 91 gc.gridx = 1; 88 92 gc.weightx = 1.0; 89 add(tfOsmServerUrl = new JosmTextField(), gc);93 add(tfOsmServerUrl = new HistoryComboBox(), gc); 90 94 lblApiUrl.setLabelFor(tfOsmServerUrl); 91 SelectAllOnFocusGainedDecorator.decorate(tfOsmServerUrl );92 valOsmServerUrl = new ApiUrlValidator(tfOsmServerUrl );95 SelectAllOnFocusGainedDecorator.decorate(tfOsmServerUrl.getEditorComponent()); 96 valOsmServerUrl = new ApiUrlValidator(tfOsmServerUrl.getEditorComponent()); 93 97 valOsmServerUrl.validate(); 94 98 propagator = new ApiUrlPropagator(); … … 103 107 gc.weightx = 0.0; 104 108 ValidateApiUrlAction actTest = new ValidateApiUrlAction(); 105 tfOsmServerUrl.get Document().addDocumentListener(actTest);109 tfOsmServerUrl.getEditorComponent().getDocument().addDocumentListener(actTest); 106 110 add(btnTest = new SideButton(actTest), gc); 107 111 } … … 128 132 propagator.propagate(url); 129 133 } 134 tfOsmServerUrl.setPossibleItems(SERVER_URL_HISTORY.get()); 130 135 } 131 136 … … 142 147 } else { 143 148 Main.pref.put("osm-server.url", hmiUrl); 149 tfOsmServerUrl.addCurrentItemToHistory(); 150 SERVER_URL_HISTORY.put(tfOsmServerUrl.getHistory()); 144 151 } 145 152 String newUrl = OsmApi.getOsmApi().getServerUrl();
Note:
See TracChangeset
for help on using the changeset viewer.