Class CasTreeViewer

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public class CasTreeViewer extends JPanel
A GUI that displays annotation results in a Swing tree viewer. This class extends JPanel and so can be reused within any Swing application.
See Also:
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      The Constant serialVersionUID.
      See Also:
    • splitPane

      private JSplitPane splitPane
      The split pane.
    • tree

      private JTree tree
      The tree.
    • rightPanel

      private JPanel rightPanel
      The right panel.
    • annotationTypeLabel

      private JLabel annotationTypeLabel
      The annotation type label.
    • annotationTextPane

      private JTextPane annotationTextPane
      The annotation text pane.
    • featureTable

      private JTable featureTable
      The feature table.
  • Constructor Details

    • CasTreeViewer

      public CasTreeViewer(CAS aCAS) throws CASException
      Creates a CAS Tree Viewer.
      Parameters:
      aCAS - the CAS containing the annotations to be displayed in the tree viewer GUI
      Throws:
      CASException - the CAS exception
  • Method Details

    • refreshAnnotationData

      private void refreshAnnotationData(AnnotationFS aAnnotation)
      Called when the user selects a new node in the JTree. Refreshes the right pane to display information about the selected annotation.
      Parameters:
      aAnnotation - the annotation that was selected in the JTree
    • buildTree

      private TreeNode buildTree(CAS aCAS) throws CASException
      Builds a tree from a CAS.
      Parameters:
      aCAS - CAS from which annotations will be extracted
      Returns:
      the tree node
      Throws:
      CASException - the CAS exception
    • _buildTree

      private void _buildTree(DefaultMutableTreeNode aParentNode, FSIterator aIterator, int aStartPos, int aEndPos)
      Recursive method called by
      invalid reference
      buildTree(DefaultMutableTreeNode,FSIterator)
      .
      Parameters:
      aParentNode - root node of tree to be built
      aIterator - iterator over all annotation in CAS
      aStartPos - text position at which to begin processing
      aEndPos - text position at which to end processing
    • main

      public static void main(String[] args)
      Main program. Runs a TAE and displays the resulting annotations in the tree viewer.
      Parameters:
      args - Command-line arguments - two are reguired: the path to the TAE descriptor and a file to be analyzed.
    • getText

      private static String getText(String text)
      Gets text to be processed by the TAE. If the document contains XML tags named TEXT like this: <TEXT%gt;Process this text.</TEXT%gt;, then only the text within those tags is returned. Otherwise the whole document is returned.
      Parameters:
      text - the text
      Returns:
      the text
    • printUsageMessage

      private static void printUsageMessage()
      Prints usage message.
    • setSize

      public void setSize(Dimension d)
      Sets the size.
      Overrides:
      setSize in class Component
      Parameters:
      d - the new size
      See Also: