Ticket #3764: 3764.patch
File 3764.patch, 19.1 KB (added by , 11 years ago) |
---|
-
src/org/openstreetmap/josm/Main.java
diff --git a/src/org/openstreetmap/josm/Main.java b/src/org/openstreetmap/josm/Main.java index ecc19d7..3c90e3e 100644
a b import org.openstreetmap.josm.gui.preferences.projection.ProjectionPreference; 87 87 import org.openstreetmap.josm.gui.progress.PleaseWaitProgressMonitor; 88 88 import org.openstreetmap.josm.gui.progress.ProgressMonitorExecutor; 89 89 import org.openstreetmap.josm.gui.util.RedirectInputMap; 90 import org.openstreetmap.josm.gui.widgets.JMultilineLabel; 90 91 import org.openstreetmap.josm.io.OsmApi; 91 92 import org.openstreetmap.josm.tools.CheckParameterUtil; 92 93 import org.openstreetmap.josm.tools.I18n; … … abstract public class Main { 1078 1079 version.startsWith("1.9") || version.startsWith("9")) 1079 1080 return; 1080 1081 if (version.startsWith("1.5") || version.startsWith("5")) { 1081 J Label ho = new JLabel("<html>"+1082 JMultilineLabel ho = new JMultilineLabel("<html>"+ 1082 1083 tr("<h2>JOSM requires Java version 6.</h2>"+ 1083 1084 "Detected Java version: {0}.<br>"+ 1084 1085 "You can <ul><li>update your Java (JRE) or</li>"+ -
src/org/openstreetmap/josm/actions/AboutAction.java
diff --git a/src/org/openstreetmap/josm/actions/AboutAction.java b/src/org/openstreetmap/josm/actions/AboutAction.java index 08dc17b..1b96bd3 100644
a b import javax.swing.JOptionPane; 14 14 import javax.swing.JPanel; 15 15 import javax.swing.JScrollPane; 16 16 import javax.swing.JTabbedPane; 17 import javax.swing.text.DefaultEditorKit; 17 18 18 19 import org.openstreetmap.josm.Main; 19 20 import org.openstreetmap.josm.data.Version; 20 21 import org.openstreetmap.josm.gui.util.GuiHelper; 22 import org.openstreetmap.josm.gui.widgets.JMultilineLabel; 21 23 import org.openstreetmap.josm.gui.widgets.JosmTextArea; 22 24 import org.openstreetmap.josm.gui.widgets.UrlLabel; 23 25 import org.openstreetmap.josm.plugins.PluginHandler; … … public class AboutAction extends JosmAction { 73 75 license.setCaretPosition(0); 74 76 75 77 JPanel info = new JPanel(new GridBagLayout()); 76 JLabel caption = new JLabel("JOSM – " + tr("Java OpenStreetMap Editor")); 77 caption.setFont(GuiHelper.getTitleFont()); 78 info.add(caption, GBC.eol().fill(GBC.HORIZONTAL).insets(10,0,0,0)); 79 info.add(GBC.glue(0,10), GBC.eol()); 80 info.add(new JLabel(tr("Version {0}", version.getVersionString())), GBC.eol().fill(GBC.HORIZONTAL).insets(10,0,0,0)); 81 info.add(GBC.glue(0,5), GBC.eol()); 82 info.add(new JLabel(tr("Last change at {0}",version.getTime())), GBC.eol().fill(GBC.HORIZONTAL).insets(10,0,0,0)); 83 info.add(GBC.glue(0,5), GBC.eol()); 84 info.add(new JLabel(tr("Java Version {0}",System.getProperty("java.version"))), GBC.eol().fill(GBC.HORIZONTAL).insets(10,0,0,0)); 85 info.add(GBC.glue(0,10), GBC.eol()); 78 final JMultilineLabel label = new JMultilineLabel("<html>" + 79 "<h1>" + "JOSM – " + tr("Java OpenStreetMap Editor") + "</h1>" + 80 "<p style='font-size:75%'></p>" + 81 "<p>" + tr("Version {0}", version.getVersionString()) + "</p>" + 82 "<p style='font-size:50%'></p>" + 83 "<p>" + tr("Last change at {0}", version.getTime()) + "</p>" + 84 "<p style='font-size:50%'></p>" + 85 "<p>" + tr("Java Version {0}", System.getProperty("java.version")) + "</p>" + 86 "<p style='font-size:50%'></p>" + 87 "</html>"); 88 info.add(label, GBC.eol().fill(GBC.HORIZONTAL).insets(10, 0, 0, 0)); 86 89 info.add(new JLabel(tr("Homepage")), GBC.std().insets(10,0,10,0)); 87 90 info.add(new UrlLabel(Main.JOSM_WEBSITE,2), GBC.eol().fill(GBC.HORIZONTAL)); 88 91 info.add(GBC.glue(0,5), GBC.eol()); -
src/org/openstreetmap/josm/command/Command.java
diff --git a/src/org/openstreetmap/josm/command/Command.java b/src/org/openstreetmap/josm/command/Command.java index 108c29c..fb47b2d 100644
a b import org.openstreetmap.josm.data.osm.visitor.AbstractVisitor; 26 26 import org.openstreetmap.josm.gui.ConditionalOptionPaneUtil; 27 27 import org.openstreetmap.josm.gui.layer.Layer; 28 28 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 29 import org.openstreetmap.josm.gui.widgets.JMultilineLabel; 29 30 import org.openstreetmap.josm.tools.CheckParameterUtil; 30 31 31 32 /** … … abstract public class Command extends PseudoCommand { 210 211 } 211 212 if (outside) { 212 213 JPanel msg = new JPanel(new GridBagLayout()); 213 msg.add(new J Label("<html>" + outsideDialogMessage + "</html>"));214 msg.add(new JMultilineLabel("<html>" + outsideDialogMessage + "</html>")); 214 215 boolean answer = ConditionalOptionPaneUtil.showConfirmationDialog( 215 216 operation + "_outside_nodes", 216 217 Main.parent, … … abstract public class Command extends PseudoCommand { 224 225 } 225 226 if (incomplete) { 226 227 JPanel msg = new JPanel(new GridBagLayout()); 227 msg.add(new J Label("<html>" + incompleteDialogMessage + "</html>"));228 msg.add(new JMultilineLabel("<html>" + incompleteDialogMessage + "</html>")); 228 229 boolean answer = ConditionalOptionPaneUtil.showConfirmationDialog( 229 230 operation + "_incomplete", 230 231 Main.parent, -
src/org/openstreetmap/josm/command/DeleteCommand.java
diff --git a/src/org/openstreetmap/josm/command/DeleteCommand.java b/src/org/openstreetmap/josm/command/DeleteCommand.java index a63f4f0..38703a1 100644
a b import org.openstreetmap.josm.gui.ConditionalOptionPaneUtil; 37 37 import org.openstreetmap.josm.gui.DefaultNameFormatter; 38 38 import org.openstreetmap.josm.gui.actionsupport.DeleteFromRelationConfirmationDialog; 39 39 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 40 import org.openstreetmap.josm.gui.widgets.JMultilineLabel; 40 41 import org.openstreetmap.josm.tools.CheckParameterUtil; 41 42 import org.openstreetmap.josm.tools.ImageProvider; 42 43 import org.openstreetmap.josm.tools.Utils; … … public class DeleteCommand extends Command { 465 466 466 467 private static boolean confirmRelationDeletion(Collection<Relation> relations) { 467 468 JPanel msg = new JPanel(new GridBagLayout()); 468 msg.add(new J Label("<html>" + trn(469 msg.add(new JMultilineLabel("<html>" + trn( 469 470 "You are about to delete {0} relation: {1}" 470 471 + "<br/>" 471 472 + "This step is rarely necessary and cannot be undone easily after being uploaded to the server." -
src/org/openstreetmap/josm/gui/ConditionalOptionPaneUtil.java
diff --git a/src/org/openstreetmap/josm/gui/ConditionalOptionPaneUtil.java b/src/org/openstreetmap/josm/gui/ConditionalOptionPaneUtil.java index 2dd5843..1d99441 100644
a b import javax.swing.JPanel; 18 18 import javax.swing.JRadioButton; 19 19 20 20 import org.openstreetmap.josm.Main; 21 import org.openstreetmap.josm.gui.widgets.JMultilineLabel; 21 22 import org.openstreetmap.josm.tools.GBC; 22 23 import org.openstreetmap.josm.tools.Utils; 23 24 … … public final class ConditionalOptionPaneUtil { 270 271 if (message instanceof Component) { 271 272 add((Component) message, GBC.eop()); 272 273 } else if (message != null) { 273 add(new J Label(message.toString()), GBC.eop());274 add(new JMultilineLabel(message.toString()), GBC.eop()); 274 275 } 275 276 add(cbShowPermanentDialog, GBC.eol()); 276 277 add(cbShowSessionDialog, GBC.eol()); -
src/org/openstreetmap/josm/gui/SplashScreen.java
diff --git a/src/org/openstreetmap/josm/gui/SplashScreen.java b/src/org/openstreetmap/josm/gui/SplashScreen.java index 6dd4bab..4a7c87f 100644
a b public class SplashScreen extends JFrame { 64 64 innerContentPane.add(logo, gbc); 65 65 66 66 // Add the name of this application 67 JLabel caption = new JLabel("JOSM -" + tr("Java OpenStreetMap Editor"));67 JLabel caption = new JLabel("JOSM – " + tr("Java OpenStreetMap Editor")); 68 68 caption.setFont(GuiHelper.getTitleFont()); 69 69 gbc.gridheight = 1; 70 70 gbc.gridx = 1; -
src/org/openstreetmap/josm/gui/io/BasicUploadSettingsPanel.java
diff --git a/src/org/openstreetmap/josm/gui/io/BasicUploadSettingsPanel.java b/src/org/openstreetmap/josm/gui/io/BasicUploadSettingsPanel.java index 3a3a022..c102484 100644
a b import javax.swing.event.HyperlinkListener; 28 28 import org.openstreetmap.josm.Main; 29 29 import org.openstreetmap.josm.data.osm.Changeset; 30 30 import org.openstreetmap.josm.gui.widgets.HistoryComboBox; 31 import org.openstreetmap.josm.gui.widgets.JMultilineLabel; 31 32 import org.openstreetmap.josm.gui.widgets.JosmEditorPane; 32 33 import org.openstreetmap.josm.tools.CheckParameterUtil; 33 34 import org.openstreetmap.josm.tools.GBC; … … public class BasicUploadSettingsPanel extends JPanel { 55 56 protected JPanel buildUploadCommentPanel() { 56 57 JPanel pnl = new JPanel(new GridBagLayout()); 57 58 58 final JEditorPane commentLabel = JosmEditorPane.createJLabelLikePane(); 59 commentLabel.setText("<html><b>" + tr("Provide a brief comment for the changes you are uploading:")); 59 final JEditorPane commentLabel = new JMultilineLabel("<html><b>" + tr("Provide a brief comment for the changes you are uploading:")); 60 60 pnl.add(commentLabel, GBC.eol().insets(0, 5, 10, 3).fill(GBC.HORIZONTAL)); 61 61 hcbUploadComment.setToolTipText(tr("Enter an upload comment")); 62 62 hcbUploadComment.setMaxTextLength(Changeset.MAX_COMMENT_LENGTH); … … public class BasicUploadSettingsPanel extends JPanel { 68 68 hcbUploadComment.getEditor().getEditorComponent().addFocusListener(commentModelListener); 69 69 pnl.add(hcbUploadComment, GBC.eol().fill(GBC.HORIZONTAL)); 70 70 71 final JEditorPane sourceLabel = JosmEditorPane.createJLabelLikePane(); 72 sourceLabel.setText("<html><b>" + tr("Specify the data source for the changes") 71 final JEditorPane sourceLabel = new JMultilineLabel("<html><b>" + tr("Specify the data source for the changes") 73 72 + "</b> (<a href=\"urn:changeset-source\">" + tr("obtain from current layers") + "</a>)<b>:</b>"); 74 73 sourceLabel.addHyperlinkListener(new HyperlinkListener() { 75 74 @Override -
src/org/openstreetmap/josm/gui/io/UploadParameterSummaryPanel.java
diff --git a/src/org/openstreetmap/josm/gui/io/UploadParameterSummaryPanel.java b/src/org/openstreetmap/josm/gui/io/UploadParameterSummaryPanel.java index 2fd44a4..53afe08 100644
a b import javax.swing.event.HyperlinkEvent; 15 15 import javax.swing.event.HyperlinkListener; 16 16 17 17 import org.openstreetmap.josm.data.osm.Changeset; 18 import org.openstreetmap.josm.gui.widgets.JMultilineLabel; 18 19 import org.openstreetmap.josm.gui.widgets.JosmEditorPane; 19 20 import org.openstreetmap.josm.io.OsmApi; 20 21 import org.openstreetmap.josm.tools.ImageProvider; … … import org.openstreetmap.josm.tools.ImageProvider; 23 24 public class UploadParameterSummaryPanel extends JPanel implements HyperlinkListener, PropertyChangeListener{ 24 25 private UploadStrategySpecification spec = new UploadStrategySpecification(); 25 26 private int numObjects; 26 private J osmEditorPanejepMessage;27 private JMultilineLabel jepMessage; 27 28 private JLabel lblWarning; 28 29 29 30 private Changeset selectedChangeset; … … public class UploadParameterSummaryPanel extends JPanel implements HyperlinkList 98 99 } 99 100 100 101 protected void build() { 101 jepMessage = JosmEditorPane.createJLabelLikePane();102 jepMessage = new JMultilineLabel(""); 102 103 jepMessage.addHyperlinkListener(this); 103 104 104 105 setLayout(new BorderLayout()); -
src/org/openstreetmap/josm/gui/io/UploadStrategySelectionPanel.java
diff --git a/src/org/openstreetmap/josm/gui/io/UploadStrategySelectionPanel.java b/src/org/openstreetmap/josm/gui/io/UploadStrategySelectionPanel.java index df8082e..31f562b 100644
a b public class UploadStrategySelectionPanel extends JPanel implements PropertyChan 107 107 gc.weightx = 0.0; 108 108 gc.weighty = 0.0; 109 109 gc.gridwidth = 2; 110 J Label lbl = lblStrategies.get(UploadStrategy.SINGLE_REQUEST_STRATEGY);110 JMultilineLabel lbl = lblStrategies.get(UploadStrategy.SINGLE_REQUEST_STRATEGY); 111 111 lbl.setText(tr("Upload data in one request")); 112 112 pnl.add(lbl, gc); 113 113 gc.gridx = 3; … … public class UploadStrategySelectionPanel extends JPanel implements PropertyChan 319 319 int maxChunkSize = OsmApi.getOsmApi().getCapabilities().getMaxChangesetSize(); 320 320 if (maxChunkSize > 0 && numUploadedObjects > maxChunkSize) { 321 321 rbStrategy.get(UploadStrategy.SINGLE_REQUEST_STRATEGY).setEnabled(false); 322 JLabel lbl = lblStrategies.get(UploadStrategy.SINGLE_REQUEST_STRATEGY); 323 lbl.setIcon(ImageProvider.get("warning-small.png")); 322 JMultilineLabel lbl = lblStrategies.get(UploadStrategy.SINGLE_REQUEST_STRATEGY); 324 323 lbl.setText(tr("Upload in one request not possible (too many objects to upload)")); 325 324 lbl.setToolTipText(tr("<html>Cannot upload {0} objects in one request because the<br>" 326 325 + "max. changeset size {1} on server ''{2}'' is exceeded.</html>", … … public class UploadStrategySelectionPanel extends JPanel implements PropertyChan 340 339 341 340 } else { 342 341 rbStrategy.get(UploadStrategy.SINGLE_REQUEST_STRATEGY).setEnabled(true); 343 J Label lbl = lblStrategies.get(UploadStrategy.SINGLE_REQUEST_STRATEGY);342 JMultilineLabel lbl = lblStrategies.get(UploadStrategy.SINGLE_REQUEST_STRATEGY); 344 343 lbl.setText(tr("Upload data in one request")); 345 lbl.setIcon(null);346 344 lbl.setToolTipText(""); 347 345 lblNumRequests.get(UploadStrategy.SINGLE_REQUEST_STRATEGY).setVisible(true); 348 346 -
src/org/openstreetmap/josm/gui/preferences/server/OAuthAuthenticationPreferencesPanel.java
diff --git a/src/org/openstreetmap/josm/gui/preferences/server/OAuthAuthenticationPreferencesPanel.java b/src/org/openstreetmap/josm/gui/preferences/server/OAuthAuthenticationPreferencesPanel.java index 8bfe243..71945ba 100644
a b public class OAuthAuthenticationPreferencesPanel extends JPanel implements Prope 188 188 gc.insets = new Insets(0,0,3,0); 189 189 gc.fill = GridBagConstraints.HORIZONTAL; 190 190 gc.weightx = 1.0; 191 J Label lbl;191 JMultilineLabel lbl; 192 192 add(lbl = new JMultilineLabel(tr("You do not have an Access Token yet to access the OSM server using OAuth. Please authorize first.")), gc); 193 193 lbl.setFont(lbl.getFont().deriveFont(Font.PLAIN)); 194 194 … … public class OAuthAuthenticationPreferencesPanel extends JPanel implements Prope 227 227 gc.fill = GridBagConstraints.HORIZONTAL; 228 228 gc.weightx = 1.0; 229 229 gc.gridwidth = 2; 230 J Label lbl;230 JMultilineLabel lbl; 231 231 add(lbl = new JMultilineLabel(tr("You already have an Access Token to access the OSM server using OAuth.")), gc); 232 232 lbl.setFont(lbl.getFont().deriveFont(Font.PLAIN)); 233 233 -
src/org/openstreetmap/josm/gui/widgets/JMultilineLabel.java
diff --git a/src/org/openstreetmap/josm/gui/widgets/JMultilineLabel.java b/src/org/openstreetmap/josm/gui/widgets/JMultilineLabel.java index b7b6362..c954168 100644
a b package org.openstreetmap.josm.gui.widgets; 4 4 import java.awt.Dimension; 5 5 import java.awt.Rectangle; 6 6 7 import javax.swing.JEditorPane; 7 8 import javax.swing.JLabel; 8 9 import javax.swing.plaf.basic.BasicHTML; 10 import javax.swing.text.Caret; 9 11 import javax.swing.text.View; 10 12 11 13 /** … … import javax.swing.text.View; 18 20 * 19 21 * @since 6340 20 22 */ 21 public class JMultilineLabel extends J Label{23 public class JMultilineLabel extends JEditorPane { 22 24 private int maxWidth = Integer.MAX_VALUE; 23 25 private Rectangle oldbounds = null; 24 26 private Dimension oldPreferred = null; … … public class JMultilineLabel extends JLabel { 32 34 * @param text The text to display 33 35 */ 34 36 public JMultilineLabel(String text) { 37 this(text, true); 38 } 39 40 public JMultilineLabel(String text, boolean allBold) { 35 41 super(); 42 JosmEditorPane.makeJLabelLike(this, allBold); 36 43 String html = text.trim().replaceAll("\n", "<br>"); 37 44 if (!html.startsWith("<html>")) { 38 45 html = "<html>" + html + "</html>"; -
src/org/openstreetmap/josm/gui/widgets/JosmEditorPane.java
diff --git a/src/org/openstreetmap/josm/gui/widgets/JosmEditorPane.java b/src/org/openstreetmap/josm/gui/widgets/JosmEditorPane.java index 3c66559..4bef38c 100644
a b import javax.swing.JEditorPane; 12 12 import javax.swing.UIManager; 13 13 import javax.swing.text.html.StyleSheet; 14 14 15 import org.openstreetmap.josm.gui.util.GuiHelper; 15 16 import org.openstreetmap.josm.tools.Utils; 16 17 17 18 /** … … public class JosmEditorPane extends JEditorPane { 80 81 } 81 82 82 83 /** 83 * Creates a {@link JosmEditorPane} which is meantto be used as a powerful replacement of {@link javax.swing.JLabel}.84 * Adapts an {@link JEditorPane} to be used as a powerful replacement of {@link javax.swing.JLabel}. 84 85 */ 85 public static JosmEditorPane createJLabelLikePane() {86 final JosmEditorPane pane = new JosmEditorPane("text/html", "");86 public static void makeJLabelLike(JEditorPane pane, boolean allBold) { 87 pane.setContentType("text/html"); 87 88 pane.setOpaque(false); 88 89 pane.setEditable(false); 89 90 90 91 JosmHTMLEditorKit kit = new JosmHTMLEditorKit(); 91 92 final Font f = UIManager.getFont("Label.font"); 92 93 final StyleSheet ss = new StyleSheet(); 93 final String rule = MessageFormat.format( 94 ss.addRule((allBold ? "html" : "strong, b") + " {" + getFontRule(f) + "}"); 95 ss.addRule("a {text-decoration: underline; color: blue}"); 96 ss.addRule("h1 {" + getFontRule(GuiHelper.getTitleFont()) + "}"); 97 kit.setStyleSheet(ss); 98 pane.setEditorKit(kit); 99 } 100 101 private static String getFontRule(Font f) { 102 return MessageFormat.format( 94 103 "font-family: ''{0}'';font-size: {1,number}pt; font-weight: {2}; font-style: {3}", 95 104 f.getName(), 96 105 f.getSize(), 97 106 "bold", 98 107 f.isItalic() ? "italic" : "normal" 99 108 ); 100 ss.addRule("strong {" + rule + "}");101 ss.addRule("a {text-decoration: underline; color: blue}");102 kit.setStyleSheet(ss);103 pane.setEditorKit(kit);104 105 return pane;106 109 } 107 110 }