public class DOMUtil
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static boolean |
DEBUG
Whether or not debugging is enabled.
|
Constructor and Description |
---|
DOMUtil() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
adjustTitleForBrowser(java.lang.String title)
Adjust line breaks within in the provided title for optimal readability and display length for
the current user agent.
|
static void |
cancelAllDocumentSelections()
Cancel all currently selected region(s) on the current page.
|
static com.google.gwt.dom.client.NativeEvent |
createTouchEndEvent(boolean bubbles,
boolean cancelable,
int detail,
boolean ctrlKey,
boolean altKey,
boolean shiftKey,
boolean metaKey,
com.google.gwt.core.client.JsArray<com.google.gwt.dom.client.Touch> changedTouches) |
static void |
debugWidgetWithColor(com.google.gwt.user.client.ui.Widget widget,
java.lang.String color)
Set a widget's border style for debugging purposes.
|
static void |
fastSetElementPosition(com.google.gwt.dom.client.Element elem,
int left,
int top)
Set an element's location as fast as possible, avoiding some of the overhead in
AbsolutePanel.setWidgetPosition(Widget, int, int) . |
static int |
findIntersect(com.google.gwt.user.client.ui.IndexedPanel parent,
Location location,
LocationWidgetComparator comparator)
Find child widget intersection at the provided location using the provided comparator strategy.
|
static int |
getBorderLeft(com.google.gwt.dom.client.Element elem)
Gets an element's CSS based 'border-left-width' in pixels or
0 (zero) when the
element is hidden. |
static int |
getBorderTop(com.google.gwt.dom.client.Element elem)
Gets an element's CSS based 'border-top-widget' in pixels or
0 (zero) when the
element is hidden. |
static int |
getClientHeight(com.google.gwt.dom.client.Element elem)
Gets an element's client height in pixels or
0 (zero) when the element is hidden. |
static int |
getClientWidth(com.google.gwt.dom.client.Element elem)
Gets an element's client widget in pixels or
0 (zero) when the element is hidden. |
static java.lang.String |
getEffectiveStyle(com.google.gwt.dom.client.Element elem,
java.lang.String styleName) |
static int |
getHorizontalBorders(com.google.gwt.user.client.ui.Widget widget)
Gets the sum of an element's left and right CSS borders in pixels.
|
static java.lang.String |
getNodeName(com.google.gwt.dom.client.Element elem)
Determine an element's node name via the
nodeName property. |
static int |
getVerticalBorders(com.google.gwt.user.client.ui.Widget widget)
Gets the sum of an element's top and bottom CSS borders in pixels.
|
static boolean |
isRtl(com.google.gwt.user.client.ui.Widget widget) |
static void |
reportFatalAndThrowRuntimeException(java.lang.String msg)
Report a fatal exception via
Window.alert() than throw a
RuntimeException . |
static void |
setStatus(java.lang.String text)
Set the browser's status bar text, if supported and enabled in the client browser.
|
public static final boolean DEBUG
public static java.lang.String adjustTitleForBrowser(java.lang.String title)
title
- the desired raw textpublic static void cancelAllDocumentSelections()
public static void debugWidgetWithColor(com.google.gwt.user.client.ui.Widget widget, java.lang.String color)
widget
- the widget to colorcolor
- the desired border colorpublic static void fastSetElementPosition(com.google.gwt.dom.client.Element elem, int left, int top)
AbsolutePanel.setWidgetPosition(Widget, int, int)
.elem
- the element's whose position is to be modifiedleft
- the left pixel offsettop
- the top pixel offsetpublic static int findIntersect(com.google.gwt.user.client.ui.IndexedPanel parent, Location location, LocationWidgetComparator comparator)
parent
- the parent widget which contains the children to be comparedlocation
- the location of the intersectioncomparator
- the comparator strategypublic static boolean isRtl(com.google.gwt.user.client.ui.Widget widget)
public static int getBorderLeft(com.google.gwt.dom.client.Element elem)
0
(zero) when the
element is hidden.elem
- the element to be measuredpublic static int getBorderTop(com.google.gwt.dom.client.Element elem)
0
(zero) when the
element is hidden.elem
- the element to be measuredpublic static int getClientHeight(com.google.gwt.dom.client.Element elem)
0
(zero) when the element is hidden.
This is equal to offset height minus the top and bottom CSS borders.elem
- the element to be measuredpublic static int getClientWidth(com.google.gwt.dom.client.Element elem)
0
(zero) when the element is hidden.
This is equal to offset width minus the left and right CSS borders.elem
- the element to be measuredpublic static java.lang.String getEffectiveStyle(com.google.gwt.dom.client.Element elem, java.lang.String styleName)
public static int getHorizontalBorders(com.google.gwt.user.client.ui.Widget widget)
widget
- the widget to be measuredpublic static java.lang.String getNodeName(com.google.gwt.dom.client.Element elem)
nodeName
property.elem
- the element whose node name is to be determinedpublic static int getVerticalBorders(com.google.gwt.user.client.ui.Widget widget)
widget
- the widget to be measuredpublic static void reportFatalAndThrowRuntimeException(java.lang.String msg) throws java.lang.RuntimeException
Window.alert()
than throw a
RuntimeException
.msg
- the message to reportjava.lang.RuntimeException
- a new exception based on the provided messagepublic static void setStatus(java.lang.String text)
text
- the message to use as the window statuspublic static com.google.gwt.dom.client.NativeEvent createTouchEndEvent(boolean bubbles, boolean cancelable, int detail, boolean ctrlKey, boolean altKey, boolean shiftKey, boolean metaKey, com.google.gwt.core.client.JsArray<com.google.gwt.dom.client.Touch> changedTouches)