Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.maryanovsky.gwtutils.client.ui
Class UiUtils

    java.lang.Object
      com.maryanovsky.gwtutils.client.ui.UiUtils

    public class UiUtils

extends Object

A utility class for UI related functionality.

Author:
  Maryanovsky Alexander

Field Summary
`static com.maryanovsky.gwtutils.client.ui.UiUtils.Delegate` | `LTR` The delegate for left-to-right languages.
`static com.maryanovsky.gwtutils.client.ui.UiUtils.Delegate` | `RTL` The delegate for right-to-left languages.

Constructor Summary
`UiUtils()`

Method Summary
`static void` | `addDependentStyleName(Widget widget, String styleSuffix)` Adds a dependent style name to the specified widget.
`static void` | `addDialogButtons(HorizontalPanel panel, List<? extends Widget> buttons)` Adds the specified dialog buttons to the specified panel.
`static void` | `addFullSize(Panel panel, Widget widget)` Adds the specified widget to the specified absolute panel and makes it occupy the panel fully.
`static void` | `addInCorner(Panel panel, Widget widget, Alignment corner, SizeView offset)` Adds the specified widget to the specified corner of the specified panel with the specified offset from the borders.
`static Object` | `addLoadListener(Element element, Callback<Element> callback)` Registers a load listener for the specified element which will invoke the specified callback with the element.
`static HandlerRegistration` | `addSizeChangeHandler(Widget widget, ResizeHandler handler)` Attempts to track changes in the size of the specified widget and notify the specified change listener.
`static void` | `addWidgets(HorizontalPanel panel, List<? extends Widget> widgets)` Adds the specified widgets to the specified horizontal panel in reading order.
`static void` | `applyPngHack(Image image, String url, Size size)` Applies the IE PNG hack to the specified image.
`static void` | `cancelCurrentEvent()` Cancels processing of the current event by stopping its propagation and preventing the default action from occurring.
`static
`<H extends EventHandler> void`
` | `cancelEvent(DomEvent<H> evt)` Cancels the processing of the specified `DomEvent` by stopping its propagation and preventing the default action from occurring.
`static void` | `cancelEvent(NativeEvent evt)` Cancels processing of the specified event by stopping its propagation and preventing the default action from occurring.
`static void` | `disableContextMenu(Element element)` Disables the browser context menu for the specified element (and enables right-click detection).
`static void` | `disableDragging(Object dragTracker)` Makes the specified widget un-draggable, after it was made draggable with makeDraggable(Widget, HasAllMouseHandlers, HandlesAllDragEvents).
`static void` | `extraImageCellHeightWorkaround(Element tdElement)` Fixes a strange problem with an image being placed in a table cell.
`static void` | `extraImageCellHeightWorkaround(Widget panel)` Fixes the problem described by extraImageCellHeightWorkaround(Element) for every TD element of the specified panel.
`static void` | `fillRow(HTMLTable table, int row, int height)` Fills the specified row of a table with vertical struts of the specified size.
`static void` | `findElementsByTagName(Element parent, String tagName, List<Element> list)` Finds the children of the specified element whose tag name is the specified one, and adds them to the specified list.
`static Rectangle` | `getBoundsClient(Widget widget)` Returns the bounds of the specified widget, in the client coordinate system.
`static Widget` | `getHorizontalStrut(int width)` Creates a horizontal spacer of the specified width.
`static HasHorizontalAlignment.HorizontalAlignmentConstant` | `getLeadingAlignment()` Returns the alignment constant corresponding to the beginning of the line in reading order.
`static String` | `getPngHackedImageHtml(String url, Size size)` Returns the HTML for an image at the specified URL with the PNG hack applied to it.
`static String` | `getPrimaryStyleName(String fullStyleName)` Returns the "primary" style name based on the specified full style name.
`static String` | `getPrimaryStyleName(Widget widget)` Returns the "primary" style name of the specified widget.
`static Widget` | `getRelatedHorizontalStrut()` Returns a horizontal spacer of with the size of the preferred distance between related elements.
`static Widget` | `getRelatedVerticalStrut()` Returns a vertical spacer of with the size of the preferred distance between related elements.
`static Widget` | `getRigidArea(int width, int height)` Creates a spacer of the specified dimensions.
`static String` | `getTagName(Element element)` Returns the tag name of the specified element.
`static PointView` | `getTargetCoordinates(Touch touch)` Returns the location of the specified touch in the coordinate system of the target element.
`static Point` | `getTopLeft(Widget widget)` Returns the top-left location of an absolutely positioned widget from its "top" and "left" style attributes.
`static HasHorizontalAlignment.HorizontalAlignmentConstant` | `getTrailingAlignment()` Returns the alignment constant corresponding to the end of the line in reading order.
`static Widget` | `getUnrelatedHorizontalStrut()` Returns a horizontal spacer of with the size of the preferred distance between unrelated elements.
`static Widget` | `getUnrelatedVerticalStrut()` Returns a vertical spacer of with the size of the preferred distance between unrelated elements.
`static Widget` | `getVerticalStrut(int height)` Creates a vertical spacer of the specified height.
`static boolean` | `getVisibility(Widget widget)` Returns whether the specified widget's "visibility" CSS property is not set to "hidden" or "collapsed" or "inherit" and the parent's visibility is false.
`static Size` | `getWidgetSize(Widget widget)` Returns the size of the specified widget (offsetWidth, offsetHeight).
`static
`<H extends MouseDownHandler & MouseUpHandler & MouseOutHandler & MouseOverHandler & MouseMoveHandler & MouseWheelHandler> HandlerRegistration`
` | `handleAllMouseEvents(HasAllMouseHandlers source, H receiver)` Adds the specified mouse event handler to the specified mouse event source and returns the proper registration.
`static boolean` | `isAncestorOf(Widget ancestor, Widget widget)` Returns whether `ancestor` is an ancestor of the specified widget.
`static boolean` | `isNativeMouseButton(int button)` Returns whether the specified value is one of `NativeEvent.BUTTON_LEFT`, `NativeEvent.BUTTON_MIDDLE` or `NativeEvent.BUTTON_RIGHT`.
`static Object` | `makeDraggable(Widget widget, HasAllMouseHandlers dragHandle, HandlesAllDragEvents handler)` Makes the specified widget draggable via the specified drag handle.
`static Label` | `makeLabelFor(String text)` Creates a label to be a label for some other element.
`static void` | `maybeInitializeEventSystem()` If the event system has not yet been initialized, initializes it.
`static HTMLTable` | `prepareLayoutTable(HTMLTable table)` Prepares the specified table to be a layout table by clearing its cell padding, spacing and border.
`static void` | `removeListener(Element element, Object listenerId)` Unregisters a load listener from the specified element.
`static void` | `setAbsoluteBounds(Widget widget, int left, int top, int width, int height)` Makes the specified widget positioned absolutely and sets its bounds.
`static void` | `setAbsoluteBounds(Widget widget, RectangleView bounds)` Makes the specified widget positioned absolutely and sets its bounds.
`static void` | `setAbsoluteFullSize(Widget widget)` Sets the specified widget's position attribute to "absolute", its top and left attributes to "0px" and its width and height attributes to "100%".
`static void` | `setBounds(Element element, int left, int top, int width, int height)` Sets the "left", "top", "width" and "height" style attributes of the widget to the specified values, in pixels.
`static void` | `setBounds(Element element, RectangleView bounds)` Sets the bounds ("left", "top", "width" and "height" style attributes) of the specified element.
`static void` | `setBounds(Widget widget, int left, int top, int width, int height)` Sets the "left", "top", "width" and "height" style attributes of the widget to the specified values, in pixels.
`static void` | `setBounds(Widget widget, RectangleView bounds)` Sets the bounds ("left", "top", "width" and "height" style attributes) of the specified widget.
`static void` | `setContainingSize(AbsolutePanel panel)` Sets the bounds of the specified panel so that all of its widgets are within them (obviously, except those placed at negative coordinates).
`static void` | `setDataDirection(Widget widget)` Sets the direction of the specified widget to LTR.
`static void` | `setDelegate(com.maryanovsky.gwtutils.client.ui.UiUtils.Delegate delegate)` Sets the current delegate.
`static void` | `setElementId(Widget widget, String id)` Sets the id attribute of the specified widget's DOM element to the specified value.
`static void` | `setFullSize(Widget widget)` Sets the specified widget's top and left attributes to "0px" and its width and height attributes to "100%".
`static void` | `setGrabbingCursor(Widget widget)` Sets the "grabbing" cursor on the specified widget, if supported.
`static void` | `setGrabbingCursorUrl(String url)` Sets the grabbing cursor to the specified URL.
`static void` | `setGrabCursor(Widget widget)` Sets the "grab" cursor on the specified widget, if supported.
`static void` | `setGrabCursorUrl(String url)` Sets the grab cursor to the specified URL.
`static void` | `setGridRow(Grid grid, int row, List<? extends Widget> widgets)` Puts the specified widgets into the specified row in the grid, in language order.
`static void` | `setGridRow(Grid grid, int row, List<? extends Widget> widgets, List<HasVerticalAlignment.VerticalAlignmentConstant> vAlignments, List<HasHorizontalAlignment.HorizontalAlignmentConstant> hAlignments)` Puts the specified widgets into the specified row in the grid, in language order.
`static void` | `setLeadingMargin(Widget widget, int size)` Sets the margin leading the element, in the reading direction (left when in LTR, right when in RTL mode).
`static void` | `setOpacity(Widget widget, double opacity)` Sets the opacity of the specified widget to the specified value, where 0 stands for completely transparent and 1 for completely opaque.
`static void` | `setPosition(Element element, int left, int top)` Sets the "left" and "top" style attributes of the widget to the specified values, in pixels.
`static void` | `setPosition(Widget widget, int left, int top)` Sets the "left" and "top" style attributes of the widget to the specified values, in pixels.
`static void` | `setPosition(Widget widget, PointView position)` Sets the position of the widget to the specified one, in pixels.
`static void` | `setSize(Element element, int width, int height)` Sets the "width" and "height" attributes of the element to the specified values, in pixels.
`static void` | `setSize(Widget widget, int width, int height)` Sets the "width" and "height" style attributes of the widget to the specified values, in pixels.
`static void` | `setSize(Widget widget, SizeView size)` Sets the size of the widget to the specified one, in pixels.
`static void` | `setTextDirection(Widget widget)` Sets the direction of the specified widget to the direction of the application's language.
`static void` | `setTopLeft(Widget widget, int x, int y)` Sets the widget's position via the "top" and "left" style attributes.
`static void` | `setTopLeft(Widget widget, PointView point)` Sets the widget's position via the "top" and "left" style attributes.
`static void` | `setTrailingMargin(Widget widget, int size)` Sets the margin trailing the element, in the reading direction (right when in LTR, left when in RTL mode).
`static void` | `setTransform(Element element, String transform)` Applies the specified transform CSS property to the specified element.
`static void` | `setTransformOrigin(Element element, String origin)` Applies the specified transform-origin CSS property to the specified element.
`static void` | `setVisibility(Widget widget, boolean isVisible)` Sets the visibility of the specified widget.
`static void` | `setVisualWidth(Widget widget, GwtUiDefaults.WidgetElementType elementType, int width)` Sets the width of the specified widget so that its visual width is as specified.
`static void` | `setVisualWidth(Widget widget, int width)` Sets the width of the specified widget so that its visual width is as specified.
`static void` | `setZOrder(Widget[] widgets)` Sets the z-indices of the specified widgets to their indices in the specified array, making widgets with greater indices appear on top of widgets with smaller indices.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### LTR

    public static final com.maryanovsky.gwtutils.client.ui.UiUtils.Delegate LTR

  The delegate for left-to-right languages.

### RTL

    public static final com.maryanovsky.gwtutils.client.ui.UiUtils.Delegate RTL

  The delegate for right-to-left languages.

Constructor Detail

### UiUtils

    public UiUtils()

Method Detail

### setDelegate

    public static void setDelegate(com.maryanovsky.gwtutils.client.ui.UiUtils.Delegate delegate)

  Sets the current delegate. Possible values are `LTR` and `RTL`.

### makeLabelFor

    public static Label makeLabelFor(String text)

  Creates a label to be a label for some other element.

### setLeadingMargin

    public static void setLeadingMargin(Widget widget,
                                        int size)

  Sets the margin leading the element, in the reading direction (left when in LTR, right when in RTL mode).

### setTrailingMargin

    public static void setTrailingMargin(Widget widget,
                                         int size)

  Sets the margin trailing the element, in the reading direction (right when in LTR, left when in RTL mode).

### setGridRow

    public static void setGridRow(Grid grid,
                                  int row,
                                  List<? extends Widget> widgets)

  Puts the specified widgets into the specified row in the grid, in language order.

### setGridRow

    public static void setGridRow(Grid grid,
                                  int row,
                                  List<? extends Widget> widgets,
                                  List<HasVerticalAlignment.VerticalAlignmentConstant> vAlignments,
                                  List<HasHorizontalAlignment.HorizontalAlignmentConstant> hAlignments)

  Puts the specified widgets into the specified row in the grid, in language order. Additionally, the corresponding cells are set to the specified alignments (if the alignment values are non-`null`).

### addWidgets

    public static void addWidgets(HorizontalPanel panel,
                                  List<? extends Widget> widgets)

  Adds the specified widgets to the specified horizontal panel in reading order.

### addDialogButtons

    public static void addDialogButtons(HorizontalPanel panel,
                                        List<? extends Widget> buttons)

  Adds the specified dialog buttons to the specified panel. The order of the arguments should be consistent with MS Windows standards ("OK" first, "Cancel" second) when using an LTR language. The actual order in which the buttons will be placed depends on the current language and platform.

### getLeadingAlignment

    public static HasHorizontalAlignment.HorizontalAlignmentConstant getLeadingAlignment()

  Returns the alignment constant corresponding to the beginning of the line in reading order.

### getTrailingAlignment

    public static HasHorizontalAlignment.HorizontalAlignmentConstant getTrailingAlignment()

  Returns the alignment constant corresponding to the end of the line in reading order.

### setTextDirection

    public static void setTextDirection(Widget widget)

  Sets the direction of the specified widget to the direction of the application's language.

### setDataDirection

    public static void setDataDirection(Widget widget)

  Sets the direction of the specified widget to LTR.

### setVisualWidth

    public static void setVisualWidth(Widget widget,
                                      GwtUiDefaults.WidgetElementType elementType,
                                      int width)

  Sets the width of the specified widget so that its visual width is as specified.

### setVisualWidth

    public static void setVisualWidth(Widget widget,
                                      int width)

  Sets the width of the specified widget so that its visual width is as specified. This is different from `setVisualWidth(Widget, GwtUiDefaults.WidgetElementType, int)` in that it guesses the element type of the widget itself, but only works for standard GWT widgets.

### getHorizontalStrut

    public static Widget getHorizontalStrut(int width)

  Creates a horizontal spacer of the specified width.

### getVerticalStrut

    public static Widget getVerticalStrut(int height)

  Creates a vertical spacer of the specified height.

### getRigidArea

    public static Widget getRigidArea(int width,
                                      int height)

  Creates a spacer of the specified dimensions.

### getRelatedHorizontalStrut

    public static Widget getRelatedHorizontalStrut()

  Returns a horizontal spacer of with the size of the preferred distance between related elements.

### getUnrelatedHorizontalStrut

    public static Widget getUnrelatedHorizontalStrut()

  Returns a horizontal spacer of with the size of the preferred distance between unrelated elements.

### getRelatedVerticalStrut

    public static Widget getRelatedVerticalStrut()

  Returns a vertical spacer of with the size of the preferred distance between related elements.

### getUnrelatedVerticalStrut

    public static Widget getUnrelatedVerticalStrut()

  Returns a vertical spacer of with the size of the preferred distance between unrelated elements.

### setAbsoluteFullSize

    public static void setAbsoluteFullSize(Widget widget)

  Sets the specified widget's position attribute to "absolute", its top and left attributes to "0px" and its width and height attributes to "100%".

### setFullSize

    public static void setFullSize(Widget widget)

  Sets the specified widget's top and left attributes to "0px" and its width and height attributes to "100%".

### addFullSize

    public static void addFullSize(Panel panel,
                                   Widget widget)

  Adds the specified widget to the specified absolute panel and makes it occupy the panel fully.

### setAbsoluteBounds

    public static void setAbsoluteBounds(Widget widget,
                                         int left,
                                         int top,
                                         int width,
                                         int height)

  Makes the specified widget positioned absolutely and sets its bounds.

### setAbsoluteBounds

    public static void setAbsoluteBounds(Widget widget,
                                         RectangleView bounds)

  Makes the specified widget positioned absolutely and sets its bounds.

### setBounds

    public static void setBounds(Widget widget,
                                 int left,
                                 int top,
                                 int width,
                                 int height)

  Sets the "left", "top", "width" and "height" style attributes of the widget to the specified values, in pixels.

### setBounds

    public static void setBounds(Widget widget,
                                 RectangleView bounds)

  Sets the bounds ("left", "top", "width" and "height" style attributes) of the specified widget.

### setBounds

    public static void setBounds(Element element,
                                 RectangleView bounds)

  Sets the bounds ("left", "top", "width" and "height" style attributes) of the specified element.

### setBounds

    public static void setBounds(Element element,
                                 int left,
                                 int top,
                                 int width,
                                 int height)

  Sets the "left", "top", "width" and "height" style attributes of the widget to the specified values, in pixels.

### setSize

    public static void setSize(Widget widget,
                               int width,
                               int height)

  Sets the "width" and "height" style attributes of the widget to the specified values, in pixels.

### setSize

    public static void setSize(Element element,
                               int width,
                               int height)

  Sets the "width" and "height" attributes of the element to the specified values, in pixels.

### setSize

    public static void setSize(Widget widget,
                               SizeView size)

  Sets the size of the widget to the specified one, in pixels.

### setPosition

    public static void setPosition(Widget widget,
                                   int left,
                                   int top)

  Sets the "left" and "top" style attributes of the widget to the specified values, in pixels.

### setPosition

    public static void setPosition(Element element,
                                   int left,
                                   int top)

  Sets the "left" and "top" style attributes of the widget to the specified values, in pixels.

### setPosition

    public static void setPosition(Widget widget,
                                   PointView position)

  Sets the position of the widget to the specified one, in pixels.

### setContainingSize

    public static void setContainingSize(AbsolutePanel panel)

  Sets the bounds of the specified panel so that all of its widgets are within them (obviously, except those placed at negative coordinates).

### addInCorner

    public static void addInCorner(Panel panel,
                                   Widget widget,
                                   Alignment corner,
                                   SizeView offset)

  Adds the specified widget to the specified corner of the specified panel with the specified offset from the borders.

  Parameters:
    `panel` - The panel to add to.
    `widget` - The widget to place in a corner.
    `corner` - The corner to place the widget in. This must be one of the alignment constants which define a corner (not anything in the middle).
    `offset` - The offset, in pixels, from the borders.

### getTopLeft

    public static Point getTopLeft(Widget widget)

  Returns the top-left location of an absolutely positioned widget from its "top" and "left" style attributes. Note that this only works for absolutely positioned widgets.

### setTopLeft

    public static void setTopLeft(Widget widget,
                                  PointView point)

  Sets the widget's position via the "top" and "left" style attributes.

### setTopLeft

    public static void setTopLeft(Widget widget,
                                  int x,
                                  int y)

  Sets the widget's position via the "top" and "left" style attributes.

### getBoundsClient

    public static Rectangle getBoundsClient(Widget widget)

  Returns the bounds of the specified widget, in the client coordinate system.

### getWidgetSize

    public static Size getWidgetSize(Widget widget)

  Returns the size of the specified widget (offsetWidth, offsetHeight).

### getTargetCoordinates

    public static PointView getTargetCoordinates(Touch touch)

  Returns the location of the specified touch in the coordinate system of the target element.

### disableContextMenu

    public static void disableContextMenu(Element element)

  Disables the browser context menu for the specified element (and enables right-click detection). Note that this is not reliable across browsers (Opera, for example, doesn't care and still displays the context menu).

### setElementId

    public static void setElementId(Widget widget,
                                    String id)

  Sets the id attribute of the specified widget's DOM element to the specified value.

### getTagName

    public static String getTagName(Element element)

  Returns the tag name of the specified element.

### findElementsByTagName

    public static void findElementsByTagName(Element parent,
                                             String tagName,
                                             List<Element> list)

  Finds the children of the specified element whose tag name is the specified one, and adds them to the specified list. Tag name comparison is done in a case-insensitive manner.

### getPrimaryStyleName

    public static String getPrimaryStyleName(String fullStyleName)

  Returns the "primary" style name based on the specified full style name.

### getPrimaryStyleName

    public static String getPrimaryStyleName(Widget widget)

  Returns the "primary" style name of the specified widget.

### addDependentStyleName

    public static void addDependentStyleName(Widget widget,
                                             String styleSuffix)

  Adds a dependent style name to the specified widget. See UIObject.addStyleName(String) for a description of dependent styles.

  Parameters:
    `styleSuffix` - The suffix of the dependent style (not including the '-' separator).

### setVisibility

    public static void setVisibility(Widget widget,
                                     boolean isVisible)

  Sets the visibility of the specified widget. This is different from `UIObject.setVisible(boolean)` in that it uses the "visibility" CSS property, and not "display".

### getVisibility

    public static boolean getVisibility(Widget widget)

  Returns whether the specified widget's "visibility" CSS property is not set to "hidden" or "collapsed" or "inherit" and the parent's visibility is false.

### setZOrder

    public static void setZOrder(Widget[] widgets)

  Sets the z-indices of the specified widgets to their indices in the specified array, making widgets with greater indices appear on top of widgets with smaller indices.

### setOpacity

    public static void setOpacity(Widget widget,
                                  double opacity)

  Sets the opacity of the specified widget to the specified value, where 0 stands for completely transparent and 1 for completely opaque.

### setGrabCursorUrl

    public static void setGrabCursorUrl(String url)

  Sets the grab cursor to the specified URL. This will be used by `setGrabCursor(Widget)`.

### setGrabbingCursorUrl

    public static void setGrabbingCursorUrl(String url)

  Sets the grabbing cursor to the specified URL. This will be used by `setGrabbingCursor(Widget)`.

### setGrabCursor

    public static void setGrabCursor(Widget widget)

  Sets the "grab" cursor on the specified widget, if supported. You can set the cursor to be used via `setGrabCursorUrl(String)` or it will currently only work under Mozilla browsers.

### setGrabbingCursor

    public static void setGrabbingCursor(Widget widget)

  Sets the "grabbing" cursor on the specified widget, if supported. You can set the cursor to be used via `setGrabbingCursorUrl(String)` or it will currently only work under Mozilla browsers.

### extraImageCellHeightWorkaround

    public static void extraImageCellHeightWorkaround(Element tdElement)

  Fixes a strange problem with an image being placed in a table cell. The problem is that there are extra 4 pixels below the image. Known anomalies, if you want to try and fix it: - If a DIV is put instead of an image, it works fine. - It works fine in HTML Transitional, but not Strict. - The behaviour is not due to GWT or anything - a plain HTML table also behaves this way. Note that tdElement must be an actual TD element.

### extraImageCellHeightWorkaround

    public static void extraImageCellHeightWorkaround(Widget panel)

  Fixes the problem described by extraImageCellHeightWorkaround(Element) for every TD element of the specified panel.

### fillRow

    public static void fillRow(HTMLTable table,
                               int row,
                               int height)

  Fills the specified row of a table with vertical struts of the specified size. Note that the row must already exist.

### prepareLayoutTable

    public static HTMLTable prepareLayoutTable(HTMLTable table)

  Prepares the specified table to be a layout table by clearing its cell padding, spacing and border.

### handleAllMouseEvents

    public static <H extends MouseDownHandler & MouseUpHandler & MouseOutHandler & MouseOverHandler & MouseMoveHandler & MouseWheelHandler> HandlerRegistration handleAllMouseEvents(HasAllMouseHandlers source,
                                                                                                                                                                                H receiver)

  Adds the specified mouse event handler to the specified mouse event source and returns the proper registration. This method is needed because `HandlesAllMouseEvents.handle(HasAllMouseHandlers, MouseDownHandler)` doesn't bother to return a proper `HandlerRegistration`.

### addSizeChangeHandler

    public static HandlerRegistration addSizeChangeHandler(Widget widget,
                                                           ResizeHandler handler)

  Attempts to track changes in the size of the specified widget and notify the specified change listener. Note that there isn't much we can actually do to get notified when the size changes - what we do is listen to size changes of the containing window, and look if the size of the widget changed as well. It's not good, but it's better than nothing.

### cancelCurrentEvent

    public static void cancelCurrentEvent()

  Cancels processing of the current event by stopping its propagation and preventing the default action from occurring.

### cancelEvent

    public static void cancelEvent(NativeEvent evt)

  Cancels processing of the specified event by stopping its propagation and preventing the default action from occurring.

### cancelEvent

    public static <H extends EventHandler> void cancelEvent(DomEvent<H> evt)

  Cancels the processing of the specified `DomEvent` by stopping its propagation and preventing the default action from occurring.

### makeDraggable

    public static Object makeDraggable(Widget widget,
                                       HasAllMouseHandlers dragHandle,
                                       HandlesAllDragEvents handler)

  Makes the specified widget draggable via the specified drag handle. The dragging will also be reported to the specified drag handler, if not `null`, with all parameters passed being relative to the parent of the dragged widget. That is, the drag target widget will be the parent and the pressed point and offset will be relative to the parent. You may make the widget un-draggable again by passing the return value to disableDragging(Object).

### disableDragging

    public static void disableDragging(Object dragTracker)

  Makes the specified widget un-draggable, after it was made draggable with makeDraggable(Widget, HasAllMouseHandlers, HandlesAllDragEvents).

  Parameters:
    `dragTracker` - The object returned by `makeDraggable`.

### applyPngHack

    public static void applyPngHack(Image image,
                                    String url,
                                    Size size)

  Applies the IE PNG hack to the specified image. When using the PNG hack, never call `Image.setUrl(String)` directly; always use this method instead. Also, using `Image.getUrl()` on a PNG-hacked image will not return the expected URL. You don't have to, but are advised to specify the image's size - the PNG hack is only 100% reliable if you do.

  Parameters:
    `image` - The image to apply the PNG hack to.
    `url` - The URL of the PNG image.
    `size` - The size of the image; may be `null`.

### getPngHackedImageHtml

    public static String getPngHackedImageHtml(String url,
                                               Size size)

  Returns the HTML for an image at the specified URL with the PNG hack applied to it. You don't have to, but are advised to specify the image's size - the PNG hack is only 100% reliable if you do.

### maybeInitializeEventSystem

    public static void maybeInitializeEventSystem()

  If the event system has not yet been initialized, initializes it.

### isNativeMouseButton

    public static boolean isNativeMouseButton(int button)

  Returns whether the specified value is one of `NativeEvent.BUTTON_LEFT`, `NativeEvent.BUTTON_MIDDLE` or `NativeEvent.BUTTON_RIGHT`.

### isAncestorOf

    public static boolean isAncestorOf(Widget ancestor,
                                       Widget widget)

  Returns whether `ancestor` is an ancestor of the specified widget.

### setTransform

    public static void setTransform(Element element,
                                    String transform)

  Applies the specified transform CSS property to the specified element. This is needed because currently different browsers have different names for the property. Note that IE doesn't currently implement it at all.

### setTransformOrigin

    public static void setTransformOrigin(Element element,
                                          String origin)

  Applies the specified transform-origin CSS property to the specified element. This is needed because currently different browsers have different names for the property. Note that IE doesn't currently implement it at all.

### addLoadListener

    public static Object addLoadListener(Element element,
                                         Callback<Element> callback)

  Registers a load listener for the specified element which will invoke the specified callback with the element. Returns an object which may be passed to

### removeListener

    public static void removeListener(Element element,
                                      Object listenerId)

  Unregisters a load listener from the specified element. The listenerId argument should be the object returned by `addLoadListener(com.google.gwt.dom.client.Element, Callback)`.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD