|
|
@@ -48,9 +48,9 @@ public class Util { |
|
|
|
|
|
|
|
/** |
|
|
|
* Helper method for debugging purposes. |
|
|
|
* |
|
|
|
* |
|
|
|
* Stops execution on firefox browsers on a breakpoint. |
|
|
|
* |
|
|
|
* |
|
|
|
*/ |
|
|
|
@Deprecated |
|
|
|
public static void browserDebugger() { |
|
|
@@ -61,7 +61,7 @@ public class Util { |
|
|
|
* 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. |
|
|
|
* |
|
|
|
* |
|
|
|
* @param event |
|
|
|
* @return return key code |
|
|
|
* @since 7.2.4 |
|
|
@@ -72,12 +72,12 @@ public class Util { |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* |
|
|
|
* |
|
|
|
* 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. |
|
|
|
* |
|
|
|
* |
|
|
|
* @param x |
|
|
|
* @param y |
|
|
|
* @return the element at given coordinates |
|
|
@@ -92,18 +92,18 @@ public class Util { |
|
|
|
* This 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. |
|
|
|
* |
|
|
|
* |
|
|
|
* @param widget |
|
|
|
* @param lazy |
|
|
|
* run componentSizeUpdated lazyly |
|
|
|
* |
|
|
|
* |
|
|
|
* @deprecated As of 7.0, use |
|
|
|
* {@link LayoutManager#setNeedsMeasure(ComponentConnector)} |
|
|
|
* instead |
|
|
@@ -143,7 +143,7 @@ public class Util { |
|
|
|
|
|
|
|
/** |
|
|
|
* Converts html entities to text. |
|
|
|
* |
|
|
|
* |
|
|
|
* @param html |
|
|
|
* @return escaped string presentation of given html |
|
|
|
*/ |
|
|
@@ -154,7 +154,7 @@ public class Util { |
|
|
|
|
|
|
|
/** |
|
|
|
* Escapes the string so it is safe to write inside an HTML attribute. |
|
|
|
* |
|
|
|
* |
|
|
|
* @param attribute |
|
|
|
* The string to escape |
|
|
|
* @return An escaped version of <literal>attribute</literal>. |
|
|
@@ -166,9 +166,9 @@ public class Util { |
|
|
|
|
|
|
|
/** |
|
|
|
* Clones given element as in JavaScript. |
|
|
|
* |
|
|
|
* |
|
|
|
* Deprecate this if there appears similar method into GWT someday. |
|
|
|
* |
|
|
|
* |
|
|
|
* @param element |
|
|
|
* @param deep |
|
|
|
* clone child tree also |
|
|
@@ -275,9 +275,9 @@ public class Util { |
|
|
|
|
|
|
|
/** |
|
|
|
* Run workaround for webkits overflow auto issue. |
|
|
|
* |
|
|
|
* |
|
|
|
* See: our bug #2138 and https://bugs.webkit.org/show_bug.cgi?id=21462 |
|
|
|
* |
|
|
|
* |
|
|
|
* @param elem |
|
|
|
* with overflow auto |
|
|
|
*/ |
|
|
@@ -291,7 +291,7 @@ public class Util { |
|
|
|
* 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. |
|
|
|
* |
|
|
|
* |
|
|
|
* @param state |
|
|
|
* @return |
|
|
|
*/ |
|
|
@@ -323,7 +323,7 @@ public class Util { |
|
|
|
* Checks if a and b are equals using {@link #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. |
|
|
|
* |
|
|
|
* |
|
|
|
* @param a |
|
|
|
* The first value to compare |
|
|
|
* @param b |
|
|
@@ -344,7 +344,7 @@ public class Util { |
|
|
|
/** |
|
|
|
* Gets the border-box width for the given element, i.e. element width + |
|
|
|
* border + padding. Always rounds up to nearest integer. |
|
|
|
* |
|
|
|
* |
|
|
|
* @param element |
|
|
|
* The element to check |
|
|
|
* @return The border-box width for the element |
|
|
@@ -357,7 +357,7 @@ public class Util { |
|
|
|
/** |
|
|
|
* Gets the border-box height for the given element, i.e. element height + |
|
|
|
* border + padding. Always rounds up to nearest integer. |
|
|
|
* |
|
|
|
* |
|
|
|
* @param element |
|
|
|
* The element to check |
|
|
|
* @return The border-box height for the element |
|
|
@@ -404,7 +404,7 @@ public class Util { |
|
|
|
|
|
|
|
/** |
|
|
|
* Detects what is currently the overflow style attribute in given element. |
|
|
|
* |
|
|
|
* |
|
|
|
* @param pe |
|
|
|
* the element to detect |
|
|
|
* @return true if auto or scroll |
|
|
@@ -420,9 +420,9 @@ public class Util { |
|
|
|
* also returned if "element" is part of its caption. If |
|
|
|
* <literal>element</literal> is not part of any child component, null is |
|
|
|
* returned. |
|
|
|
* |
|
|
|
* |
|
|
|
* This method returns the deepest nested VPaintableWidget. |
|
|
|
* |
|
|
|
* |
|
|
|
* @param client |
|
|
|
* A reference to ApplicationConnection |
|
|
|
* @param parent |
|
|
@@ -480,7 +480,7 @@ public class Util { |
|
|
|
|
|
|
|
/** |
|
|
|
* Will (attempt) to focus the given DOM Element. |
|
|
|
* |
|
|
|
* |
|
|
|
* @param el |
|
|
|
* the element to focus |
|
|
|
*/ |
|
|
@@ -492,7 +492,7 @@ public class Util { |
|
|
|
/** |
|
|
|
* Helper method to find the nearest parent paintable instance by traversing |
|
|
|
* the DOM upwards from given element. |
|
|
|
* |
|
|
|
* |
|
|
|
* @param element |
|
|
|
* the element to start from |
|
|
|
*/ |
|
|
@@ -510,7 +510,7 @@ public class Util { |
|
|
|
/** |
|
|
|
* Helper method to find first instance of given Widget type found by |
|
|
|
* traversing DOM upwards from given element. |
|
|
|
* |
|
|
|
* |
|
|
|
* @param element |
|
|
|
* the element where to start seeking of Widget |
|
|
|
* @param class1 |
|
|
@@ -524,7 +524,7 @@ public class Util { |
|
|
|
|
|
|
|
/** |
|
|
|
* Force webkit to redraw an element |
|
|
|
* |
|
|
|
* |
|
|
|
* @param element |
|
|
|
* The element that should be redrawn |
|
|
|
*/ |
|
|
@@ -537,7 +537,7 @@ public class Util { |
|
|
|
* 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. |
|
|
|
* |
|
|
|
* |
|
|
|
* @param e |
|
|
|
* The element to perform the hack on |
|
|
|
*/ |
|
|
@@ -550,7 +550,7 @@ public class Util { |
|
|
|
* 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. |
|
|
|
* |
|
|
|
* |
|
|
|
* @since 7.3 |
|
|
|
* @param e |
|
|
|
* The element to perform the hack on |
|
|
@@ -563,9 +563,9 @@ public class Util { |
|
|
|
/** |
|
|
|
* 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. |
|
|
|
* |
|
|
|
* |
|
|
|
* @param element |
|
|
|
* The element to detach and re-attach |
|
|
|
*/ |
|
|
@@ -581,7 +581,7 @@ public class Util { |
|
|
|
|
|
|
|
/** |
|
|
|
* Returns the index of the childElement within its parent. |
|
|
|
* |
|
|
|
* |
|
|
|
* @param subElement |
|
|
|
* @return |
|
|
|
*/ |
|
|
@@ -655,7 +655,7 @@ public class Util { |
|
|
|
* Temporarily sets the {@code styleProperty} to {@code tempValue} and then |
|
|
|
* resets it to its current value. Used mainly to work around rendering |
|
|
|
* issues in IE (and possibly in other browsers) |
|
|
|
* |
|
|
|
* |
|
|
|
* @param element |
|
|
|
* The target element |
|
|
|
* @param styleProperty |
|
|
@@ -673,7 +673,7 @@ public class Util { |
|
|
|
* 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. |
|
|
|
* |
|
|
|
* |
|
|
|
* @param event |
|
|
|
* @return |
|
|
|
*/ |
|
|
@@ -686,7 +686,7 @@ public class Util { |
|
|
|
* 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. |
|
|
|
* |
|
|
|
* |
|
|
|
* @param event |
|
|
|
* the mouse event to get coordinates from |
|
|
|
* @return the element at the coordinates of the event |
|
|
@@ -701,7 +701,7 @@ public class Util { |
|
|
|
* 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. |
|
|
|
* |
|
|
|
* |
|
|
|
* @param event |
|
|
|
* @return |
|
|
|
*/ |
|
|
@@ -711,7 +711,7 @@ public class Util { |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* |
|
|
|
* |
|
|
|
* @see #getTouchOrMouseClientY(Event) |
|
|
|
* @param currentGwtEvent |
|
|
|
* @return |
|
|
@@ -723,7 +723,7 @@ public class Util { |
|
|
|
|
|
|
|
/** |
|
|
|
* @see #getTouchOrMouseClientX(Event) |
|
|
|
* |
|
|
|
* |
|
|
|
* @param event |
|
|
|
* @return |
|
|
|
*/ |
|
|
@@ -750,7 +750,7 @@ public class Util { |
|
|
|
|
|
|
|
/** |
|
|
|
* Gets the currently focused element. |
|
|
|
* |
|
|
|
* |
|
|
|
* @return The active element or null if no active element could be found. |
|
|
|
*/ |
|
|
|
@Deprecated |
|
|
@@ -760,7 +760,7 @@ public class Util { |
|
|
|
|
|
|
|
/** |
|
|
|
* Gets the currently focused element for Internet Explorer. |
|
|
|
* |
|
|
|
* |
|
|
|
* @return The currently focused element |
|
|
|
* @deprecated Use #getFocusedElement instead |
|
|
|
*/ |
|
|
@@ -786,7 +786,7 @@ public class Util { |
|
|
|
* 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. |
|
|
|
* |
|
|
|
* |
|
|
|
* @param widget |
|
|
|
* @return true if attached and displayed |
|
|
|
*/ |
|
|
@@ -798,7 +798,7 @@ public class Util { |
|
|
|
/** |
|
|
|
* Scrolls an element into view vertically only. Modified version of |
|
|
|
* Element.scrollIntoView. |
|
|
|
* |
|
|
|
* |
|
|
|
* @param elem |
|
|
|
* The element to scroll into view |
|
|
|
*/ |
|
|
@@ -810,7 +810,7 @@ public class Util { |
|
|
|
/** |
|
|
|
* Checks if the given event is either a touch event or caused by the left |
|
|
|
* mouse button |
|
|
|
* |
|
|
|
* |
|
|
|
* @param event |
|
|
|
* @return true if the event is a touch event or caused by the left mouse |
|
|
|
* button, false otherwise |
|
|
@@ -822,7 +822,7 @@ public class Util { |
|
|
|
|
|
|
|
/** |
|
|
|
* Performs a shallow comparison of the collections. |
|
|
|
* |
|
|
|
* |
|
|
|
* @param collection1 |
|
|
|
* The first collection |
|
|
|
* @param collection2 |
|
|
@@ -867,7 +867,7 @@ public class Util { |
|
|
|
/** |
|
|
|
* Resolve a relative URL to an absolute URL based on the current document's |
|
|
|
* location. |
|
|
|
* |
|
|
|
* |
|
|
|
* @param url |
|
|
|
* a string with the relative URL to resolve |
|
|
|
* @return the corresponding absolute URL as a string |
|
|
@@ -940,7 +940,7 @@ public class Util { |
|
|
|
|
|
|
|
/** |
|
|
|
* Convert a {@link JavaScriptObject} into a string representation. |
|
|
|
* |
|
|
|
* |
|
|
|
* @param json |
|
|
|
* a JavaScript object to be converted to a string |
|
|
|
* @return JSON in string representation |
|
|
@@ -952,7 +952,7 @@ public class Util { |
|
|
|
|
|
|
|
/** |
|
|
|
* Parse a string containing JSON into a {@link JavaScriptObject}. |
|
|
|
* |
|
|
|
* |
|
|
|
* @param <T> |
|
|
|
* the overlay type to expect from the parse |
|
|
|
* @param jsonAsString |
|
|
@@ -964,7 +964,7 @@ public class Util { |
|
|
|
return JSON.parse(jsonAsString); |
|
|
|
}-*/; |
|
|
|
|
|
|
|
public static Logger getLogger() { |
|
|
|
private static Logger getLogger() { |
|
|
|
return Logger.getLogger(Util.class.getName()); |
|
|
|
} |
|
|
|
} |