Class CgviewHTMLDocument

java.lang.Object
ca.ualberta.stothard.cgview.CgviewHTMLDocument
All Implemented Interfaces:
CgviewConstants

public class CgviewHTMLDocument extends Object implements CgviewConstants
This class contains methods for constructing HTML pages that contain Cgview maps. Tags are added to the document in the order that the various tag adding methods are called. The methods in this class escape all supplied text to make it suitable for inclusion in an HTML document.
Author:
Paul Stothard
  • Constructor Details

    • CgviewHTMLDocument

      public CgviewHTMLDocument()
      Constructs a new CgviewHTMLDocument object.
  • Method Details

    • addHeader

      public void addHeader(String title, String zoom, String zoomCenter, String imageFormat, Boolean useOverlib, Boolean useExternalStyleSheet)
      Adds header information to this CgviewHTMLDocument, including an html opening tag. This method should be the first method called after a CgviewHTMLDocument is created.
      Parameters:
      title - the title in the header.
      zoom - the value to appear in the 'zoom' meta tag.
      zoomCenter - the value to appear in the 'zoomCenter' meta tag.
      imageFormat - the format of the image to which this CgviewHTMLDocument refers.
      useOverlib - whether or not to use the overlib.js JavaScript library for PNG and JPG image maps.
      useExternalStyleSheet - whether or not to use an external stylesheet.
    • addTableStart

      public void addTableStart(int width)
      Adds table and tbody opening tags to this CgviewHTMLDocument.
      Parameters:
      width - the width of the table in pixels.
    • addTableStart

      public void addTableStart(int width, int border)
      Adds table and tbody opening tags to this CgviewHTMLDocument.
      Parameters:
      width - the width of the table in pixels.
      border - the width of the border in pixels.
    • addTableEnd

      public void addTableEnd()
      Adds table and tbody closing tags to this CgviewHTMLDocument.
    • addTableRowStart

      public void addTableRowStart()
      Adds tr opening tag to this CgviewHTMLDocument.
    • addTableRowEnd

      public void addTableRowEnd()
      Adds tr closing tag to this CgviewHTMLDocument.
    • addTableColumnStart

      public void addTableColumnStart()
      Adds td opening tag to this CgviewHTMLDocument.
    • addTableColumnCenterStart

      public void addTableColumnCenterStart()
      Adds td opening tag with center alignment to this CgviewHTMLDocument.
    • addTableColumnLeftStart

      public void addTableColumnLeftStart()
      Adds td opening tag with left alignment to this CgviewHTMLDocument.
    • addTableColumnRightStart

      public void addTableColumnRightStart()
      Adds td opening tag with right alignment to this CgviewHTMLDocument.
    • addTableColumnEnd

      public void addTableColumnEnd()
      Adds td closing tag to this CgviewHTMLDocument.
    • addValidationInfo

      public void addValidationInfo()
      Adds text to this CgviewHTMLDocument stating that the document is valid XHTML 1.0 and valid CSS.
    • addFooter

      public void addFooter()
      Adds body and html closing tags to this CgviewHTMLDocument. This method should be the last method called before the contents of this document are retrieved using getContents().
    • addSpanNoteStart

      public void addSpanNoteStart()
      Adds a span opening tag with the 'note' style to this CgviewHTMLDocument.
    • addSpanFileSizeStart

      public void addSpanFileSizeStart()
      Adds a span opening tag with the 'fileSize' style to this CgviewHTMLDocument.
    • addSpanValidStart

      public void addSpanValidStart()
      Adds a span opening tag with the 'validInfo' style to this CgviewHTMLDocument.
    • addSpanWarningStart

      public void addSpanWarningStart()
      Adds a span opening tag with the 'warning' style to this CgviewHTMLDocument.
    • addSpanEnd

      public void addSpanEnd()
      Adds a span closing tag to this CgviewHTMLDocument.
    • addImageMap

      public void addImageMap(String imageFile, int width, int height, ArrayList labelBounds, Boolean useOverlib)
      Adds an image with an image map to this CgviewHTMLDocument, to implement mouseovers and hyperlinks associated with Cgview Feature objects and FeatureRange objects. Image maps are used for PNG and JPG maps. SVG maps contain the mouseover and hyperlink information internally.
      Parameters:
      imageFile - the image URL that the image map refers to.
      width - the width of the image.
      height - the height of the image.
      labelBounds - an ArrayList of LabelBounds objects, obtained from a previously drawn Cgview object using the Cgview.getLabelBounds() method.
      useOverlib - whether or not to use the overlib.js JavaScript library for PNG and JPG image maps.
    • addImage

      public void addImage(String imageFile, int width, int height)
      Adds an image to this CgviewHTMLDocument. Use this method for adding a JPG or PNG image to a CgviewHTMLDocument. To add an SVG image use addSVG(java.lang.String, int, int).
      Parameters:
      imageFile - the image URL.
      width - the width of the image.
      height - the height of the image.
    • addImage

      public void addImage(String imageFile, int width, int height, String alt)
      Adds an image to this CgviewHTMLDocument. Use this method for adding a JPG or PNG image to a CgviewHTMLDocument. To add an SVG image use addSVG(java.lang.String, int, int).
      Parameters:
      imageFile - the image URL.
      width - the width of the image.
      height - the height of the image.
      alt - alternate text for the image
    • addButton

      public void addButton(String imageFile, String linkFile, String altText)
      Adds an image of a button to this CgviewHTMLDocument and links the button to another file.
      Parameters:
      imageFile - the button image URL.
      linkFile - the URL to be linked to the button.
      altText - a short description of the image.
    • addButtonNoLink

      public void addButtonNoLink(String imageFile, String altText)
      Adds an image of a button to this CgviewHTMLDocument.
      Parameters:
      imageFile - the button image URL.
      altText - a short description of the image.
    • addSVG

      public void addSVG(String imageFile, int width, int height)
      Adds an SVG image to this CgviewHTMLDocument.
      Parameters:
      imageFile - the SVG image URL.
      width - the width of the SVG image.
      height - the height of the SVG image.
    • addBreak

      public void addBreak()
      Adds a br tag to this CgviewHTMLDocument.
    • addSpace

      public void addSpace()
      Adds a non-breaking space to this CgviewHTMLDocument.
    • addLink

      public void addLink(String name, String link)
      Adds a hyperlink to this CgviewHTMLDocument.
      Parameters:
      name - the text to appear in the link.
      link - the link URL.
    • addText

      public void addText(String text)
      Adds text to this CgviewHTMLDocument.
      Parameters:
      text -
    • getContents

      public ArrayList getContents()
      Returns the contents of this CgviewHTMLDocument.
      Returns:
      an ArrayList of the entries in this CgviewHTMLDocument.