Changeset 5050 in josm for trunk/src/org
- Timestamp:
- 2012-03-08T10:04:21+01:00 (13 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/AboutAction.java
r4982 r5050 71 71 info.add(GBC.glue(0,10), GBC.eol()); 72 72 info.add(new JLabel(tr("Homepage")), GBC.std().insets(10,0,10,0)); 73 info.add(new UrlLabel("http://josm.openstreetmap.de"), GBC.eol().fill(GBC.HORIZONTAL)); 73 info.add(new UrlLabel("http://josm.openstreetmap.de",2), GBC.eol().fill(GBC.HORIZONTAL)); 74 info.add(GBC.glue(0,5), GBC.eol()); 74 75 info.add(new JLabel(tr("Bug Reports")), GBC.std().insets(10,0,10,0)); 75 info.add(new UrlLabel("http://josm.openstreetmap.de/newticket" ), GBC.eol().fill(GBC.HORIZONTAL));76 info.add(new UrlLabel("http://josm.openstreetmap.de/newticket",2), GBC.eol().fill(GBC.HORIZONTAL)); 76 77 77 78 JTextArea revision = new JTextArea(); -
trunk/src/org/openstreetmap/josm/actions/Map_Rectifier_WMSmenuAction.java
r4973 r5050 137 137 if(!s.url.equals("")) { 138 138 panel.add(serviceBtn, GBC.std()); 139 panel.add(new UrlLabel(s.url, tr("Visit Homepage")), GBC.eol().anchor(GridBagConstraints.EAST) );139 panel.add(new UrlLabel(s.url, tr("Visit Homepage")), GBC.eol().anchor(GridBagConstraints.EAST), 2); 140 140 } else { 141 141 panel.add(serviceBtn, GBC.eol().anchor(GridBagConstraints.WEST)); -
trunk/src/org/openstreetmap/josm/actions/mapmode/DrawAction.java
r4982 r5050 12 12 import java.awt.BasicStroke; 13 13 import java.awt.Color; 14 import java.awt.Component; 14 15 import java.awt.Cursor; 15 16 import java.awt.Graphics2D; 17 import java.awt.KeyboardFocusManager; 16 18 import java.awt.MenuItem; 17 19 import java.awt.Point; … … 39 41 40 42 import java.util.TreeSet; 41 import javax.swing.AbstractAction; 42 import javax.swing.JOptionPane; 43 44 import javax.swing.JPopupMenu; 45 import javax.swing.Timer; 43 import javax.swing.*; 46 44 import org.openstreetmap.josm.Main; 47 45 import org.openstreetmap.josm.actions.JosmAction; … … 224 222 return; 225 223 if (event instanceof KeyEvent) { 224 Component focused = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner(); 225 Component wantedFocus = Main.map.mapView.getParent(); 226 boolean foundMapViewAncestor=false; 227 while (focused!=null) { 228 if (focused==wantedFocus) { 229 foundMapViewAncestor=true; 230 } 231 focused = focused.getParent(); 232 } 233 // we accept only events that come from map or toggle dialogs, not from menu and dialogs 234 if (!foundMapViewAncestor) return; 226 235 processKeyEvent((KeyEvent) event); 227 236 } // toggle angle snapping … … 238 247 private Timer timer; 239 248 void processKeyEvent(KeyEvent e) { 240 if (!snappingShortcut.isEvent(e) )249 if (!snappingShortcut.isEvent(e) && !getShortcut().isEvent(e)) 241 250 return; 242 251 … … 261 270 262 271 private void doKeyPressEvent(KeyEvent e) { 263 if (!snappingShortcut.isEvent(e))264 return;265 272 snapHelper.setFixedMode(); 266 273 computeHelperLine(); … … 268 275 } 269 276 private void doKeyReleaseEvent(KeyEvent e) { 270 if (!snappingShortcut.isEvent(e))271 return;272 277 snapHelper.unFixOrTurnOff(); 273 278 computeHelperLine(); -
trunk/src/org/openstreetmap/josm/gui/history/VersionInfoPanel.java
r4602 r5050 2 2 package org.openstreetmap.josm.gui.history; 3 3 4 import java.awt.*; 4 5 import static org.openstreetmap.josm.tools.I18n.tr; 5 6 6 import java.awt.BorderLayout;7 import java.awt.FlowLayout;8 import java.awt.GridBagConstraints;9 import java.awt.GridBagLayout;10 7 import java.io.UnsupportedEncodingException; 11 8 import java.net.URLEncoder; … … 48 45 49 46 pnlUserAndChangeset = new JPanel(); 50 pnlUserAndChangeset.setLayout(new FlowLayout(FlowLayout.LEFT));51 lblUser = new UrlLabel( );47 pnlUserAndChangeset.setLayout(new GridLayout(2,2)); 48 lblUser = new UrlLabel("", 2); 52 49 pnlUserAndChangeset.add(new JLabel(tr("User:"))); 53 50 pnlUserAndChangeset.add(lblUser); 54 51 pnlUserAndChangeset.add(new JLabel(tr("Changeset:"))); 55 lblChangeset = new UrlLabel( );52 lblChangeset = new UrlLabel("", 2); 56 53 pnlUserAndChangeset.add(lblChangeset); 57 54 -
trunk/src/org/openstreetmap/josm/gui/layer/GpxLayer.java
r4968 r5050 839 839 tr("<html>Upload of unprocessed GPS data as map data is considered harmful.<br>If you want to upload traces, look here:</html>")), 840 840 GBC.eol()); 841 msg.add(new UrlLabel(tr("http://www.openstreetmap.org/traces") ), GBC.eop());841 msg.add(new UrlLabel(tr("http://www.openstreetmap.org/traces"),2), GBC.eop()); 842 842 if (!ConditionalOptionPaneUtil.showConfirmationDialog("convert_to_data", Main.parent, msg, tr("Warning"), 843 843 JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE, JOptionPane.OK_OPTION)) -
trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPreset.java
r5021 r5050 854 854 } 855 855 if (url != null) { 856 p.add(new UrlLabel(url, locale_text ), GBC.eol().anchor(GBC.WEST));856 p.add(new UrlLabel(url, locale_text, 2), GBC.eol().anchor(GBC.WEST)); 857 857 } 858 858 return false; -
trunk/src/org/openstreetmap/josm/tools/BugReportExceptionHandler.java
r5013 r5050 126 126 tr("You have encountered an error in JOSM. Before you file a bug report " + 127 127 "make sure you have updated to the latest version of JOSM here:")), GBC.eol()); 128 p.add(new UrlLabel("http://josm.openstreetmap.de/#Download" ), GBC.eop().insets(8,0,0,0));128 p.add(new UrlLabel("http://josm.openstreetmap.de/#Download",2), GBC.eop().insets(8,0,0,0)); 129 129 p.add(new JMultilineLabel( 130 130 tr("You should also update your plugins. If neither of those help please " + 131 131 "file a bug report in our bugtracker using this link:")), GBC.eol()); 132 p.add(new UrlLabel(url.toString(), "http://josm.openstreetmap.de/josmticket?..." ), GBC.eop().insets(8,0,0,0));132 p.add(new UrlLabel(url.toString(), "http://josm.openstreetmap.de/josmticket?...",2), GBC.eop().insets(8,0,0,0)); 133 133 p.add(new JMultilineLabel( 134 134 tr("There the error information provided below should already be " + … … 138 138 tr("Alternatively, if that does not work you can manually fill in the information " + 139 139 "below at this URL:")), GBC.eol()); 140 p.add(new UrlLabel("http://josm.openstreetmap.de/newticket" ), GBC.eop().insets(8,0,0,0));140 p.add(new UrlLabel("http://josm.openstreetmap.de/newticket",2), GBC.eop().insets(8,0,0,0)); 141 141 if (Utils.copyToClipboard(text)) { 142 142 p.add(new JLabel(tr("(The text has already been copied to your clipboard.)")), GBC.eop()); -
trunk/src/org/openstreetmap/josm/tools/UrlLabel.java
r5019 r5050 2 2 package org.openstreetmap.josm.tools; 3 3 4 import java.awt.Cursor; 4 5 import java.awt.event.MouseEvent; 5 6 import java.awt.event.MouseListener; 6 import javax.swing.JEditorPane; 7 import javax.swing.event.HyperlinkEvent; 8 import javax.swing.event.HyperlinkListener; 7 import javax.swing.JLabel; 8 import javax.swing.SwingUtilities; 9 9 import static org.openstreetmap.josm.tools.I18n.tr; 10 10 … … 12 12 * Label that contains a clickable link. 13 13 * @author Imi 14 * 5050: Simplifications by Zverikk included by akks 14 15 */ 15 public class UrlLabel extends J EditorPane implements HyperlinkListener,MouseListener {16 public class UrlLabel extends JLabel implements MouseListener { 16 17 17 18 private String url = ""; 18 19 private String description = ""; 20 private int fontPlus; 19 21 20 22 public UrlLabel() { 21 addHyperlinkListener(this);22 23 addMouseListener(this); 23 setEditable(false); 24 setOpaque(false); 24 setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); 25 25 } 26 26 27 27 public UrlLabel(String url) { 28 this (url, url); 28 this (url, url, 0); 29 } 30 31 public UrlLabel(String url, int fontPlus) { 32 this (url, url, fontPlus); 29 33 } 30 34 31 35 public UrlLabel(String url, String description) { 36 this (url, url, 0); 37 } 38 39 public UrlLabel(String url, String description, int fontPlus) { 32 40 this(); 33 41 setUrl(url); 34 42 setDescription(description); 43 this.fontPlus = fontPlus; 44 if (fontPlus!=0) setFont(getFont().deriveFont(0, getFont().getSize()+fontPlus)); 35 45 refresh(); 36 46 } 37 47 38 48 protected void refresh() { 39 setContentType("text/html");40 49 if (url != null) { 41 50 setText("<html><a href=\""+url+"\">"+description+"</a></html>"); … … 44 53 } 45 54 setToolTipText(String.format("<html>%s<br/>%s</html>",url, tr("Right click = copy to clipboard"))); 46 }47 48 public void hyperlinkUpdate(HyperlinkEvent e) {49 if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {50 OpenBrowser.displayUrl(url);51 }52 55 } 53 56 … … 75 78 76 79 @Override 77 public void mouseClicked(MouseEvent e) { } 80 public void mouseClicked(MouseEvent e) { 81 if( SwingUtilities.isLeftMouseButton(e) ) { 82 OpenBrowser.displayUrl(url); 83 } else if( SwingUtilities.isRightMouseButton(e) ) { 84 Utils.copyToClipboard(url); 85 } 86 } 78 87 @Override 79 88 public void mousePressed(MouseEvent e) { } … … 82 91 @Override 83 92 public void mouseExited(MouseEvent e) { } 84 85 93 @Override 86 public void mouseReleased(MouseEvent e) { 87 if (e.getButton() == MouseEvent.BUTTON3) { 88 Utils.copyToClipboard(url); 89 } 90 } 94 public void mouseReleased(MouseEvent e) { } 91 95 92 96 }
Note:
See TracChangeset
for help on using the changeset viewer.