Changeset 6040 in josm for trunk


Ignore:
Timestamp:
2013-06-29T01:23:39+02:00 (6 years ago)
Author:
Don-vip
Message:

fix #8827 - HTML rendering differ if run before or after having launched Help Browser

Location:
trunk/src/org/openstreetmap/josm
Files:
1 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/OpenLocationAction.java

    r6032 r6040  
    154154     */
    155155    public String findSummaryDocumentation() {
    156         String result = "";
    157         for (int i = 0; i < downloadTasks.size(); i++) {
    158             Class<? extends DownloadTask> taskClass = downloadTasks.get(i);
     156        String result = "<table>";
     157        for (Class<? extends DownloadTask> taskClass : downloadTasks) {
    159158            if (taskClass != null) {
    160159                try {
    161160                    DownloadTask task = taskClass.getConstructor().newInstance();
    162                     result += "<br/>" + task.acceptsDocumentationSummary();
     161                    result += task.acceptsDocumentationSummary();
    163162                } catch (Exception e) {
    164163                    e.printStackTrace();
     
    166165            }
    167166        }
     167        result += "</table>";
    168168        return result;
    169169    }
     
    187187        } else {
    188188            final String details = findSummaryDocumentation();    // Explain what patterns are supported
    189             HelpAwareOptionPane.showMessageDialogInEDT(Main.parent, tr(
    190                     "<html><p>Cannot open URL ''{0}''<br/>The following download tasks accept the URL patterns shown:<br/>{1}</p></html>",
    191                     url, details), tr("Download Location"), JOptionPane.ERROR_MESSAGE, HelpUtil.ht("/Action/OpenLocation"));
     189            HelpAwareOptionPane.showMessageDialogInEDT(Main.parent, "<html><p>" + tr(
     190                    "Cannot open URL ''{0}''<br>The following download tasks accept the URL patterns shown:<br>{1}",
     191                    url, details) + "</p></html>", tr("Download Location"), JOptionPane.ERROR_MESSAGE, HelpUtil.ht("/Action/OpenLocation"));
    192192        }
    193193    }
  • trunk/src/org/openstreetmap/josm/actions/downloadtasks/AbstractDownloadTask.java

    r6033 r6040  
    5959                buf.append("<li>");
    6060                buf.append(XmlWriter.encode(pattern));
     61                buf.append("</li>");
    6162            }
    6263            buf.append("</ul>");
  • trunk/src/org/openstreetmap/josm/gui/HelpAwareOptionPane.java

    r5951 r6040  
    2121import javax.swing.JOptionPane;
    2222import javax.swing.KeyStroke;
    23 import javax.swing.SwingUtilities;
    2423
    2524import org.openstreetmap.josm.gui.help.HelpBrowser;
    2625import org.openstreetmap.josm.gui.help.HelpUtil;
     26import org.openstreetmap.josm.gui.util.GuiHelper;
    2727import org.openstreetmap.josm.gui.widgets.JosmEditorPane;
    2828import org.openstreetmap.josm.tools.ImageProvider;
     
    284284     */
    285285    static public void showMessageDialogInEDT(final Component parentComponent, final Object msg, final String title, final int messageType, final String helpTopic)  {
    286         SwingUtilities.invokeLater(new Runnable() {
     286        GuiHelper.runInEDT(new Runnable() {
    287287            public void run() {
    288288                showOptionDialog(parentComponent, msg, title, messageType, null, null, null, helpTopic);
  • trunk/src/org/openstreetmap/josm/gui/help/HelpBrowser.java

    r5998 r6040  
    4141import javax.swing.text.html.HTML.Tag;
    4242import javax.swing.text.html.HTMLDocument;
    43 import javax.swing.text.html.HTMLEditorKit;
    4443import javax.swing.text.html.StyleSheet;
    4544
     
    4948import org.openstreetmap.josm.gui.MainMenu;
    5049import org.openstreetmap.josm.gui.widgets.JosmEditorPane;
     50import org.openstreetmap.josm.gui.widgets.JosmHTMLEditorKit;
    5151import org.openstreetmap.josm.tools.ImageProvider;
    5252import org.openstreetmap.josm.tools.LanguageInfo.LocaleType;
     
    168168    protected void build() {
    169169        help = new JosmEditorPane();
    170         HTMLEditorKit kit = new HTMLEditorKit();
     170        JosmHTMLEditorKit kit = new JosmHTMLEditorKit();
    171171        kit.setStyleSheet(buildStyleSheet());
    172172        help.setEditorKit(kit);
  • trunk/src/org/openstreetmap/josm/gui/io/UploadParameterSummaryPanel.java

    r5886 r6040  
    1717import javax.swing.event.HyperlinkEvent;
    1818import javax.swing.event.HyperlinkListener;
    19 import javax.swing.text.html.HTMLEditorKit;
    2019import javax.swing.text.html.StyleSheet;
    2120
    2221import org.openstreetmap.josm.data.osm.Changeset;
    2322import org.openstreetmap.josm.gui.widgets.JosmEditorPane;
     23import org.openstreetmap.josm.gui.widgets.JosmHTMLEditorKit;
    2424import org.openstreetmap.josm.io.OsmApi;
    2525import org.openstreetmap.josm.tools.ImageProvider;
    2626
     27// FIXME this class should extend HtmlPanel instead (duplicated code in here)
    2728public class UploadParameterSummaryPanel extends JPanel implements HyperlinkListener, PropertyChangeListener{
    2829    private UploadStrategySpecification spec = new UploadStrategySpecification();
     
    127128        ss.addRule(rule);
    128129        ss.addRule("a {text-decoration: underline; color: blue}");
    129         HTMLEditorKit kit = new HTMLEditorKit();
     130        JosmHTMLEditorKit kit = new JosmHTMLEditorKit();
    130131        kit.setStyleSheet(ss);
    131132        jepMessage.setEditorKit(kit);
  • trunk/src/org/openstreetmap/josm/gui/widgets/HtmlPanel.java

    r5886 r6040  
    99import javax.swing.JPanel;
    1010import javax.swing.UIManager;
    11 import javax.swing.text.html.HTMLEditorKit;
    1211import javax.swing.text.html.StyleSheet;
    1312
     
    1918 * blue and they are underlined. There is also a CSS rule for the HTML tag &lt;strong&gt;
    2019 * configured.
    21  *
     20 * @since 2688
    2221 */
    2322public class HtmlPanel extends JPanel {
     
    5049        ss.addRule("a {text-decoration: underline; color: blue}");
    5150        ss.addRule("ul {margin-left: 1cm; list-style-type: disc}");
    52         HTMLEditorKit kit = new HTMLEditorKit();
     51        JosmHTMLEditorKit kit = new JosmHTMLEditorKit();
    5352        kit.setStyleSheet(ss);
    5453        jepMessage.setEditorKit(kit);
Note: See TracChangeset for help on using the changeset viewer.