public class JavaHelpFactory
extends java.lang.Object
// get the zip file as an URL URL url = ... try { // create the Help factory JavaHelpFactory factory = new JavaHelpFactory(url); factory.create(); ArticlesModel model = factory.getModel(); // create the viewer component SwingHelpContentViewer viewer = new SwingHelpContentViewer(); viewer.installModel(model); JComponent pane = viewer.getHelpComponent(); // do whatever you want with the component } catch (IOException | SAXException ex) { ex.printStackTrace(); }
merge(java.net.URL)
method. For example:
// get the zip file as an URL URL url = ... try { // create the Help factory JavaHelpFactory factory = new JavaHelpFactory(url); factory.create(); // get the zip file of the content ot merge as an URL URL mergedURL = ... // merge the content factory.merge(mergedURL); // create the viewer component SwingHelpContentViewer viewer = new SwingHelpContentViewer(); viewer.installModel(model); JComponent pane = viewer.getHelpComponent(); // do whatever you want with the component } catch (IOException | SAXException ex) { ex.printStackTrace(); }
Constructor and Description |
---|
JavaHelpFactory(java.net.URL url)
Constructor.
|
JavaHelpFactory(java.net.URL url,
java.lang.String dataBasePath)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
ArticlesModel |
create()
Creates the ArticlesModel.
|
java.util.Locale |
getLocale()
Return the Locale to use for the GUI. it will be the English Locale by default.
|
ArticlesModel |
getModel()
The articles model.
|
void |
install(HelpContentViewer<?,?> viewer)
Install the Help content in the HelpContentViewer.
|
boolean |
merge(java.net.URL url)
Parse a help URL and merge the result with the existing ArticlesModel.
|
boolean |
merge(java.net.URL url,
java.lang.String databasePath)
Parse a help URL and merge the result with the existing ArticlesModel.
|
void |
setIndexPath(java.lang.String path)
Set the path of the index article.
|
void |
setLocale(java.util.Locale locale)
Set the Locale to use for the GUI.
|
public JavaHelpFactory(java.net.URL url)
url
- the URL for the zip file containing the help content.public JavaHelpFactory(java.net.URL url, java.lang.String dataBasePath)
url
- the URL for the zip file containing the help content.dataBasePath
- the path for the XML database entrypublic ArticlesModel getModel()
public void setLocale(java.util.Locale locale)
locale
- the Localepublic java.util.Locale getLocale()
public void setIndexPath(java.lang.String path)
path
- the path of the index articlepublic ArticlesModel create() throws java.io.IOException, org.xml.sax.SAXException
java.io.IOException
org.xml.sax.SAXException
public boolean merge(java.net.URL url) throws java.io.IOException, org.xml.sax.SAXException
url
- the URL for the zip file containing the help content to mergejava.io.IOException
org.xml.sax.SAXException
public boolean merge(java.net.URL url, java.lang.String databasePath) throws java.io.IOException, org.xml.sax.SAXException
url
- the URL for the zip file containing the help content to mergedatabasePath
- the XML database pathjava.io.IOException
org.xml.sax.SAXException
public void install(HelpContentViewer<?,?> viewer) throws java.io.IOException
viewer
- the HelpContentViewerjava.io.IOException
Copyright © 2016-2024 Herve Girod. All Rights Reserved. Documentation and source under the BSD licence