Package org.openstreetmap.josm.gui.help
Class HyperlinkHandler
- java.lang.Object
-
- org.openstreetmap.josm.gui.help.HyperlinkHandler
-
- All Implemented Interfaces:
java.util.EventListener
,javax.swing.event.HyperlinkListener
public class HyperlinkHandler extends java.lang.Object implements javax.swing.event.HyperlinkListener
Handles clicks on hyperlinks insideHelpBrowser
.- Since:
- 14807
-
-
Field Summary
Fields Modifier and Type Field Description private IHelpBrowser
browser
private JosmEditorPane
help
-
Constructor Summary
Constructors Constructor Description HyperlinkHandler(IHelpBrowser browser, JosmEditorPane help)
Constructs a newHyperlinkHandler
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.String
getUrlFragment(javax.swing.event.HyperlinkEvent e)
Checks whether the hyperlink event originated on a <a ...> element with a relative href consisting of a URL fragment only, i.e.void
hyperlinkUpdate(javax.swing.event.HyperlinkEvent e)
protected boolean
scrollToElementWithId(java.lang.String id)
Scrolls the help browser to the element with idid
-
-
-
Field Detail
-
browser
private final IHelpBrowser browser
-
help
private final JosmEditorPane help
-
-
Constructor Detail
-
HyperlinkHandler
public HyperlinkHandler(IHelpBrowser browser, JosmEditorPane help)
Constructs a newHyperlinkHandler
.- Parameters:
browser
- help browserhelp
- inner help pane
-
-
Method Detail
-
scrollToElementWithId
protected boolean scrollToElementWithId(java.lang.String id)
Scrolls the help browser to the element with idid
- Parameters:
id
- the id- Returns:
- true, if an element with this id was found and scrolling was successful; false, otherwise
-
getUrlFragment
protected java.lang.String getUrlFragment(javax.swing.event.HyperlinkEvent e)
Checks whether the hyperlink event originated on a <a ...> element with a relative href consisting of a URL fragment only, i.e. <a href="#thisIsALocalFragment">. If so, replies the fragment, i.e. "thisIsALocalFragment". Otherwise, repliesnull
- Parameters:
e
- the hyperlink event- Returns:
- the local fragment or
null
-
hyperlinkUpdate
public void hyperlinkUpdate(javax.swing.event.HyperlinkEvent e)
- Specified by:
hyperlinkUpdate
in interfacejavax.swing.event.HyperlinkListener
-
-