- Timestamp:
- 2007-10-26T21:58:25+02:00 (17 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/ServerSidePreferences.java
r343 r431 12 12 import java.io.StringReader; 13 13 import java.net.HttpURLConnection; 14 import java.net.URLConnection; 14 15 import java.net.MalformedURLException; 15 16 import java.net.URL; … … 46 47 try { 47 48 System.out.println("reading preferences from "+serverUrl); 48 HttpURLConnection con = (HttpURLConnection)serverUrl.openConnection();49 addAuth(con);49 URLConnection con = serverUrl.openConnection(); 50 if (con instanceof HttpURLConnection) addAuth((HttpURLConnection) con); 50 51 con.connect(); 51 52 BufferedReader reader = new BufferedReader(new InputStreamReader(con.getInputStream())); … … 55 56 b.append("\n"); 56 57 } 57 con.disconnect();58 if (con instanceof HttpURLConnection) ((HttpURLConnection) con).disconnect(); 58 59 return b.toString(); 59 60 } catch (IOException e) { … … 122 123 if (!properties.containsKey("osm-server.password") && password != null) 123 124 properties.put("osm-server.password", password); 124 Reader in = new StringReader(connection.download()); 125 String cont = connection.download(); 126 if (cont == null) return; 127 Reader in = new StringReader(cont); 125 128 try { 126 129 XmlObjectParser.Uniform<Prop> parser = new XmlObjectParser.Uniform<Prop>(in, "tag", Prop.class); … … 176 179 } catch (MalformedURLException e) { 177 180 e.printStackTrace(); 181 } catch (IllegalArgumentException e) { 182 e.printStackTrace(); 178 183 } catch (IOException e) { 179 184 e.printStackTrace(); -
trunk/src/org/openstreetmap/josm/gui/MainApplet.java
r298 r431 4 4 import static org.openstreetmap.josm.tools.I18n.tr; 5 5 6 import java.applet.AppletStub; 7 import java.applet.AppletContext; 6 8 import java.awt.GridBagLayout; 7 9 import java.awt.event.ActionEvent; 8 10 import java.awt.event.KeyEvent; 11 import java.io.File; 12 import java.net.URL; 9 13 import java.util.Arrays; 10 14 import java.util.Collection; … … 14 18 15 19 import javax.swing.JApplet; 20 import javax.swing.JFrame; 16 21 import javax.swing.JLabel; 17 22 import javax.swing.JOptionPane; … … 55 60 56 61 private Map<String, Collection<String>> args = new HashMap<String, Collection<String>>(); 57 private UploadPreferencesAction uploadPreferences = new UploadPreferencesAction();58 62 59 63 @Override public String[][] getParameterInfo() { … … 101 105 // remove offending stuff from JOSM (that would break the SecurityManager) 102 106 m.remove(m.fileMenu); 103 m.editMenu.add( uploadPreferences);107 m.editMenu.add(new UploadPreferencesAction()); 104 108 m.open.setEnabled(false); 105 109 m.exit.setEnabled(false); … … 118 122 return v; 119 123 } 124 125 public static void main(String[] args) { 126 final JFrame frame = new JFrame("Java OpenStreetMap Applet"); 127 MainApplet applet = new MainApplet(); 128 applet.setStub(new AppletStub() { 129 public void appletResize(int w, int h) { 130 frame.resize(w, h); 131 } 132 133 public AppletContext getAppletContext() { 134 return null; 135 } 136 137 public URL getCodeBase() { 138 try { 139 return new File(".").toURI().toURL(); 140 } catch (Exception e) { 141 e.printStackTrace(); 142 return null; 143 } 144 } 145 146 public URL getDocumentBase() { 147 return getCodeBase(); 148 } 149 150 public String getParameter(String k) { 151 return null; 152 } 153 154 public boolean isActive() { 155 return true; 156 } 157 }); 158 applet.init(); 159 applet.start(); 160 frame.setContentPane(applet); 161 frame.setVisible(true); 162 } 120 163 } -
trunk/src/org/openstreetmap/josm/gui/MapFrame.java
r373 r431 101 101 102 102 // status line below the map 103 if (!Main.applet) 104 statusLine = new MapStatus(this); 103 statusLine = new MapStatus(this); 105 104 } 106 105 -
trunk/src/org/openstreetmap/josm/gui/MapStatus.java
r373 r431 17 17 import java.awt.event.MouseEvent; 18 18 import java.awt.event.MouseMotionListener; 19 import java.awt.event.KeyAdapter; 20 import java.awt.event.KeyEvent; 19 21 import java.lang.reflect.InvocationTargetException; 20 22 import java.text.DecimalFormat; … … 270 272 // Listen to keyboard/mouse events for pressing/releasing alt key and 271 273 // inform the collector. 272 Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener(){ 273 public void eventDispatched(AWTEvent event) { 274 synchronized (collector) { 275 mouseState.modifiers = ((InputEvent)event).getModifiersEx(); 276 if (event instanceof MouseEvent) 277 mouseState.mousePos = ((MouseEvent)event).getPoint(); 278 collector.notify(); 279 } 280 } 281 }, AWTEvent.KEY_EVENT_MASK | AWTEvent.MOUSE_EVENT_MASK | AWTEvent.MOUSE_MOTION_EVENT_MASK); 274 try { 275 Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener(){ 276 public void eventDispatched(AWTEvent event) { 277 synchronized (collector) { 278 mouseState.modifiers = ((InputEvent)event).getModifiersEx(); 279 if (event instanceof MouseEvent) 280 mouseState.mousePos = ((MouseEvent)event).getPoint(); 281 collector.notify(); 282 } 283 } 284 }, AWTEvent.KEY_EVENT_MASK | AWTEvent.MOUSE_EVENT_MASK | AWTEvent.MOUSE_MOTION_EVENT_MASK); 285 } catch (SecurityException ex) { 286 mapFrame.mapView.addMouseMotionListener(new MouseMotionListener() { 287 public void mouseMoved(MouseEvent e) { 288 synchronized (collector) { 289 mouseState.modifiers = e.getModifiersEx(); 290 mouseState.mousePos = e.getPoint(); 291 collector.notify(); 292 } 293 } 294 295 public void mouseDragged(MouseEvent e) { 296 mouseMoved(e); 297 } 298 }); 299 300 mapFrame.mapView.addKeyListener(new KeyAdapter() { 301 public void keyPressed(KeyEvent e) { 302 synchronized (collector) { 303 mouseState.modifiers = e.getModifiersEx(); 304 collector.notify(); 305 } 306 } 307 308 public void keyReleased(KeyEvent e) { 309 keyReleased(e); 310 } 311 }); 312 } 282 313 } 283 314 -
trunk/src/org/openstreetmap/josm/tools/ImageProvider.java
r298 r431 167 167 168 168 static { 169 sources.add(ClassLoader.getSystemClassLoader()); 169 try { 170 sources.add(ClassLoader.getSystemClassLoader()); 171 } catch (SecurityException ex) { 172 sources.add(ImageProvider.class.getClassLoader()); 173 } 170 174 } 171 175 } -
trunk/start.html
r321 r431 1 1 <applet 2 2 code="org/openstreetmap/josm/gui/MainApplet.class" 3 archive="dist/josm-custom.jar ,lib/gettext-commons-0.9.jar,lib/metadata-extractor-2.3.1.jar,lib/MinML2.jar"3 archive="dist/josm-custom.jar" 4 4 width="800" 5 height="600" 6 username="foo" 7 password="bar" 8 /> 5 height="600"> 6 </applet>
Note:
See TracChangeset
for help on using the changeset viewer.