Class JHSecondaryViewer

All Implemented Interfaces:
ViewAwareComponent, ActionListener, ImageObserver, ItemSelectable, MenuContainer, Serializable, EventListener, Accessible, SwingConstants

public class JHSecondaryViewer extends JButton implements ActionListener, ViewAwareComponent
This class is a secondary viewer to be included in HTML content within JHContentViewer. The ViewerType can either be a SecondaryWindow or a Popup. Activation is done be either a Button or a mouse enabled Label. Both Button and Label support Text, Icon, or Text and Icon.

To use this class within HTML content use the &ltobject&gt tag. Below is an example usage:

 &ltobject CLASSID="java:com.sun.java.help.impl.JHSecondaryViewer"&gt
 &ltparam name="content" value="secondary_contents.html"&gt
 &ltparam name="viewerActivator" value="javax.help.LinkLabel"&gt
 &ltparam name="viewerStyle" value="javax.help.Popup"&gt
 &ltparam name="viewerSize" value="300,400"&gt
 &ltparam name="text" value="Click here"&gt
 &ltparam name="textFontFamily" value="SansSerif"&gt
 &ltparam name="textFontSize" value="x-large"&gt
 &ltparam name="textFontWeight" value="plain"&gt
 &ltparam name="textFontStyle" value="italic"&gt
 &ltparam name="textColor" value="red"&gt
 &lt/object&gt
 

Valid parameters are:

  • content - a valid url, can be relative to the current viewer
See Also:
  • Field Details

    • SECONDARY_WINDOW

      public static String SECONDARY_WINDOW
  • Constructor Details

    • JHSecondaryViewer

      public JHSecondaryViewer()
      Create a secondaryviewer. By default the viewer creates a button with the text of ">"
  • Method Details

    • setViewData

      public void setViewData(View v)
      Sets data optained from the View
      Specified by:
      setViewData in interface ViewAwareComponent
    • setContent

      public void setContent(String content)
      Set the content for the secondary viewer
      Parameters:
      content - a valid URL
    • getContent

      public String getContent()
      Returns the content of the secondary viewer
    • setId

      public void setId(String id)
      Set the ID for content in the secondary viewer
      Parameters:
      content - a valid URL
    • getId

      public String getId()
      Returns the ID of the secondary viewer
    • setViewerName

      public void setViewerName(String name)
      Sets the viewer name to display the content in. Viewer is only valid for ViewerStyle "SecondaryWindow"
    • getViewerName

      public String getViewerName()
      Returns the viewer name
    • setViewerActivator

      public void setViewerActivator(String activator)
      Sets the viewer activator. Valid activators are
      • javax.help.LinkButton
      • javax.help.LinkLabel
      The new activatory type will be used the next time a view is displayed.
    • getViewerActivator

      public String getViewerActivator()
      Returns the viewer activator
    • setViewerStyle

      public void setViewerStyle(String style)
      Sets the viewer style. There are two valid viewer styles:
      • javax.help.SecondaryWindow
      • javax.help.Popup

          Viewer style is updated the next time the viewer is made visible

      Parameters:
      style - a valid ViewerStyle
    • getViewerStyle

      public String getViewerStyle()
      Returns the current ViewerStyle
    • setViewerLocation

      public void setViewerLocation(String location)
      Sets the viewer's location to display the content in. Location is relative to the screen or a modal dialog box The String must be in the form of "x,y". If no viewer location is established the default is 0,0 for secondary windows. Location is ignored for popups.
      See Also:
    • getViewerLocation

      public String getViewerLocation()
      Returns the viewer Location. Location is relative to the screen or a modal dialog box. The form of the location is "x,y". The default location is 0,0.
      See Also:
    • setViewerSize

      public void setViewerSize(String size)
      Sets the viewer's size to display the content in. The String must be in the form of "width,heigt". If no size is set the default is 200,200.
      See Also:
    • getViewerSize

      public String getViewerSize()
      Returns the viewer's Size. The form of the size is "width,height".
      See Also:
    • setIconByName

      public void setIconByName(String name)
      Sets the icon in the activator by url or id. The url is relative to the base address of the document.
      See Also:
    • setIconByID

      public void setIconByID(String name)
      Sets the icon in the activator by id.
      See Also:
    • setTextFontFamily

      public void setTextFontFamily(String family)
      Sets the text Font family for the activator text. For JDK 1.1 this must a family name of Dialog, DialogInput, Monospaced, Serif, SansSerif, or Symbol.
    • getTextFontFamily

      public String getTextFontFamily()
      Returns the text Font family name of the activator text
    • setTextFontSize

      public void setTextFontSize(String size)
      Sets the text size for the activator text. The String size is a valid Cascading Style Sheet value for text size. Acceptable values are as follows:
      • xx-small
      • x-small
      • small
      • medium
      • large
      • x-large
      • xx-large
      • bigger - increase the current base font size by 1
      • smaller - decrease the current base font size by 1
      • xxpt - set the font size to a specific pt value of "xx"
      • +x - increase the current base font size by a value of "x"
      • -x - decrease the current base font size by a value of "x"
      • x - set the font size to the point size associated with the index "x"
    • getTextFontSize

      public String getTextFontSize()
      Returns the text Font family name of the activator text
    • setTextFontWeight

      public void setTextFontWeight(String weight)
      Sets the text Font Weigth for the activator text. Valid weights are
      • plain
      • bold
    • getTextFontWeight

      public String getTextFontWeight()
      Returns the text Font weight of the activator text
    • setTextFontStyle

      public void setTextFontStyle(String style)
      Sets the text Font Style for the activator text. Valid font styles are
      • plain
      • italic
    • getTextFontStyle

      public String getTextFontStyle()
      Returns the text Font style of the activator text
    • setTextColor

      public void setTextColor(String name)
      Sets the text Color for the activator text. The following is a list of supported Color names
      • black
      • blue
      • cyan
      • darkGray
      • gray
      • green
      • lightGray
      • magenta
      • orange
      • pink
      • red
      • white
      • yellow
    • getTextColor

      public String getTextColor()
      Returns the text Color of the activator text
    • actionPerformed

      public void actionPerformed(ActionEvent e)
      Displays the viewer according to the viewerType
      Specified by:
      actionPerformed in interface ActionListener