Changeset 30511 in osm for applications/editors/josm/plugins/geochat/src
- Timestamp:
- 2014-07-07T08:32:16+02:00 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/geochat/src/geochat/GeoChatPanel.java
r30262 r30511 4 4 import java.awt.*; 5 5 import java.awt.event.*; 6 import java.io.IOException; 6 7 import java.text.SimpleDateFormat; 7 8 import java.util.*; … … 11 12 import org.openstreetmap.josm.data.Bounds; 12 13 import org.openstreetmap.josm.data.coor.LatLon; 13 import org.openstreetmap.josm.gui.JosmUserIdentityManager; 14 import org.openstreetmap.josm.gui.MapView; 14 import org.openstreetmap.josm.gui.*; 15 15 import org.openstreetmap.josm.gui.dialogs.ToggleDialog; 16 16 import org.openstreetmap.josm.gui.layer.MapViewPaintable; … … 33 33 private ChatServerConnection connection; 34 34 // those fields should be visible to popup menu actions 35 protectedMap<String, LatLon> users;36 protectedChatPaneManager chatPanes;37 protectedboolean userLayerActive;35 Map<String, LatLon> users; 36 ChatPaneManager chatPanes; 37 boolean userLayerActive; 38 38 39 39 public GeoChatPanel() { … … 97 97 JButton loginButton = new JButton(tr("Login")); 98 98 loginButton.addActionListener(new ActionListener() { 99 @Override 99 100 public void actionPerformed( ActionEvent e ) { 100 101 connection.login(nameField.getText()); … … 105 106 final JCheckBox autoLoginBox = new JCheckBox(tr("Enable autologin"), Main.pref.getBoolean("geochat.autologin", true)); 106 107 autoLoginBox.addActionListener(new ActionListener() { 108 @Override 107 109 public void actionPerformed( ActionEvent e ) { 108 110 Main.pref.put("geochat.autologin", autoLoginBox.isSelected()); … … 128 130 connection.bruteLogout(); 129 131 } 130 } catch( Throwablee ) {132 } catch( IOException e ) { 131 133 Main.warn("Failed to logout from geochat server: " + e.getMessage()); 132 134 } … … 158 160 * for all users nearby. 159 161 */ 162 @Override 160 163 public void paint( Graphics2D g, MapView mv, Bounds bbox ) { 161 164 Graphics2D g2d = (Graphics2D)g.create(); … … 205 208 final String alarm = (alarmLevel <= 0 ? "" : alarmLevel == 1 ? "* " : "!!! ") + title; 206 209 GuiHelper.runInEDT(new Runnable() { 210 @Override 207 211 public void run() { 208 212 setTitle(alarm); … … 223 227 /* ============ ChatServerConnectionListener methods ============= */ 224 228 229 @Override 225 230 public void loggedIn( String userName ) { 226 231 Main.pref.put("geochat.username", userName); 227 232 if( gcPanel.getComponentCount() == 1 ) { 228 GuiHelper.runInEDTAndWait(new Runnable() { 229 @Override 230 public void run() { 231 gcPanel.remove(0); 232 gcPanel.add(tabs, BorderLayout.CENTER); 233 gcPanel.add(input, BorderLayout.SOUTH); 234 } 235 }); 236 } 237 updateTitleAlarm(); 238 } 239 233 GuiHelper.runInEDTAndWait(new Runnable() { 234 @Override 235 public void run() { 236 gcPanel.remove(0); 237 gcPanel.add(tabs, BorderLayout.CENTER); 238 gcPanel.add(input, BorderLayout.SOUTH); 239 } 240 }); 241 } 242 updateTitleAlarm(); 243 } 244 245 @Override 240 246 public void notLoggedIn( final String reason ) { 241 247 if( reason != null ) { 242 SwingUtilities.invokeLater(new Runnable() { 248 GuiHelper.runInEDT(new Runnable() { 249 @Override 243 250 public void run() { 244 JOptionPane.showMessageDialog(Main.parent, reason);251 new Notification(tr("GeoChat") + ": " + reason).show(); 245 252 } 246 253 }); … … 255 262 } 256 263 264 @Override 257 265 public void messageSendFailed( final String reason ) { 258 SwingUtilities.invokeLater(new Runnable() { 266 GuiHelper.runInEDT(new Runnable() { 267 @Override 259 268 public void run() { 260 JOptionPane.showMessageDialog(Main.parent, reason);269 new Notification(tr("GeoChat") + ": " + reason).show(); 261 270 } 262 271 }); 263 272 } 264 273 274 @Override 265 275 public void statusChanged( boolean active ) { 266 276 // only the public tab, because private chats don't rely on coordinates … … 269 279 } 270 280 281 @Override 271 282 public void updateUsers( Map<String, LatLon> newUsers ) { 272 283 for( String uname : this.users.keySet() ) { … … 292 303 } 293 304 305 @Override 294 306 public void receivedMessages( boolean replace, List<ChatMessage> messages ) { 295 307 if( replace ) … … 346 358 } 347 359 360 @Override 348 361 public void receivedPrivateMessages( boolean replace, List<ChatMessage> messages ) { 349 362 if( replace )
Note:
See TracChangeset
for help on using the changeset viewer.