org.eesgmbh.gimv.client.presenter
Class OverviewPresenter

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

public class OverviewPresenter
extends Object

This presenter can be used to display and manipulate the currently shown bounds of the main image within larger bounds.

E.g. it can show the currently displayed map section within a larger map as a rectangle. The rectangle can be moved as a whole or only a single bound can be changed.

The overview presenter must be instantiated with a different handler manager than the one used to process events for the main image. This handler manager will connect the presenter with its own Viewport to receive notifications of drag operations.

If the user changes the overview with this presenter, the resulting change will be propagated to all registered dependant handler managers with a SetDomainBoundsEvent. If you got a single main image with one overview, the only dependant handler manager is the one of the main image.

After instantiating the presenter, it must be configured with handles. These handles represent the visual representation of the overview and are configured to alter a certain set of bounds (see addHandle(GenericWidgetView, Bound...).

Registers with the HandlerManager to receive the following events

Fires the following events on all dependant handler managers

Since:
0.1.3

Constructor Summary
OverviewPresenter(GenericWidgetView overviewWidgetView, HandlerManager handlerManager, HandlerManager dependantHandlerManager)
          Instantiates the overview presenter.
 
Method Summary
 void addDependantHandlerManager(HandlerManager handlerManager)
          Adds HandlerManager who will receive a SetDomainBoundsEvent and (optionally) a LoadImageDataEvent after a drag on the overviewWidget finished.
 void addHandle(GenericWidgetView handleView, Bound... bounds)
          Adds a view as a dragging handle.
 void setFireLoadImageDataEvent(boolean fireLoadImageDataEvent)
          Defines, whether a LoadImageDataEvent is fired.
 void setHorizontallyLocked(boolean horizontallyLocked)
          If set to true the overview widget's left and right pixel bounds are locked.
 void setMinClippingHeight(int minHeight)
          The minimum height the overview can be resized to.
 void setMinClippingWidth(int minWidth)
          The minimum width the overview can be resized to.
 void setOverviewLeftOffset(int overviewLeftOffsetInPixels)
          Sets the amount of pixels for the vertical offset of the overview widget.
 void setOverviewTopOffset(int overviewTopOffsetInPixels)
          Sets the amount of pixels for the vertical offset of the overview widget.
 void setPreserveAspectRatio(boolean preserveAspectRatio)
          Specifies whether the overview should keep its aspect ratio when it is being resized or not.
 void setVerticallyLocked(boolean verticallyLocked)
          If set to true the overview widget's top and bottom pixel bounds are locked.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OverviewPresenter

public OverviewPresenter(GenericWidgetView overviewWidgetView,
                         HandlerManager handlerManager,
                         HandlerManager dependantHandlerManager)
Instantiates the overview presenter.

Parameters:
overviewWidgetView - The UI for displaying the selected portion
handlerManager - A HandlerManager
dependantHandlerManager - A HandlerManager who will receive a SetDomainBoundsEvent and (optionally) a LoadImageDataEvent after a drag on the overviewWidget finished. The bounds are the current domain bounds of the overview (the portion selected).
Method Detail

addHandle

public void addHandle(GenericWidgetView handleView,
                      Bound... bounds)
Adds a view as a dragging handle. The Bound enums specify which bound of the overview will change as a result of dragging the handle. This will both be reflected in the placement and dimensions of the overview on the UI and also on the domain bounds change of the components registerd as dependant handler managers.

A handle with the LEFT bound changes the left bound. Dragging this handle will change the left bound of the overview bound and leave all other bounds unchanged. The width of the overview changes accordingly

When two bounds are specified, e. g. LEFT and RIGHT, dragging the handle will result in the view moving horizontally, preserving it's width, but changing both left and right by the same amount.

Parameters:
handleView - the view to be added as a dragging handle
bounds - bounds which the handle will change

setPreserveAspectRatio

public void setPreserveAspectRatio(boolean preserveAspectRatio)
Specifies whether the overview should keep its aspect ratio when it is being resized or not.

Default: false

Parameters:
preserveAspectRatio - true to preserve the aspect ratio, false not to

setMinClippingWidth

public void setMinClippingWidth(int minWidth)
The minimum width the overview can be resized to. Default: 0 pixels

Parameters:
minWidth - minimum width, in pixels

setMinClippingHeight

public void setMinClippingHeight(int minHeight)
The minimum height the overview can be resized to.

Default: 0 pixels

Parameters:
minHeight - minimum height, in pixels

setHorizontallyLocked

public void setHorizontallyLocked(boolean horizontallyLocked)
If set to true the overview widget's left and right pixel bounds are locked. So the left and right handles (if any) can't be moved. An overview widget which is horizontally locked can only move vertically.

Disables: preserveAspectRatio

Default: false

Parameters:
horizontallyLocked -

setVerticallyLocked

public void setVerticallyLocked(boolean verticallyLocked)
If set to true the overview widget's top and bottom pixel bounds are locked. So the top and bottom handles (if any) can't be moved. An overview widget which is vertically locked can only move horizontally.

Disables: preserveAspectRatio

Default: false

Parameters:
verticallyLocked -

setOverviewTopOffset

public void setOverviewTopOffset(int overviewTopOffsetInPixels)
Sets the amount of pixels for the vertical offset of the overview widget.

Default: 0 pixels

Parameters:
overviewTopOffsetInPixels - offset in pixels

setOverviewLeftOffset

public void setOverviewLeftOffset(int overviewLeftOffsetInPixels)
Sets the amount of pixels for the vertical offset of the overview widget.

Default: 0 pixels

Parameters:
overviewLeftOffsetInPixels - offset in pixels

setFireLoadImageDataEvent

public void setFireLoadImageDataEvent(boolean fireLoadImageDataEvent)

Defines, whether a LoadImageDataEvent is fired.

Default is true.

Parameters:
fireLoadImageDataEvent - fire it, or not

addDependantHandlerManager

public void addDependantHandlerManager(HandlerManager handlerManager)
Adds HandlerManager who will receive a SetDomainBoundsEvent and (optionally) a LoadImageDataEvent after a drag on the overviewWidget finished.

Parameters:
handlerManager - A HandlerManager instance


Copyright © 2010 - EES GmbH