edu.uchsc.ccp.knowtator
Class Knowtator

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by edu.stanford.smi.protege.widget.AbstractWidget
                      extended by edu.stanford.smi.protege.widget.AbstractTabWidget
                          extended by edu.uchsc.ccp.knowtator.Knowtator
All Implemented Interfaces:
Plugin, Disposable, Selectable, TabWidget, Widget, FastAnnotateListener, FilterChangedListener, NotifyTextChangeListener, RefreshAnnotationsDisplayListener, SelectedAnnotationChangeListener, TextSourceChangeListener, ActionListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible

public class Knowtator
extends AbstractTabWidget
implements TextSourceChangeListener, ActionListener, SelectedAnnotationChangeListener, RefreshAnnotationsDisplayListener, FastAnnotateListener, FilterChangedListener, NotifyTextChangeListener

Authors: Philip V. Ogren Created: September 2004 Description: This class implements the AbstractTabWidget - the basic Protege plugin. This is the central class for the Annotator plugin. Todo: Changes: 8/11/2005 pvo renderer passed to KB.setClientInformation so that the ComplexSlotMentionValueWidget can use it. 8/15/2005 pvo added method nextFilterInstance for applying the "next" select annotation filter. This method should maybe be moved to ProjectSettings class.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
 
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 String CHANGE_SORT_METHOD
           
static String KNOWTATOR_MANAGER
          This string is used to give a hash key for the AnnotationUtil that will be passed to the knowledge base as client information that other objects can access.
static String SELECT_FILTER
           
static String SELECT_NEXT_ANNOTATION
           
static String SELECT_NEXT_ANNOTATION_FILTER
           
static String SELECT_PREVIOUS_ANNOTATION
           
static String SELECT_PREVIOUS_ANNOTATION_FILTER
           
 
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
Knowtator()
           
 
Method Summary
 void actionPerformed(ActionEvent actionEvent)
           
 void annotationSelectionChanged(SelectedAnnotationChangeEvent sace)
          To get the currently selected annotation at any time call KnowtatorManager.getSelectedAnnotation().
 void dispose()
          removing the instance from currentInstances was interferring with the code that changes the type of an instance.
 void fastAnnotateAddCls(Frame frame)
          Adds the given class to the fast annotate tool bar
 void fastAnnotateClsChange()
           
 void fastAnnotateQuit()
           
 void fastAnnotateRemoveCls(Frame frame)
          Removes the given class from the fast annotate tool bar
 void fastAnnotateStart()
           
 void filterChanged(FilterChangedEvent event)
           
 void initialize()
           
static boolean isSuitable(Project project, Collection errors)
           
static void main(String[] args)
          For testing/debuging purposes only.
 void notifyTextChanged(String notifyText)
           
 void refreshAnnotationsDisplay(boolean scrollToSelection)
           
static void resetProtegeTitle(Project project)
          This code was copied and modified from ProjectManager.updateUI()
 void selectFilterInstance()
           
 void textSourceChanged(TextSourceChangeEvent event)
           
 
Methods inherited from class edu.stanford.smi.protege.widget.AbstractTabWidget
addMainWindowToolBarButton, addUserToolBar, canClose, canSave, close, configure, createLeftRightSplitPane, createTopBottomSplitPane, getClsTree, getIcon, getLabel, getMainWindowMenuBar, getMainWindowToolBar, getSelectedInstances, getSelection, getShortDescription, getUserToolBar, removeMainWindowToolBarButton, removeUserToolBar, save, setClsTree, setIcon, setInstanceSelectable, setLabel, setShortDescription, setup, synchronizeClsTree, synchronizeToInstances
 
Methods inherited from class edu.stanford.smi.protege.widget.AbstractWidget
addSelectionListener, beginTransaction, beginTransaction, clearSelection, commitTransaction, endTransaction, equals, getDescriptor, getKnowledgeBase, getProject, getPropertyList, getStringProperty, isDesignTime, isRuntime, notifySelectionListeners, paint, removeSelectionListener, rollbackTransaction, setPropertyList, setup, show, showInstance
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
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, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, 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, addInputMethodListener, 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, getInputMethodRequests, 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, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, 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
 
Methods inherited from interface edu.stanford.smi.protege.widget.Widget
getDescriptor, getKnowledgeBase, getProject
 
Methods inherited from interface edu.stanford.smi.protege.util.Selectable
addSelectionListener, clearSelection, notifySelectionListeners, removeSelectionListener
 
Methods inherited from interface edu.stanford.smi.protege.plugin.Plugin
getName
 

Field Detail

KNOWTATOR_MANAGER

public static final String KNOWTATOR_MANAGER
This string is used to give a hash key for the AnnotationUtil that will be passed to the knowledge base as client information that other objects can access.

See Also:
Constant Field Values

CHANGE_SORT_METHOD

public static final String CHANGE_SORT_METHOD
See Also:
Constant Field Values

SELECT_FILTER

public static final String SELECT_FILTER
See Also:
Constant Field Values

SELECT_PREVIOUS_ANNOTATION_FILTER

public static final String SELECT_PREVIOUS_ANNOTATION_FILTER
See Also:
Constant Field Values

SELECT_NEXT_ANNOTATION_FILTER

public static final String SELECT_NEXT_ANNOTATION_FILTER
See Also:
Constant Field Values

SELECT_PREVIOUS_ANNOTATION

public static final String SELECT_PREVIOUS_ANNOTATION
See Also:
Constant Field Values

SELECT_NEXT_ANNOTATION

public static final String SELECT_NEXT_ANNOTATION
See Also:
Constant Field Values
Constructor Detail

Knowtator

public Knowtator()
Method Detail

filterChanged

public void filterChanged(FilterChangedEvent event)
Specified by:
filterChanged in interface FilterChangedListener

initialize

public void initialize()
Specified by:
initialize in interface Widget

notifyTextChanged

public void notifyTextChanged(String notifyText)
Specified by:
notifyTextChanged in interface NotifyTextChangeListener

fastAnnotateStart

public void fastAnnotateStart()
Specified by:
fastAnnotateStart in interface FastAnnotateListener

fastAnnotateQuit

public void fastAnnotateQuit()
Specified by:
fastAnnotateQuit in interface FastAnnotateListener

fastAnnotateClsChange

public void fastAnnotateClsChange()
Specified by:
fastAnnotateClsChange in interface FastAnnotateListener

fastAnnotateAddCls

public void fastAnnotateAddCls(Frame frame)
Description copied from interface: FastAnnotateListener
Adds the given class to the fast annotate tool bar

Specified by:
fastAnnotateAddCls in interface FastAnnotateListener
Parameters:
frame - The class to be added to the tool bar

fastAnnotateRemoveCls

public void fastAnnotateRemoveCls(Frame frame)
Description copied from interface: FastAnnotateListener
Removes the given class from the fast annotate tool bar

Specified by:
fastAnnotateRemoveCls in interface FastAnnotateListener
Parameters:
frame - The class to be removed

annotationSelectionChanged

public void annotationSelectionChanged(SelectedAnnotationChangeEvent sace)
Description copied from interface: SelectedAnnotationChangeListener
To get the currently selected annotation at any time call KnowtatorManager.getSelectedAnnotation().

Specified by:
annotationSelectionChanged in interface SelectedAnnotationChangeListener
See Also:
KnowtatorManager.getSelectedAnnotation()

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)

isSuitable

public static boolean isSuitable(Project project,
                                 Collection errors)

textSourceChanged

public void textSourceChanged(TextSourceChangeEvent event)
Specified by:
textSourceChanged in interface TextSourceChangeListener

selectFilterInstance

public void selectFilterInstance()

actionPerformed

public void actionPerformed(ActionEvent actionEvent)
Specified by:
actionPerformed in interface ActionListener

dispose

public void dispose()
removing the instance from currentInstances was interferring with the code that changes the type of an instance. The instances directType would be changed causing the clsListener to trigger directInstanceRemoved on the class that was the old directType of the instance. This would remove the instance from the currentInstances list. I tried to add it back in after the directType was changed but this behaved erratically. Use of currentInstances will have to be aware that the list may contain deleted instances. In HighlightSpans - I simply remove instances that cause a NullPointerException from currentInstances. I should probably have a InstanceListener instead.

Specified by:
dispose in interface Disposable
Overrides:
dispose in class AbstractWidget

resetProtegeTitle

public static void resetProtegeTitle(Project project)
This code was copied and modified from ProjectManager.updateUI()

Parameters:
project -

main

public static void main(String[] args)
For testing/debuging purposes only.

Parameters:
args -