Class StyleMapEditor

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

public class StyleMapEditor extends JDialog implements ActionListener
A GUI for editing style maps for the annotation viewer.

A style map is an XML document that describes how each kind of output from a Text Analysis Engine is to be displayed in the annotation viewer. Each output type that the user wants to be displayed will have an entry in the style map. Each entry in the style map contains:

  • The CSS style used to display annotations of that type (for example "background:blue; color:white;" to display white text on a blue background.
  • A label used to identify the annotations in the annotation viewer

To invoke the editor, call the launchEditor(AnalysisEngineMetaData, String, CAS) method.

See Also:
  • Field Details

  • Constructor Details

    • StyleMapEditor

      public StyleMapEditor(JFrame aOwner, CAS cas)
      Creates a new `Editor.
  • Method Details

    • getPreferredSize

      public Dimension getPreferredSize()
      Overrides:
      getPreferredSize in class Container
    • setTextAnalysisEngine

      @Deprecated public void setTextAnalysisEngine(TaeDescription tae)
    • setAnalysisEngine

      public void setAnalysisEngine(AnalysisEngineDescription ae)
    • launchEditor

      public String launchEditor(AnalysisEngineMetaData aAnalysisEngineMetaData, String aStyleMapXml, CAS cas)
      Displays the StyleMapEditor GUI and allows the user to edit a style map. When the user has finished, the new style map is returned.
      Parameters:
      aAnalysisEngineMetaData - Metadata for the AnalysisEngine whose style map is to be edited. This contains the AE's capabilities and type system definition, which are needed by the editor.
      aStyleMapXml - An existing style map XML document that will be loaded into the editor. This is optional, if null is passed in, a default style map will be automatically generated from the AE metadata.
      Returns:
      a new style map XML document. If the user cancels, null is returned.
    • createStyleList

      public ArrayList createStyleList(AnalysisEngineMetaData aAnalysisEngineMetaData, String aStyleMapXml)
      Creates a List of StyleMapEntry objects from the given AnalysisEngineMetaData and style map XML.
      Parameters:
      aAnalysisEngineMetaData - Metadata for the AnalysisEngine whose style map is being edited.
      aStyleMapXml - An existing style map XML document. This is optional, if null is passed in, a default style map will be automatically generated.
      Returns:
      an ArrayList containing one StyleMapEntry object for each output type declared in aTaeMetaData.
    • parseStyleList

      public ArrayList parseStyleList(String aStyleMapXml)
    • actionPerformed

      public void actionPerformed(ActionEvent evt)
      Specified by:
      actionPerformed in interface ActionListener
    • getAnnotationsTable

      protected StyleMapTable getAnnotationsTable()
    • launchGUI

      private boolean launchGUI(ArrayList aStyleList, CAS cas)
      Displays the Style Map Editor GUI and allows the user to interact with it.
      Parameters:
      aStyleList - an ArrayList containing the style map entries to be edited. When the user modifies a setting in the GUI, the elements of this List will be updated.
      Returns:
      true if the user exits the dialog by clicking the OK button, false if the user has clicked the Cancel button.
    • setUpColorEditor

      private void setUpColorEditor(JTable table)
    • generateStyleMap

      private String generateStyleMap(ArrayList aStyleList)
      Generates a style map XML document from the style list.
      Parameters:
      aStyleList - An ArrayList containing the style map entries to be written to XML.
      Returns:
      A style map XML document representing the information in aStyleList.
    • addRow

      public void addRow(String typeName)