Changeset 6901 in josm
- Timestamp:
- 2014-03-07T11:35:00+01:00 (11 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/Main.java
r6900 r6901 37 37 import javax.swing.JComponent; 38 38 import javax.swing.JFrame; 39 import javax.swing.JLabel;40 39 import javax.swing.JOptionPane; 41 40 import javax.swing.JPanel; … … 88 87 import org.openstreetmap.josm.gui.progress.ProgressMonitorExecutor; 89 88 import org.openstreetmap.josm.gui.util.RedirectInputMap; 89 import org.openstreetmap.josm.gui.widgets.JMultilineLabel; 90 90 import org.openstreetmap.josm.io.OsmApi; 91 91 import org.openstreetmap.josm.tools.CheckParameterUtil; … … 1123 1123 return; 1124 1124 if (version.startsWith("1.5") || version.startsWith("5")) { 1125 JLabel ho = new JLabel("<html>"+ 1125 JMultilineLabel ho = new JMultilineLabel("<html>"+ 1126 1126 tr("<h2>JOSM requires Java version 6.</h2>"+ 1127 1127 "Detected Java version: {0}.<br>"+ -
trunk/src/org/openstreetmap/josm/actions/AboutAction.java
r6897 r6901 19 19 import org.openstreetmap.josm.data.Version; 20 20 import org.openstreetmap.josm.gui.util.GuiHelper; 21 import org.openstreetmap.josm.gui.widgets.JMultilineLabel; 21 22 import org.openstreetmap.josm.gui.widgets.JosmTextArea; 22 23 import org.openstreetmap.josm.gui.widgets.UrlLabel; … … 74 75 75 76 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()); 77 final JMultilineLabel label = new JMultilineLabel("<html>" + 78 "<h1>" + "JOSM – " + tr("Java OpenStreetMap Editor") + "</h1>" + 79 "<p style='font-size:75%'></p>" + 80 "<p>" + tr("Version {0}", version.getVersionString()) + "</p>" + 81 "<p style='font-size:50%'></p>" + 82 "<p>" + tr("Last change at {0}", version.getTime()) + "</p>" + 83 "<p style='font-size:50%'></p>" + 84 "<p>" + tr("Java Version {0}", System.getProperty("java.version")) + "</p>" + 85 "<p style='font-size:50%'></p>" + 86 "</html>"); 87 info.add(label, GBC.eol().fill(GBC.HORIZONTAL).insets(10, 0, 0, 0)); 86 88 info.add(new JLabel(tr("Homepage")), GBC.std().insets(10,0,10,0)); 87 89 info.add(new UrlLabel(Main.getJOSMWebsite(),2), GBC.eol().fill(GBC.HORIZONTAL)); -
trunk/src/org/openstreetmap/josm/command/Command.java
r6883 r6901 10 10 import java.util.Map.Entry; 11 11 12 import javax.swing.JLabel;13 12 import javax.swing.JOptionPane; 14 13 import javax.swing.JPanel; … … 26 25 import org.openstreetmap.josm.gui.layer.Layer; 27 26 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 27 import org.openstreetmap.josm.gui.widgets.JMultilineLabel; 28 28 import org.openstreetmap.josm.tools.CheckParameterUtil; 29 29 … … 210 210 if (outside) { 211 211 JPanel msg = new JPanel(new GridBagLayout()); 212 msg.add(new JLabel("<html>" + outsideDialogMessage + "</html>")); 212 msg.add(new JMultilineLabel("<html>" + outsideDialogMessage + "</html>")); 213 213 boolean answer = ConditionalOptionPaneUtil.showConfirmationDialog( 214 214 operation + "_outside_nodes", … … 224 224 if (incomplete) { 225 225 JPanel msg = new JPanel(new GridBagLayout()); 226 msg.add(new JLabel("<html>" + incompleteDialogMessage + "</html>")); 226 msg.add(new JMultilineLabel("<html>" + incompleteDialogMessage + "</html>")); 227 227 boolean answer = ConditionalOptionPaneUtil.showConfirmationDialog( 228 228 operation + "_incomplete", -
trunk/src/org/openstreetmap/josm/command/DeleteCommand.java
r6881 r6901 20 20 21 21 import javax.swing.Icon; 22 import javax.swing.JLabel;23 22 import javax.swing.JOptionPane; 24 23 import javax.swing.JPanel; … … 38 37 import org.openstreetmap.josm.gui.actionsupport.DeleteFromRelationConfirmationDialog; 39 38 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 39 import org.openstreetmap.josm.gui.widgets.JMultilineLabel; 40 40 import org.openstreetmap.josm.tools.CheckParameterUtil; 41 41 import org.openstreetmap.josm.tools.ImageProvider; … … 464 464 private static boolean confirmRelationDeletion(Collection<Relation> relations) { 465 465 JPanel msg = new JPanel(new GridBagLayout()); 466 msg.add(new JLabel("<html>" + trn( 466 msg.add(new JMultilineLabel("<html>" + trn( 467 467 "You are about to delete {0} relation: {1}" 468 468 + "<br/>" -
trunk/src/org/openstreetmap/josm/gui/ConditionalOptionPaneUtil.java
r6889 r6901 13 13 14 14 import javax.swing.ButtonGroup; 15 import javax.swing.JLabel;16 15 import javax.swing.JOptionPane; 17 16 import javax.swing.JPanel; … … 19 18 20 19 import org.openstreetmap.josm.Main; 20 import org.openstreetmap.josm.gui.widgets.JMultilineLabel; 21 21 import org.openstreetmap.josm.tools.GBC; 22 22 import org.openstreetmap.josm.tools.Utils; … … 271 271 add((Component) message, GBC.eop()); 272 272 } else if (message != null) { 273 add(new JLabel(message.toString()), GBC.eop()); 273 add(new JMultilineLabel(message.toString()), GBC.eop()); 274 274 } 275 275 add(cbShowPermanentDialog, GBC.eol()); -
trunk/src/org/openstreetmap/josm/gui/SplashScreen.java
r6889 r6901 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; … … 107 107 } 108 108 109 /** 110 * Returns the progress monitor. 111 * @return The progress monitor 112 */ 109 113 public ProgressMonitor getProgressMonitor() { 110 114 return progressMonitor; -
trunk/src/org/openstreetmap/josm/gui/io/BasicUploadSettingsPanel.java
r6660 r6901 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.J osmEditorPane;31 import org.openstreetmap.josm.gui.widgets.JMultilineLabel; 32 32 import org.openstreetmap.josm.tools.CheckParameterUtil; 33 33 import org.openstreetmap.josm.tools.GBC; … … 56 56 JPanel pnl = new JPanel(new GridBagLayout()); 57 57 58 final JEditorPane commentLabel = JosmEditorPane.createJLabelLikePane(); 59 commentLabel.setText("<html><b>" + tr("Provide a brief comment for the changes you are uploading:")); 58 final JEditorPane commentLabel = new JMultilineLabel("<html><b>" + tr("Provide a brief comment for the changes you are uploading:")); 60 59 pnl.add(commentLabel, GBC.eol().insets(0, 5, 10, 3).fill(GBC.HORIZONTAL)); 61 60 hcbUploadComment.setToolTipText(tr("Enter an upload comment")); … … 69 68 pnl.add(hcbUploadComment, GBC.eol().fill(GBC.HORIZONTAL)); 70 69 71 final JEditorPane sourceLabel = JosmEditorPane.createJLabelLikePane(); 72 sourceLabel.setText("<html><b>" + tr("Specify the data source for the changes") 70 final JEditorPane sourceLabel = new JMultilineLabel("<html><b>" + tr("Specify the data source for the changes") 73 71 + "</b> (<a href=\"urn:changeset-source\">" + tr("obtain from current layers") + "</a>)<b>:</b>"); 74 72 sourceLabel.addHyperlinkListener(new HyperlinkListener() { -
trunk/src/org/openstreetmap/josm/gui/io/UploadParameterSummaryPanel.java
r6822 r6901 16 16 17 17 import org.openstreetmap.josm.data.osm.Changeset; 18 import org.openstreetmap.josm.gui.widgets.J osmEditorPane;18 import org.openstreetmap.josm.gui.widgets.JMultilineLabel; 19 19 import org.openstreetmap.josm.io.OsmApi; 20 20 import org.openstreetmap.josm.tools.ImageProvider; … … 24 24 private UploadStrategySpecification spec = new UploadStrategySpecification(); 25 25 private int numObjects; 26 private J osmEditorPanejepMessage;26 private JMultilineLabel jepMessage; 27 27 private JLabel lblWarning; 28 28 … … 99 99 100 100 protected void build() { 101 jepMessage = JosmEditorPane.createJLabelLikePane();101 jepMessage = new JMultilineLabel(""); 102 102 jepMessage.addHyperlinkListener(this); 103 103 -
trunk/src/org/openstreetmap/josm/gui/io/UploadStrategySelectionPanel.java
r6889 r6901 1 1 // License: GPL. For details, see LICENSE file. 2 2 package org.openstreetmap.josm.gui.io; 3 3 4 import static org.openstreetmap.josm.tools.I18n.tr; 4 5 import static org.openstreetmap.josm.tools.I18n.trn; … … 30 31 31 32 import org.openstreetmap.josm.Main; 32 import org.openstreetmap.josm.io.OsmApi;33 import org.openstreetmap.josm.tools.ImageProvider;34 33 import org.openstreetmap.josm.gui.widgets.JMultilineLabel; 35 34 import org.openstreetmap.josm.gui.widgets.JosmTextField; 35 import org.openstreetmap.josm.io.OsmApi; 36 36 37 37 /** … … 108 108 gc.weighty = 0.0; 109 109 gc.gridwidth = 2; 110 JLabel 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); … … 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>" … … 341 340 } else { 342 341 rbStrategy.get(UploadStrategy.SINGLE_REQUEST_STRATEGY).setEnabled(true); 343 JLabel 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); -
trunk/src/org/openstreetmap/josm/gui/preferences/server/OAuthAuthenticationPreferencesPanel.java
r6890 r6901 189 189 gc.fill = GridBagConstraints.HORIZONTAL; 190 190 gc.weightx = 1.0; 191 JLabel 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)); … … 228 228 gc.weightx = 1.0; 229 229 gc.gridwidth = 2; 230 JLabel 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)); -
trunk/src/org/openstreetmap/josm/gui/widgets/JMultilineLabel.java
r6365 r6901 5 5 import java.awt.Rectangle; 6 6 7 import javax.swing.J Label;7 import javax.swing.JEditorPane; 8 8 import javax.swing.plaf.basic.BasicHTML; 9 9 import javax.swing.text.View; … … 16 16 * Note that this won't work if JMultilineLabel is put into a JScrollBox or 17 17 * similar as the bounds will never change. Instead scrollbars will be displayed. 18 * 18 * 19 19 * @since 6340 20 20 */ 21 public class JMultilineLabel extends J Label{21 public class JMultilineLabel extends JEditorPane { 22 22 private int maxWidth = Integer.MAX_VALUE; 23 23 private Rectangle oldbounds = null; … … 33 33 */ 34 34 public JMultilineLabel(String text) { 35 super(); 35 this(text, true); 36 } 37 38 public JMultilineLabel(String text, boolean allBold) { 39 JosmEditorPane.makeJLabelLike(this, allBold); 36 40 String html = text.trim().replaceAll("\n", "<br>"); 37 41 if (!html.startsWith("<html>")) { -
trunk/src/org/openstreetmap/josm/gui/widgets/JosmEditorPane.java
r6654 r6901 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 … … 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 JosmEditorPanecreateJLabelLikePane() {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); … … 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(), … … 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 }
Note:
See TracChangeset
for help on using the changeset viewer.