org.crosswire.bibledesktop.display.basic
Class URITipMgr

java.lang.Object
  extended by java.awt.event.MouseAdapter
      extended by org.crosswire.bibledesktop.display.basic.URITipMgr
All Implemented Interfaces:
ActionListener, MouseListener, MouseMotionListener, MouseWheelListener, EventListener, URIEventListener

public class URITipMgr
extends MouseAdapter
implements ActionListener, URIEventListener, MouseMotionListener

How it works: 1. It keeps track of mouse movement. 2. It registers the URI entering event and starts a timer. 3. When the timer fires, a tip pops up, the timer stopped. 4. The timer is stopped when a URI leaving event is received. 5. Whenever mouse clicked outside the tip, it disappears. 6. Click in the tip to make it sticky, double-click to close. 7. If sticky, tip updates as the mouse enters another URI.

Author:
Yingjie Lan [lanyjie at yahoo dot com]
See Also:
for license details. The copyright to this program is held by it's authors.

Field Summary
private  org.crosswire.common.xml.Converter converter
           
private  URIEvent event
           
private  int lastx
           
private  int lasty
           
private  Component owner
           
private  Popup popup
           
private  JScrollPane scrView
           
private  boolean sticky
           
private  Timer timer
           
private  TitledBorder title
           
private  JTextPane txtView
           
 
Constructor Summary
URITipMgr(Component own, Dimension dim)
           
 
Method Summary
 void actionPerformed(ActionEvent e)
           
 void activateURI(URIEvent ev)
          This method is called to indicate that an URI can be processed.
 void enterURI(URIEvent ev)
          This method is called to indicate that the mouse has entered the URI.
(package private)  void hideTip(boolean stick)
           
(package private)  boolean interested(URIEvent ev)
           
 void leaveURI(URIEvent ev)
          This method is called to indicate that the mouse has left the URI.
 void mouseClicked(MouseEvent e)
           
 void mouseDragged(MouseEvent e)
           
 void mouseExited(MouseEvent e)
           
 void mouseMoved(MouseEvent e)
           
 void setDelay(int delay)
           
(package private)  void showTip()
           
 void updateText()
           
 
Methods inherited from class java.awt.event.MouseAdapter
mouseEntered, mousePressed, mouseReleased, mouseWheelMoved
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

owner

private Component owner

txtView

private JTextPane txtView

scrView

private JScrollPane scrView

title

private TitledBorder title

popup

private Popup popup

sticky

private boolean sticky

lastx

private int lastx

lasty

private int lasty

event

private URIEvent event

timer

private Timer timer

converter

private org.crosswire.common.xml.Converter converter
Constructor Detail

URITipMgr

public URITipMgr(Component own,
                 Dimension dim)
Method Detail

setDelay

public void setDelay(int delay)

updateText

public void updateText()

showTip

void showTip()

hideTip

void hideTip(boolean stick)

interested

boolean interested(URIEvent ev)
Parameters:
ev - if we are interested in this event

activateURI

public void activateURI(URIEvent ev)
Description copied from interface: URIEventListener
This method is called to indicate that an URI can be processed.

Specified by:
activateURI in interface URIEventListener
Parameters:
ev - Describes the URI

enterURI

public void enterURI(URIEvent ev)
Description copied from interface: URIEventListener
This method is called to indicate that the mouse has entered the URI.

Specified by:
enterURI in interface URIEventListener
Parameters:
ev - Describes the URI

leaveURI

public void leaveURI(URIEvent ev)
Description copied from interface: URIEventListener
This method is called to indicate that the mouse has left the URI.

Specified by:
leaveURI in interface URIEventListener
Parameters:
ev - Describes the URI

actionPerformed

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

mouseDragged

public void mouseDragged(MouseEvent e)
Specified by:
mouseDragged in interface MouseMotionListener
Overrides:
mouseDragged in class MouseAdapter
Parameters:
e -

mouseMoved

public void mouseMoved(MouseEvent e)
Specified by:
mouseMoved in interface MouseMotionListener
Overrides:
mouseMoved in class MouseAdapter

mouseClicked

public void mouseClicked(MouseEvent e)
Specified by:
mouseClicked in interface MouseListener
Overrides:
mouseClicked in class MouseAdapter

mouseExited

public void mouseExited(MouseEvent e)
Specified by:
mouseExited in interface MouseListener
Overrides:
mouseExited in class MouseAdapter

Copyright ยจ 2003-2013