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:
  • Constructor Details

    • StyleMapEditor

      public StyleMapEditor(JFrame aOwner, CAS cas)
      Creates a new `Editor.
      Parameters:
      aOwner - the a owner
      cas - the cas
  • Method Details

    • getPreferredSize

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

      @Deprecated public void setTextAnalysisEngine(TaeDescription tae)
      Sets the text analysis engine.
      Parameters:
      tae - the new text analysis engine
    • setAnalysisEngine

      public void setAnalysisEngine(AnalysisEngineDescription ae)
      Sets the analysis engine.
      Parameters:
      ae - the new analysis engine
    • 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.
      cas - the cas
      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)
      Parses the style list.
      Parameters:
      aStyleMapXml - the a style map xml
      Returns:
      the array list
    • actionPerformed

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

      protected StyleMapTable getAnnotationsTable()
      Gets the annotations table.
      Returns:
      the annotations table
    • addRow

      public void addRow(String typeName)
      Adds the row.
      Parameters:
      typeName - the type name