Browse Source

Add pointer to new location for methods moved to WidgetUtil (#17952)

Change-Id: Ie1b8fb8673adfa94e28e1f41441a5df52c91b30d
tags/7.4.7
Leif Åstrand 9 years ago
parent
commit
675c40e419
1 changed files with 201 additions and 0 deletions
  1. 201
    0
      client/src/com/vaadin/client/Util.java

+ 201
- 0
client/src/com/vaadin/client/Util.java View File

* *
* Stops execution on firefox browsers on a breakpoint. * Stops execution on firefox browsers on a breakpoint.
* *
* @deprecated As of 7.4.0, use {@link WidgetUtil#browserDebugger()}
* instead.
*/ */
@Deprecated @Deprecated
public static void browserDebugger() { public static void browserDebugger() {
* space bar (because space is considered as char). If return 0 use * space bar (because space is considered as char). If return 0 use
* getCharCode. * getCharCode.
* *
* @deprecated As of 7.4.0, use {@link WidgetUtil#getKeyCode(KeyEvent)}
* instead.
*
* @param event * @param event
* @return return key code * @return return key code
* @since 7.2.4 * @since 7.2.4
* TODO fix crossplat issues clientX vs pageX. See quircksmode. Not critical * TODO fix crossplat issues clientX vs pageX. See quircksmode. Not critical
* for vaadin as we scroll div istead of page. * for vaadin as we scroll div istead of page.
* *
* @deprecated As of 7.4.0, use
* {@link WidgetUtil#getElementFromPoint(int, int)} instead.
*
* @param x * @param x
* @param y * @param y
* @return the element at given coordinates * @return the element at given coordinates
return null; return null;
} }


/**
* @deprecated As of 7.4.0, use {@link WidgetUtil#parseRelativeSize(String)}
* instead.
*/
@Deprecated @Deprecated
public static float parseRelativeSize(String size) { public static float parseRelativeSize(String size) {
return WidgetUtil.parseRelativeSize(size); return WidgetUtil.parseRelativeSize(size);
/** /**
* Converts html entities to text. * Converts html entities to text.
* *
* @deprecated As of 7.4.0, use {@link WidgetUtil#escapeHTML(String)}
* instead.
*
* @param html * @param html
* @return escaped string presentation of given html * @return escaped string presentation of given html
*/ */
/** /**
* Escapes the string so it is safe to write inside an HTML attribute. * Escapes the string so it is safe to write inside an HTML attribute.
* *
* @deprecated As of 7.4.0, use {@link WidgetUtil#escapeAttribute(String)}
* instead.
*
* @param attribute * @param attribute
* The string to escape * The string to escape
* @return An escaped version of <literal>attribute</literal>. * @return An escaped version of <literal>attribute</literal>.
* *
* Deprecate this if there appears similar method into GWT someday. * Deprecate this if there appears similar method into GWT someday.
* *
* @deprecated As of 7.4.0, use
* {@link WidgetUtil#cloneNode(Element, boolean)} instead.
*
* @param element * @param element
* @param deep * @param deep
* clone child tree also * clone child tree also
return DOM.asOld(WidgetUtil.cloneNode(element, deep)); return DOM.asOld(WidgetUtil.cloneNode(element, deep));
} }


/**
* @deprecated As of 7.4.0, use
* {@link WidgetUtil#measureHorizontalPaddingAndBorder(Element, int)}
* instead.
*/
@Deprecated @Deprecated
public static int measureHorizontalPaddingAndBorder(Element element, public static int measureHorizontalPaddingAndBorder(Element element,
int paddingGuess) { int paddingGuess) {
paddingGuess); paddingGuess);
} }


/**
* @deprecated As of 7.4.0, use
* {@link WidgetUtil#measureVerticalPaddingAndBorder(Element, int)}
* instead.
*/
@Deprecated @Deprecated
public static int measureVerticalPaddingAndBorder(Element element, public static int measureVerticalPaddingAndBorder(Element element,
int paddingGuess) { int paddingGuess) {
.measureVerticalPaddingAndBorder(element, paddingGuess); .measureVerticalPaddingAndBorder(element, paddingGuess);
} }


/**
* @deprecated As of 7.4.0, use
* {@link WidgetUtil#measureHorizontalBorder(Element)} instead.
*/
@Deprecated @Deprecated
public static int measureHorizontalBorder(Element element) { public static int measureHorizontalBorder(Element element) {
return WidgetUtil.measureHorizontalBorder(element); return WidgetUtil.measureHorizontalBorder(element);
} }


/**
* @deprecated As of 7.4.0, use
* {@link WidgetUtil#measureVerticalBorder(Element)} instead.
*/
@Deprecated @Deprecated
public static int measureVerticalBorder(Element element) { public static int measureVerticalBorder(Element element) {
return WidgetUtil.measureVerticalBorder(element); return WidgetUtil.measureVerticalBorder(element);
} }


/**
* @deprecated As of 7.4.0, use
* {@link WidgetUtil#measureMarginLeft(Element)} instead.
*/
@Deprecated @Deprecated
public static int measureMarginLeft(Element element) { public static int measureMarginLeft(Element element) {
return WidgetUtil.measureMarginLeft(element); return WidgetUtil.measureMarginLeft(element);
} }


/**
* @deprecated As of 7.4.0, use
* {@link WidgetUtil#setHeightExcludingPaddingAndBorder(Widget, String, int)}
* instead.
*/
@Deprecated @Deprecated
public static int setHeightExcludingPaddingAndBorder(Widget widget, public static int setHeightExcludingPaddingAndBorder(Widget widget,
String height, int paddingBorderGuess) { String height, int paddingBorderGuess) {
paddingBorderGuess); paddingBorderGuess);
} }


/**
* @deprecated As of 7.4.0, use
* {@link WidgetUtil#setWidthExcludingPaddingAndBorder(Widget, String, int)}
* instead.
*/
@Deprecated @Deprecated
public static int setWidthExcludingPaddingAndBorder(Widget widget, public static int setWidthExcludingPaddingAndBorder(Widget widget,
String width, int paddingBorderGuess) { String width, int paddingBorderGuess) {
paddingBorderGuess); paddingBorderGuess);
} }


/**
* @deprecated As of 7.4.0, use
* {@link WidgetUtil#setWidthExcludingPaddingAndBorder(Element, int, int, boolean)}
* instead.
*/
@Deprecated @Deprecated
public static int setWidthExcludingPaddingAndBorder(Element element, public static int setWidthExcludingPaddingAndBorder(Element element,
int requestedWidth, int horizontalPaddingBorderGuess, int requestedWidth, int horizontalPaddingBorderGuess,
requestedWidthIncludesPaddingBorder); requestedWidthIncludesPaddingBorder);
} }


/**
* @deprecated As of 7.4.0, use
* {@link WidgetUtil#setHeightExcludingPaddingAndBorder(Element, int, int, boolean)}
* instead.
*/
@Deprecated @Deprecated
public static int setHeightExcludingPaddingAndBorder(Element element, public static int setHeightExcludingPaddingAndBorder(Element element,
int requestedHeight, int verticalPaddingBorderGuess, int requestedHeight, int verticalPaddingBorderGuess,
requestedHeightIncludesPaddingBorder); requestedHeightIncludesPaddingBorder);
} }


/**
* @deprecated As of 7.4, use {@link Class#getSimpleName()} instead.
*/
@Deprecated @Deprecated
public static String getSimpleName(Object widget) { public static String getSimpleName(Object widget) {
if (widget == null) { if (widget == null) {
return name.substring(name.lastIndexOf('.') + 1); return name.substring(name.lastIndexOf('.') + 1);
} }


/**
* @deprecated As of 7.4.0, use {@link WidgetUtil#setFloat(Element, String)}
* instead.
*/
@Deprecated @Deprecated
public static void setFloat(Element element, String value) { public static void setFloat(Element element, String value) {
WidgetUtil.setFloat(element, value); WidgetUtil.setFloat(element, value);
} }


/**
* @deprecated As of 7.4.0, use {@link WidgetUtil#getNativeScrollbarSize()}
* instead.
*/
@Deprecated @Deprecated
public static int getNativeScrollbarSize() { public static int getNativeScrollbarSize() {
return WidgetUtil.getNativeScrollbarSize(); return WidgetUtil.getNativeScrollbarSize();
/** /**
* Defers the execution of {@link #runWebkitOverflowAutoFix(Element)} * Defers the execution of {@link #runWebkitOverflowAutoFix(Element)}
* *
* @deprecated As of 7.4.0, use
* {@link WidgetUtil#runWebkitOverflowAutoFixDeferred(Element)}
* instead.
*
* @since 7.2.6 * @since 7.2.6
* @param elem * @param elem
* with overflow auto * with overflow auto
* *
* See: our bug #2138 and https://bugs.webkit.org/show_bug.cgi?id=21462 * See: our bug #2138 and https://bugs.webkit.org/show_bug.cgi?id=21462
* *
* @deprecated As of 7.4.0, use
* {@link WidgetUtil#runWebkitOverflowAutoFix(Element)} instead.
*
* @param elem * @param elem
* with overflow auto * with overflow auto
*/ */
return uidl.getBooleanAttribute("cached"); return uidl.getBooleanAttribute("cached");
} }


/**
* @deprecated As of 7.4.0, use {@link WidgetUtil#alert(String)} instead.
*/
@Deprecated @Deprecated
public static void alert(String string) { public static void alert(String string) {
WidgetUtil.alert(string); WidgetUtil.alert(string);
* Gets the border-box width for the given element, i.e. element width + * Gets the border-box width for the given element, i.e. element width +
* border + padding. Always rounds up to nearest integer. * border + padding. Always rounds up to nearest integer.
* *
* @deprecated As of 7.4.0, use {@link WidgetUtil#getRequiredWidth(Element)}
* instead.
*
* @param element * @param element
* The element to check * The element to check
* @return The border-box width for the element * @return The border-box width for the element
* Gets the border-box height for the given element, i.e. element height + * Gets the border-box height for the given element, i.e. element height +
* border + padding. Always rounds up to nearest integer. * border + padding. Always rounds up to nearest integer.
* *
* @deprecated As of 7.4.0, use
* {@link WidgetUtil#getRequiredHeight(Element)} instead.
*
* @param element * @param element
* The element to check * The element to check
* @return The border-box height for the element * @return The border-box height for the element
return WidgetUtil.getRequiredHeight(element); return WidgetUtil.getRequiredHeight(element);
} }


/**
* @deprecated As of 7.4.0, use
* {@link WidgetUtil#getRequiredWidthBoundingClientRect(Element)}
* instead.
*/
@Deprecated @Deprecated
public int getRequiredWidthBoundingClientRect( public int getRequiredWidthBoundingClientRect(
com.google.gwt.dom.client.Element element) { com.google.gwt.dom.client.Element element) {
return WidgetUtil.getRequiredWidthBoundingClientRect(element); return WidgetUtil.getRequiredWidthBoundingClientRect(element);
} }


/**
* @deprecated As of 7.4.0, use
* {@link WidgetUtil#getRequiredHeightComputedStyle(Element)}
* instead.
*/
@Deprecated @Deprecated
public static int getRequiredHeightComputedStyle( public static int getRequiredHeightComputedStyle(
com.google.gwt.dom.client.Element element) { com.google.gwt.dom.client.Element element) {
return WidgetUtil.getRequiredHeightComputedStyle(element); return WidgetUtil.getRequiredHeightComputedStyle(element);
} }


/**
* @deprecated As of 7.4.0, use
* {@link WidgetUtil#getRequiredWidthComputedStyle(Element)}
* instead.
*/
@Deprecated @Deprecated
public static int getRequiredWidthComputedStyle( public static int getRequiredWidthComputedStyle(
com.google.gwt.dom.client.Element element) { com.google.gwt.dom.client.Element element) {
return WidgetUtil.getRequiredWidthComputedStyle(element); return WidgetUtil.getRequiredWidthComputedStyle(element);
} }


/**
* @deprecated As of 7.4.0, use
* {@link WidgetUtil#getRequiredHeightBoundingClientRect(Element)}
* instead.
*/
@Deprecated @Deprecated
public static int getRequiredHeightBoundingClientRect( public static int getRequiredHeightBoundingClientRect(
com.google.gwt.dom.client.Element element) { com.google.gwt.dom.client.Element element) {
return WidgetUtil.getRequiredHeightBoundingClientRect(element); return WidgetUtil.getRequiredHeightBoundingClientRect(element);
} }


/**
* @deprecated As of 7.4.0, use {@link WidgetUtil#getRequiredWidth(Widget)}
* instead.
*/
@Deprecated @Deprecated
public static int getRequiredWidth(Widget widget) { public static int getRequiredWidth(Widget widget) {
return WidgetUtil.getRequiredWidth(widget); return WidgetUtil.getRequiredWidth(widget);
} }


/**
* @deprecated As of 7.4.0, use {@link WidgetUtil#getRequiredHeight(Widget)}
* instead.
*/
@Deprecated @Deprecated
public static int getRequiredHeight(Widget widget) { public static int getRequiredHeight(Widget widget) {
return WidgetUtil.getRequiredHeight(widget); return WidgetUtil.getRequiredHeight(widget);
/** /**
* Detects what is currently the overflow style attribute in given element. * Detects what is currently the overflow style attribute in given element.
* *
* @deprecated As of 7.4.0, use
* {@link WidgetUtil#mayHaveScrollBars(Element)} instead.
*
* @param pe * @param pe
* the element to detect * the element to detect
* @return true if auto or scroll * @return true if auto or scroll
/** /**
* Will (attempt) to focus the given DOM Element. * Will (attempt) to focus the given DOM Element.
* *
* @deprecated As of 7.4.0, use {@link WidgetUtil#focus(Element)} instead.
*
* @param el * @param el
* the element to focus * the element to focus
*/ */
* Helper method to find first instance of given Widget type found by * Helper method to find first instance of given Widget type found by
* traversing DOM upwards from given element. * traversing DOM upwards from given element.
* *
* @deprecated As of 7.4.0, use
* {@link WidgetUtil#findWidget(Element, Class)} instead.
*
* @param element * @param element
* the element where to start seeking of Widget * the element where to start seeking of Widget
* @param class1 * @param class1
/** /**
* Force webkit to redraw an element * Force webkit to redraw an element
* *
* @deprecated As of 7.4.0, use
* {@link WidgetUtil#forceWebkitRedraw(Element)} instead.
*
* @param element * @param element
* The element that should be redrawn * The element that should be redrawn
*/ */
* necessary in cases where IE8 "forgets" to update child elements when they * necessary in cases where IE8 "forgets" to update child elements when they
* resize. * resize.
* *
* @deprecated As of 7.4.0, use {@link WidgetUtil#forceIE8Redraw(Element)}
* instead.
*
* @param e * @param e
* The element to perform the hack on * The element to perform the hack on
*/ */
* necessary in cases where IE "forgets" to update child elements when they * necessary in cases where IE "forgets" to update child elements when they
* resize. * resize.
* *
* @deprecated As of 7.4.0, use {@link WidgetUtil#forceIERedraw(Element)}
* instead.
*
* @since 7.3 * @since 7.3
* @param e * @param e
* The element to perform the hack on * The element to perform the hack on
* *
* Does nothing if the element is not attached to the DOM. * Does nothing if the element is not attached to the DOM.
* *
* @deprecated As of 7.4.0, use {@link WidgetUtil#detachAttach(Element)}
* instead.
*
* @param element * @param element
* The element to detach and re-attach * The element to detach and re-attach
*/ */
WidgetUtil.detachAttach(element); WidgetUtil.detachAttach(element);
} }


/**
* @deprecated As of 7.4.0, use
* {@link WidgetUtil#sinkOnloadForImages(Element)} instead.
*/
@Deprecated @Deprecated
public static void sinkOnloadForImages(Element element) { public static void sinkOnloadForImages(Element element) {
WidgetUtil.sinkOnloadForImages(element); WidgetUtil.sinkOnloadForImages(element);
/** /**
* Returns the index of the childElement within its parent. * Returns the index of the childElement within its parent.
* *
* @deprecated As of 7.4.0, use
* {@link WidgetUtil#getChildElementIndex(Element)} instead.
*
* @param subElement * @param subElement
* @return * @return
*/ */
* resets it to its current value. Used mainly to work around rendering * resets it to its current value. Used mainly to work around rendering
* issues in IE (and possibly in other browsers) * issues in IE (and possibly in other browsers)
* *
* @deprecated As of 7.4.0, use
* {@link WidgetUtil#setStyleTemporarily(Element, String, String)}
* instead.
*
* @param element * @param element
* The target element * The target element
* @param styleProperty * @param styleProperty
* position from either first changed touch (if touch event) or from the * position from either first changed touch (if touch event) or from the
* event itself. * event itself.
* *
* @deprecated As of 7.4.0, use
* {@link WidgetUtil#getTouchOrMouseClientX(Event)} instead.
*
* @param event * @param event
* @return * @return
*/ */
* event. Please note that this is not always the same as the target of the * event. Please note that this is not always the same as the target of the
* event e.g. if event capture is used. * event e.g. if event capture is used.
* *
* @deprecated As of 7.4.0, use
* {@link WidgetUtil#getElementUnderMouse(NativeEvent)} instead.
*
* @param event * @param event
* the mouse event to get coordinates from * the mouse event to get coordinates from
* @return the element at the coordinates of the event * @return the element at the coordinates of the event
* position from either first changed touch (if touch event) or from the * position from either first changed touch (if touch event) or from the
* event itself. * event itself.
* *
* @deprecated As of 7.4.0, use
* {@link WidgetUtil#getTouchOrMouseClientY(Event)} instead.
*
* @param event * @param event
* @return * @return
*/ */
} }


/** /**
* @deprecated As of 7.4.0, use
* {@link WidgetUtil#getTouchOrMouseClientY(NativeEvent)}
* instead.
* *
* @see #getTouchOrMouseClientY(Event) * @see #getTouchOrMouseClientY(Event)
* @param currentGwtEvent * @param currentGwtEvent
} }


/** /**
* @deprecated As of 7.4.0, use
* {@link WidgetUtil#getTouchOrMouseClientX(NativeEvent)}
* instead.
*
* @see #getTouchOrMouseClientX(Event) * @see #getTouchOrMouseClientX(Event)
* *
* @param event * @param event
return WidgetUtil.getTouchOrMouseClientX(event); return WidgetUtil.getTouchOrMouseClientX(event);
} }


/**
* @deprecated As of 7.4.0, use {@link WidgetUtil#isTouchEvent(Event)}
* instead.
*/
@Deprecated @Deprecated
public static boolean isTouchEvent(Event event) { public static boolean isTouchEvent(Event event) {
return WidgetUtil.isTouchEvent(event); return WidgetUtil.isTouchEvent(event);
} }


/**
* @deprecated As of 7.4.0, use {@link WidgetUtil#isTouchEvent(NativeEvent)}
* instead.
*/
@Deprecated @Deprecated
public static boolean isTouchEvent(NativeEvent event) { public static boolean isTouchEvent(NativeEvent event) {
return WidgetUtil.isTouchEvent(event); return WidgetUtil.isTouchEvent(event);
} }


/**
* @deprecated As of 7.4.0, use
* {@link WidgetUtil#simulateClickFromTouchEvent(Event, Widget)}
* instead.
*/
@Deprecated @Deprecated
public static void simulateClickFromTouchEvent(Event touchevent, public static void simulateClickFromTouchEvent(Event touchevent,
Widget widget) { Widget widget) {
/** /**
* Gets the currently focused element. * Gets the currently focused element.
* *
* @deprecated As of 7.4.0, use {@link WidgetUtil#getFocusedElement()}
* instead.
*
* @return The active element or null if no active element could be found. * @return The active element or null if no active element could be found.
*/ */
@Deprecated @Deprecated
/** /**
* Gets currently focused element and checks if it's editable * Gets currently focused element and checks if it's editable
* *
* @deprecated As of 7.4.0, use
* {@link WidgetUtil#isFocusedElementEditable()} instead.
*
* @since 7.4 * @since 7.4
* *
* @return true if focused element is editable * @return true if focused element is editable
* be e.g used to check whether component should react to some events or * be e.g used to check whether component should react to some events or
* not. * not.
* *
* @deprecated As of 7.4.0, use
* {@link WidgetUtil#isAttachedAndDisplayed(Widget)} instead.
*
* @param widget * @param widget
* @return true if attached and displayed * @return true if attached and displayed
*/ */
* Scrolls an element into view vertically only. Modified version of * Scrolls an element into view vertically only. Modified version of
* Element.scrollIntoView. * Element.scrollIntoView.
* *
* @deprecated As of 7.4.0, use
* {@link WidgetUtil#scrollIntoViewVertically(Element)} instead.
*
* @param elem * @param elem
* The element to scroll into view * The element to scroll into view
*/ */
* Checks if the given event is either a touch event or caused by the left * Checks if the given event is either a touch event or caused by the left
* mouse button * mouse button
* *
* @deprecated As of 7.4.0, use
* {@link WidgetUtil#isTouchEventOrLeftMouseButton(Event)}
* instead.
*
* @param event * @param event
* @return true if the event is a touch event or caused by the left mouse * @return true if the event is a touch event or caused by the left mouse
* button, false otherwise * button, false otherwise
* Resolve a relative URL to an absolute URL based on the current document's * Resolve a relative URL to an absolute URL based on the current document's
* location. * location.
* *
* @deprecated As of 7.4.0, use {@link WidgetUtil#getAbsoluteUrl(String)}
* instead.
*
* @param url * @param url
* a string with the relative URL to resolve * a string with the relative URL to resolve
* @return the corresponding absolute URL as a string * @return the corresponding absolute URL as a string
* to the start. This makes Firefox work the same way as other browsers * to the start. This makes Firefox work the same way as other browsers
* (#13477) * (#13477)
* *
* @deprecated As of 7.4.0, use
* {@link WidgetUtil#setSelectionRange(Element, int, int, String)}
* instead.
*
* @param elem * @param elem
* the html input element. * the html input element.
* @param pos * @param pos

Loading…
Cancel
Save