// License: GPL. See LICENSE file for details. package org.openstreetmap.josm.gui; import static org.openstreetmap.josm.tools.I18n.tr; import java.io.IOException; import java.util.ArrayList; import java.util.concurrent.Executors; import java.util.concurrent.ExecutorService; import java.util.concurrent.Callable; import java.util.concurrent.Future; import java.util.regex.Matcher; import java.util.regex.Pattern; import java.awt.BorderLayout; import java.awt.EventQueue; import javax.swing.JScrollPane; import javax.swing.JEditorPane; import javax.swing.JPanel; import javax.swing.event.HyperlinkEvent; import javax.swing.event.HyperlinkListener; import javax.swing.border.EmptyBorder; import org.openstreetmap.josm.Main; import org.openstreetmap.josm.io.CacheCustomContent; import org.openstreetmap.josm.tools.OpenBrowser; import org.openstreetmap.josm.tools.WikiReader; import org.openstreetmap.josm.actions.AboutAction; public class GettingStarted extends JPanel { private String content = ""; static private String styles = "\n"; public class LinkGeneral extends JEditorPane implements HyperlinkListener { public LinkGeneral(String text) { setContentType("text/html"); setText(text); setEditable(false); setOpaque(false); addHyperlinkListener(this); } public void hyperlinkUpdate(HyperlinkEvent e) { if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { OpenBrowser.displayUrl(e.getDescription()); } } } /** * This class encapsulates the "reading URL" task and can be executed in background and in * parallel. Since the MOTD is many separate pages this speeds things up quite a lot. If no * localized version is available, it automatically falls back to the international one. */ private class readMOTD implements Callable { private boolean isLocalized; private boolean isHelp; private String urlLoc; private String urlIntl; private String urlBase; /** * Read a MOTD page * @param isLocalized If true, tries to get localized version as defined in urlLoc * @param urlBase Base URL (i.e. http://www.openstreetmap.de/wiki/) * @param urlLoc Part to append to base URL to receive localized version * @param urlIntl Part to append to base URL to receive international version * @param makeList If true, the URL's contents will be wrapped in a list (