TextHelpModel newModel = (TextHelpModel) event.getNewValue(); if (oldModel != null) { oldModel.removeHelpModelListener(this); oldModel.removeTextHelpModelListener(this); newModel.addHelpModelListener(this); newModel.addTextHelpModelListener(this);
/** * Hightlights a section of the current document from p0 to p1. * * @param p0 Starting position. * @param p1 Ending position. */ public void addHighlight(int p0, int p1) { model.addHighlight(p0,p1); }
/** * Determines which ID is displayed (if any). * @returns the current ID or null if there is none */ public ID getCurrentID() { debug("getCurrentID"); if (model != null) { return model.getCurrentID(); } return null; }
/** * Visits a given ID. Propagates down into the model. * * @param id The String to visit. Relative to the HS of the current model. * @exception BadIDException The ID is not valid for the HelpSet for the current model. */ public void setCurrentID(String id) throws BadIDException { try { model.setCurrentID(ID.create(id, getModel().getHelpSet())); } catch (InvalidHelpSetContextException ex) { // cannot happen } }
title = title + "-" + anchor; TextHelpModel model = theViewer.getModel(); model.setDocumentTitle(title); ID id = model.getHelpSet().getCombinedMap().getIDFromURL(url); if (id != null) { try { model.setCurrentID(id,title, (JHelpNavigator)null); } catch (InvalidHelpSetContextException ex) { model.setCurrentURL(url, title,(JHelpNavigator)null); model.setCurrentURL(url, title, (JHelpNavigator)null);
private void rebuild() { debug("rebuild"); TextHelpModel model = theViewer.getModel(); if (model == null) { debug("rebuild-end: model is null"); return; } /** * html future additions * if we were doing any highlighting the highlights would need * to be removed here */ HelpSet hs = model.getHelpSet(); // for glossary - not set homeID page - glossary is not synchronized if(theViewer.getSynch()){ try { Map.ID homeID = hs.getHomeID(); Locale locale = hs.getLocale(); String name = HelpUtilities.getString(locale, "history.homePage"); model.setCurrentID(homeID, name, (JHelpNavigator)null); html.setURL(model.getCurrentURL()); } catch (Exception e) { // ignore } } debug("rebuild-end"); }
if (model != null) { model.addHelpModelListener(this); model.addTextHelpModelListener(this); URL url = model.getCurrentURL(); if (url != null) { html.setURL(url);
/** * @return The URL to the HelpSet. */ public URL getHelpSetURL() { HelpSet hs = contentViewer.getModel().getHelpSet(); if (hs == null) { return null; } return hs.getHelpSetURL(); }
public void uninstallUI(JComponent c) { debug("uninstallUI"); JHelpContentViewer viewer = (JHelpContentViewer) c; viewer.removePropertyChangeListener(this); /** * html future additions * remove all html listeners here - if we add any */ TextHelpModel model = viewer.getModel(); if (model != null) { model.removeHelpModelListener(this); model.removeTextHelpModelListener(this); } viewer.setLayout(null); viewer.removeAll(); }
/** * @return The URL currently being presented in the viewer. */ public URL getCurrentURL() { return model.getCurrentURL(); }
/** * @return The document title. */ public String getDocumentTitle() { return model.getDocumentTitle(); }
/** * Removes any Highlights. */ public void removeAllHighlights() { model.removeAllHighlights(); }
/** * Adds a listener for the HelpModelEvent posted after the model has * changed. * * @param l - The listener to add. * @see javax.help.HelpModel#removeHelpModelListener */ public void addHelpModelListener(HelpModelListener l) { getModel().addHelpModelListener(l); }
/** * Adds a listener for the TExtHelpModelEvent posted after the model has * changed. * * @param l - The listener to add. * @see javax.help.TextHelpModel#removeHelpModelListener */ public void addTextHelpModelListener(TextHelpModelListener l) { getModel().addTextHelpModelListener(l); }
/** * Removes a listener previously added with <tt>addHelpModelListener</tt> * * @param l - The listener to remove. * @see javax.help.HelpModel#addHelpModelListener */ public void removeHelpModelListener(HelpModelListener l) { getModel().removeHelpModelListener(l); }
TextHelpModel.Highlight highlights[] = m.getHighlights();
private void rebuild() { debug("rebuild"); TextHelpModel model = theViewer.getModel(); if (model == null) { debug("rebuild-end: model is null"); return; } // The model has changed. I'll need to clear the HTML viewer and // put in the home page Highlighter h = html.getHighlighter(); debug("removeAllHighlights"); h.removeAllHighlights(); HelpSet hs = model.getHelpSet(); // for glossary - not set homeID page - glossary is not synchronized if(theViewer.getSynch()){ try { Map.ID homeID = hs.getHomeID(); Locale locale = hs.getLocale(); String name = HelpUtilities.getString(locale, "history.homePage"); model.setCurrentID(homeID, name, (JHelpNavigator)null); html.setPage(model.getCurrentURL()); } catch (Exception e) { // ignore } } debug("rebuild-end"); }
if (model != null) { model.addHelpModelListener(this); model.addTextHelpModelListener(this); URL url = model.getCurrentURL(); if (url != null) { try {
Locale locale = ((JHelp)getControl()).getModel().getHelpSet().getLocale(); Enumeration items = historyModel.getBackwardHistory().elements(); JMenuItem mi = null;
public void uninstallUI(JComponent c) { debug("uninstallUI"); JHelpContentViewer viewer = (JHelpContentViewer) c; viewer.removePropertyChangeListener(this); html.removePropertyChangeListener(this); TextHelpModel model = viewer.getModel(); if (model != null) { model.removeHelpModelListener(this); model.removeTextHelpModelListener(this); } viewer.setLayout(null); viewer.removeAll(); }