Changeset 29563 in osm for applications
- Timestamp:
- 2013-05-06T22:28:01+02:00 (11 years ago)
- Location:
- applications/editors/josm/plugins/geochat/src/geochat
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/geochat/src/geochat/GeoChatPanel.java
r29558 r29563 48 48 createChatPane(null); 49 49 50 tabs.addMouseListener(new MouseAdapter() { 51 @Override public void mousePressed( MouseEvent e ) { check(e); } 52 @Override public void mouseReleased( MouseEvent e ) { check(e); } 53 54 private void check( MouseEvent e ) { 55 if( e.isPopupTrigger() ) { 56 createPopupMenu().show(tabs, e.getX(), e.getY()); 57 } 58 } 59 }); 50 tabs.addMouseListener(new PopupAdapter()); 60 51 61 52 input = new JPanelTextField() { … … 92 83 nameField.setPreferredSize(new Dimension(nameField.getPreferredSize().width, loginButton.getPreferredSize().height)); 93 84 94 // loginPanel = new JPanel(new BorderLayout());95 // loginPanel.add(nameField, BorderLayout.CENTER);96 // loginPanel.add(loginButton, BorderLayout.EAST);97 85 loginPanel = new JPanel(new GridBagLayout()); 98 86 loginPanel.add(nameField, GBC.std().fill(GridBagConstraints.HORIZONTAL).insets(15, 0, 5, 0)); … … 108 96 connection.addListener(this); 109 97 connection.checkLogin(); 110 }111 112 private JPopupMenu createPopupMenu() {113 JMenu userMenu = new JMenu(tr("Private chat"));114 for( String user : users.keySet() ) {115 if( !chatPanes.containsKey(user) )116 userMenu.add(new PrivateChatAction(user));117 }118 119 JPopupMenu menu = new JPopupMenu();120 menu.add(new JCheckBoxMenuItem(new ToggleUserLayerAction()));121 if( userMenu.getComponentCount() > 0 )122 menu.add(userMenu);123 if( getRecipient() != null )124 menu.add(new CloseTabAction());125 menu.add(new ClearPaneAction());126 menu.add(new LogoutAction());127 return menu;128 98 } 129 99 … … 165 135 caret.setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE); 166 136 JScrollPane scrollPane = new JScrollPane(chatPane, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); 137 chatPane.addMouseListener(new PopupAdapter()); 167 138 168 139 ChatLogEntry entry = new ChatLogEntry(); … … 243 214 radius /= 2; 244 215 245 Font font = g2d.getFont().deriveFont( Math.min(zoom * 2, 8));216 Font font = g2d.getFont().deriveFont(Font.BOLD, Math.max(zoom * 2, 8)); 246 217 g2d.setFont(font); 247 218 FontMetrics fm = g2d.getFontMetrics(); … … 257 228 } 258 229 } 230 231 /* ============ ChatServerConnectionListener methods ============= */ 259 232 260 233 public void loggedIn( String userName ) { … … 350 323 } 351 324 } 325 326 /* =================== Service classes ==================== */ 352 327 353 328 private class JPanelTextField extends JTextField { … … 389 364 } 390 365 366 /* ================= Actions for popup menu ==================== */ 367 368 369 private JPopupMenu createPopupMenu() { 370 JMenu userMenu = new JMenu(tr("Private chat")); 371 for( String user : users.keySet() ) { 372 if( !chatPanes.containsKey(user) ) 373 userMenu.add(new PrivateChatAction(user)); 374 } 375 376 JPopupMenu menu = new JPopupMenu(); 377 menu.add(new JCheckBoxMenuItem(new ToggleUserLayerAction())); 378 if( userMenu.getItemCount() > 0 ) 379 menu.add(userMenu); 380 if( getRecipient() != null ) 381 menu.add(new CloseTabAction()); 382 // menu.add(new ClearPaneAction()); 383 // menu.add(new LogoutAction()); 384 return menu; 385 } 386 387 private class PopupAdapter extends MouseAdapter { 388 @Override public void mousePressed( MouseEvent e ) { check(e); } 389 @Override public void mouseReleased( MouseEvent e ) { check(e); } 390 391 private void check( MouseEvent e ) { 392 if( e.isPopupTrigger() ) { 393 createPopupMenu().show(tabs, e.getX(), e.getY()); 394 } 395 } 396 } 397 391 398 private class PrivateChatAction extends AbstractAction { 392 399 private String userName; … … 407 414 public CloseTabAction() { 408 415 super(tr("Close tab")); 409 putValue(SMALL_ICON, ImageProvider.get("help"));416 // putValue(SMALL_ICON, ImageProvider.get("help")); 410 417 } 411 418 … … 420 427 public LogoutAction() { 421 428 super(tr("Logout")); 422 putValue(SMALL_ICON, ImageProvider.get("help"));429 // putValue(SMALL_ICON, ImageProvider.get("help")); 423 430 } 424 431 … … 431 438 public ClearPaneAction() { 432 439 super(tr("Clear log")); 433 putValue(SMALL_ICON, ImageProvider.get("help"));440 // putValue(SMALL_ICON, ImageProvider.get("help")); 434 441 } 435 442 … … 442 449 public ToggleUserLayerAction() { 443 450 super(tr("Show users on map")); 444 putValue(SMALL_ICON, ImageProvider.get("help"));451 // putValue(SMALL_ICON, ImageProvider.get("help")); 445 452 } 446 453 -
applications/editors/josm/plugins/geochat/src/geochat/JsonQueryUtil.java
r29558 r29563 29 29 String serverURL = Main.pref.get("geochat.server", "http://zverik.dev.openstreetmap.org/osmochat.php?action="); 30 30 URL url = new URL(serverURL + query); 31 System.out.println("GeoChat URL = " + url.toString());31 // System.out.println("GeoChat URL = " + url.toString()); 32 32 HttpURLConnection connection = (HttpURLConnection)url.openConnection(); 33 33 connection.connect();
Note:
See TracChangeset
for help on using the changeset viewer.