edu.uchsc.ccp.knowtator.ui
Class KnowtatorTextPane

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.text.JTextComponent
                  extended by javax.swing.JEditorPane
                      extended by javax.swing.JTextPane
                          extended by edu.uchsc.ccp.knowtator.ui.KnowtatorTextPane
All Implemented Interfaces:
AnnotationCreatedListener, RefreshAnnotationsDisplayListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, Scrollable

public class KnowtatorTextPane
extends JTextPane
implements RefreshAnnotationsDisplayListener, AnnotationCreatedListener

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JEditorPane
JEditorPane.AccessibleJEditorPane, JEditorPane.AccessibleJEditorPaneHTML, JEditorPane.JEditorPaneAccessibleHypertextSupport
 
Nested classes/interfaces inherited from class javax.swing.text.JTextComponent
JTextComponent.AccessibleJTextComponent, JTextComponent.KeyBinding
 
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
static int DASHED_LINES
           
static int NO_LINES
           
static int SOLID_LINES
           
static int VERTICAL_LINES
           
 
Fields inherited from class javax.swing.JEditorPane
HONOR_DISPLAY_PROPERTIES, W3C_LENGTH_UNITS
 
Fields inherited from class javax.swing.text.JTextComponent
DEFAULT_KEYMAP, FOCUS_ACCELERATOR_KEY
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
KnowtatorTextPane(KnowtatorManager manager)
           
 
Method Summary
 void addAnnotationHighlights(Collection<Span> spans, Color color, int lines)
           
 void annotationCreated(AnnotationCreatedEvent event)
           
 void clearAnnotationHighlights()
           
 void clearHighlights()
           
 void clearSelectionHighlights()
           
 void hideHighlights()
           
 void highlightAnnotationTemp(SimpleInstance annotation)
          written to provide a way for AnnotationPicker and AnnotationSchemaTree context menu to temporarily highlight an annotation.
 void highlightSelectedInstance(SimpleInstance selectedAnnotation, boolean scrollToSelection)
           
 void highlightSpans(boolean scrollToSelection)
           
 void highlightSpans(SimpleInstance selectedAnnotation, List<SimpleInstance> annotations, boolean scrollToSelection)
           
 void refreshAnnotationsDisplay(boolean scrollToSelection)
           
 void repaint()
           
 void select(Collection<Span> spans)
           
 void select(int start)
           
 void select(int start, int end)
           
 void select(Span span)
           
 boolean select(Span span, boolean isNew)
           
 void setAnnotationUtil(AnnotationUtil annotationUtil)
           
 void setDisplayColors(DisplayColors displayColors)
           
 void setScrollPane(JScrollPane scrollPane)
           
 void setText(String text)
           
 void showAllHighlights()
           
 void showAnnotationHighlights()
           
 void showSelectionHighlights()
           
 void updateTokenRegex()
           
 
Methods inherited from class javax.swing.JTextPane
addStyle, createDefaultEditorKit, getCharacterAttributes, getInputAttributes, getLogicalStyle, getParagraphAttributes, getStyle, getStyledDocument, getStyledEditorKit, getUIClassID, insertComponent, insertIcon, paramString, removeStyle, replaceSelection, setCharacterAttributes, setDocument, setEditorKit, setLogicalStyle, setParagraphAttributes, setStyledDocument
 
Methods inherited from class javax.swing.JEditorPane
addHyperlinkListener, createEditorKitForContentType, fireHyperlinkUpdate, getAccessibleContext, getContentType, getEditorKit, getEditorKitClassNameForContentType, getEditorKitForContentType, getHyperlinkListeners, getPage, getPreferredSize, getScrollableTracksViewportHeight, getScrollableTracksViewportWidth, getStream, getText, read, registerEditorKitForContentType, registerEditorKitForContentType, removeHyperlinkListener, scrollToReference, setContentType, setEditorKitForContentType, setPage, setPage
 
Methods inherited from class javax.swing.text.JTextComponent
addCaretListener, addInputMethodListener, addKeymap, copy, cut, fireCaretUpdate, getActions, getCaret, getCaretColor, getCaretListeners, getCaretPosition, getDisabledTextColor, getDocument, getDragEnabled, getFocusAccelerator, getHighlighter, getInputMethodRequests, getKeymap, getKeymap, getMargin, getNavigationFilter, getPreferredScrollableViewportSize, getScrollableBlockIncrement, getScrollableUnitIncrement, getSelectedText, getSelectedTextColor, getSelectionColor, getSelectionEnd, getSelectionStart, getText, getToolTipText, getUI, isEditable, loadKeymap, modelToView, moveCaretPosition, paste, processInputMethodEvent, read, removeCaretListener, removeKeymap, removeNotify, selectAll, setCaret, setCaretColor, setCaretPosition, setComponentOrientation, setDisabledTextColor, setDragEnabled, setEditable, setFocusAccelerator, setHighlighter, setKeymap, setMargin, setNavigationFilter, setSelectedTextColor, setSelectionColor, setSelectionEnd, setSelectionStart, setUI, updateUI, viewToModel, write
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, resize, resize, setBounds, setBounds, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NO_LINES

public static final int NO_LINES
See Also:
Constant Field Values

SOLID_LINES

public static final int SOLID_LINES
See Also:
Constant Field Values

DASHED_LINES

public static final int DASHED_LINES
See Also:
Constant Field Values

VERTICAL_LINES

public static final int VERTICAL_LINES
See Also:
Constant Field Values
Constructor Detail

KnowtatorTextPane

public KnowtatorTextPane(KnowtatorManager manager)
Method Detail

annotationCreated

public void annotationCreated(AnnotationCreatedEvent event)
Specified by:
annotationCreated in interface AnnotationCreatedListener

refreshAnnotationsDisplay

public void refreshAnnotationsDisplay(boolean scrollToSelection)
Specified by:
refreshAnnotationsDisplay in interface RefreshAnnotationsDisplayListener
Parameters:
scrollToSelection - this was added to the interface to solve a scrolling problem. Essentially, when you scroll using a scroll bar, you do not want to enforce that the selected annotation remain visible - otherwise refreshing the annotations will cause the scroll bar to go right back to the selected annotation immediately after it is scrolled out of view.
See Also:
TextViewer.initialize(), KnowtatorManager.refreshAnnotationsDisplay(boolean)

repaint

public void repaint()
Overrides:
repaint in class Component

highlightSpans

public void highlightSpans(boolean scrollToSelection)

setScrollPane

public void setScrollPane(JScrollPane scrollPane)

setAnnotationUtil

public void setAnnotationUtil(AnnotationUtil annotationUtil)

setDisplayColors

public void setDisplayColors(DisplayColors displayColors)

updateTokenRegex

public void updateTokenRegex()

select

public void select(int start)

select

public void select(int start,
                   int end)
Overrides:
select in class JTextComponent

select

public void select(Span span)

select

public boolean select(Span span,
                      boolean isNew)

select

public void select(Collection<Span> spans)

addAnnotationHighlights

public void addAnnotationHighlights(Collection<Span> spans,
                                    Color color,
                                    int lines)

clearHighlights

public void clearHighlights()

hideHighlights

public void hideHighlights()

clearAnnotationHighlights

public void clearAnnotationHighlights()

clearSelectionHighlights

public void clearSelectionHighlights()

showAllHighlights

public void showAllHighlights()

showSelectionHighlights

public void showSelectionHighlights()

showAnnotationHighlights

public void showAnnotationHighlights()

setText

public void setText(String text)
Overrides:
setText in class JEditorPane

highlightAnnotationTemp

public void highlightAnnotationTemp(SimpleInstance annotation)
written to provide a way for AnnotationPicker and AnnotationSchemaTree context menu to temporarily highlight an annotation.

Parameters:
annotation -
See Also:
AnnotationPicker.mouseMoved(MouseEvent)

highlightSelectedInstance

public void highlightSelectedInstance(SimpleInstance selectedAnnotation,
                                      boolean scrollToSelection)
                               throws InvalidSpanException
Throws:
InvalidSpanException

highlightSpans

public void highlightSpans(SimpleInstance selectedAnnotation,
                           List<SimpleInstance> annotations,
                           boolean scrollToSelection)
                    throws InvalidSpanException
Throws:
InvalidSpanException