|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.google.gwt.user.client.ui.UIObject
com.google.gwt.user.client.ui.Widget
com.google.gwt.user.client.ui.Panel
com.google.gwt.user.client.ui.ComplexPanel
com.google.gwt.user.client.ui.AbsolutePanel
org.eesgmbh.gimv.client.widgets.Viewport
public class Viewport
This widget captures mouse events.
Mouse dragging, meaning the left mouse button is pressed and the mouse is moved over the viewport,
is translated into semantic ViewportDragInProgressEvent and ViewportDragFinishedEventHandler
events.
For most Gimv components, it is required to define a viewport widget and add the actual image to this viewport. There must not be any margin, padding or other kinds of offsets between the viewport and the contained image.
Proper configuration requires to set the width and height explicitly (in any unit
including percentages), adding the image component and setting the HandlerManager.
Registers with the HandlerManager to receive the following events
StateChangeEvent (when switching between move and zoom)
SetDataAreaPixelBoundsEvent (optional, if the image contains a data area related to SetDomainBoundsEvent, e.g. without axis areas)
Fires the following events
ViewportMouseMoveEvent - simply wraps the GWT MouseMoveEvent in a Gimv event
ViewportMouseOutEvent - simply wraps the GWT MouseOutEvent in a Gimv event
ViewportMouseWheelEvent - simply wraps the GWT MouseOutEvent in a Gimv event
StateChangeEvent - fired when the shift key is pressed, during left mouse down and move (drag)
ViewportDragInProgressEvent - fired, while the user moves the mouse over the image and presses down the left mouse button
ViewportDragFinishedEvent - fired, when the user finished dragging (releases the mouse button)
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObject |
|---|
UIObject.DebugIdImpl, UIObject.DebugIdImplEnabled |
| Field Summary |
|---|
| Fields inherited from class com.google.gwt.user.client.ui.UIObject |
|---|
DEBUG_ID_PREFIX |
| Constructor Summary | |
|---|---|
Viewport()
No arg constructor. |
|
Viewport(String width,
String height)
Instantiates the viewport with width and height. |
|
| Method Summary | |
|---|---|
void |
add(Widget w)
Delegates to AbsolutePanel.add(Widget, int, int) with height and with set to zero. |
void |
setEnableZoomWhenShiftkeyPressed(boolean enableZoomWhenShiftkeyPressed)
If set to true, a StateChangeEvent.createZoom(StateChangeEventHandler...) event will be fired
whenever the user presses the shift key when initiating a drag. |
void |
setHandlerManager(HandlerManager handlerManager)
Registers necessary handlers. |
| Methods inherited from class com.google.gwt.user.client.ui.AbsolutePanel |
|---|
add, getWidgetLeft, getWidgetTop, insert, insert, remove, setWidgetPosition, setWidgetPositionImpl |
| Methods inherited from class com.google.gwt.user.client.ui.ComplexPanel |
|---|
add, adjustIndex, checkIndexBoundsForAccess, checkIndexBoundsForInsertion, getChildren, getWidget, getWidgetCount, getWidgetIndex, insert, insert, iterator, remove |
| Methods inherited from class com.google.gwt.user.client.ui.Panel |
|---|
adopt, adopt, clear, disown, doAttachChildren, doDetachChildren, onLoad, onUnload, orphan |
| Methods inherited from class com.google.gwt.user.client.ui.Widget |
|---|
addDomHandler, addHandler, delegateEvent, fireEvent, getHandlerCount, getLayoutData, getParent, isAttached, isOrWasAttached, onAttach, onBrowserEvent, onDetach, removeFromParent, setLayoutData, sinkEvents |
| Methods inherited from class com.google.gwt.user.client.ui.UIObject |
|---|
addStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, getTitle, isVisible, isVisible, onEnsureDebugId, removeStyleDependentName, removeStyleName, setElement, setElement, setHeight, setPixelSize, setSize, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, toString, unsinkEvents |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface com.google.gwt.user.client.ui.IndexedPanel |
|---|
getWidget, getWidgetCount, getWidgetIndex, remove |
| Constructor Detail |
|---|
public Viewport()
The methods UIObject.setWidth(String), UIObject.setHeight(String), add(Widget) must be invoked afterwards
(all three probably implicitly by ui binder) and very importantly setHandlerManager(HandlerManager)
public Viewport(String width,
String height)
width - a CSS attribute (e.g. "100px", "100%")height - a CSS attribute (e.g. "100px", "100%")| Method Detail |
|---|
public void setHandlerManager(HandlerManager handlerManager)
handlerManager - A HandlerManagerpublic void setEnableZoomWhenShiftkeyPressed(boolean enableZoomWhenShiftkeyPressed)
StateChangeEvent.createZoom(StateChangeEventHandler...) event will be fired
whenever the user presses the shift key when initiating a drag.
This means that the image will be zoomed if the user presses the shift
key and otherwise moved.
Default is false.
enableZoomWhenShiftkeyPressed - public void add(Widget w)
AbsolutePanel.add(Widget, int, int) with height and with set to zero.
The UIBinder uses AbsolutePanel.add(Widget) to add a child component to
an AbsolutePanel. In order to be able to change the position of the underlying
widget, the widget has to be given absolute coordinates (resulting in position:absolute, top and
left to be set in css).
This workaround can be removed, once GWT allows positioning of child elements in UI Binder templates
implementation alternatives:
- set position:absolute, top and left directly in ui binder xml
- do not use UIBinder for the inner image
- set position of the image afterwards
- code custom AbsolutePanelParser
add in interface HasWidgetsadd in interface InsertPaneladd in class AbsolutePanelAbsolutePanel.add(com.google.gwt.user.client.ui.Widget)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||