org.eesgmbh.gimv.client.controls
Class MouseWheelControl

java.lang.Object
  extended by org.eesgmbh.gimv.client.controls.MouseWheelControl

public class MouseWheelControl
extends Object

Reacts to MouseWheelEvent over the viewport and zooms the image accordingly. The zoom centers on the current mouse position within the viewport.

The zoom factor which is a percentage value (0 to 1 based) can be set with setZoomFactor(double). The default value is 0.2.

The control can be configured to preview a zoomed image (meaning rescaled on the client side) by setting setPreviewZoomByRescalingTheImage(boolean) before it is being fully rendered. This is enabled by default.

By default, a LoadImageDataEvent is only fired after 150ms passed since the last mouse wheel event. This effectively restricts the number of LoadImageDataEvent, potentially causing expensive rendering on the server side. The value can be changed with setLoadImageDataEventFiringDelay(int).

Registers with the HandlerManager to receive the following events

Fires the following events


Constructor Summary
MouseWheelControl(HandlerManager handlerManager)
          Instantiates the control with the default configuration.
 
Method Summary
 void setFireLoadImageDataEvent(boolean fireLoadImageDataEvent)
          Defines, whether a LoadImageDataEvent is fired.
 void setLoadImageDataEventFiringDelay(int delayInMillis)
          Sets the time in milliseconds for how long to defer firing a LoadImageDataEvent.
 void setPreviewZoomByRescalingTheImage(boolean previewZoomByRescalingTheImage)
          Whether you want to see a preview of the image by simply repositioning and rescaling it before the new image is beeing rendered and displayed.
 void setZoomFactor(double zoomFactor)
          Sets the zoom factor both for zooming in and out.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MouseWheelControl

public MouseWheelControl(HandlerManager handlerManager)
Instantiates the control with the default configuration.

Parameters:
handlerManager - A HandlerManager
Method Detail

setZoomFactor

public void setZoomFactor(double zoomFactor)
Sets the zoom factor both for zooming in and out. Default is 0.2 (20%)

Parameters:
zoomFactor - zoom factor must be positive and not zero

setPreviewZoomByRescalingTheImage

public void setPreviewZoomByRescalingTheImage(boolean previewZoomByRescalingTheImage)

Whether you want to see a preview of the image by simply repositioning and rescaling it before the new image is beeing rendered and displayed. This gives an instant feedback to the user.

Default is true.

Parameters:
previewZoomByRescalingTheImage -

setFireLoadImageDataEvent

public void setFireLoadImageDataEvent(boolean fireLoadImageDataEvent)

Defines, whether a LoadImageDataEvent is fired.

Default is true.

Parameters:
fireLoadImageDataEvent - fire it, or not

setLoadImageDataEventFiringDelay

public void setLoadImageDataEventFiringDelay(int delayInMillis)
Sets the time in milliseconds for how long to defer firing a LoadImageDataEvent.

The default value is 150 ms. This means that 150 ms have to pass after the last wheel event until a LoadImageDataEvent is fired causing the image to be newly rendered. If multiple wheel events were received during that period, the new image bounds will be the 'sum' of all wheel events.

This helps to reduce server load where rendering might take place.

Parameters:
delayInMillis - A millisecond value. Pass in 0 (zero) to deactivate delayed firing of LoadImageDataEvent


Copyright © 2010 - EES GmbH