org.eesgmbh.gimv.client.presenter
Class TooltipPresenter

java.lang.Object
  extended by org.eesgmbh.gimv.client.presenter.TooltipPresenter

public class TooltipPresenter
extends Object

A presenter to display hover, clickable (not yet) and static (not yet) tooltips.

The actual tooltip html is obtained from the ImageEntity instances in the SetImageEntitiesEvent. The html is passed into HTML widgets, that are internally constructed in a pool.

The presenter can be configured in what way it will match a particular tooltip to the current mouse position, see configureHoverMatch(boolean, boolean, boolean).

The offset of the tooltip can be set with setDisplayOffset(int, int).

If there shouldn't be any tooltips for a certain ImageEntity group id, these can be set with addExcludedImageEntityGroupId(String).

Registers with the HandlerManager to receive the following events

Fires no events.


Constructor Summary
TooltipPresenter(HandlerManager handlerManager)
          Instantiates the presenter.
 
Method Summary
 void addExcludedImageEntityGroupId(String groupId)
          Add an ImageEntity group id, for which no tooltips should be displayed.
 void configureHoverMatch(boolean horizontal, boolean vertical, boolean displayAll)
          Configures the tooltip display mechanism to be used as a result of the current mouse position.
 void setDisplayOffset(int xOffset, int yOffset)
          An offset in pixels for the tooltip position based on the center of the bounds of the ImageEntitys The default is xOffset=1, yOffset=1
 void setTooltipZIndex(int zIndex)
          Set the z-index for all tooltips.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TooltipPresenter

public TooltipPresenter(HandlerManager handlerManager)
Instantiates the presenter.

Parameters:
handlerManager - A HandlerManager
Method Detail

configureHoverMatch

public void configureHoverMatch(boolean horizontal,
                                boolean vertical,
                                boolean displayAll)

Configures the tooltip display mechanism to be used as a result of the current mouse position.

Setting both horizontal and vertical to true will require the mouse position to be excactly above the ImageEntity bounds.

If for instance only horizontal is set to true, only the x position must match with the ImageEntity bounds, meaning that the tooltip will be displayed even if the mouse cursor is somewhere below or above the ImageEntity bounds.

The opposite holds true for horizontal=false and vertical=true.

The default is horizontal=true, vertical=false, displayAll=false

performance note: This current version of the presenter requires a lot of initialization time when both horizontal and vertical must match, tests in IE 7 (the slowest browsers) resulted in 10 sec of initialization for only 800 tooltips. So basically horizontal=true and vertical=true should not be used at the moment.

Parameters:
horizontal - mouse position must match horizontally with the ImageEntity bounds
vertical - mouse position must match vertically with the ImageEntity bounds
displayAll - whether to display all ImageEntity tooltips whose bound's center is exactly at the current mouse position

setDisplayOffset

public void setDisplayOffset(int xOffset,
                             int yOffset)
An offset in pixels for the tooltip position based on the center of the bounds of the ImageEntitys

The default is xOffset=1, yOffset=1

Parameters:
xOffset - offset in pixels
yOffset - offset in pixels

addExcludedImageEntityGroupId

public void addExcludedImageEntityGroupId(String groupId)
Add an ImageEntity group id, for which no tooltips should be displayed.

Parameters:
groupId - an ImageEntity group id

setTooltipZIndex

public void setTooltipZIndex(int zIndex)
Set the z-index for all tooltips.

The default z-index is 10000.

You only need to invoke this method, if the tooltips do not appear on top of other components with a z-index higher than 10000.

Parameters:
zIndex - A css z-index for all tooltips


Copyright © 2010 - EES GmbH