GATE
Version 3.1-2270

gate.gui.docview
Class TextualDocumentView

java.lang.Object
  extended by gate.util.AbstractFeatureBearer
      extended by gate.creole.AbstractResource
          extended by gate.gui.docview.AbstractDocumentView
              extended by gate.gui.docview.TextualDocumentView
All Implemented Interfaces:
ActionsPublisher, DocumentView, Resource, FeatureBearer, NameBearer, VisualResource, Serializable

public class TextualDocumentView
extends AbstractDocumentView

This class provides a central view for a textual document.

See Also:
Serialized Form

Nested Class Summary
protected  class TextualDocumentView.BlinkAction
          Blinks the blinking highlights if any.
 
Field Summary
protected  AnnotationListView annotationListView
           
protected static int BLINK_DELAY
          The delay used by the blinker.
protected  Timer blinker
           
protected  Map blinkingTagsForAnnotations
          The annotations used for blinking highlights and their tags.
protected  gate.gui.docview.TextualDocumentView.GateDocumentListener gateDocListener
           
protected  JScrollPane scroller
           
protected  JEditorPane textView
           
 
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
TextualDocumentView()
           
 
Method Summary
 void addBlinkingHighlight(Annotation ann)
           
 Object addHighlight(Annotation ann, AnnotationSet set, Color colour)
           
 List addHighlights(Collection annotations, AnnotationSet set, Color colour)
          Ads several highlights in one go.
 Component getGUI()
          Returns the actual UI component this view represents.
 int getType()
          Returns the type of this view.
protected  void initGUI()
          Implementers should override this method and use it for populating the GUI.
protected  void initListeners()
           
 void moveHighlight(Object tag, int newStart, int newEnd)
          Gives access to the highliter's change highlight operation.
protected  void registerHooks()
          This method will be called whenever the view becomes active.
 void removeAllBlinkingHighlights()
           
 void removeBlinkingHighlight(Annotation ann)
           
 void removeHighlight(Object tag)
           
 void removeHighlights(Collection tags)
          Removes several highlights in one go.
 void scrollAnnotationToVisible(Annotation ann)
           
 void setTarget(Object target)
          Stores the target (which should always be a Document) into the AbstractDocumentView.document field.
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
 
Methods inherited from class gate.creole.AbstractResource
checkParameterValues, cleanup, 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
cleanup, getParameterValue, init, setParameterValue, setParameterValues
 
Methods inherited from interface gate.util.FeatureBearer
getFeatures, setFeatures
 
Methods inherited from interface gate.util.NameBearer
getName, setName
 

Field Detail

scroller

protected JScrollPane scroller

annotationListView

protected AnnotationListView annotationListView

gateDocListener

protected gate.gui.docview.TextualDocumentView.GateDocumentListener gateDocListener

blinkingTagsForAnnotations

protected Map blinkingTagsForAnnotations
The annotations used for blinking highlights and their tags. A map from Annotation ID to tag(i.e. Object).


blinker

protected Timer blinker

textView

protected JEditorPane textView

BLINK_DELAY

protected static final int BLINK_DELAY
The delay used by the blinker.

See Also:
Constant Field Values
Constructor Detail

TextualDocumentView

public TextualDocumentView()
Method Detail

addHighlight

public Object addHighlight(Annotation ann,
                           AnnotationSet set,
                           Color colour)

scrollAnnotationToVisible

public void scrollAnnotationToVisible(Annotation ann)

removeHighlight

public void removeHighlight(Object tag)

moveHighlight

public void moveHighlight(Object tag,
                          int newStart,
                          int newEnd)
                   throws BadLocationException
Gives access to the highliter's change highlight operation. Can be used to change the offset of an existing highlight.

Parameters:
tag - the tag for the highlight
newStart - new start offset.
newEnd - new end offset.
Throws:
BadLocationException

addHighlights

public List addHighlights(Collection annotations,
                          AnnotationSet set,
                          Color colour)
Ads several highlights in one go. This method should not be called from within the UI thread.

Parameters:
annotations - the collection of annotations for which highlights are to be added.
set - the annotation set all the annotations belong to.
colour - the colour for the highlights.
Returns:
the list of tags for the added highlights. The order of the elements corresponds to the order defined by the iterator of the collection of annotations provided.

removeHighlights

public void removeHighlights(Collection tags)
Removes several highlights in one go. This method should not be called from within the UI thread.

Parameters:
tags - the tags for the highlights to be removed

addBlinkingHighlight

public void addBlinkingHighlight(Annotation ann)

removeBlinkingHighlight

public void removeBlinkingHighlight(Annotation ann)

removeAllBlinkingHighlights

public void removeAllBlinkingHighlights()

getType

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

Returns:
an int value
See Also:
DocumentView.CENTRAL, DocumentView.HORIZONTAL, DocumentView.VERTICAL

setTarget

public void setTarget(Object target)
Stores the target (which should always be a Document) into the AbstractDocumentView.document field.

Specified by:
setTarget in interface VisualResource
Overrides:
setTarget in class AbstractDocumentView
Parameters:
target - the object (be it a Resource, DataStore or whatever) this viewer has to display

initGUI

protected void initGUI()
Description copied from class: AbstractDocumentView
Implementers should override this method and use it for populating the GUI.

Specified by:
initGUI in class AbstractDocumentView

getGUI

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

Returns:
a Component value.

initListeners

protected void initListeners()

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

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

GATE
Version 3.1-2270