Class AnnotationViewerDialog

All Implemented Interfaces:
ActionListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, RootPaneContainer, WindowConstants

public class AnnotationViewerDialog extends JDialog implements ActionListener
Dialog that loads analyzed documents stored in XMI or XCAS format and allows them to be viewed using the Java-based CAS viewer or a web browser, in either an HTML/Javascript format or in the inline XML format.
See Also:
  • Field Details

    • annotationViewGenerator

      protected AnnotationViewGenerator annotationViewGenerator
      The annotation view generator.
  • Constructor Details

    • AnnotationViewerDialog

      public AnnotationViewerDialog(JFrame aParentFrame, String aDialogTitle, PrefsMediator med, File aStyleMapFile, String aPerformanceStats, TypeSystem aTypeSystem, String[] aTypesToDisplay, String interactiveTempFN, boolean javaViewerRBisSelected, boolean javaViewerUCRBisSelected, boolean xmlRBisSelected, CAS cas)
      Create an AnnotationViewer Dialog.
      Parameters:
      aParentFrame - frame containing this panel
      aDialogTitle - title to display for the dialog
      med - the med
      aStyleMapFile - filename of style map to be used to view files in HTML
      aPerformanceStats - string representaiton of performance statistics, optional.
      aTypeSystem - the CAS Type System to which the XCAS files must conform.
      aTypesToDisplay - array of types that should be highlighted in the viewer. This can be set to the output types of the Analysis Engine. A value of null means to display all types.
      interactiveTempFN - the interactive temp FN
      javaViewerRBisSelected - the java viewer R bis selected
      javaViewerUCRBisSelected - the java viewer UCR bis selected
      xmlRBisSelected - the xml R bis selected
      cas - the cas
    • AnnotationViewerDialog

      public AnnotationViewerDialog(JFrame aParentFrame, String aDialogTitle, PrefsMediator med, File aStyleMapFile, String aPerformanceStats, TypeSystem aTypeSystem, String[] aTypesToDisplay, boolean generatedStyleMap, CAS cas)
      Instantiates a new annotation viewer dialog.
      Parameters:
      aParentFrame - the a parent frame
      aDialogTitle - the a dialog title
      med - the med
      aStyleMapFile - the a style map file
      aPerformanceStats - the a performance stats
      aTypeSystem - the a type system
      aTypesToDisplay - the a types to display
      generatedStyleMap - the generated style map
      cas - the cas
  • Method Details

    • actionPerformed

      public void actionPerformed(ActionEvent arg0)
      Specified by:
      actionPerformed in interface ActionListener
    • getDefaultCasViewName

      public String getDefaultCasViewName()
      Gets the name of the CAS View that will be displayed first in the annotation viewer.
      Returns:
      the default cas view name
    • setDefaultCasViewName

      public void setDefaultCasViewName(String defaultCasViewName)
      Sets the name of the CAS View that will be displayed first in the annotation viewer. It not set, defaults to CAS.NAME_DEFAULT_SOFA.
      Parameters:
      defaultCasViewName - the new default cas view name
    • launchThatViewer

      public void launchThatViewer(String inputDirPath, String fileName, TypeSystem typeSystem, String[] aTypesToDisplay, boolean javaViewerRBisSelected, boolean javaViewerUCRBisSelected, boolean xmlRBisSelected, File styleMapFile, File viewerDirectory)
      Launch that viewer.
      Parameters:
      inputDirPath - the input dir path
      fileName - the file name
      typeSystem - the type system
      aTypesToDisplay - the a types to display
      javaViewerRBisSelected - the java viewer R bis selected
      javaViewerUCRBisSelected - the java viewer UCR bis selected
      xmlRBisSelected - the xml R bis selected
      styleMapFile - the style map file
      viewerDirectory - the viewer directory
    • getTextValue

      public static String getTextValue(Node node)
      Assumes node has a text field and extracts its value. JMP
      Parameters:
      node - the node
      Returns:
      the text value
    • getFirstChildByName

      public static Node getFirstChildByName(Node node, String name)
      Gets the first child with a given name. JMP
      Parameters:
      node - the node
      name - the name
      Returns:
      the first child by name
    • getColorsForTypesFromFile

      public void getColorsForTypesFromFile(CasAnnotationViewer viewer, File aStyleMapFile)
      Reads in annotation-color associations from stylemap file. JMP Also reads checked value if present.
      Parameters:
      viewer - the viewer
      aStyleMapFile - the a style map file
    • displayError

      public void displayError(String aErrorString)
      Displays an error message to the user.
      Parameters:
      aErrorString - error message to display
    • displayError

      public void displayError(Throwable aThrowable)
      Displays an error message to the user.
      Parameters:
      aThrowable - Throwable whose message is to be displayed.
    • promptForAE

      If the current AE filename is not know ask for it. Then parse the selected file and return the AnalysisEngineDescription object.
      Returns:
      the selected AnalysisEngineDescription, null if the user cancelled
      Throws:
      IOException - Signals that an I/O exception has occurred.
      InvalidXMLException - the invalid XML exception
      ResourceInitializationException - the resource initialization exception