Package com.vaadin.client
Class Util
- java.lang.Object
-
- com.vaadin.client.Util
-
public class Util extends Object
-
-
Constructor Summary
Constructors Constructor Description Util()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static void
alert(String string)
Deprecated.As of 7.4.0, useWidgetUtil.alert(String)
instead.static void
browserDebugger()
Deprecated.As of 7.4.0, useWidgetUtil.browserDebugger()
instead.static com.google.gwt.user.client.Element
cloneNode(com.google.gwt.dom.client.Element element, boolean deep)
Deprecated.As of 7.4.0, useWidgetUtil.cloneNode(Element, boolean)
instead.static boolean
collectionsEquals(Collection<?> collection1, Collection<?> collection2)
Performs a shallow comparison of the collections.static void
detachAttach(com.google.gwt.dom.client.Element element)
Deprecated.As of 7.4.0, useWidgetUtil.detachAttach(Element)
instead.static boolean
equals(Object a, Object b)
Deprecated.As of 7.1 useObject.equals(Object)
insteadstatic String
escapeAttribute(String attribute)
Deprecated.As of 7.4.0, useWidgetUtil.escapeAttribute(String)
instead.static String
escapeHTML(String html)
Deprecated.As of 7.4.0, useWidgetUtil.escapeHTML(String)
instead.static ComponentConnector
findConnectorFor(com.google.gwt.user.client.ui.Widget widget)
static ComponentConnector
findPaintable(ApplicationConnection client, com.google.gwt.dom.client.Element element)
Helper method to find the nearest parent paintable instance by traversing the DOM upwards from given element.static <T> T
findWidget(com.google.gwt.dom.client.Element element, Class<? extends com.google.gwt.user.client.ui.Widget> class1)
Deprecated.As of 7.4.0, useWidgetUtil.findWidget(Element, Class)
instead.static void
focus(com.google.gwt.dom.client.Element el)
Deprecated.As of 7.4.0, useWidgetUtil.focus(Element)
instead.static void
forceIE8Redraw(com.google.gwt.dom.client.Element e)
Deprecated.As of 7.4.0, useWidgetUtil.forceIE8Redraw(Element)
instead.static void
forceIERedraw(com.google.gwt.dom.client.Element e)
Deprecated.As of 7.4.0, useWidgetUtil.forceIERedraw(Element)
instead.static void
forceWebkitRedraw(com.google.gwt.dom.client.Element element)
Deprecated.As of 7.4.0, useWidgetUtil.forceWebkitRedraw(Element)
instead.static String
getAbsoluteUrl(String url)
Deprecated.As of 7.4.0, useWidgetUtil.getAbsoluteUrl(String)
instead.static int
getChildElementIndex(com.google.gwt.dom.client.Element childElement)
Deprecated.As of 7.4.0, useWidgetUtil.getChildElementIndex(Element)
instead.static ComponentConnector
getConnectorForElement(ApplicationConnection client, com.google.gwt.user.client.ui.Widget parent, com.google.gwt.dom.client.Element element)
Locates the nested child component ofparent which contains the elementelement .static String
getConnectorString(ServerConnector p)
static com.google.gwt.user.client.Element
getElementFromPoint(int clientX, int clientY)
Deprecated.As of 7.4.0, useWidgetUtil.getElementFromPoint(int, int)
instead.static com.google.gwt.user.client.Element
getElementUnderMouse(com.google.gwt.dom.client.NativeEvent event)
Deprecated.As of 7.4.0, useWidgetUtil.getElementUnderMouse(NativeEvent)
instead.static com.google.gwt.user.client.Element
getFocusedElement()
Deprecated.As of 7.4.0, useWidgetUtil.getFocusedElement()
instead.static com.google.gwt.user.client.Element
getIEFocusedElement()
Deprecated.Use #getFocusedElement insteadstatic int
getKeyCode(com.google.gwt.event.dom.client.KeyEvent<?> event)
Deprecated.As of 7.4.0, useWidgetUtil.getKeyCode(KeyEvent)
instead.static int
getNativeScrollbarSize()
Deprecated.As of 7.4.0, useWidgetUtil.getNativeScrollbarSize()
instead.static int
getRequiredHeight(com.google.gwt.dom.client.Element element)
Deprecated.As of 7.4.0, useWidgetUtil.getRequiredHeight(Element)
instead.static int
getRequiredHeight(com.google.gwt.user.client.ui.Widget widget)
Deprecated.As of 7.4.0, useWidgetUtil.getRequiredHeight(Widget)
instead.static int
getRequiredHeightBoundingClientRect(com.google.gwt.dom.client.Element element)
Deprecated.As of 7.4.0, useWidgetUtil.getRequiredHeightBoundingClientRect(Element)
instead.static int
getRequiredHeightComputedStyle(com.google.gwt.dom.client.Element element)
Deprecated.As of 7.4.0, useWidgetUtil.getRequiredHeightComputedStyle(Element)
instead.static int
getRequiredWidth(com.google.gwt.dom.client.Element element)
Deprecated.As of 7.4.0, useWidgetUtil.getRequiredWidth(Element)
instead.static int
getRequiredWidth(com.google.gwt.user.client.ui.Widget widget)
Deprecated.As of 7.4.0, useWidgetUtil.getRequiredWidth(Widget)
instead.int
getRequiredWidthBoundingClientRect(com.google.gwt.dom.client.Element element)
Deprecated.As of 7.4.0, useWidgetUtil.getRequiredWidthBoundingClientRect(Element)
instead.static int
getRequiredWidthComputedStyle(com.google.gwt.dom.client.Element element)
Deprecated.As of 7.4.0, useWidgetUtil.getRequiredWidthComputedStyle(Element)
instead.static String
getSimpleName(Object widget)
Deprecated.As of 7.4, useClass.getSimpleName()
instead.static int
getTouchOrMouseClientX(com.google.gwt.dom.client.NativeEvent event)
Deprecated.As of 7.4.0, useWidgetUtil.getTouchOrMouseClientX(NativeEvent)
instead.static int
getTouchOrMouseClientX(com.google.gwt.user.client.Event event)
Deprecated.As of 7.4.0, useWidgetUtil.getTouchOrMouseClientX(Event)
instead.static int
getTouchOrMouseClientY(com.google.gwt.dom.client.NativeEvent currentGwtEvent)
Deprecated.As of 7.4.0, useWidgetUtil.getTouchOrMouseClientY(NativeEvent)
instead.static int
getTouchOrMouseClientY(com.google.gwt.user.client.Event event)
Deprecated.As of 7.4.0, useWidgetUtil.getTouchOrMouseClientY(Event)
instead.static boolean
isAttachedAndDisplayed(com.google.gwt.user.client.ui.Widget widget)
Deprecated.As of 7.4.0, useWidgetUtil.isAttachedAndDisplayed(Widget)
instead.static boolean
isCached(UIDL uidl)
Deprecated.static boolean
isFocusedElementEditable()
Deprecated.As of 7.4.0, useWidgetUtil.isFocusedElementEditable()
instead.static boolean
isTouchEvent(com.google.gwt.dom.client.NativeEvent event)
Deprecated.As of 7.4.0, useWidgetUtil.isTouchEvent(NativeEvent)
instead.static boolean
isTouchEvent(com.google.gwt.user.client.Event event)
Deprecated.As of 7.4.0, useWidgetUtil.isTouchEvent(Event)
instead.static boolean
isTouchEventOrLeftMouseButton(com.google.gwt.user.client.Event event)
Deprecated.As of 7.4.0, useWidgetUtil.isTouchEventOrLeftMouseButton(Event)
instead.static <T extends JsonValue>
Tjso2json(com.google.gwt.core.client.JavaScriptObject jso)
Converts a nativeJavaScriptObject
into aJsonValue
.static com.google.gwt.core.client.JavaScriptObject
json2jso(JsonValue jsonValue)
Converts aJsonValue
into a nativeJavaScriptObject
.static void
logMethodInvocations(ApplicationConnection c, Collection<MethodInvocation> methodInvocations)
static boolean
mayHaveScrollBars(com.google.gwt.dom.client.Element pe)
Deprecated.As of 7.4.0, useWidgetUtil.mayHaveScrollBars(Element)
instead.static int
measureHorizontalBorder(com.google.gwt.dom.client.Element element)
Deprecated.As of 7.4.0, useWidgetUtil.measureHorizontalBorder(Element)
instead.static int
measureHorizontalPaddingAndBorder(com.google.gwt.dom.client.Element element, int paddingGuess)
Deprecated.As of 7.4.0, useWidgetUtil.measureHorizontalPaddingAndBorder(Element, int)
instead.static int
measureMarginLeft(com.google.gwt.dom.client.Element element)
Deprecated.As of 7.4.0, useWidgetUtil.measureMarginLeft(Element)
instead.static int
measureVerticalBorder(com.google.gwt.dom.client.Element element)
Deprecated.As of 7.4.0, useWidgetUtil.measureVerticalBorder(Element)
instead.static int
measureVerticalPaddingAndBorder(com.google.gwt.dom.client.Element element, int paddingGuess)
Deprecated.As of 7.4.0, useWidgetUtil.measureVerticalPaddingAndBorder(Element, int)
instead.static void
notifyParentOfSizeChange(com.google.gwt.user.client.ui.Widget widget, boolean lazy)
Deprecated.As of 7.0, useLayoutManager.setNeedsMeasure(ComponentConnector)
insteadstatic <T extends com.google.gwt.core.client.JavaScriptObject>
Tparse(String jsonAsString)
Parse a string containing JSON into aJavaScriptObject
.static RenderInformation.FloatSize
parseRelativeSize(AbstractComponentState state)
Parses shared state and fetches the relative size of the component.static float
parseRelativeSize(String size)
Deprecated.As of 7.4.0, useWidgetUtil.parseRelativeSize(String)
instead.static double
round(double num, int exp)
Roundnum
up toexp
decimal positions.static void
runWebkitOverflowAutoFix(com.google.gwt.dom.client.Element elem)
Deprecated.As of 7.4.0, useWidgetUtil.runWebkitOverflowAutoFix(Element)
instead.static void
runWebkitOverflowAutoFixDeferred(com.google.gwt.dom.client.Element elem)
Deprecated.As of 7.4.0, useWidgetUtil.runWebkitOverflowAutoFixDeferred(Element)
instead.static void
scrollIntoViewVertically(com.google.gwt.dom.client.Element elem)
Deprecated.As of 7.4.0, useWidgetUtil.scrollIntoViewVertically(Element)
instead.static void
setFloat(com.google.gwt.dom.client.Element element, String value)
Deprecated.As of 7.4.0, useWidgetUtil.setFloat(Element, String)
instead.static int
setHeightExcludingPaddingAndBorder(com.google.gwt.dom.client.Element element, int requestedHeight, int verticalPaddingBorderGuess, boolean requestedHeightIncludesPaddingBorder)
Deprecated.As of 7.4.0, useWidgetUtil.setHeightExcludingPaddingAndBorder(Element, int, int, boolean)
instead.static int
setHeightExcludingPaddingAndBorder(com.google.gwt.user.client.ui.Widget widget, String height, int paddingBorderGuess)
Deprecated.As of 7.4.0, useWidgetUtil.setHeightExcludingPaddingAndBorder(Widget, String, int)
instead.static void
setSelectionRange(com.google.gwt.dom.client.Element elem, int pos, int length, String direction)
Deprecated.As of 7.4.0, useWidgetUtil.setSelectionRange(Element, int, int, String)
instead.static void
setStyleTemporarily(com.google.gwt.dom.client.Element element, String styleProperty, String tempValue)
Deprecated.As of 7.4.0, useWidgetUtil.setStyleTemporarily(Element, String, String)
instead.static int
setWidthExcludingPaddingAndBorder(com.google.gwt.dom.client.Element element, int requestedWidth, int horizontalPaddingBorderGuess, boolean requestedWidthIncludesPaddingBorder)
Deprecated.As of 7.4.0, useWidgetUtil.setWidthExcludingPaddingAndBorder(Element, int, int, boolean)
instead.static int
setWidthExcludingPaddingAndBorder(com.google.gwt.user.client.ui.Widget widget, String width, int paddingBorderGuess)
Deprecated.As of 7.4.0, useWidgetUtil.setWidthExcludingPaddingAndBorder(Widget, String, int)
instead.static boolean
shouldSkipMeasurementOfConnector(ComponentConnector candidate)
Test if we can can skip measuring this connector.static boolean
shouldSkipMeasurementOfConnector(ComponentConnector candidate, ComponentConnector parent)
Test if we can can skip measuring this connector.static void
simulateClickFromTouchEvent(com.google.gwt.user.client.Event touchevent, com.google.gwt.user.client.ui.Widget widget)
Deprecated.As of 7.4.0, useWidgetUtil.simulateClickFromTouchEvent(Event, Widget)
instead.static void
sinkOnloadForImages(com.google.gwt.dom.client.Element element)
Deprecated.As of 7.4.0, useWidgetUtil.sinkOnloadForImages(Element)
instead.static void
updateRelativeChildrenAndSendSizeUpdateEvent(ApplicationConnection client, com.google.gwt.user.client.ui.HasWidgets container, com.google.gwt.user.client.ui.Widget widget)
-
-
-
Method Detail
-
browserDebugger
@Deprecated public static void browserDebugger()
Deprecated.As of 7.4.0, useWidgetUtil.browserDebugger()
instead.Helper method for debugging purposes. Stops execution on firefox browsers on a breakpoint.
-
getKeyCode
@Deprecated public static int getKeyCode(com.google.gwt.event.dom.client.KeyEvent<?> event)
Deprecated.As of 7.4.0, useWidgetUtil.getKeyCode(KeyEvent)
instead.Helper method for a bug fix #14041. For mozilla getKeyCode return 0 for space bar (because space is considered as char). If return 0 use getCharCode.- Parameters:
event
-- Returns:
- return key code
- Since:
- 7.2.4
-
getElementFromPoint
@Deprecated public static com.google.gwt.user.client.Element getElementFromPoint(int clientX, int clientY)
Deprecated.As of 7.4.0, useWidgetUtil.getElementFromPoint(int, int)
instead.Returns the topmost element of from given coordinates. TODO fix crossplat issues clientX vs pageX. See quircksmode. Not critical for vaadin as we scroll div istead of page.- Parameters:
x
-y
-- Returns:
- the element at given coordinates
-
notifyParentOfSizeChange
@Deprecated public static void notifyParentOfSizeChange(com.google.gwt.user.client.ui.Widget widget, boolean lazy)
Deprecated.As of 7.0, useLayoutManager.setNeedsMeasure(ComponentConnector)
insteadThis helper method can be called if components size have been changed outside rendering phase. It notifies components parent about the size change so it can react. When using this method, developer should consider if size changes could be notified lazily. If lazy flag is true, method will save widget and wait for a moment until it notifies parents in chunks. This may vastly optimize layout in various situation. Example: if component have a lot of images their onload events may fire "layout phase" many times in a short period.- Parameters:
widget
-lazy
- run componentSizeUpdated lazyly
-
findConnectorFor
public static ComponentConnector findConnectorFor(com.google.gwt.user.client.ui.Widget widget)
-
parseRelativeSize
@Deprecated public static float parseRelativeSize(String size)
Deprecated.As of 7.4.0, useWidgetUtil.parseRelativeSize(String)
instead.
-
escapeHTML
@Deprecated public static String escapeHTML(String html)
Deprecated.As of 7.4.0, useWidgetUtil.escapeHTML(String)
instead.Converts html entities to text.- Parameters:
html
-- Returns:
- escaped string presentation of given html
-
escapeAttribute
@Deprecated public static String escapeAttribute(String attribute)
Deprecated.As of 7.4.0, useWidgetUtil.escapeAttribute(String)
instead.Escapes the string so it is safe to write inside an HTML attribute.- Parameters:
attribute
- The string to escape- Returns:
- An escaped version of
attribute .
-
cloneNode
@Deprecated public static com.google.gwt.user.client.Element cloneNode(com.google.gwt.dom.client.Element element, boolean deep)
Deprecated.As of 7.4.0, useWidgetUtil.cloneNode(Element, boolean)
instead.Clones given element as in JavaScript. Deprecate this if there appears similar method into GWT someday.- Parameters:
element
-deep
- clone child tree also- Returns:
-
measureHorizontalPaddingAndBorder
@Deprecated public static int measureHorizontalPaddingAndBorder(com.google.gwt.dom.client.Element element, int paddingGuess)
Deprecated.As of 7.4.0, useWidgetUtil.measureHorizontalPaddingAndBorder(Element, int)
instead.
-
measureVerticalPaddingAndBorder
@Deprecated public static int measureVerticalPaddingAndBorder(com.google.gwt.dom.client.Element element, int paddingGuess)
Deprecated.As of 7.4.0, useWidgetUtil.measureVerticalPaddingAndBorder(Element, int)
instead.
-
measureHorizontalBorder
@Deprecated public static int measureHorizontalBorder(com.google.gwt.dom.client.Element element)
Deprecated.As of 7.4.0, useWidgetUtil.measureHorizontalBorder(Element)
instead.
-
measureVerticalBorder
@Deprecated public static int measureVerticalBorder(com.google.gwt.dom.client.Element element)
Deprecated.As of 7.4.0, useWidgetUtil.measureVerticalBorder(Element)
instead.
-
measureMarginLeft
@Deprecated public static int measureMarginLeft(com.google.gwt.dom.client.Element element)
Deprecated.As of 7.4.0, useWidgetUtil.measureMarginLeft(Element)
instead.
-
setHeightExcludingPaddingAndBorder
@Deprecated public static int setHeightExcludingPaddingAndBorder(com.google.gwt.user.client.ui.Widget widget, String height, int paddingBorderGuess)
Deprecated.As of 7.4.0, useWidgetUtil.setHeightExcludingPaddingAndBorder(Widget, String, int)
instead.
-
setWidthExcludingPaddingAndBorder
@Deprecated public static int setWidthExcludingPaddingAndBorder(com.google.gwt.user.client.ui.Widget widget, String width, int paddingBorderGuess)
Deprecated.As of 7.4.0, useWidgetUtil.setWidthExcludingPaddingAndBorder(Widget, String, int)
instead.
-
setWidthExcludingPaddingAndBorder
@Deprecated public static int setWidthExcludingPaddingAndBorder(com.google.gwt.dom.client.Element element, int requestedWidth, int horizontalPaddingBorderGuess, boolean requestedWidthIncludesPaddingBorder)
Deprecated.As of 7.4.0, useWidgetUtil.setWidthExcludingPaddingAndBorder(Element, int, int, boolean)
instead.
-
setHeightExcludingPaddingAndBorder
@Deprecated public static int setHeightExcludingPaddingAndBorder(com.google.gwt.dom.client.Element element, int requestedHeight, int verticalPaddingBorderGuess, boolean requestedHeightIncludesPaddingBorder)
Deprecated.As of 7.4.0, useWidgetUtil.setHeightExcludingPaddingAndBorder(Element, int, int, boolean)
instead.
-
getSimpleName
@Deprecated public static String getSimpleName(Object widget)
Deprecated.As of 7.4, useClass.getSimpleName()
instead.
-
setFloat
@Deprecated public static void setFloat(com.google.gwt.dom.client.Element element, String value)
Deprecated.As of 7.4.0, useWidgetUtil.setFloat(Element, String)
instead.
-
getNativeScrollbarSize
@Deprecated public static int getNativeScrollbarSize()
Deprecated.As of 7.4.0, useWidgetUtil.getNativeScrollbarSize()
instead.
-
runWebkitOverflowAutoFixDeferred
@Deprecated public static void runWebkitOverflowAutoFixDeferred(com.google.gwt.dom.client.Element elem)
Deprecated.As of 7.4.0, useWidgetUtil.runWebkitOverflowAutoFixDeferred(Element)
instead.Defers the execution ofrunWebkitOverflowAutoFix(Element)
- Parameters:
elem
- with overflow auto- Since:
- 7.2.6
-
runWebkitOverflowAutoFix
@Deprecated public static void runWebkitOverflowAutoFix(com.google.gwt.dom.client.Element elem)
Deprecated.As of 7.4.0, useWidgetUtil.runWebkitOverflowAutoFix(Element)
instead.Run workaround for webkits overflow auto issue. See: our bug #2138 and https://bugs.webkit.org/show_bug.cgi?id=21462- Parameters:
elem
- with overflow auto
-
parseRelativeSize
public static RenderInformation.FloatSize parseRelativeSize(AbstractComponentState state)
Parses shared state and fetches the relative size of the component. If a dimension is not specified as relative it will return -1. If the shared state does not contain width or height specifications this will return null.- Parameters:
state
-- Returns:
-
isCached
@Deprecated public static boolean isCached(UIDL uidl)
Deprecated.
-
alert
@Deprecated public static void alert(String string)
Deprecated.As of 7.4.0, useWidgetUtil.alert(String)
instead.
-
equals
@Deprecated public static boolean equals(Object a, Object b)
Deprecated.As of 7.1 useObject.equals(Object)
insteadChecks if a and b are equals usingObject.equals(Object)
. Handles null values as well. Does not ensure that objects are of the same type. Assumes that the first object's equals method handle equals properly.- Parameters:
a
- The first value to compareb
- The second value to compare- Returns:
-
updateRelativeChildrenAndSendSizeUpdateEvent
public static void updateRelativeChildrenAndSendSizeUpdateEvent(ApplicationConnection client, com.google.gwt.user.client.ui.HasWidgets container, com.google.gwt.user.client.ui.Widget widget)
-
getRequiredWidth
@Deprecated public static int getRequiredWidth(com.google.gwt.dom.client.Element element)
Deprecated.As of 7.4.0, useWidgetUtil.getRequiredWidth(Element)
instead.Gets the border-box width for the given element, i.e. element width + border + padding. Always rounds up to nearest integer.- Parameters:
element
- The element to check- Returns:
- The border-box width for the element
-
getRequiredHeight
@Deprecated public static int getRequiredHeight(com.google.gwt.dom.client.Element element)
Deprecated.As of 7.4.0, useWidgetUtil.getRequiredHeight(Element)
instead.Gets the border-box height for the given element, i.e. element height + border + padding. Always rounds up to nearest integer.- Parameters:
element
- The element to check- Returns:
- The border-box height for the element
-
getRequiredWidthBoundingClientRect
@Deprecated public int getRequiredWidthBoundingClientRect(com.google.gwt.dom.client.Element element)
Deprecated.As of 7.4.0, useWidgetUtil.getRequiredWidthBoundingClientRect(Element)
instead.
-
getRequiredHeightComputedStyle
@Deprecated public static int getRequiredHeightComputedStyle(com.google.gwt.dom.client.Element element)
Deprecated.As of 7.4.0, useWidgetUtil.getRequiredHeightComputedStyle(Element)
instead.
-
getRequiredWidthComputedStyle
@Deprecated public static int getRequiredWidthComputedStyle(com.google.gwt.dom.client.Element element)
Deprecated.As of 7.4.0, useWidgetUtil.getRequiredWidthComputedStyle(Element)
instead.
-
getRequiredHeightBoundingClientRect
@Deprecated public static int getRequiredHeightBoundingClientRect(com.google.gwt.dom.client.Element element)
Deprecated.As of 7.4.0, useWidgetUtil.getRequiredHeightBoundingClientRect(Element)
instead.
-
getRequiredWidth
@Deprecated public static int getRequiredWidth(com.google.gwt.user.client.ui.Widget widget)
Deprecated.As of 7.4.0, useWidgetUtil.getRequiredWidth(Widget)
instead.
-
getRequiredHeight
@Deprecated public static int getRequiredHeight(com.google.gwt.user.client.ui.Widget widget)
Deprecated.As of 7.4.0, useWidgetUtil.getRequiredHeight(Widget)
instead.
-
mayHaveScrollBars
@Deprecated public static boolean mayHaveScrollBars(com.google.gwt.dom.client.Element pe)
Deprecated.As of 7.4.0, useWidgetUtil.mayHaveScrollBars(Element)
instead.Detects what is currently the overflow style attribute in given element.- Parameters:
pe
- the element to detect- Returns:
- true if auto or scroll
-
getConnectorForElement
public static ComponentConnector getConnectorForElement(ApplicationConnection client, com.google.gwt.user.client.ui.Widget parent, com.google.gwt.dom.client.Element element)
Locates the nested child component ofparent which contains the elementelement . The child component is also returned if "element" is part of its caption. Ifelement is not part of any child component, null is returned. This method returns the deepest nested VPaintableWidget.- Parameters:
client
- A reference to ApplicationConnectionparent
- The widget that containselement .element
- An element that is a sub element of the parent- Returns:
- The VPaintableWidget which the element is a part of. Null if the element does not belong to a child.
-
focus
@Deprecated public static void focus(com.google.gwt.dom.client.Element el)
Deprecated.As of 7.4.0, useWidgetUtil.focus(Element)
instead.Will (attempt) to focus the given DOM Element.- Parameters:
el
- the element to focus
-
findPaintable
public static ComponentConnector findPaintable(ApplicationConnection client, com.google.gwt.dom.client.Element element)
Helper method to find the nearest parent paintable instance by traversing the DOM upwards from given element.- Parameters:
element
- the element to start from
-
findWidget
@Deprecated public static <T> T findWidget(com.google.gwt.dom.client.Element element, Class<? extends com.google.gwt.user.client.ui.Widget> class1)
Deprecated.As of 7.4.0, useWidgetUtil.findWidget(Element, Class)
instead.Helper method to find first instance of given Widget type found by traversing DOM upwards from given element.- Parameters:
element
- the element where to start seeking of Widgetclass1
- the Widget type to seek for
-
forceWebkitRedraw
@Deprecated public static void forceWebkitRedraw(com.google.gwt.dom.client.Element element)
Deprecated.As of 7.4.0, useWidgetUtil.forceWebkitRedraw(Element)
instead.Force webkit to redraw an element- Parameters:
element
- The element that should be redrawn
-
forceIE8Redraw
@Deprecated public static final void forceIE8Redraw(com.google.gwt.dom.client.Element e)
Deprecated.As of 7.4.0, useWidgetUtil.forceIE8Redraw(Element)
instead.Performs a hack to trigger a re-layout in the IE8. This is usually necessary in cases where IE8 "forgets" to update child elements when they resize.- Parameters:
e
- The element to perform the hack on
-
forceIERedraw
@Deprecated public static void forceIERedraw(com.google.gwt.dom.client.Element e)
Deprecated.As of 7.4.0, useWidgetUtil.forceIERedraw(Element)
instead.Performs a hack to trigger a re-layout in the IE browser. This is usually necessary in cases where IE "forgets" to update child elements when they resize.- Parameters:
e
- The element to perform the hack on- Since:
- 7.3
-
detachAttach
@Deprecated public static void detachAttach(com.google.gwt.dom.client.Element element)
Deprecated.As of 7.4.0, useWidgetUtil.detachAttach(Element)
instead.Detaches and re-attaches the element from its parent. The element is reattached at the same position in the DOM as it was before. Does nothing if the element is not attached to the DOM.- Parameters:
element
- The element to detach and re-attach
-
sinkOnloadForImages
@Deprecated public static void sinkOnloadForImages(com.google.gwt.dom.client.Element element)
Deprecated.As of 7.4.0, useWidgetUtil.sinkOnloadForImages(Element)
instead.
-
getChildElementIndex
@Deprecated public static int getChildElementIndex(com.google.gwt.dom.client.Element childElement)
Deprecated.As of 7.4.0, useWidgetUtil.getChildElementIndex(Element)
instead.Returns the index of the childElement within its parent.- Parameters:
subElement
-- Returns:
-
logMethodInvocations
public static void logMethodInvocations(ApplicationConnection c, Collection<MethodInvocation> methodInvocations)
-
setStyleTemporarily
@Deprecated public static void setStyleTemporarily(com.google.gwt.dom.client.Element element, String styleProperty, String tempValue)
Deprecated.As of 7.4.0, useWidgetUtil.setStyleTemporarily(Element, String, String)
instead.Temporarily sets thestyleProperty
totempValue
and then resets it to its current value. Used mainly to work around rendering issues in IE (and possibly in other browsers)- Parameters:
element
- The target elementstyleProperty
- The name of the property to settempValue
- The temporary value
-
getTouchOrMouseClientX
@Deprecated public static int getTouchOrMouseClientX(com.google.gwt.user.client.Event event)
Deprecated.As of 7.4.0, useWidgetUtil.getTouchOrMouseClientX(Event)
instead.A helper method to return the client position from an event. Returns position from either first changed touch (if touch event) or from the event itself.- Parameters:
event
-- Returns:
-
getElementUnderMouse
@Deprecated public static com.google.gwt.user.client.Element getElementUnderMouse(com.google.gwt.dom.client.NativeEvent event)
Deprecated.As of 7.4.0, useWidgetUtil.getElementUnderMouse(NativeEvent)
instead.Find the element corresponding to the coordinates in the passed mouse event. Please note that this is not always the same as the target of the event e.g. if event capture is used.- Parameters:
event
- the mouse event to get coordinates from- Returns:
- the element at the coordinates of the event
-
getTouchOrMouseClientY
@Deprecated public static int getTouchOrMouseClientY(com.google.gwt.user.client.Event event)
Deprecated.As of 7.4.0, useWidgetUtil.getTouchOrMouseClientY(Event)
instead.A helper method to return the client position from an event. Returns position from either first changed touch (if touch event) or from the event itself.- Parameters:
event
-- Returns:
-
getTouchOrMouseClientY
@Deprecated public static int getTouchOrMouseClientY(com.google.gwt.dom.client.NativeEvent currentGwtEvent)
Deprecated.As of 7.4.0, useWidgetUtil.getTouchOrMouseClientY(NativeEvent)
instead.- Parameters:
currentGwtEvent
-- Returns:
- See Also:
getTouchOrMouseClientY(Event)
-
getTouchOrMouseClientX
@Deprecated public static int getTouchOrMouseClientX(com.google.gwt.dom.client.NativeEvent event)
Deprecated.As of 7.4.0, useWidgetUtil.getTouchOrMouseClientX(NativeEvent)
instead.- Parameters:
event
-- Returns:
- See Also:
getTouchOrMouseClientX(Event)
-
isTouchEvent
@Deprecated public static boolean isTouchEvent(com.google.gwt.user.client.Event event)
Deprecated.As of 7.4.0, useWidgetUtil.isTouchEvent(Event)
instead.
-
isTouchEvent
@Deprecated public static boolean isTouchEvent(com.google.gwt.dom.client.NativeEvent event)
Deprecated.As of 7.4.0, useWidgetUtil.isTouchEvent(NativeEvent)
instead.
-
simulateClickFromTouchEvent
@Deprecated public static void simulateClickFromTouchEvent(com.google.gwt.user.client.Event touchevent, com.google.gwt.user.client.ui.Widget widget)
Deprecated.As of 7.4.0, useWidgetUtil.simulateClickFromTouchEvent(Event, Widget)
instead.
-
getFocusedElement
@Deprecated public static com.google.gwt.user.client.Element getFocusedElement()
Deprecated.As of 7.4.0, useWidgetUtil.getFocusedElement()
instead.Gets the currently focused element.- Returns:
- The active element or null if no active element could be found.
-
getIEFocusedElement
@Deprecated public static com.google.gwt.user.client.Element getIEFocusedElement()
Deprecated.Use #getFocusedElement insteadGets the currently focused element for Internet Explorer.- Returns:
- The currently focused element
-
isFocusedElementEditable
@Deprecated public static boolean isFocusedElementEditable()
Deprecated.As of 7.4.0, useWidgetUtil.isFocusedElementEditable()
instead.Gets currently focused element and checks if it's editable- Returns:
- true if focused element is editable
- Since:
- 7.4
-
isAttachedAndDisplayed
@Deprecated public static boolean isAttachedAndDisplayed(com.google.gwt.user.client.ui.Widget widget)
Deprecated.As of 7.4.0, useWidgetUtil.isAttachedAndDisplayed(Widget)
instead.Kind of stronger version of isAttached(). In addition to std isAttached, this method checks that this widget nor any of its parents is hidden. Can be e.g used to check whether component should react to some events or not.- Parameters:
widget
-- Returns:
- true if attached and displayed
-
scrollIntoViewVertically
@Deprecated public static void scrollIntoViewVertically(com.google.gwt.dom.client.Element elem)
Deprecated.As of 7.4.0, useWidgetUtil.scrollIntoViewVertically(Element)
instead.Scrolls an element into view vertically only. Modified version of Element.scrollIntoView.- Parameters:
elem
- The element to scroll into view
-
isTouchEventOrLeftMouseButton
@Deprecated public static boolean isTouchEventOrLeftMouseButton(com.google.gwt.user.client.Event event)
Deprecated.As of 7.4.0, useWidgetUtil.isTouchEventOrLeftMouseButton(Event)
instead.Checks if the given event is either a touch event or caused by the left mouse button- Parameters:
event
-- Returns:
- true if the event is a touch event or caused by the left mouse button, false otherwise
-
collectionsEquals
public static boolean collectionsEquals(Collection<?> collection1, Collection<?> collection2)
Performs a shallow comparison of the collections.- Parameters:
collection1
- The first collectioncollection2
- The second collection- Returns:
- true if the collections contain the same elements in the same order, false otherwise
-
getConnectorString
public static String getConnectorString(ServerConnector p)
-
getAbsoluteUrl
@Deprecated public static String getAbsoluteUrl(String url)
Deprecated.As of 7.4.0, useWidgetUtil.getAbsoluteUrl(String)
instead.Resolve a relative URL to an absolute URL based on the current document's location.- Parameters:
url
- a string with the relative URL to resolve- Returns:
- the corresponding absolute URL as a string
-
setSelectionRange
@Deprecated public static void setSelectionRange(com.google.gwt.dom.client.Element elem, int pos, int length, String direction)
Deprecated.As of 7.4.0, useWidgetUtil.setSelectionRange(Element, int, int, String)
instead.Sets the selection range of an input element. We need this JSNI function to set selection range so that we can use the optional direction attribute to set the anchor to the end and the focus to the start. This makes Firefox work the same way as other browsers (#13477)- Parameters:
elem
- the html input element.pos
- the index of the first selected character.length
- the selection length.direction
- a string indicating the direction in which the selection was performed. This may be "forward" or "backward", or "none" if the direction is unknown or irrelevant.- Since:
- 7.3
-
jso2json
public static <T extends JsonValue> T jso2json(com.google.gwt.core.client.JavaScriptObject jso)
Converts a nativeJavaScriptObject
into aJsonValue
. This is a no-op in GWT code compiled to javascript, but needs some special handling to work when run in JVM.- Parameters:
jso
- the java script object to represent as json- Returns:
- the json representation
-
json2jso
public static com.google.gwt.core.client.JavaScriptObject json2jso(JsonValue jsonValue)
Converts aJsonValue
into a nativeJavaScriptObject
. This is a no-op in GWT code compiled to javascript, but needs some special handling to work when run in JVM.- Parameters:
jsonValue
- the json value- Returns:
- a native javascript object representation of the json value
-
parse
public static <T extends com.google.gwt.core.client.JavaScriptObject> T parse(String jsonAsString)
Parse a string containing JSON into aJavaScriptObject
.- Type Parameters:
T
- the overlay type to expect from the parse- Parameters:
jsonAsString
-- Returns:
- a JavaScript object constructed from the parse
-
round
public static double round(double num, int exp)
Roundnum
up toexp
decimal positions.- Since:
- 7.6
-
shouldSkipMeasurementOfConnector
public static boolean shouldSkipMeasurementOfConnector(ComponentConnector candidate, ComponentConnector parent)
Test if we can can skip measuring this connector. We can skip the measurement if its parent is a ChildMeasureHintConnector and has an appropriate mode set. For internal use only. May be removed or replaced in the future.
-
shouldSkipMeasurementOfConnector
public static boolean shouldSkipMeasurementOfConnector(ComponentConnector candidate)
Test if we can can skip measuring this connector. We can skip the measurement if its parent is a ChildMeasureHintConnector and has an appropriate mode set. This version of the method tries to recursively locate such a parent. For internal use only. May be removed or replaced in the future.
-
-