org.annotation.wordfreak
Class WordFreakKeyboardFocusManager

java.lang.Object
  extended byjava.awt.KeyboardFocusManager
      extended byjava.awt.DefaultKeyboardFocusManager
          extended byorg.annotation.wordfreak.WordFreakKeyboardFocusManager
All Implemented Interfaces:
AnnotationSchemeListener, javax.swing.event.ChangeListener, java.util.EventListener, java.awt.KeyEventDispatcher, java.awt.KeyEventPostProcessor

public class WordFreakKeyboardFocusManager
extends java.awt.DefaultKeyboardFocusManager
implements AnnotationSchemeListener, javax.swing.event.ChangeListener


Nested Class Summary
static interface WordFreakKeyboardFocusManager.HotKeyListener
          Interface by which listener components are notified of hot key presses.
static interface WordFreakKeyboardFocusManager.KeyBufferListener
          Interface by which listener components are notified of the status of the key buffer.
 
Field Summary
 
Fields inherited from class java.awt.KeyboardFocusManager
BACKWARD_TRAVERSAL_KEYS, DOWN_CYCLE_TRAVERSAL_KEYS, FORWARD_TRAVERSAL_KEYS, UP_CYCLE_TRAVERSAL_KEYS
 
Method Summary
 void addAnnotation(Annotation a)
          Designates that the specified annotation has been added
 void addAnnotation(Annotation a, Annotation p)
           
 void addKeyBufferListener(WordFreakKeyboardFocusManager.KeyBufferListener kl)
           
 void addListener(ViewerListener vl)
           
 void addProperty(DynamicFeature f)
           
 void addProperty(DynamicFeature f, java.lang.String s)
           
 void addProperty(DynamicFeature f, java.lang.String l, java.lang.String s)
           
 void addProperty(java.lang.String f)
           
 void addProperty(java.lang.String f, java.lang.String s)
           
 void addStyle(java.lang.String name, javax.swing.text.AttributeSet as)
          This allows an AnnotationScheme to change the background color for a particular annotation
 void annotation(Annotation a)
          Notifies the listener to focus display the specified annotation.
 void clearAnnotationHighlights()
           
 void clearHotKeys(WordFreakKeyboardFocusManager.HotKeyListener hkl)
           
 boolean dispatchKeyEvent(java.awt.event.KeyEvent e)
           
 void file(AnnotationFile af)
          Notifies the listener that the specified annotation file should be presented to the user.
static WordFreakKeyboardFocusManager getInstance()
           
 void highlightAnnotation(Annotation a, java.awt.Color c)
           
 boolean keyPressed(java.awt.event.KeyEvent e)
           
 boolean keyReleased(java.awt.event.KeyEvent e)
           
 boolean keyTyped(java.awt.event.KeyEvent e)
           
 void makeVisible(Annotation a)
          Notifies the listener to make sure the annotation is visible
 void markOutcomes(Annotation[] codes, java.awt.Color c)
           
 void markOutcomes(java.lang.String[] codes, java.awt.Color c)
          Specifies a set of outcomes for this annotation and designates the color that should be used to disply them.
 void moveAnnotation(Annotation a)
          Designates that the specified annotation is about to be moved.
 void outcomes(java.lang.String[] names)
          This allows an AnnotationScheme to change the outcomes presented to the user.
 void outcomes(java.lang.String[] names, java.lang.String[] codes)
          This allows an AnnotationScheme to change the outcomes presented to the user.
 void outcomes(java.lang.String[] names, java.lang.String[] codes, java.util.Map groups)
          This allows an AnnotationScheme to change the outcomes presented to the user.
 boolean postProcessKeyEvent(java.awt.event.KeyEvent e)
           
 void progress(double p)
           
 void progress(int x, int n)
           
 void refresh()
          Notifies the listener that annotated files have been filtered in the scheme and may need to be redisplayed
 void refresh(Annotation a)
          Notifies the listen that the specified annotation needs to be redrawn.
 void registerHotKey(java.lang.String name, int keyCode, int mods, WordFreakKeyboardFocusManager.HotKeyListener hkl)
           
 void registerMnemonic(char m, java.lang.String c)
           
 void registerMnemonic(char m, java.lang.String c, java.lang.String f)
           
 void reloadedFiles()
          Notifies the listener that annotated files have been reloaded in the scheme and may have been changed in arbitrary ways.
 void removeAnnotatedFile(AnnotationFile af)
           
 void removeAnnotation(Annotation a)
          Designates that the specified annotation has been removed.
 void removeContextualMenuItems(javax.swing.JMenuItem[] menus)
           
 void removeKeyBufferListener(WordFreakKeyboardFocusManager.KeyBufferListener kl)
           
 void removeListener(ViewerListener vl)
           
 void select(Annotation a)
          Notifies the listner that the specified annotation should be displayed as selected.
 void select(AnnotationSelection annotations)
          Notifies the listener that the specified selection should be displayed as selected.
 void select(Span s)
          Notifies the listner that the specified selection span should be displayed as selected.
 void setAnnotationStyle(Annotation a, java.lang.String name)
           
 void setAnnotationView(AnnotationView view)
          Indicates that annotations from the specified view should be processed.
 void setBackgroundColor(Annotation a, java.awt.Color c)
           
 void setColorScheme(java.util.Map cs)
          Provides a mapping between outcomes and colors for display purposes.
 void setContextualMenuItems(javax.swing.JMenuItem[] menus)
           
 void setContextualMenuItems(javax.swing.JMenuItem[] menus, java.lang.String[] alt_names, int[] mods)
           
 void setFocus(java.awt.Component c)
           
 void setIcons(javax.swing.Icon[] icons)
           
 void setProperty(DynamicFeature f)
           
 void setProperty(DynamicFeature f, java.lang.String s)
           
 void setProperty(DynamicFeature f, java.lang.String l, java.lang.String s)
           
 void setProperty(java.lang.String f)
          Designates that the specified property should be used for displaying label information about annotations handled by the caller.
 void setProperty(java.lang.String f, java.lang.String s)
           
 void setSortCriteria(SortCriteria s)
          Indicates that the annotations will be sorted based on the specified sort criteria.
 void showRelations(boolean b)
          Specifies whether the scheme wants relations to be displayed based on the specified parameter.
 void stateChanged(javax.swing.event.ChangeEvent e)
           
 void updateAnnotation(Annotation a)
          Designates that the specified annotation has been changed.
 
Methods inherited from class java.awt.DefaultKeyboardFocusManager
dequeueKeyEvents, discardKeyEvents, dispatchEvent, downFocusCycle, enqueueKeyEvents, focusNextComponent, focusPreviousComponent, processKeyEvent, upFocusCycle
 
Methods inherited from class java.awt.KeyboardFocusManager
addKeyEventDispatcher, addKeyEventPostProcessor, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, addVetoableChangeListener, clearGlobalFocusOwner, downFocusCycle, firePropertyChange, fireVetoableChange, focusNextComponent, focusPreviousComponent, getActiveWindow, getCurrentFocusCycleRoot, getCurrentKeyboardFocusManager, getDefaultFocusTraversalKeys, getDefaultFocusTraversalPolicy, getFocusedWindow, getFocusOwner, getGlobalActiveWindow, getGlobalCurrentFocusCycleRoot, getGlobalFocusedWindow, getGlobalFocusOwner, getGlobalPermanentFocusOwner, getKeyEventDispatchers, getKeyEventPostProcessors, getPermanentFocusOwner, getPropertyChangeListeners, getPropertyChangeListeners, getVetoableChangeListeners, getVetoableChangeListeners, redispatchEvent, removeKeyEventDispatcher, removeKeyEventPostProcessor, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, removeVetoableChangeListener, setCurrentKeyboardFocusManager, setDefaultFocusTraversalKeys, setDefaultFocusTraversalPolicy, setGlobalActiveWindow, setGlobalCurrentFocusCycleRoot, setGlobalFocusedWindow, setGlobalFocusOwner, setGlobalPermanentFocusOwner, upFocusCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static WordFreakKeyboardFocusManager getInstance()

addKeyBufferListener

public void addKeyBufferListener(WordFreakKeyboardFocusManager.KeyBufferListener kl)

removeKeyBufferListener

public void removeKeyBufferListener(WordFreakKeyboardFocusManager.KeyBufferListener kl)

registerMnemonic

public void registerMnemonic(char m,
                             java.lang.String c)

registerMnemonic

public void registerMnemonic(char m,
                             java.lang.String c,
                             java.lang.String f)

registerHotKey

public void registerHotKey(java.lang.String name,
                           int keyCode,
                           int mods,
                           WordFreakKeyboardFocusManager.HotKeyListener hkl)

clearHotKeys

public void clearHotKeys(WordFreakKeyboardFocusManager.HotKeyListener hkl)

addListener

public void addListener(ViewerListener vl)

removeListener

public void removeListener(ViewerListener vl)

dispatchKeyEvent

public boolean dispatchKeyEvent(java.awt.event.KeyEvent e)
Specified by:
dispatchKeyEvent in interface java.awt.KeyEventDispatcher

postProcessKeyEvent

public boolean postProcessKeyEvent(java.awt.event.KeyEvent e)
Specified by:
postProcessKeyEvent in interface java.awt.KeyEventPostProcessor

keyReleased

public boolean keyReleased(java.awt.event.KeyEvent e)

keyPressed

public boolean keyPressed(java.awt.event.KeyEvent e)

keyTyped

public boolean keyTyped(java.awt.event.KeyEvent e)

stateChanged

public void stateChanged(javax.swing.event.ChangeEvent e)
Specified by:
stateChanged in interface javax.swing.event.ChangeListener

setFocus

public void setFocus(java.awt.Component c)

outcomes

public void outcomes(java.lang.String[] names)
Description copied from interface: AnnotationSchemeListener
This allows an AnnotationScheme to change the outcomes presented to the user.

Specified by:
outcomes in interface AnnotationSchemeListener
Parameters:
names - The names for the outcome to be displayed to the user and used in the file..

outcomes

public void outcomes(java.lang.String[] names,
                     java.lang.String[] codes)
Description copied from interface: AnnotationSchemeListener
This allows an AnnotationScheme to change the outcomes presented to the user.

Specified by:
outcomes in interface AnnotationSchemeListener
Parameters:
names - The names for the outcome to be displayed to the user.
codes - The string to be stored in the file for this selection.

outcomes

public void outcomes(java.lang.String[] names,
                     java.lang.String[] codes,
                     java.util.Map groups)
Description copied from interface: AnnotationSchemeListener
This allows an AnnotationScheme to change the outcomes presented to the user.

Specified by:
outcomes in interface AnnotationSchemeListener
Parameters:
names - The names for the outcome to be displayed to the user.
codes - The string to be stored in the file for this selection.
groups - A mapping from group labels to a set of names for that group.

setIcons

public void setIcons(javax.swing.Icon[] icons)
Specified by:
setIcons in interface AnnotationSchemeListener

file

public void file(AnnotationFile af)
Description copied from interface: AnnotationSchemeListener
Notifies the listener that the specified annotation file should be presented to the user. This may be the file that is already displayed.

Specified by:
file in interface AnnotationSchemeListener

annotation

public void annotation(Annotation a)
Description copied from interface: AnnotationSchemeListener
Notifies the listener to focus display the specified annotation. This may be the annotation that is currently being displayed.

Specified by:
annotation in interface AnnotationSchemeListener
Parameters:
a - The annotation to be displayed.

refresh

public void refresh(Annotation a)
Description copied from interface: AnnotationSchemeListener
Notifies the listen that the specified annotation needs to be redrawn.

Specified by:
refresh in interface AnnotationSchemeListener
Parameters:
a - The annotation that needs to be refreshed.

makeVisible

public void makeVisible(Annotation a)
Description copied from interface: AnnotationSchemeListener
Notifies the listener to make sure the annotation is visible

Specified by:
makeVisible in interface AnnotationSchemeListener
Parameters:
a - the annotation to make visible

select

public void select(Annotation a)
Description copied from interface: AnnotationSchemeListener
Notifies the listner that the specified annotation should be displayed as selected.

Specified by:
select in interface AnnotationSchemeListener
Parameters:
a - the annotation to be selected.

select

public void select(Span s)
Description copied from interface: AnnotationSchemeListener
Notifies the listner that the specified selection span should be displayed as selected.

Specified by:
select in interface AnnotationSchemeListener
Parameters:
s - the span to be selected.

select

public void select(AnnotationSelection annotations)
Description copied from interface: AnnotationSchemeListener
Notifies the listener that the specified selection should be displayed as selected.

Specified by:
select in interface AnnotationSchemeListener
Parameters:
annotations - the selection to be selected.

addStyle

public void addStyle(java.lang.String name,
                     javax.swing.text.AttributeSet as)
Description copied from interface: AnnotationSchemeListener
This allows an AnnotationScheme to change the background color for a particular annotation

Specified by:
addStyle in interface AnnotationSchemeListener

setAnnotationStyle

public void setAnnotationStyle(Annotation a,
                               java.lang.String name)
Specified by:
setAnnotationStyle in interface AnnotationSchemeListener

setBackgroundColor

public void setBackgroundColor(Annotation a,
                               java.awt.Color c)
Specified by:
setBackgroundColor in interface AnnotationSchemeListener

highlightAnnotation

public void highlightAnnotation(Annotation a,
                                java.awt.Color c)
Specified by:
highlightAnnotation in interface AnnotationSchemeListener

clearAnnotationHighlights

public void clearAnnotationHighlights()
Specified by:
clearAnnotationHighlights in interface AnnotationSchemeListener

showRelations

public void showRelations(boolean b)
Description copied from interface: AnnotationSchemeListener
Specifies whether the scheme wants relations to be displayed based on the specified parameter.

Specified by:
showRelations in interface AnnotationSchemeListener
Parameters:
b - indicates that relations should or shouldn't be displayed.

updateAnnotation

public void updateAnnotation(Annotation a)
Description copied from interface: AnnotationSchemeListener
Designates that the specified annotation has been changed.

Specified by:
updateAnnotation in interface AnnotationSchemeListener
Parameters:
a - The changed annotation.

addAnnotation

public void addAnnotation(Annotation a)
Description copied from interface: AnnotationSchemeListener
Designates that the specified annotation has been added

Specified by:
addAnnotation in interface AnnotationSchemeListener
Parameters:
a - The added annotation.

addAnnotation

public void addAnnotation(Annotation a,
                          Annotation p)
Specified by:
addAnnotation in interface AnnotationSchemeListener

removeAnnotation

public void removeAnnotation(Annotation a)
Description copied from interface: AnnotationSchemeListener
Designates that the specified annotation has been removed.

Specified by:
removeAnnotation in interface AnnotationSchemeListener
Parameters:
a - The annotation which is being removed.

moveAnnotation

public void moveAnnotation(Annotation a)
Description copied from interface: AnnotationSchemeListener
Designates that the specified annotation is about to be moved.

Specified by:
moveAnnotation in interface AnnotationSchemeListener
Parameters:
a - The annotation which is being moved.

removeAnnotatedFile

public void removeAnnotatedFile(AnnotationFile af)

progress

public void progress(int x,
                     int n)
Specified by:
progress in interface AnnotationSchemeListener

progress

public void progress(double p)
Specified by:
progress in interface AnnotationSchemeListener

markOutcomes

public void markOutcomes(java.lang.String[] codes,
                         java.awt.Color c)
Description copied from interface: AnnotationSchemeListener
Specifies a set of outcomes for this annotation and designates the color that should be used to disply them.

Specified by:
markOutcomes in interface AnnotationSchemeListener

markOutcomes

public void markOutcomes(Annotation[] codes,
                         java.awt.Color c)
Specified by:
markOutcomes in interface AnnotationSchemeListener

setColorScheme

public void setColorScheme(java.util.Map cs)
Description copied from interface: AnnotationSchemeListener
Provides a mapping between outcomes and colors for display purposes.

Specified by:
setColorScheme in interface AnnotationSchemeListener

setProperty

public void setProperty(java.lang.String f)
Description copied from interface: AnnotationSchemeListener
Designates that the specified property should be used for displaying label information about annotations handled by the caller. By default the "type" property is used for such purposes.

Specified by:
setProperty in interface AnnotationSchemeListener
Parameters:
f - the name of the property to be used as the default label property.

setProperty

public void setProperty(java.lang.String f,
                        java.lang.String s)
Specified by:
setProperty in interface AnnotationSchemeListener

addProperty

public void addProperty(java.lang.String f)
Specified by:
addProperty in interface AnnotationSchemeListener

addProperty

public void addProperty(java.lang.String f,
                        java.lang.String s)
Specified by:
addProperty in interface AnnotationSchemeListener

setProperty

public void setProperty(DynamicFeature f)
Specified by:
setProperty in interface AnnotationSchemeListener

setProperty

public void setProperty(DynamicFeature f,
                        java.lang.String s)
Specified by:
setProperty in interface AnnotationSchemeListener

setProperty

public void setProperty(DynamicFeature f,
                        java.lang.String l,
                        java.lang.String s)
Specified by:
setProperty in interface AnnotationSchemeListener

addProperty

public void addProperty(DynamicFeature f)
Specified by:
addProperty in interface AnnotationSchemeListener

addProperty

public void addProperty(DynamicFeature f,
                        java.lang.String s)
Specified by:
addProperty in interface AnnotationSchemeListener

addProperty

public void addProperty(DynamicFeature f,
                        java.lang.String l,
                        java.lang.String s)
Specified by:
addProperty in interface AnnotationSchemeListener

reloadedFiles

public void reloadedFiles()
Description copied from interface: AnnotationSchemeListener
Notifies the listener that annotated files have been reloaded in the scheme and may have been changed in arbitrary ways.

Specified by:
reloadedFiles in interface AnnotationSchemeListener

refresh

public void refresh()
Description copied from interface: AnnotationSchemeListener
Notifies the listener that annotated files have been filtered in the scheme and may need to be redisplayed

Specified by:
refresh in interface AnnotationSchemeListener

setSortCriteria

public void setSortCriteria(SortCriteria s)
Description copied from interface: AnnotationSchemeListener
Indicates that the annotations will be sorted based on the specified sort criteria.

Specified by:
setSortCriteria in interface AnnotationSchemeListener
Parameters:
s -

setAnnotationView

public void setAnnotationView(AnnotationView view)
Description copied from interface: AnnotationSchemeListener
Indicates that annotations from the specified view should be processed. If the specified view is null then there are currently no annotations to process. Typically processing entails displaying the annotations.

Specified by:
setAnnotationView in interface AnnotationSchemeListener
Parameters:
view - The current view for the scheme.

setContextualMenuItems

public void setContextualMenuItems(javax.swing.JMenuItem[] menus)
Specified by:
setContextualMenuItems in interface AnnotationSchemeListener

setContextualMenuItems

public void setContextualMenuItems(javax.swing.JMenuItem[] menus,
                                   java.lang.String[] alt_names,
                                   int[] mods)
Specified by:
setContextualMenuItems in interface AnnotationSchemeListener

removeContextualMenuItems

public void removeContextualMenuItems(javax.swing.JMenuItem[] menus)
Specified by:
removeContextualMenuItems in interface AnnotationSchemeListener


Copyright © 2004 Thomas Morton and Jeremy LaCivita. All Rights Reserved.