|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.vaadin.client.Util
public class Util
| Nested Class Summary | |
|---|---|
static class |
Util.CssSize
Wrap a css size value and its unit and translate back and forth to the string representation. Eg. |
| Constructor Summary | |
|---|---|
Util()
|
|
| Method Summary | ||
|---|---|---|
static void |
alert(java.lang.String string)
|
|
static void |
browserDebugger()
Helper method for debugging purposes. |
|
static com.google.gwt.user.client.Element |
cloneNode(Element element,
boolean deep)
Clones given element as in JavaScript. |
|
static boolean |
collectionsEquals(java.util.Collection collection1,
java.util.Collection collection2)
Performs a shallow comparison of the collections. |
|
static void |
detachAttach(Element element)
Detaches and re-attaches the element from its parent. |
|
static boolean |
equals(java.lang.Object a,
java.lang.Object b)
Deprecated. As of 7.1 use Object.equals(Object) instead |
|
static java.lang.String |
escapeAttribute(java.lang.String attribute)
Escapes the string so it is safe to write inside an HTML attribute. |
|
static java.lang.String |
escapeHTML(java.lang.String html)
Converts html entities to text. |
|
static ComponentConnector |
findConnectorFor(Widget widget)
|
|
static ComponentConnector |
findPaintable(ApplicationConnection client,
Element element)
Helper method to find the nearest parent paintable instance by traversing the DOM upwards from given element. |
|
static
|
findWidget(Element element,
java.lang.Class<? extends Widget> class1)
Helper method to find first instance of given Widget type found by traversing DOM upwards from given element. |
|
static void |
focus(Element el)
Will (attempt) to focus the given DOM Element. |
|
static void |
forceIE8Redraw(Element e)
Performs a hack to trigger a re-layout in the IE8. |
|
static void |
forceIERedraw(Element e)
Performs a hack to trigger a re-layout in the IE browser. |
|
static void |
forceWebkitRedraw(Element element)
Force webkit to redraw an element |
|
static java.lang.String |
getAbsoluteUrl(java.lang.String url)
Resolve a relative URL to an absolute URL based on the current document's location. |
|
static int |
getChildElementIndex(Element childElement)
Returns the index of the childElement within its parent. |
|
static ComponentConnector |
getConnectorForElement(ApplicationConnection client,
Widget parent,
Element element)
Locates the nested child component of |
|
static java.lang.String |
getConnectorString(ServerConnector p)
|
|
static com.google.gwt.user.client.Element |
getElementFromPoint(int clientX,
int clientY)
Returns the topmost element of from given coordinates. |
|
static com.google.gwt.user.client.Element |
getElementUnderMouse(NativeEvent event)
Find the element corresponding to the coordinates in the passed mouse event. |
|
static com.google.gwt.user.client.Element |
getFocusedElement()
Gets the currently focused element. |
|
static com.google.gwt.user.client.Element |
getIEFocusedElement()
Deprecated. Use #getFocusedElement instead |
|
static int |
getKeyCode(
Helper method for a bug fix #14041. |
|
static int |
getNativeScrollbarSize()
|
|
static int |
getRequiredHeight(com.google.gwt.dom.client.Element element)
Gets the border-box height for the given element, i.e. |
|
static int |
getRequiredHeight(Widget widget)
|
|
static int |
getRequiredHeightBoundingClientRect(com.google.gwt.dom.client.Element element)
|
|
static int |
getRequiredHeightComputedStyle(com.google.gwt.dom.client.Element element)
|
|
static int |
getRequiredWidth(com.google.gwt.dom.client.Element element)
Gets the border-box width for the given element, i.e. |
|
static int |
getRequiredWidth(Widget widget)
|
|
static int |
getRequiredWidthBoundingClientRect(com.google.gwt.dom.client.Element element)
|
|
static int |
getRequiredWidthComputedStyle(com.google.gwt.dom.client.Element element)
|
|
static java.lang.String |
getSimpleName(java.lang.Object widget)
|
|
static int |
getTouchOrMouseClientX(Event event)
A helper method to return the client position from an event. |
|
static int |
getTouchOrMouseClientX(NativeEvent event)
|
|
static int |
getTouchOrMouseClientY(Event event)
A helper method to return the client position from an event. |
|
static int |
getTouchOrMouseClientY(NativeEvent currentGwtEvent)
|
|
static boolean |
isAttachedAndDisplayed(Widget widget)
Kind of stronger version of isAttached(). |
|
static boolean |
isCached(UIDL uidl)
Deprecated. |
|
static boolean |
isTouchEvent(Event event)
|
|
static boolean |
isTouchEvent(NativeEvent event)
|
|
static boolean |
isTouchEventOrLeftMouseButton(Event event)
Checks if the given event is either a touch event or caused by the left mouse button |
|
static boolean |
mayHaveScrollBars(com.google.gwt.dom.client.Element pe)
Detects what is currently the overflow style attribute in given element. |
|
static int |
measureHorizontalBorder(Element element)
|
|
static int |
measureHorizontalPaddingAndBorder(Element element,
int paddingGuess)
|
|
static int |
measureMarginLeft(Element element)
|
|
static int |
measureVerticalBorder(Element element)
|
|
static int |
measureVerticalPaddingAndBorder(Element element,
int paddingGuess)
|
|
static void |
notifyParentOfSizeChange(Widget widget,
boolean lazy)
Deprecated. As of 7.0, use LayoutManager.setNeedsMeasure(ComponentConnector)
instead |
|
static RenderInformation.FloatSize |
parseRelativeSize(com.vaadin.shared.AbstractComponentState state)
Parses shared state and fetches the relative size of the component. |
|
static float |
parseRelativeSize(java.lang.String size)
|
|
static void |
runWebkitOverflowAutoFix(Element elem)
Run workaround for webkits overflow auto issue. |
|
static void |
runWebkitOverflowAutoFixDeferred(Element elem)
Defers the execution of runWebkitOverflowAutoFix(Element) |
|
static void |
scrollIntoViewVertically(Element elem)
Scrolls an element into view vertically only. |
|
static void |
setFloat(Element element,
java.lang.String value)
|
|
static int |
setHeightExcludingPaddingAndBorder(Element element,
int requestedHeight,
int verticalPaddingBorderGuess,
boolean requestedHeightIncludesPaddingBorder)
|
|
static int |
setHeightExcludingPaddingAndBorder(Widget widget,
java.lang.String height,
int paddingBorderGuess)
|
|
static void |
setSelectionRange(Element elem,
int pos,
int length,
java.lang.String direction)
Sets the selection range of an input element. |
|
static void |
setStyleTemporarily(Element element,
java.lang.String styleProperty,
java.lang.String tempValue)
Temporarily sets the styleProperty to tempValue and then
resets it to its current value. |
|
static int |
setWidthExcludingPaddingAndBorder(Element element,
int requestedWidth,
int horizontalPaddingBorderGuess,
boolean requestedWidthIncludesPaddingBorder)
|
|
static int |
setWidthExcludingPaddingAndBorder(Widget widget,
java.lang.String width,
int paddingBorderGuess)
|
|
static void |
simulateClickFromTouchEvent(Event touchevent,
Widget widget)
|
|
static void |
sinkOnloadForImages(Element element)
|
|
static void |
updateRelativeChildrenAndSendSizeUpdateEvent(ApplicationConnection client,
HasWidgets container,
Widget widget)
|
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Util()
| Method Detail |
|---|
public static void browserDebugger()
public static int getKeyCode(event)
event -
public static com.google.gwt.user.client.Element getElementFromPoint(int clientX,
int clientY)
x - y -
@Deprecated
public static void notifyParentOfSizeChange(Widget widget,
boolean lazy)
LayoutManager.setNeedsMeasure(ComponentConnector)
instead
widget - lazy - run componentSizeUpdated lazylypublic static ComponentConnector findConnectorFor(Widget widget)
public static float parseRelativeSize(java.lang.String size)
public static java.lang.String escapeHTML(java.lang.String html)
html -
public static java.lang.String escapeAttribute(java.lang.String attribute)
attribute - The string to escape
public static com.google.gwt.user.client.Element cloneNode(Element element,
boolean deep)
element - deep - clone child tree also
public static int measureHorizontalPaddingAndBorder(Element element,
int paddingGuess)
public static int measureVerticalPaddingAndBorder(Element element,
int paddingGuess)
public static int measureHorizontalBorder(Element element)
public static int measureVerticalBorder(Element element)
public static int measureMarginLeft(Element element)
public static int setHeightExcludingPaddingAndBorder(Widget widget,
java.lang.String height,
int paddingBorderGuess)
public static int setWidthExcludingPaddingAndBorder(Widget widget,
java.lang.String width,
int paddingBorderGuess)
public static int setWidthExcludingPaddingAndBorder(Element element,
int requestedWidth,
int horizontalPaddingBorderGuess,
boolean requestedWidthIncludesPaddingBorder)
public static int setHeightExcludingPaddingAndBorder(Element element,
int requestedHeight,
int verticalPaddingBorderGuess,
boolean requestedHeightIncludesPaddingBorder)
public static java.lang.String getSimpleName(java.lang.Object widget)
public static void setFloat(Element element,
java.lang.String value)
public static int getNativeScrollbarSize()
public static void runWebkitOverflowAutoFixDeferred(Element elem)
runWebkitOverflowAutoFix(Element)
elem - with overflow autopublic static void runWebkitOverflowAutoFix(Element elem)
elem - with overflow autopublic static RenderInformation.FloatSize parseRelativeSize(com.vaadin.shared.AbstractComponentState state)
state -
@Deprecated public static boolean isCached(UIDL uidl)
public static void alert(java.lang.String string)
@Deprecated
public static boolean equals(java.lang.Object a,
java.lang.Object b)
Object.equals(Object) instead
Object.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.
a - The first value to compareb - The second value to compare
public static void updateRelativeChildrenAndSendSizeUpdateEvent(ApplicationConnection client,
HasWidgets container,
Widget widget)
public static int getRequiredWidth(com.google.gwt.dom.client.Element element)
element - The element to check
public static int getRequiredHeight(com.google.gwt.dom.client.Element element)
element - The element to check
public static int getRequiredWidthBoundingClientRect(com.google.gwt.dom.client.Element element)
public static int getRequiredHeightComputedStyle(com.google.gwt.dom.client.Element element)
public static int getRequiredWidthComputedStyle(com.google.gwt.dom.client.Element element)
public static int getRequiredHeightBoundingClientRect(com.google.gwt.dom.client.Element element)
public static int getRequiredWidth(Widget widget)
public static int getRequiredHeight(Widget widget)
public static boolean mayHaveScrollBars(com.google.gwt.dom.client.Element pe)
pe - the element to detect
public static ComponentConnector getConnectorForElement(ApplicationConnection client,
Widget parent,
Element element)
client - A reference to ApplicationConnectionparent - The widget that contains element - An element that is a sub element of the parent
public static void focus(Element el)
el - the element to focus
public static ComponentConnector findPaintable(ApplicationConnection client,
Element element)
element - the element to start from
public static <T> T findWidget(Element element,
java.lang.Class<? extends Widget> class1)
element - the element where to start seeking of Widgetclass1 - the Widget type to seek forpublic static void forceWebkitRedraw(Element element)
element - The element that should be redrawnpublic static final void forceIE8Redraw(Element e)
e - The element to perform the hack onpublic static void forceIERedraw(Element e)
e - The element to perform the hack onpublic static void detachAttach(Element element)
element - The element to detach and re-attachpublic static void sinkOnloadForImages(Element element)
public static int getChildElementIndex(Element childElement)
subElement -
public static void setStyleTemporarily(Element element,
java.lang.String styleProperty,
java.lang.String tempValue)
styleProperty to tempValue and then
resets it to its current value. Used mainly to work around rendering
issues in IE (and possibly in other browsers)
element - The target elementstyleProperty - The name of the property to settempValue - The temporary valuepublic static int getTouchOrMouseClientX(Event event)
event -
public static com.google.gwt.user.client.Element getElementUnderMouse(NativeEvent event)
event - the mouse event to get coordinates from
public static int getTouchOrMouseClientY(Event event)
event -
public static int getTouchOrMouseClientY(NativeEvent currentGwtEvent)
currentGwtEvent -
getTouchOrMouseClientY(Event)public static int getTouchOrMouseClientX(NativeEvent event)
event -
getTouchOrMouseClientX(Event)public static boolean isTouchEvent(Event event)
public static boolean isTouchEvent(NativeEvent event)
public static void simulateClickFromTouchEvent(Event touchevent,
Widget widget)
public static com.google.gwt.user.client.Element getFocusedElement()
@Deprecated public static com.google.gwt.user.client.Element getIEFocusedElement()
public static boolean isAttachedAndDisplayed(Widget widget)
widget -
public static void scrollIntoViewVertically(Element elem)
elem - The element to scroll into viewpublic static boolean isTouchEventOrLeftMouseButton(Event event)
event -
public static boolean collectionsEquals(java.util.Collection collection1,
java.util.Collection collection2)
collection1 - The first collectioncollection2 - The second collection
public static java.lang.String getConnectorString(ServerConnector p)
public static java.lang.String getAbsoluteUrl(java.lang.String url)
url - a string with the relative URL to resolve
public static void setSelectionRange(Element elem,
int pos,
int length,
java.lang.String direction)
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.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||