public class TextualDocumentView extends AbstractDocumentView
Modifier and Type | Class and Description |
---|---|
protected class |
TextualDocumentView.GateDocumentListener |
static class |
TextualDocumentView.HighlightData |
class |
TextualDocumentView.PermanentSelectionCaret |
protected class |
TextualDocumentView.SwingDocumentListener |
protected class |
TextualDocumentView.UpdateHighlightsAction
Blinks the blinking highlights if any.
|
Modifier and Type | Field and Description |
---|---|
protected static int |
BLINK_DELAY
The delay used by the blinker.
|
protected List<AnnotationData> |
blinkingHighlightsToAdd
Used internally to store the annotations for which blinking
highlights need to be added.
|
protected Set<AnnotationData> |
blinkingHighlightsToRemove
Used internally to store the annotations for which blinking
highlights need to be removed.
|
protected Map<AnnotationData,TextualDocumentView.HighlightData> |
blinkingTagsForAnnotations
The annotations used for blinking highlights and their tags.
|
protected TextualDocumentView.GateDocumentListener |
gateDocListener |
protected static int |
HIGHLIGHT_DELAY
The delay used by the highlights minder.
|
protected Timer |
highlightsMinder |
protected List<TextualDocumentView.HighlightData> |
highlightsToAdd
This list stores the
TextualDocumentView.HighlightData
values for annotations pending highlighting |
protected List<TextualDocumentView.HighlightData> |
highlightsToRemove
This list stores the
TextualDocumentView.HighlightData
values for highlights that need to be removed |
protected JScrollPane |
scroller
The scroll pane holding the text
|
protected TextualDocumentView.SwingDocumentListener |
swingDocListener |
protected JTextArea |
textView |
active, document, guiInitialised, handle, owner
name
features
CENTRAL, HORIZONTAL, VERTICAL
Constructor and Description |
---|
TextualDocumentView() |
Modifier and Type | Method and Description |
---|---|
TextualDocumentView.HighlightData |
addHighlight(AnnotationData aData,
Color colour) |
List<TextualDocumentView.HighlightData> |
addHighlights(Collection<AnnotationData> annotations,
Color colour)
Adds several highlights in one go.
|
void |
addHighlights(List<TextualDocumentView.HighlightData> list)
Same as
addHighlights(java.util.Collection, java.awt.Color) but
without the intermediate creation of HighlightData objects. |
void |
changeOrientation(ComponentOrientation orientation)
Set the text orientation in the document.
|
void |
cleanup()
releases the memory allocated to this resource
|
Component |
getGUI()
Returns the actual UI component this view represents.
|
JTextArea |
getTextView() |
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 |
removeHighlight(TextualDocumentView.HighlightData tag) |
void |
removeHighlights(Collection<TextualDocumentView.HighlightData> tags)
Removes several highlights in one go.
|
void |
scrollAnnotationToVisible(Annotation ann) |
void |
setEditable(boolean editable) |
void |
setSelectedAnnotations(List<AnnotationData> selectedAnnots)
Removes all blinking highlights and shows the new ones,
corresponding to the new set of selected annotations
|
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.
|
getActions, getDocument, getHandle, getOwner, isActive, setActive, setHandle, setOwner
checkParameterValues, flushBeanInfoCache, forgetBeanInfo, getBeanInfo, getInitParameterValues, getInitParameterValues, getName, getParameterValue, getParameterValue, getParameterValues, init, removeResourceListeners, setName, setParameterValue, setParameterValue, setParameterValues, setParameterValues, setResourceListeners, toString
getFeatures, setFeatures
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
targetReinitialised
getParameterValue, init, setParameterValue, setParameterValues
getFeatures, setFeatures
getName, setName
protected JScrollPane scroller
protected TextualDocumentView.GateDocumentListener gateDocListener
protected TextualDocumentView.SwingDocumentListener swingDocListener
protected Map<AnnotationData,TextualDocumentView.HighlightData> blinkingTagsForAnnotations
AnnotationData
to tag(i.e. Object
).protected List<TextualDocumentView.HighlightData> highlightsToAdd
TextualDocumentView.HighlightData
values for annotations pending highlightingprotected List<TextualDocumentView.HighlightData> highlightsToRemove
TextualDocumentView.HighlightData
values for highlights that need to be removedprotected Set<AnnotationData> blinkingHighlightsToRemove
protected List<AnnotationData> blinkingHighlightsToAdd
protected Timer highlightsMinder
protected JTextArea textView
protected static final int BLINK_DELAY
protected static final int HIGHLIGHT_DELAY
public void cleanup()
AbstractResource
cleanup
in interface Resource
cleanup
in class AbstractResource
public TextualDocumentView.HighlightData addHighlight(AnnotationData aData, Color colour)
public List<TextualDocumentView.HighlightData> addHighlights(Collection<AnnotationData> annotations, Color colour)
annotations
- the collection of annotations for which
highlights are to be added.colour
- the colour for the highlights.public void removeHighlight(TextualDocumentView.HighlightData tag)
public void addHighlights(List<TextualDocumentView.HighlightData> list)
addHighlights(java.util.Collection, java.awt.Color)
but
without the intermediate creation of HighlightData objects.list
- list of HighlightDatapublic void removeHighlights(Collection<TextualDocumentView.HighlightData> tags)
tags
- the tags for the highlights to be removedpublic void changeOrientation(ComponentOrientation orientation)
orientation
- either left to right or right to leftpublic void scrollAnnotationToVisible(Annotation ann)
public void moveHighlight(Object tag, int newStart, int newEnd) throws BadLocationException
tag
- the tag for the highlightnewStart
- new start offset.newEnd
- new end offset.BadLocationException
public void setSelectedAnnotations(List<AnnotationData> selectedAnnots)
setSelectedAnnotations
in interface DocumentView
setSelectedAnnotations
in class AbstractDocumentView
public int getType()
DocumentView
DocumentView.CENTRAL
,
DocumentView.HORIZONTAL
,
DocumentView.VERTICAL
public void setTarget(Object target)
Document
) into
the AbstractDocumentView.document
field.setTarget
in interface VisualResource
setTarget
in class AbstractDocumentView
target
- the object (be it a Resource
,
DataStore
or whatever) this viewer has to displaypublic void setEditable(boolean editable)
protected void initGUI()
AbstractDocumentView
initGUI
in class AbstractDocumentView
public Component getGUI()
DocumentView
Component
value.protected void initListeners()
protected void unregisterHooks()
AbstractDocumentView
AbstractDocumentView.registerHooks()
.unregisterHooks
in class AbstractDocumentView
protected void registerHooks()
AbstractDocumentView
registerHooks
in class AbstractDocumentView
public JTextArea getTextView()
Copyright © 2024 GATE. All rights reserved.