gate.gui.docview
Class CorefEditor

java.lang.Object
  extended bygate.util.AbstractFeatureBearer
      extended bygate.creole.AbstractResource
          extended bygate.gui.docview.AbstractDocumentView
              extended bygate.gui.docview.CorefEditor
All Implemented Interfaces:
ActionListener, ActionsPublisher, AnnotationSetListener, DocumentListener, DocumentView, EventListener, FeatureBearer, FeatureMapListener, NameBearer, Resource, Serializable, VisualResource

public class CorefEditor
extends AbstractDocumentView
implements ActionListener, FeatureMapListener, DocumentListener, AnnotationSetListener

See Also:
Serialized Form

Nested Class Summary
protected  class CorefEditor.ChainToolTipAction
          When user hovers over the chainnodes
protected  class CorefEditor.CorefTreeCellRenderer
          Cell renderer to add the checkbox in the tree
protected  class CorefEditor.CorefTreeMouseListener
          Action for mouseClick on the Tree
protected  class CorefEditor.CorefTreeNode
           
protected  class CorefEditor.NewCorefAction
          When user hovers over the annotations which have been highlighted by show button
protected  class CorefEditor.TextPaneMouseListener
           
 
Field Summary
private  JComboBox annotSets
           
private  DefaultComboBoxModel annotSetsModel
           
private  Annotation annotToConsiderForChain
           
private  JComboBox annotTypes
           
private  DefaultComboBoxModel annotTypesModel
           
private  CorefEditor.ChainToolTipAction chainToolTipAction
           
private  Timer chainToolTipTimer
           
private  HashMap colorChainsMap
           
private  ColorGenerator colorGenerator
           
private  HashMap corefAnnotationSetNodesMap
           
private  HashMap corefChains
           
private  JTree corefTree
           
private  HashMap currentColors
           
private  HashMap currentSelections
           
private static String DEFAULT_ANNOTSET_NAME
           
private  boolean explicitCall
           
private  ArrayList highlightedChainAnnots
           
private  int[] highlightedChainAnnotsOffsets
           
private  HashMap highlightedTags
           
private  ArrayList highlightedTypeAnnots
           
private  int[] highlightedTypeAnnotsOffsets
           
private  Highlighter highlighter
           
private  JPanel mainPanel
           
private  CorefEditor.NewCorefAction newCorefAction
           
private  Timer newCorefActionTimer
           
private  JWindow popupWindow
           
private  CorefEditor.CorefTreeNode rootNode
           
private  HashMap selectionChainsMap
           
private  JToggleButton showAnnotations
           
private  JPanel subPanel
           
private  JEditorPane textPane
           
private  CorefEditor.TextPaneMouseListener textPaneMouseListener
           
private  TextualDocumentView textView
           
private  JPanel topPanel
           
private  ArrayList typeSpecificHighlightedTags
           
 
Fields inherited from class gate.gui.docview.AbstractDocumentView
active, document, guiInitialised, handle, owner
 
Fields inherited from class gate.creole.AbstractResource
name
 
Fields inherited from class gate.util.AbstractFeatureBearer
features
 
Fields inherited from interface gate.gui.docview.DocumentView
CENTRAL, HORIZONTAL, VERTICAL
 
Constructor Summary
CorefEditor()
           
 
Method Summary
 void actionPerformed(ActionEvent ae)
          ActionPerformed Activity
 void annotationAdded(AnnotationSetEvent ase)
          Called when a new Annotation has been added
 void annotationRemoved(AnnotationSetEvent ase)
          Called when an Annotation has been removed
 void annotationSetAdded(DocumentEvent de)
          This method is called when any new annotationSet is added
 void annotationSetRemoved(DocumentEvent de)
          This method is called when any annotationSet is removed outside the co-reference editor..
private  void annotSetSelectionChanged()
          When annotationSet selection changes
 void cleanup()
          This methods cleans up the memory by removing all listener registrations
 void contentEdited(DocumentEvent e)
          Called when the content of the document has changed through an edit operation.
private  CorefEditor.CorefTreeNode createChain(AnnotationSet set, boolean isDefaultSet)
          Creates the internal data structure
 void featureMapUpdated()
          Called when features are changed outside the co-refEditor
 CorefEditor.CorefTreeNode findOutChainNode(String chainNodeString)
           
private  CorefEditor.CorefTreeNode findOutTheChainHead(Annotation ann)
          Given an annotation, this will find out the chainHead
 Annotation findOutTheLongestAnnotation(ArrayList matches, AnnotationSet set)
          Given arrayList containing Ids of the annotations, and an annotationSet, this method returns the annotations that has longest string among the matches
private  AnnotationSet getAnnotationSet(String annotSet)
          Returns annotation Set
private  Color getColor(String annotationType)
          This method uses the java.util.prefs.Preferences and get the color for particular annotationType..
 Component getGUI()
          Returns the actual UI component this view represents.
 String getString(Annotation ann)
          Given an annotation, this method returns the string of that annotation
 int getType()
          Returns the type of this view.
 void highlightAnnotations()
          This methods highlights the annotations
private  void initData()
          This will initialise the data
protected  void initGUI()
          This method intiates the GUI for co-reference editor
 void mouseClicked(MouseEvent me)
           
protected  void registerHooks()
          This method will be called whenever the view becomes active.
 void reinitAllVariables()
           
 void removeChainReference(Annotation annot, CorefEditor.CorefTreeNode chainHead)
          This method removes the reference of this annotatation from the current chain
private  void showTypeWiseAnnotations()
          When user preses the show Toggle button, this will show up annotations of selected Type from selected AnnotationSet
protected  void unregisterHooks()
          This method will be called whenever this view becomes inactive.
 
Methods inherited from class gate.gui.docview.AbstractDocumentView
getActions, getDocument, isActive, setActive, setHandle, setOwner, setTarget
 
Methods inherited from class gate.creole.AbstractResource
checkParameterValues, getBeanInfo, getName, getParameterValue, getParameterValue, init, removeResourceListeners, setName, setParameterValue, setParameterValue, setParameterValues, setParameterValues, setResourceListeners
 
Methods inherited from class gate.util.AbstractFeatureBearer
getFeatures, setFeatures
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface gate.Resource
getParameterValue, init, setParameterValue, setParameterValues
 
Methods inherited from interface gate.util.FeatureBearer
getFeatures, setFeatures
 
Methods inherited from interface gate.util.NameBearer
getName, setName
 

Field Detail

DEFAULT_ANNOTSET_NAME

private static final String DEFAULT_ANNOTSET_NAME
See Also:
Constant Field Values

mainPanel

private JPanel mainPanel

topPanel

private JPanel topPanel

subPanel

private JPanel subPanel

showAnnotations

private JToggleButton showAnnotations

annotSets

private JComboBox annotSets

annotTypes

private JComboBox annotTypes

annotSetsModel

private DefaultComboBoxModel annotSetsModel

annotTypesModel

private DefaultComboBoxModel annotTypesModel

corefTree

private JTree corefTree

rootNode

private CorefEditor.CorefTreeNode rootNode

corefChains

private HashMap corefChains

corefAnnotationSetNodesMap

private HashMap corefAnnotationSetNodesMap

selectionChainsMap

private HashMap selectionChainsMap

currentSelections

private HashMap currentSelections

colorChainsMap

private HashMap colorChainsMap

currentColors

private HashMap currentColors

colorGenerator

private ColorGenerator colorGenerator

textView

private TextualDocumentView textView

textPane

private JEditorPane textPane

highlightedTags

private HashMap highlightedTags

typeSpecificHighlightedTags

private ArrayList typeSpecificHighlightedTags

textPaneMouseListener

private CorefEditor.TextPaneMouseListener textPaneMouseListener

highlightedChainAnnots

private ArrayList highlightedChainAnnots

highlightedChainAnnotsOffsets

private int[] highlightedChainAnnotsOffsets

highlightedTypeAnnots

private ArrayList highlightedTypeAnnots

highlightedTypeAnnotsOffsets

private int[] highlightedTypeAnnotsOffsets

chainToolTipAction

private CorefEditor.ChainToolTipAction chainToolTipAction

chainToolTipTimer

private Timer chainToolTipTimer

newCorefAction

private CorefEditor.NewCorefAction newCorefAction

newCorefActionTimer

private Timer newCorefActionTimer

annotToConsiderForChain

private Annotation annotToConsiderForChain

popupWindow

private JWindow popupWindow

explicitCall

private boolean explicitCall

highlighter

private Highlighter highlighter
Constructor Detail

CorefEditor

public CorefEditor()
Method Detail

initGUI

protected void initGUI()
This method intiates the GUI for co-reference editor

Specified by:
initGUI in class AbstractDocumentView

reinitAllVariables

public void reinitAllVariables()

cleanup

public void cleanup()
This methods cleans up the memory by removing all listener registrations

Specified by:
cleanup in interface Resource
Overrides:
cleanup in class AbstractResource

findOutTheLongestAnnotation

public Annotation findOutTheLongestAnnotation(ArrayList matches,
                                              AnnotationSet set)
Given arrayList containing Ids of the annotations, and an annotationSet, this method returns the annotations that has longest string among the matches


annotationSetRemoved

public void annotationSetRemoved(DocumentEvent de)
This method is called when any annotationSet is removed outside the co-reference editor..

Specified by:
annotationSetRemoved in interface DocumentListener
Parameters:
de -

annotationSetAdded

public void annotationSetAdded(DocumentEvent de)
This method is called when any new annotationSet is added

Specified by:
annotationSetAdded in interface DocumentListener
Parameters:
de -

contentEdited

public void contentEdited(DocumentEvent e)
Called when the content of the document has changed through an edit operation.

Specified by:
contentEdited in interface DocumentListener

annotationAdded

public void annotationAdded(AnnotationSetEvent ase)
Description copied from interface: AnnotationSetListener
Called when a new Annotation has been added

Specified by:
annotationAdded in interface AnnotationSetListener

annotationRemoved

public void annotationRemoved(AnnotationSetEvent ase)
Description copied from interface: AnnotationSetListener
Called when an Annotation has been removed

Specified by:
annotationRemoved in interface AnnotationSetListener

featureMapUpdated

public void featureMapUpdated()
Called when features are changed outside the co-refEditor

Specified by:
featureMapUpdated in interface FeatureMapListener

actionPerformed

public void actionPerformed(ActionEvent ae)
ActionPerformed Activity

Specified by:
actionPerformed in interface ActionListener
Parameters:
ae -

showTypeWiseAnnotations

private void showTypeWiseAnnotations()
When user preses the show Toggle button, this will show up annotations of selected Type from selected AnnotationSet


getAnnotationSet

private AnnotationSet getAnnotationSet(String annotSet)
Returns annotation Set

Parameters:
annotSet -
Returns:

annotSetSelectionChanged

private void annotSetSelectionChanged()
When annotationSet selection changes


initData

private void initData()
This will initialise the data


createChain

private CorefEditor.CorefTreeNode createChain(AnnotationSet set,
                                              boolean isDefaultSet)
Creates the internal data structure

Parameters:
set -

getString

public String getString(Annotation ann)
Given an annotation, this method returns the string of that annotation

Parameters:
ann -
Returns:

removeChainReference

public void removeChainReference(Annotation annot,
                                 CorefEditor.CorefTreeNode chainHead)
This method removes the reference of this annotatation from the current chain


findOutTheChainHead

private CorefEditor.CorefTreeNode findOutTheChainHead(Annotation ann)
Given an annotation, this will find out the chainHead

Parameters:
ann -
Returns:

highlightAnnotations

public void highlightAnnotations()
This methods highlights the annotations


registerHooks

protected void registerHooks()
Description copied from class: AbstractDocumentView
This method will be called whenever the view becomes active. Implementers should use this to add hooks (such as mouse listeners) to the other views as required by their functionality.

Specified by:
registerHooks in class AbstractDocumentView

unregisterHooks

protected void unregisterHooks()
Description copied from class: AbstractDocumentView
This method will be called whenever this view becomes inactive. Implementers should use it to unregister whatever hooks they registered in AbstractDocumentView.registerHooks().

Specified by:
unregisterHooks in class AbstractDocumentView

getGUI

public Component getGUI()
Description copied from interface: DocumentView
Returns the actual UI component this view represents.

Specified by:
getGUI in interface DocumentView
Returns:
a Component value.

getType

public int getType()
Description copied from interface: DocumentView
Returns the type of this view.

Specified by:
getType in interface DocumentView
Returns:
an int value
See Also:
DocumentView.CENTRAL, DocumentView.HORIZONTAL, DocumentView.VERTICAL

mouseClicked

public void mouseClicked(MouseEvent me)

findOutChainNode

public CorefEditor.CorefTreeNode findOutChainNode(String chainNodeString)

getColor

private Color getColor(String annotationType)
This method uses the java.util.prefs.Preferences and get the color for particular annotationType.. This color could have been saved by the AnnotationSetsView

Parameters:
annotationType -
Returns: