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
      See Also:
    • splitPane

      private JSplitPane splitPane
    • tree

      private JTree tree
    • rightPanel

      private JPanel rightPanel
    • annotationTypeLabel

      private JLabel annotationTypeLabel
    • annotationTextPane

      private JTextPane annotationTextPane
    • featureTable

      private JTable featureTable
  • 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
  • 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:
      aRootNode - an existing root node for the tree
      aCAS - CAS from which annotations will be extracted
      Throws:
      CASException
    • _buildTree

      private void _buildTree(DefaultMutableTreeNode aParentNode, FSIterator aIterator, int aStartPos, int aEndPos)
      Recursive method called by 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:
      aFile - file to process
      aTAE - Text Analysis Engine that will process the file
    • printUsageMessage

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

      public void setSize(Dimension d)
      Overrides:
      setSize in class Component
      See Also: