org.formaria.swt
Class ToolTip

java.lang.Object
  extended by org.eclipse.swt.widgets.Label
      extended by org.formaria.swt.Label
          extended by org.formaria.swt.ToolTip
All Implemented Interfaces:
TextHolder

public class ToolTip
extends Label

A Tooltip class for AWT components. Unlike other Aria-AWT components the tooltips are not added via the component factory. In this initial implementation tooltips must be added explicitly.

Copyright (c) Formaria Ltd., 2008

$Revision: 1.1 $

License: see License.txt


Field Summary
protected  Font font
           
protected  int HORIZONTAL_ENLARGE
           
protected  int lag
           
protected  Composite mainComposite
           
protected  Control owner
           
protected  boolean shown
           
protected  boolean showTip
           
protected  java.lang.String tip
           
protected  org.formaria.swt.ToolTip.TooltipThread tooltipThread
           
protected  int VERTICAL_OFFSET
           
 
Fields inherited from class org.formaria.swt.Label
bufferHeight, bufferWidth, doubleBuffered, name
 
Constructor Summary
ToolTip(java.lang.String tip, Control owner)
          Create anew tooltip
 
Method Summary
protected  void addToolTip(Point pt)
          Add a tooltip
protected  void calcsize()
          Get the size
 java.lang.String getTip()
          Get the tip's text
 java.lang.String getToolTip()
          Get the tooltip text
 void mouseDoubleClick(MouseEvent e)
           
 void mouseDown(MouseEvent e)
          Invoked when a mouse button has been pressed on a component.
 void mouseEnter(MouseEvent e)
          Invoked when the mouse enters a component.
 void mouseExit(MouseEvent e)
          Invoked when the mouse exits a component.
 void mouseHover(MouseEvent e)
           
 void mouseUp(MouseEvent e)
           
protected  void removeToolTip()
          Remove a tooltip
 void setImage(java.lang.String imageName)
          Set the image name
 void setTip(java.lang.String newTip)
          Get the tip's text
 void setToolTip(java.lang.String text)
          Set the tooltip text
protected  void setToolTipLocation(Point pt)
          Set a tooltip location
protected  void showTip(Point pt)
          Show the tooltip at the specified point
 
Methods inherited from class org.formaria.swt.Label
checkSubclass, getAlignment, getPreferredSize, setDoubleBuffered, setText, setTransparent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.formaria.aria.TextHolder
getText
 

Field Detail

tip

protected java.lang.String tip

owner

protected Control owner

mainComposite

protected Composite mainComposite

shown

protected boolean shown

VERTICAL_OFFSET

protected final int VERTICAL_OFFSET
See Also:
Constant Field Values

HORIZONTAL_ENLARGE

protected final int HORIZONTAL_ENLARGE
See Also:
Constant Field Values

font

protected Font font

showTip

protected boolean showTip

lag

protected int lag

tooltipThread

protected org.formaria.swt.ToolTip.TooltipThread tooltipThread
Constructor Detail

ToolTip

public ToolTip(java.lang.String tip,
               Control owner)
Create anew tooltip

Parameters:
tip - the tip text
owner - the owner component
Method Detail

getTip

public java.lang.String getTip()
Get the tip's text

Returns:
the tooltip text

setTip

public void setTip(java.lang.String newTip)
Get the tip's text

Parameters:
newTip - the new text

addToolTip

protected void addToolTip(Point pt)
Add a tooltip

Parameters:
pt - point

calcsize

protected void calcsize()
Get the size


setToolTipLocation

protected void setToolTipLocation(Point pt)
Set a tooltip location

Parameters:
pt - point

removeToolTip

protected void removeToolTip()
Remove a tooltip


showTip

protected void showTip(Point pt)
Show the tooltip at the specified point

Parameters:
pt -

mouseExit

public void mouseExit(MouseEvent e)
Invoked when the mouse exits a component.


mouseEnter

public void mouseEnter(MouseEvent e)
Invoked when the mouse enters a component.

Parameters:
e - mouse event

mouseDown

public void mouseDown(MouseEvent e)
Invoked when a mouse button has been pressed on a component.

Parameters:
e - mouse event

mouseUp

public void mouseUp(MouseEvent e)

mouseHover

public void mouseHover(MouseEvent e)

mouseDoubleClick

public void mouseDoubleClick(MouseEvent e)

setToolTip

public void setToolTip(java.lang.String text)
Set the tooltip text

Overrides:
setToolTip in class Label
Parameters:
text - the new text

getToolTip

public java.lang.String getToolTip()
Get the tooltip text

Overrides:
getToolTip in class Label
Returns:
the existing text if any

setImage

public void setImage(java.lang.String imageName)
Set the image name

Overrides:
setImage in class Label
Parameters:
imageName - the relative URL of the new image