javax.help.ServletHelpBroker Maven / Gradle / Ivy
/*
* @(#) ServletHelpBroker.java 1.2 - last change made 10/06/04
*
* Copyright (c) 1997 Sun Microsystems, Inc. All Rights Reserved.
*
* This software is the confidential and proprietary information of Sun
* Microsystems, Inc. ("Confidential Information"). You shall not
* disclose such Confidential Information and shall use it only in
* accordance with the terms of the license agreement you entered into
* with Sun.
*
* SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE
* SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
* IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
* PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR ANY DAMAGES
* SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING
* THIS SOFTWARE OR ITS DERIVATIVES.
*/
package javax.help;
import java.util.Enumeration;
import java.util.Hashtable;
import java.net.URL;
import java.net.MalformedURLException;
import java.awt.*;
import java.awt.event.*;
import javax.help.Map.ID;
import java.util.Locale;
import java.awt.Font;
import java.awt.Dimension;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.jsp.JspWriter;
import javax.swing.tree.DefaultMutableTreeNode;
import java.io.IOException;
/**
* An implmentation of the HelpBroker interface for Servlets
*
* @author Roger Brinkley
* @version 1.2 10/06/04
*/
public class ServletHelpBroker implements HelpBroker {
protected HelpSet helpset = null;
protected DefaultHelpModel model = null;
protected NavigatorView curNav = null;
protected boolean viewDisplayed = true;
protected Locale locale=null;
protected Font font;
/**
* Zero-argument constructor.
* It should be followed by a setHelpSet() invocation.
*/
public ServletHelpBroker() {
}
/**
* Returns the default HelpSet
*/
public HelpSet getHelpSet() {
return helpset;
}
/**
* Changes the HelpSet for this broker.
* @param hs The HelpSet to set for this broker.
* A null hs is valid parameter.
*/
public void setHelpSet(HelpSet hs) {
if (hs != null && helpset != hs) {
model = new DefaultHelpModel(hs);
helpset = hs;
}
}
/**
* Gets the locale of this component.
* @return This component's locale. If this component does not
* have a locale, the defaultLocale is returned.
* @see #setLocale
*/
public Locale getLocale() {
if (locale == null) {
return Locale.getDefault();
}
return locale;
}
/**
* Sets the locale of this HelpBroker. The locale is propagated to
* the presentation.
* @param l The locale to become this component's locale. A null locale
* is the same as the defaultLocale.
* @see #getLocale
*/
public void setLocale(Locale l) {
locale = l;
}
/**
* Gets the font for this HelpBroker.
*/
public Font getFont () {
return font;
}
/**
* Sets the font for this this HelpBroker.
* @param f The font.
*/
public void setFont (Font f) {
font = f;
}
/**
* Set the currentView to the navigator with the same
* name as the name parameter.
*
* @param name The name of the navigator to set as the
* current view. If nav is null or not a valid Navigator
* in this HelpBroker then an
* IllegalArgumentException is thrown.
* @throws IllegalArgumentException if nav is null or not a valid Navigator.
*/
public void setCurrentView(String name) {
NavigatorView views[] = helpset.getNavigatorViews();
for (int i=0; i