Package org.openstreetmap.josm.gui.help
Class HelpBrowser
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- java.awt.Window
-
- java.awt.Frame
-
- javax.swing.JFrame
-
- org.openstreetmap.josm.gui.help.HelpBrowser
-
- All Implemented Interfaces:
java.awt.image.ImageObserver
,java.awt.MenuContainer
,java.io.Serializable
,javax.accessibility.Accessible
,javax.swing.RootPaneContainer
,javax.swing.WindowConstants
,IHelpBrowser
public class HelpBrowser extends javax.swing.JFrame implements IHelpBrowser
Help browser displaying HTML pages fetched from JOSM wiki.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static class
HelpBrowser.AbstractBrowserAction
(package private) static class
HelpBrowser.BackAction
(package private) static class
HelpBrowser.EditAction
(package private) static class
HelpBrowser.ForwardAction
(package private) static class
HelpBrowser.HomeAction
(package private) static class
HelpBrowser.OpenInBrowserAction
(package private) static class
HelpBrowser.ReloadAction
-
Nested classes/interfaces inherited from class javax.swing.JFrame
javax.swing.JFrame.AccessibleJFrame
-
Nested classes/interfaces inherited from class java.awt.Window
java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
-
-
Field Summary
Fields Modifier and Type Field Description private static JosmAction
FOCUS_ACTION
private JosmEditorPane
help
the help browserprivate HelpBrowserHistory
history
the help browser historyprivate static HelpBrowser
instance
the unique instanceprivate HelpContentReader
reader
private java.lang.String
url
the currently displayed URLprivate static BooleanProperty
USE_EXTERNAL_BROWSER
private javax.swing.JMenuItem
windowMenuItem
the menu item in the windows menu.-
Fields inherited from class java.awt.Frame
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
-
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
-
-
Constructor Summary
Constructors Constructor Description HelpBrowser()
Constructs a newHelpBrowser
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
build()
Builds GUI.protected javax.swing.text.html.StyleSheet
buildStyleSheet()
Builds the style sheet used in the internal help browserprotected javax.swing.JToolBar
buildToolBar()
Builds toolbar.HelpBrowserHistory
getHistory()
Replies the browser history.static HelpBrowser
getInstance()
Replies the unique instance of the help browserjava.lang.String
getUrl()
Replies the current URL.protected void
handleHelpContentReaderException(java.lang.String relativeHelpTopic, HelpContentReaderException e)
Displays a error page if a help topic couldn't be loaded because of network or IO error.protected void
handleMissingHelpContent(java.lang.String relativeHelpTopic)
Displays a warning page when a help topic doesn't exist yet.protected void
loadAbsoluteHelpTopic(java.lang.String absoluteHelpTopic)
Loads a help topic given by an absolute help topic name, i.e.protected void
loadRelativeHelpTopic(java.lang.String relativeHelpTopic)
Loads a help topic given by a relative help topic name (i.e.protected void
loadTopic(java.lang.String content)
Load help topic.void
openHelpTopic(java.lang.String relativeHelpTopic)
Loads and displays the help information for a help topic given by a relative help topic name, i.e.void
openUrl(java.lang.String url)
Opens an URL and displays the content.void
setUrl(java.lang.String url)
Sets the current URL.static void
setUrlForHelpTopic(java.lang.String helpTopic)
Show the help page for help topichelpTopic
.void
setVisible(boolean visible)
-
Methods inherited from class javax.swing.JFrame
addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
-
Methods inherited from class java.awt.Frame
addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
-
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, show, toBack, toFront
-
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
-
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setMixingCutoutShape, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
-
-
-
Field Detail
-
USE_EXTERNAL_BROWSER
private static final BooleanProperty USE_EXTERNAL_BROWSER
-
instance
private static HelpBrowser instance
the unique instance
-
windowMenuItem
private javax.swing.JMenuItem windowMenuItem
the menu item in the windows menu. Required to properly hide on dialog close
-
help
private JosmEditorPane help
the help browser
-
history
private transient HelpBrowserHistory history
the help browser history
-
url
private java.lang.String url
the currently displayed URL
-
reader
private final transient HelpContentReader reader
-
FOCUS_ACTION
private static final JosmAction FOCUS_ACTION
-
-
Constructor Detail
-
HelpBrowser
public HelpBrowser()
Constructs a newHelpBrowser
.
-
-
Method Detail
-
getInstance
public static HelpBrowser getInstance()
Replies the unique instance of the help browser- Returns:
- the unique instance of the help browser
-
setUrlForHelpTopic
public static void setUrlForHelpTopic(java.lang.String helpTopic)
Show the help page for help topichelpTopic
.- Parameters:
helpTopic
- the help topic
-
buildStyleSheet
protected javax.swing.text.html.StyleSheet buildStyleSheet()
Builds the style sheet used in the internal help browser- Returns:
- the style sheet
-
buildToolBar
protected javax.swing.JToolBar buildToolBar()
Builds toolbar.- Returns:
- the toolbar
-
build
protected final void build()
Builds GUI.
-
setVisible
public void setVisible(boolean visible)
- Overrides:
setVisible
in classjava.awt.Window
-
loadTopic
protected void loadTopic(java.lang.String content)
Load help topic.- Parameters:
content
- topic contents
-
getUrl
public java.lang.String getUrl()
Description copied from interface:IHelpBrowser
Replies the current URL.- Specified by:
getUrl
in interfaceIHelpBrowser
- Returns:
- the current URL
-
setUrl
public void setUrl(java.lang.String url)
Description copied from interface:IHelpBrowser
Sets the current URL.- Specified by:
setUrl
in interfaceIHelpBrowser
- Parameters:
url
- the current URL
-
handleMissingHelpContent
protected void handleMissingHelpContent(java.lang.String relativeHelpTopic)
Displays a warning page when a help topic doesn't exist yet.- Parameters:
relativeHelpTopic
- the help topic
-
handleHelpContentReaderException
protected void handleHelpContentReaderException(java.lang.String relativeHelpTopic, HelpContentReaderException e)
Displays a error page if a help topic couldn't be loaded because of network or IO error.- Parameters:
relativeHelpTopic
- the help topice
- the exception
-
loadRelativeHelpTopic
protected void loadRelativeHelpTopic(java.lang.String relativeHelpTopic)
Loads a help topic given by a relative help topic name (i.e. "/Action/New") First tries to load the language specific help topic. If it is missing, tries to load the topic in English.- Parameters:
relativeHelpTopic
- the relative help topic
-
loadAbsoluteHelpTopic
protected void loadAbsoluteHelpTopic(java.lang.String absoluteHelpTopic)
Loads a help topic given by an absolute help topic name, i.e. "/De:Help/Action/New"- Parameters:
absoluteHelpTopic
- the absolute help topic name
-
openUrl
public void openUrl(java.lang.String url)
Description copied from interface:IHelpBrowser
Opens an URL and displays the content. If the URL is the locator of an absolute help topic, help content is loaded from the JOSM wiki. Otherwise, the help browser loads the page from the given URL.- Specified by:
openUrl
in interfaceIHelpBrowser
- Parameters:
url
- the url
-
openHelpTopic
public void openHelpTopic(java.lang.String relativeHelpTopic)
Description copied from interface:IHelpBrowser
Loads and displays the help information for a help topic given by a relative help topic name, i.e. "/Action/New".- Specified by:
openHelpTopic
in interfaceIHelpBrowser
- Parameters:
relativeHelpTopic
- the relative help topic
-
getHistory
public HelpBrowserHistory getHistory()
Description copied from interface:IHelpBrowser
Replies the browser history.- Specified by:
getHistory
in interfaceIHelpBrowser
- Returns:
- the browser history
-
-