eTextReader
Class PopupWindowNotationHandler

java.lang.Object
  extended by eTextReader.NotationEventAdapter
      extended by eTextReader.PopupWindowNotationHandler
All Implemented Interfaces:
NotationEventListener, java.util.EventListener
Direct Known Subclasses:
OpenExternalPopupWindowHandler

public class PopupWindowNotationHandler
extends NotationEventAdapter

Provides a simple NotationEvent listener that pops up a summary window whenever an annotation is moused over.

The types of notations for which windows are shown is customizable via the methods disableTypes(eTextReader.clientInterface.Notation.AnnotationType[], boolean) and enableTypes(eTextReader.clientInterface.Notation.AnnotationType[], boolean)

Author:
mcfall

Field Summary
protected  java.util.Set<Notation.AnnotationType> enabledTypes
           
protected  QuickNoteWindow popup
           
protected  ScrollingContentPane scrollingContentPane
           
 
Constructor Summary
PopupWindowNotationHandler(javax.swing.JFrame frame, ScrollingContentPane scrollingContentPane)
          Constructs a PopupWindowNotationHandler associated with the given frame and ScrollingContentPane.
 
Method Summary
 void disableTypes(Notation.AnnotationType[] types, boolean enableOthers)
          Disables the specified array of AnnotationType objects so that popups are not shown for any of those types.
 void enableTypes(Notation.AnnotationType[] types, boolean disableOthers)
          Enables the specified array of AnnotationType objects so that popups are shown for any of those types.
protected  void handleNotationEntered(NotationEvent ne)
          Called when a notation is entered.
protected  void handleNotationExited(NotationEvent ne)
          Hides the popup window
protected  void handleNotationSelected(NotationEvent ne)
          Performs the same action is exiting the notation by calling handleNotationExited(NotationEvent)
 boolean isTypeEnabled(Notation.AnnotationType type)
          Determines whether a particular type of annotation is enabled for popups
 void notationEventOccurred(NotationEvent ne)
           Handles notifications from the ContentPane when an annotation has been entered/exited/selected.
 void pageChanged(NotationEvent ne)
          Process a page change event.
 
Methods inherited from class eTextReader.NotationEventAdapter
errorOccurred
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

popup

protected QuickNoteWindow popup

scrollingContentPane

protected ScrollingContentPane scrollingContentPane

enabledTypes

protected java.util.Set<Notation.AnnotationType> enabledTypes
Constructor Detail

PopupWindowNotationHandler

public PopupWindowNotationHandler(javax.swing.JFrame frame,
                                  ScrollingContentPane scrollingContentPane)
Constructs a PopupWindowNotationHandler associated with the given frame and ScrollingContentPane. Enabled types are specified by calling the eTextReader.Notation.AnnotationType#isPopupEnabledByDefault method

Parameters:
frame - the JFrame object used as a parent for the popup window
scrollingContentPane - the scrolling content pane holding the content
Method Detail

notationEventOccurred

public void notationEventOccurred(NotationEvent ne)

Handles notifications from the ContentPane when an annotation has been entered/exited/selected. This implementation calls the appropriate

The default implementation handles these events as follows:

Specified by:
notationEventOccurred in interface NotationEventListener
Overrides:
notationEventOccurred in class NotationEventAdapter
See Also:
handleNotationEntered(NotationEvent), handleNotationExited(NotationEvent), handleNotationSelected(NotationEvent)

handleNotationEntered

protected void handleNotationEntered(NotationEvent ne)
Called when a notation is entered.

Parameters:
ne -

handleNotationExited

protected void handleNotationExited(NotationEvent ne)
Hides the popup window

Parameters:
ne - the notation event that triggered this action

handleNotationSelected

protected void handleNotationSelected(NotationEvent ne)
Performs the same action is exiting the notation by calling handleNotationExited(NotationEvent)

Parameters:
ne - the notation event that triggered this action

pageChanged

public void pageChanged(NotationEvent ne)
Description copied from interface: NotationEventListener
Process a page change event.

Specified by:
pageChanged in interface NotationEventListener
Overrides:
pageChanged in class NotationEventAdapter

enableTypes

public void enableTypes(Notation.AnnotationType[] types,
                        boolean disableOthers)
Enables the specified array of AnnotationType objects so that popups are shown for any of those types.

Parameters:
types - an array of Notation.AnnotationType objects that should be enabled
disbleOthers - if set to true, then all types NOT contained in the array types will be disabled; otherwise, the enabled status of types not in the array types will not be changed

disableTypes

public void disableTypes(Notation.AnnotationType[] types,
                         boolean enableOthers)
Disables the specified array of AnnotationType objects so that popups are not shown for any of those types.

Parameters:
types - an array of Notation.AnnotationType objects that should be disabled
enableOthers - if set to true, then all types NOT contained in the array types will be enabled; otherwise, the enabled status of types not in the array types will not be changed

isTypeEnabled

public boolean isTypeEnabled(Notation.AnnotationType type)
Determines whether a particular type of annotation is enabled for popups

Parameters:
type - the type of annotation to check
Returns:
true if popups will be shown when the mouse hovers over the icon for the type of annotation specified by type; false if not