Changed implementations and APIs to use the non-deprecated Element class wherever possible without breaking backwards compatibility. * Methods defined in interfaces have not been touched. * Return types have only been changed methods that should have no existing third party callers (i.e. private, internal or @since 7.2) * For methods that third party code might have overridden, the method has been deprecated in favor of a new method that just delegates to the old method. * For methods that can't reasonably be overridden by third party code (i.e. private, final, static, internal or @since 7.2), the parameter type has been changed without retaining the old method. Change-Id: I7da943a77b8d0d0b9185d8c70f87d676a275d24btags/7.2.0.beta1
@@ -38,6 +38,7 @@ import com.google.gwt.core.client.JsArray; | |||
import com.google.gwt.core.client.JsArrayString; | |||
import com.google.gwt.core.client.Scheduler; | |||
import com.google.gwt.core.client.Scheduler.ScheduledCommand; | |||
import com.google.gwt.dom.client.Element; | |||
import com.google.gwt.event.shared.EventBus; | |||
import com.google.gwt.event.shared.EventHandler; | |||
import com.google.gwt.event.shared.GwtEvent; | |||
@@ -515,8 +516,7 @@ public class ApplicationConnection { | |||
// Ensure the overlay container is added to the dom and set as a live | |||
// area for assistive devices | |||
com.google.gwt.user.client.Element overlayContainer = VOverlay | |||
.getOverlayContainer(this); | |||
Element overlayContainer = VOverlay.getOverlayContainer(this); | |||
Roles.getAlertRole().setAriaLiveProperty(overlayContainer, | |||
LiveValue.ASSERTIVE); | |||
VOverlay.setOverlayContainerLabel(this, | |||
@@ -581,16 +581,16 @@ public class ApplicationConnection { | |||
return componentLocator.@com.vaadin.client.componentlocator.ComponentLocator::getElementByPath(Ljava/lang/String;)(id); | |||
}); | |||
client.getElementByPathStartingAt = $entry(function(id, element) { | |||
return componentLocator.@com.vaadin.client.componentlocator.ComponentLocator::getElementByPathStartingAt(Ljava/lang/String;Lcom/google/gwt/user/client/Element;)(id, element); | |||
return componentLocator.@com.vaadin.client.componentlocator.ComponentLocator::getElementByPathStartingAt(Ljava/lang/String;Lcom/google/gwt/dom/client/Element;)(id, element); | |||
}); | |||
client.getElementsByPath = $entry(function(id) { | |||
return componentLocator.@com.vaadin.client.componentlocator.ComponentLocator::getElementsByPath(Ljava/lang/String;)(id); | |||
}); | |||
client.getElementsByPathStartingAt = $entry(function(id, element) { | |||
return componentLocator.@com.vaadin.client.componentlocator.ComponentLocator::getElementsByPathStartingAt(Ljava/lang/String;Lcom/google/gwt/user/client/Element;)(id, element); | |||
return componentLocator.@com.vaadin.client.componentlocator.ComponentLocator::getElementsByPathStartingAt(Ljava/lang/String;Lcom/google/gwt/dom/client/Element;)(id, element); | |||
}); | |||
client.getPathForElement = $entry(function(element) { | |||
return componentLocator.@com.vaadin.client.componentlocator.ComponentLocator::getPathForElement(Lcom/google/gwt/user/client/Element;)(element); | |||
return componentLocator.@com.vaadin.client.componentlocator.ComponentLocator::getPathForElement(Lcom/google/gwt/dom/client/Element;)(element); | |||
}); | |||
client.initializing = false; | |||
@@ -3483,8 +3483,7 @@ public class ApplicationConnection { | |||
* @return Connector for focused element or null. | |||
*/ | |||
private ComponentConnector getActiveConnector() { | |||
com.google.gwt.user.client.Element focusedElement = Util | |||
.getFocusedElement(); | |||
Element focusedElement = Util.getFocusedElement(); | |||
if (focusedElement == null) { | |||
return null; | |||
} |
@@ -15,6 +15,9 @@ | |||
*/ | |||
package com.vaadin.client; | |||
import com.google.gwt.dom.client.Element; | |||
import com.google.gwt.user.client.DOM; | |||
/** | |||
* Contains size information about a rendered container and its content area. | |||
* | |||
@@ -49,7 +52,10 @@ public class RenderInformation { | |||
* @param widget | |||
* | |||
* @return true if the size has changed since last update | |||
* @deprecated As of 7.2, call and override {@link #updateSize(Element)} | |||
* instead | |||
*/ | |||
@Deprecated | |||
public boolean updateSize(com.google.gwt.user.client.Element element) { | |||
Size newSize = new Size(element.getOffsetWidth(), | |||
element.getOffsetHeight()); | |||
@@ -61,6 +67,19 @@ public class RenderInformation { | |||
} | |||
} | |||
/** | |||
* Update the size of the widget. | |||
* | |||
* @param widget | |||
* | |||
* @return true if the size has changed since last update | |||
* | |||
* @since 7.2 | |||
*/ | |||
public boolean updateSize(Element element) { | |||
return updateSize(DOM.asOld(element)); | |||
} | |||
@Override | |||
public String toString() { | |||
return "RenderInformation [contentArea=" + contentArea |
@@ -17,6 +17,7 @@ | |||
package com.vaadin.client; | |||
import com.google.gwt.dom.client.Document; | |||
import com.google.gwt.dom.client.Element; | |||
import com.google.gwt.dom.client.SpanElement; | |||
import com.google.gwt.dom.client.Style; | |||
import com.google.gwt.dom.client.Style.Cursor; | |||
@@ -30,6 +31,7 @@ import com.google.gwt.event.dom.client.DoubleClickHandler; | |||
import com.google.gwt.event.dom.client.HasDoubleClickHandlers; | |||
import com.google.gwt.event.shared.HandlerManager; | |||
import com.google.gwt.event.shared.HandlerRegistration; | |||
import com.google.gwt.user.client.DOM; | |||
import com.google.gwt.user.client.ui.ComplexPanel; | |||
import com.google.gwt.user.client.ui.Label; | |||
import com.google.gwt.user.client.ui.Widget; | |||
@@ -42,8 +44,7 @@ import com.google.gwt.user.client.ui.Widget; | |||
*/ | |||
@Deprecated | |||
public class SimpleTree extends ComplexPanel implements HasDoubleClickHandlers { | |||
private com.google.gwt.user.client.Element children = Document.get() | |||
.createDivElement().cast(); | |||
private Element children = Document.get().createDivElement(); | |||
private SpanElement handle = Document.get().createSpanElement(); | |||
private SpanElement text = Document.get().createSpanElement(); | |||
@@ -143,7 +144,14 @@ public class SimpleTree extends ComplexPanel implements HasDoubleClickHandlers { | |||
add(child, children); | |||
} | |||
/** | |||
* {@inheritDoc} | |||
* | |||
* @deprecated As of 7.2, call and override {@link #add(Widget, Element)} | |||
* instead. | |||
*/ | |||
@Override | |||
@Deprecated | |||
protected void add(Widget child, | |||
com.google.gwt.user.client.Element container) { | |||
super.add(child, container); | |||
@@ -151,6 +159,16 @@ public class SimpleTree extends ComplexPanel implements HasDoubleClickHandlers { | |||
getElement().getStyle().setPaddingLeft(3, Unit.PX); | |||
} | |||
/** | |||
* {@inheritDoc} | |||
* | |||
* @since 7.2 | |||
*/ | |||
@Override | |||
protected void add(Widget child, Element container) { | |||
add(child, DOM.asOld(container)); | |||
} | |||
/** | |||
* {@inheritDoc} Events are not fired when double clicking child widgets. | |||
*/ |
@@ -27,6 +27,7 @@ import com.google.gwt.core.client.Scheduler.ScheduledCommand; | |||
import com.google.gwt.dom.client.AnchorElement; | |||
import com.google.gwt.dom.client.DivElement; | |||
import com.google.gwt.dom.client.Document; | |||
import com.google.gwt.dom.client.Element; | |||
import com.google.gwt.dom.client.NativeEvent; | |||
import com.google.gwt.dom.client.Node; | |||
import com.google.gwt.dom.client.NodeList; | |||
@@ -147,8 +148,7 @@ public class Util { | |||
} | |||
} | |||
private static final com.google.gwt.user.client.Element escapeHtmlHelper = DOM | |||
.createDiv(); | |||
private static final Element escapeHtmlHelper = DOM.createDiv(); | |||
/** | |||
* Converts html entities to text. | |||
@@ -198,13 +198,13 @@ public class Util { | |||
* @return | |||
*/ | |||
public static native com.google.gwt.user.client.Element cloneNode( | |||
com.google.gwt.user.client.Element element, boolean deep) | |||
Element element, boolean deep) | |||
/*-{ | |||
return element.cloneNode(deep); | |||
}-*/; | |||
public static int measureHorizontalPaddingAndBorder( | |||
com.google.gwt.user.client.Element element, int paddingGuess) { | |||
public static int measureHorizontalPaddingAndBorder(Element element, | |||
int paddingGuess) { | |||
String originalWidth = DOM.getStyleAttribute(element, "width"); | |||
int originalOffsetWidth = element.getOffsetWidth(); | |||
@@ -220,8 +220,8 @@ public class Util { | |||
return padding; | |||
} | |||
public static int measureVerticalPaddingAndBorder( | |||
com.google.gwt.user.client.Element element, int paddingGuess) { | |||
public static int measureVerticalPaddingAndBorder(Element element, | |||
int paddingGuess) { | |||
String originalHeight = DOM.getStyleAttribute(element, "height"); | |||
int originalOffsetHeight = element.getOffsetHeight(); | |||
int widthGuess = (originalOffsetHeight - paddingGuess); | |||
@@ -235,8 +235,7 @@ public class Util { | |||
return padding; | |||
} | |||
public static int measureHorizontalBorder( | |||
com.google.gwt.user.client.Element element) { | |||
public static int measureHorizontalBorder(Element element) { | |||
int borders; | |||
if (BrowserInfo.get().isIE()) { | |||
@@ -267,8 +266,7 @@ public class Util { | |||
return borders; | |||
} | |||
public static int measureVerticalBorder( | |||
com.google.gwt.user.client.Element element) { | |||
public static int measureVerticalBorder(Element element) { | |||
int borders; | |||
if (BrowserInfo.get().isIE()) { | |||
String width = element.getStyle().getProperty("width"); | |||
@@ -300,8 +298,7 @@ public class Util { | |||
return borders; | |||
} | |||
public static int measureMarginLeft( | |||
com.google.gwt.user.client.Element element) { | |||
public static int measureMarginLeft(Element element) { | |||
return element.getAbsoluteLeft() | |||
- element.getParentElement().getAbsoluteLeft(); | |||
} | |||
@@ -350,9 +347,8 @@ public class Util { | |||
} | |||
} | |||
public static int setWidthExcludingPaddingAndBorder( | |||
com.google.gwt.user.client.Element element, int requestedWidth, | |||
int horizontalPaddingBorderGuess, | |||
public static int setWidthExcludingPaddingAndBorder(Element element, | |||
int requestedWidth, int horizontalPaddingBorderGuess, | |||
boolean requestedWidthIncludesPaddingBorder) { | |||
int widthGuess = requestedWidth - horizontalPaddingBorderGuess; | |||
@@ -384,9 +380,8 @@ public class Util { | |||
} | |||
public static int setHeightExcludingPaddingAndBorder( | |||
com.google.gwt.user.client.Element element, int requestedHeight, | |||
int verticalPaddingBorderGuess, | |||
public static int setHeightExcludingPaddingAndBorder(Element element, | |||
int requestedHeight, int verticalPaddingBorderGuess, | |||
boolean requestedHeightIncludesPaddingBorder) { | |||
int heightGuess = requestedHeight - verticalPaddingBorderGuess; | |||
@@ -427,8 +422,7 @@ public class Util { | |||
return name.substring(name.lastIndexOf('.') + 1); | |||
} | |||
public static void setFloat(com.google.gwt.user.client.Element element, | |||
String value) { | |||
public static void setFloat(Element element, String value) { | |||
if (BrowserInfo.get().isIE()) { | |||
DOM.setStyleAttribute(element, "styleFloat", value); | |||
} else { | |||
@@ -440,7 +434,7 @@ public class Util { | |||
public static int getNativeScrollbarSize() { | |||
if (detectedScrollbarSize < 0) { | |||
com.google.gwt.user.client.Element scroller = DOM.createDiv(); | |||
Element scroller = DOM.createDiv(); | |||
scroller.getStyle().setProperty("width", "50px"); | |||
scroller.getStyle().setProperty("height", "50px"); | |||
scroller.getStyle().setProperty("overflow", "scroll"); | |||
@@ -463,8 +457,7 @@ public class Util { | |||
* @param elem | |||
* with overflow auto | |||
*/ | |||
public static void runWebkitOverflowAutoFix( | |||
final com.google.gwt.user.client.Element elem) { | |||
public static void runWebkitOverflowAutoFix(final Element elem) { | |||
// Add max version if fix lands sometime to Webkit | |||
// Starting from Opera 11.00, also a problem in Opera | |||
if (BrowserInfo.get().requiresOverflowAutoFix()) { | |||
@@ -777,11 +770,10 @@ public class Util { | |||
* element does not belong to a child. | |||
*/ | |||
public static ComponentConnector getConnectorForElement( | |||
ApplicationConnection client, Widget parent, | |||
com.google.gwt.user.client.Element element) { | |||
ApplicationConnection client, Widget parent, Element element) { | |||
com.google.gwt.user.client.Element browseElement = element; | |||
com.google.gwt.user.client.Element rootElement = parent.getElement(); | |||
Element browseElement = element; | |||
Element rootElement = parent.getElement(); | |||
while (browseElement != null && browseElement != rootElement) { | |||
@@ -799,8 +791,7 @@ public class Util { | |||
if (connector != null) { | |||
// check that inside the rootElement | |||
while (browseElement != null && browseElement != rootElement) { | |||
browseElement = (com.google.gwt.user.client.Element) browseElement | |||
.getParentElement(); | |||
browseElement = browseElement.getParentElement(); | |||
} | |||
if (browseElement != rootElement) { | |||
return null; | |||
@@ -809,8 +800,7 @@ public class Util { | |||
} | |||
} | |||
browseElement = (com.google.gwt.user.client.Element) browseElement | |||
.getParentElement(); | |||
browseElement = browseElement.getParentElement(); | |||
} | |||
// No connector found, element is possibly inside a VOverlay | |||
@@ -831,7 +821,7 @@ public class Util { | |||
* @param el | |||
* the element to focus | |||
*/ | |||
public static native void focus(com.google.gwt.user.client.Element el) | |||
public static native void focus(Element el) | |||
/*-{ | |||
try { | |||
el.focus(); | |||
@@ -848,8 +838,7 @@ public class Util { | |||
* the element to start from | |||
*/ | |||
public static ComponentConnector findPaintable( | |||
ApplicationConnection client, | |||
com.google.gwt.user.client.Element element) { | |||
ApplicationConnection client, Element element) { | |||
Widget widget = Util.findWidget(element, null); | |||
ConnectorMap vPaintableMap = ConnectorMap.get(client); | |||
while (widget != null && !vPaintableMap.isConnector(widget)) { | |||
@@ -869,7 +858,7 @@ public class Util { | |||
* the Widget type to seek for | |||
*/ | |||
@SuppressWarnings("unchecked") | |||
public static <T> T findWidget(com.google.gwt.user.client.Element element, | |||
public static <T> T findWidget(Element element, | |||
Class<? extends Widget> class1) { | |||
if (element != null) { | |||
/* First seek for the first EventListener (~Widget) from dom */ | |||
@@ -877,8 +866,7 @@ public class Util { | |||
while (eventListener == null && element != null) { | |||
eventListener = Event.getEventListener(element); | |||
if (eventListener == null) { | |||
element = (com.google.gwt.user.client.Element) element | |||
.getParentElement(); | |||
element = element.getParentElement(); | |||
} | |||
} | |||
if (eventListener instanceof Widget) { | |||
@@ -904,8 +892,7 @@ public class Util { | |||
* @param element | |||
* The element that should be redrawn | |||
*/ | |||
public static void forceWebkitRedraw( | |||
com.google.gwt.user.client.Element element) { | |||
public static void forceWebkitRedraw(Element element) { | |||
Style style = element.getStyle(); | |||
String s = style.getProperty("webkitTransform"); | |||
if (s == null || s.length() == 0) { | |||
@@ -923,7 +910,7 @@ public class Util { | |||
* @param e | |||
* The element to perform the hack on | |||
*/ | |||
public static final void forceIE8Redraw(com.google.gwt.user.client.Element e) { | |||
public static final void forceIE8Redraw(Element e) { | |||
if (BrowserInfo.get().isIE8()) { | |||
setStyleTemporarily(e, "zoom", "1"); | |||
} | |||
@@ -938,7 +925,7 @@ public class Util { | |||
* @param element | |||
* The element to detach and re-attach | |||
*/ | |||
public static void detachAttach(com.google.gwt.user.client.Element element) { | |||
public static void detachAttach(Element element) { | |||
if (element == null) { | |||
return; | |||
} | |||
@@ -958,14 +945,11 @@ public class Util { | |||
} | |||
public static void sinkOnloadForImages( | |||
com.google.gwt.user.client.Element element) { | |||
public static void sinkOnloadForImages(Element element) { | |||
NodeList<com.google.gwt.dom.client.Element> imgElements = element | |||
.getElementsByTagName("img"); | |||
for (int i = 0; i < imgElements.getLength(); i++) { | |||
DOM.sinkEvents( | |||
(com.google.gwt.user.client.Element) imgElements.getItem(i), | |||
Event.ONLOAD); | |||
DOM.sinkEvents(imgElements.getItem(i), Event.ONLOAD); | |||
} | |||
} | |||
@@ -976,8 +960,7 @@ public class Util { | |||
* @param subElement | |||
* @return | |||
*/ | |||
public static int getChildElementIndex( | |||
com.google.gwt.user.client.Element childElement) { | |||
public static int getChildElementIndex(Element childElement) { | |||
int idx = 0; | |||
Node n = childElement; | |||
while ((n = n.getPreviousSibling()) != null) { | |||
@@ -1057,8 +1040,7 @@ public class Util { | |||
* @param tempValue | |||
* The temporary value | |||
*/ | |||
public static void setStyleTemporarily( | |||
com.google.gwt.user.client.Element element, | |||
public static void setStyleTemporarily(Element element, | |||
final String styleProperty, String tempValue) { | |||
final Style style = element.getStyle(); | |||
final String currentValue = style.getProperty(styleProperty); | |||
@@ -1167,8 +1149,8 @@ public class Util { | |||
* Get target with element from point as we want the actual element, not | |||
* the one that sunk the event. | |||
*/ | |||
final com.google.gwt.user.client.Element target = getElementFromPoint( | |||
touch.getClientX(), touch.getClientY()); | |||
final Element target = getElementFromPoint(touch.getClientX(), | |||
touch.getClientY()); | |||
/* | |||
* Fixes infocusable form fields in Safari of iOS 5.x and some Android | |||
@@ -1264,8 +1246,7 @@ public class Util { | |||
* @param elem | |||
* The element to scroll into view | |||
*/ | |||
public static native void scrollIntoViewVertically( | |||
com.google.gwt.user.client.Element elem) | |||
public static native void scrollIntoViewVertically(Element elem) | |||
/*-{ | |||
var top = elem.offsetTop; | |||
var height = elem.offsetHeight; |
@@ -17,6 +17,7 @@ | |||
package com.vaadin.client; | |||
import com.google.gwt.aria.client.Roles; | |||
import com.google.gwt.dom.client.Element; | |||
import com.google.gwt.user.client.DOM; | |||
import com.google.gwt.user.client.Event; | |||
import com.google.gwt.user.client.ui.HTML; | |||
@@ -36,15 +37,15 @@ public class VCaption extends HTML { | |||
private final ComponentConnector owner; | |||
private com.google.gwt.user.client.Element errorIndicatorElement; | |||
private Element errorIndicatorElement; | |||
private com.google.gwt.user.client.Element requiredFieldIndicator; | |||
private Element requiredFieldIndicator; | |||
private Icon icon; | |||
private String iconAltText = ""; | |||
private com.google.gwt.user.client.Element captionText; | |||
private Element captionText; | |||
private final ApplicationConnection client; | |||
@@ -411,8 +412,7 @@ public class VCaption extends HTML { | |||
@Override | |||
public void onBrowserEvent(Event event) { | |||
super.onBrowserEvent(event); | |||
final com.google.gwt.user.client.Element target = DOM | |||
.eventGetTarget(event); | |||
final Element target = DOM.eventGetTarget(event); | |||
if (DOM.eventGetType(event) == Event.ONLOAD | |||
&& icon.getElement() == target) { | |||
@@ -670,21 +670,19 @@ public class VCaption extends HTML { | |||
} | |||
protected com.google.gwt.user.client.Element getTextElement() { | |||
return captionText; | |||
return DOM.asOld(captionText); | |||
} | |||
public static String getCaptionOwnerPid(com.google.gwt.user.client.Element e) { | |||
public static String getCaptionOwnerPid(Element e) { | |||
return getOwnerPid(e); | |||
} | |||
private native static void setOwnerPid( | |||
com.google.gwt.user.client.Element el, String pid) | |||
private native static void setOwnerPid(Element el, String pid) | |||
/*-{ | |||
el.vOwnerPid = pid; | |||
}-*/; | |||
public native static String getOwnerPid( | |||
com.google.gwt.user.client.Element el) | |||
public native static String getOwnerPid(Element el) | |||
/*-{ | |||
return el.vOwnerPid; | |||
}-*/; |
@@ -16,6 +16,7 @@ | |||
package com.vaadin.client; | |||
import com.google.gwt.dom.client.Element; | |||
import com.google.gwt.user.client.DOM; | |||
import com.google.gwt.user.client.ui.FlowPanel; | |||
import com.google.gwt.user.client.ui.HTML; | |||
@@ -60,7 +61,9 @@ public class VErrorMessage extends FlowPanel { | |||
* Shows this error message next to given element. | |||
* | |||
* @param indicatorElement | |||
* @deprecated As of 7.2, call and override {@link #showAt(Element)} instead | |||
*/ | |||
@Deprecated | |||
public void showAt(com.google.gwt.user.client.Element indicatorElement) { | |||
VOverlay errorContainer = (VOverlay) getParent(); | |||
if (errorContainer == null) { | |||
@@ -81,6 +84,17 @@ public class VErrorMessage extends FlowPanel { | |||
} | |||
/** | |||
* Shows this error message next to given element. | |||
* | |||
* @param indicatorElement | |||
* | |||
* @since 7.2 | |||
*/ | |||
public void showAt(Element indicatorElement) { | |||
showAt(DOM.asOld(indicatorElement)); | |||
} | |||
public void hide() { | |||
final VOverlay errorContainer = (VOverlay) getParent(); | |||
if (errorContainer != null) { |
@@ -16,6 +16,7 @@ | |||
package com.vaadin.client; | |||
import com.google.gwt.dom.client.Element; | |||
import com.google.gwt.dom.client.Style.Display; | |||
import com.google.gwt.dom.client.Style.Position; | |||
import com.google.gwt.user.client.DOM; | |||
@@ -66,7 +67,7 @@ public class VLoadingIndicator { | |||
} | |||
}; | |||
private com.google.gwt.user.client.Element element; | |||
private Element element; | |||
/** | |||
* Returns the delay (in ms) which must pass before the loading indicator | |||
@@ -234,7 +235,7 @@ public class VLoadingIndicator { | |||
getConnection().getUIConnector().getWidget().getElement() | |||
.appendChild(element); | |||
} | |||
return element; | |||
return DOM.asOld(element); | |||
} | |||
} |
@@ -18,6 +18,7 @@ package com.vaadin.client; | |||
import com.google.gwt.aria.client.LiveValue; | |||
import com.google.gwt.aria.client.RelevantValue; | |||
import com.google.gwt.aria.client.Roles; | |||
import com.google.gwt.dom.client.Element; | |||
import com.google.gwt.event.dom.client.BlurEvent; | |||
import com.google.gwt.event.dom.client.BlurHandler; | |||
import com.google.gwt.event.dom.client.ClickEvent; | |||
@@ -48,7 +49,7 @@ public class VTooltip extends VWindowOverlay { | |||
| Event.ONMOUSEOVER | Event.ONMOUSEOUT | Event.ONMOUSEMOVE | |||
| Event.ONCLICK; | |||
VErrorMessage em = new VErrorMessage(); | |||
com.google.gwt.user.client.Element description = DOM.createDiv(); | |||
Element description = DOM.createDiv(); | |||
private boolean closing = false; | |||
private boolean opening = false; | |||
@@ -323,8 +324,7 @@ public class VTooltip extends VWindowOverlay { | |||
* Element used in search | |||
* @return true if connector and tooltip found | |||
*/ | |||
private boolean resolveConnector( | |||
com.google.gwt.user.client.Element element) { | |||
private boolean resolveConnector(Element element) { | |||
ApplicationConnection ac = getApplicationConnection(); | |||
ComponentConnector connector = Util.getConnectorForElement(ac, | |||
@@ -410,15 +410,14 @@ public class VTooltip extends VWindowOverlay { | |||
private void handleShowHide(DomEvent domEvent, boolean isFocused) { | |||
Event event = Event.as(domEvent.getNativeEvent()); | |||
com.google.gwt.dom.client.Element element = com.google.gwt.user.client.Element | |||
.as(event.getEventTarget()); | |||
Element element = Element.as(event.getEventTarget()); | |||
// We can ignore move event if it's handled by move or over already | |||
if (currentElement == element && handledByFocus == true) { | |||
return; | |||
} | |||
boolean connectorAndTooltipFound = resolveConnector((com.google.gwt.user.client.Element) element); | |||
boolean connectorAndTooltipFound = resolveConnector(element); | |||
if (!connectorAndTooltipFound) { | |||
if (isShowing()) { | |||
handleHideEvent(); |
@@ -20,6 +20,8 @@ import java.util.List; | |||
import com.google.gwt.core.client.JavaScriptObject; | |||
import com.google.gwt.core.client.JsArray; | |||
import com.google.gwt.dom.client.Element; | |||
import com.google.gwt.user.client.DOM; | |||
import com.vaadin.client.ApplicationConnection; | |||
/** | |||
@@ -70,7 +72,10 @@ public class ComponentLocator { | |||
* The element to generate a path for. | |||
* @return A String locator that identifies the target element or null if a | |||
* String locator could not be created. | |||
* @deprecated As of 7.2, call and override | |||
* {@link #getPathForElement(Element)} instead | |||
*/ | |||
@Deprecated | |||
public String getPathForElement( | |||
com.google.gwt.user.client.Element targetElement) { | |||
for (LocatorStrategy strategy : locatorStrategies) { | |||
@@ -82,6 +87,28 @@ public class ComponentLocator { | |||
return null; | |||
} | |||
/** | |||
* Generates a String locator which uniquely identifies the target element. | |||
* The {@link #getElementByPath(String)} method can be used for the inverse | |||
* operation, i.e. locating an element based on the return value from this | |||
* method. | |||
* <p> | |||
* Note that getElementByPath(getPathForElement(element)) == element is not | |||
* always true as #getPathForElement(Element) can return a path to another | |||
* element if the widget determines an action on the other element will give | |||
* the same result as the action on the target element. | |||
* </p> | |||
* | |||
* @since 7.2 | |||
* @param targetElement | |||
* The element to generate a path for. | |||
* @return A String locator that identifies the target element or null if a | |||
* String locator could not be created. | |||
*/ | |||
public String getPathForElement(Element targetElement) { | |||
return getPathForElement(DOM.asOld(targetElement)); | |||
} | |||
/** | |||
* Locates an element using a String locator (path) which identifies a DOM | |||
* element. The {@link #getPathForElement(Element)} method can be used for | |||
@@ -97,10 +124,9 @@ public class ComponentLocator { | |||
public com.google.gwt.user.client.Element getElementByPath(String path) { | |||
for (LocatorStrategy strategy : locatorStrategies) { | |||
if (strategy.validatePath(path)) { | |||
com.google.gwt.user.client.Element element = strategy | |||
.getElementByPath(path); | |||
Element element = strategy.getElementByPath(path); | |||
if (null != element) { | |||
return element; | |||
return DOM.asOld(element); | |||
} | |||
} | |||
} | |||
@@ -117,16 +143,13 @@ public class ComponentLocator { | |||
* @return The JavaScriptArray of DOM elements identified by {@code path} or | |||
* empty array if elements could not be located. | |||
*/ | |||
public JsArray<com.google.gwt.user.client.Element> getElementsByPath( | |||
String path) { | |||
JsArray<com.google.gwt.user.client.Element> jsElements = JavaScriptObject | |||
.createArray().cast(); | |||
public JsArray<Element> getElementsByPath(String path) { | |||
JsArray<Element> jsElements = JavaScriptObject.createArray().cast(); | |||
for (LocatorStrategy strategy : locatorStrategies) { | |||
if (strategy.validatePath(path)) { | |||
List<com.google.gwt.user.client.Element> elements = strategy | |||
.getElementsByPath(path); | |||
List<Element> elements = strategy.getElementsByPath(path); | |||
if (elements.size() > 0) { | |||
for (com.google.gwt.user.client.Element e : elements) { | |||
for (Element e : elements) { | |||
jsElements.push(e); | |||
} | |||
return jsElements; | |||
@@ -150,16 +173,15 @@ public class ComponentLocator { | |||
* @return The JavaScriptArray of DOM elements identified by {@code path} or | |||
* empty array if elements could not be located. | |||
*/ | |||
public JsArray<com.google.gwt.user.client.Element> getElementsByPathStartingAt( | |||
String path, com.google.gwt.user.client.Element root) { | |||
JsArray<com.google.gwt.user.client.Element> jsElements = JavaScriptObject | |||
.createArray().cast(); | |||
public JsArray<Element> getElementsByPathStartingAt(String path, | |||
Element root) { | |||
JsArray<Element> jsElements = JavaScriptObject.createArray().cast(); | |||
for (LocatorStrategy strategy : locatorStrategies) { | |||
if (strategy.validatePath(path)) { | |||
List<com.google.gwt.user.client.Element> elements = strategy | |||
.getElementsByPathStartingAt(path, root); | |||
List<Element> elements = strategy.getElementsByPathStartingAt( | |||
path, root); | |||
if (elements.size() > 0) { | |||
for (com.google.gwt.user.client.Element e : elements) { | |||
for (Element e : elements) { | |||
jsElements.push(e); | |||
} | |||
return jsElements; | |||
@@ -175,6 +197,8 @@ public class ComponentLocator { | |||
* | |||
* @see #getElementByPath(String) | |||
* | |||
* @since 7.2 | |||
* | |||
* @param path | |||
* The path of the element to be found | |||
* @param root | |||
@@ -183,13 +207,13 @@ public class ComponentLocator { | |||
* could not be located. | |||
*/ | |||
public com.google.gwt.user.client.Element getElementByPathStartingAt( | |||
String path, com.google.gwt.user.client.Element root) { | |||
String path, Element root) { | |||
for (LocatorStrategy strategy : locatorStrategies) { | |||
if (strategy.validatePath(path)) { | |||
com.google.gwt.user.client.Element element = strategy | |||
.getElementByPathStartingAt(path, root); | |||
Element element = strategy.getElementByPathStartingAt(path, | |||
root); | |||
if (null != element) { | |||
return element; | |||
return DOM.asOld(element); | |||
} | |||
} | |||
} |
@@ -20,6 +20,7 @@ import java.util.Iterator; | |||
import java.util.List; | |||
import com.google.gwt.core.client.JavaScriptObject; | |||
import com.google.gwt.dom.client.Element; | |||
import com.google.gwt.regexp.shared.RegExp; | |||
import com.google.gwt.user.client.DOM; | |||
import com.google.gwt.user.client.ui.HasWidgets; | |||
@@ -86,8 +87,7 @@ public class LegacyLocatorStrategy implements LocatorStrategy { | |||
} | |||
@Override | |||
public String getPathForElement( | |||
com.google.gwt.user.client.Element targetElement) { | |||
public String getPathForElement(Element targetElement) { | |||
ComponentConnector connector = Util | |||
.findPaintable(client, targetElement); | |||
@@ -168,8 +168,8 @@ public class LegacyLocatorStrategy implements LocatorStrategy { | |||
* If the widget can provide an identifier for the targetElement we | |||
* let it do that | |||
*/ | |||
String elementLocator = ((SubPartAware) w) | |||
.getSubPartName(targetElement); | |||
String elementLocator = ((SubPartAware) w).getSubPartName(DOM | |||
.asOld(targetElement)); | |||
if (elementLocator != null) { | |||
return path + LegacyLocatorStrategy.SUBPART_SEPARATOR | |||
+ elementLocator; | |||
@@ -191,7 +191,7 @@ public class LegacyLocatorStrategy implements LocatorStrategy { | |||
* {@inheritDoc} | |||
*/ | |||
@Override | |||
public com.google.gwt.user.client.Element getElementByPath(String path) { | |||
public Element getElementByPath(String path) { | |||
return getElementByPathStartingAt(path, null); | |||
} | |||
@@ -199,8 +199,7 @@ public class LegacyLocatorStrategy implements LocatorStrategy { | |||
* {@inheritDoc} | |||
*/ | |||
@Override | |||
public com.google.gwt.user.client.Element getElementByPathStartingAt( | |||
String path, com.google.gwt.user.client.Element baseElement) { | |||
public Element getElementByPathStartingAt(String path, Element baseElement) { | |||
/* | |||
* Path is of type "targetWidgetPath#componentPart" or | |||
* "targetWidgetPath". | |||
@@ -239,11 +238,10 @@ public class LegacyLocatorStrategy implements LocatorStrategy { | |||
* {@inheritDoc} | |||
*/ | |||
@Override | |||
public List<com.google.gwt.user.client.Element> getElementsByPath( | |||
String path) { | |||
public List<Element> getElementsByPath(String path) { | |||
// This type of search is not supported in LegacyLocator | |||
List<com.google.gwt.user.client.Element> array = new ArrayList<com.google.gwt.user.client.Element>(); | |||
com.google.gwt.user.client.Element e = getElementByPath(path); | |||
List<Element> array = new ArrayList<Element>(); | |||
Element e = getElementByPath(path); | |||
if (e != null) { | |||
array.add(e); | |||
} | |||
@@ -254,12 +252,10 @@ public class LegacyLocatorStrategy implements LocatorStrategy { | |||
* {@inheritDoc} | |||
*/ | |||
@Override | |||
public List<com.google.gwt.user.client.Element> getElementsByPathStartingAt( | |||
String path, com.google.gwt.user.client.Element root) { | |||
public List<Element> getElementsByPathStartingAt(String path, Element root) { | |||
// This type of search is not supported in LegacyLocator | |||
List<com.google.gwt.user.client.Element> array = new ArrayList<com.google.gwt.user.client.Element>(); | |||
com.google.gwt.user.client.Element e = getElementByPathStartingAt(path, | |||
root); | |||
List<Element> array = new ArrayList<Element>(); | |||
Element e = getElementByPathStartingAt(path, root); | |||
if (e != null) { | |||
array.add(e); | |||
} | |||
@@ -298,9 +294,7 @@ public class LegacyLocatorStrategy implements LocatorStrategy { | |||
* @return The widget whose root element is a parent of | |||
* {@code targetElement}. | |||
*/ | |||
private Widget findParentWidget( | |||
com.google.gwt.user.client.Element targetElement, | |||
Widget ancestorWidget) { | |||
private Widget findParentWidget(Element targetElement, Widget ancestorWidget) { | |||
/* | |||
* As we cannot resolve Widgets from the element we start from the | |||
* widget and move downwards to the correct child widget, as long as we | |||
@@ -329,10 +323,9 @@ public class LegacyLocatorStrategy implements LocatorStrategy { | |||
* @return The element identified by path, relative to baseElement or null | |||
* if the element could not be found. | |||
*/ | |||
private com.google.gwt.user.client.Element getElementByDOMPath( | |||
com.google.gwt.user.client.Element baseElement, String path) { | |||
private Element getElementByDOMPath(Element baseElement, String path) { | |||
String parts[] = path.split(PARENTCHILD_SEPARATOR); | |||
com.google.gwt.user.client.Element element = baseElement; | |||
Element element = baseElement; | |||
for (int i = 0, l = parts.length; i < l; ++i) { | |||
String part = parts[i]; | |||
@@ -342,8 +335,7 @@ public class LegacyLocatorStrategy implements LocatorStrategy { | |||
if (Util.findWidget(baseElement, null) instanceof VAbstractOrderedLayout) { | |||
if (element.hasChildNodes()) { | |||
com.google.gwt.user.client.Element e = element | |||
.getFirstChildElement().cast(); | |||
Element e = element.getFirstChildElement().cast(); | |||
String cn = e.getClassName(); | |||
if (cn != null | |||
&& (cn.equals("v-expand") || cn | |||
@@ -388,18 +380,15 @@ public class LegacyLocatorStrategy implements LocatorStrategy { | |||
* The starting point for the locator. The generated path is | |||
* relative to this element. | |||
* @return A String locator that can be used to locate the target element | |||
* using | |||
* {@link #getElementByDOMPath(com.google.gwt.user.client.Element, String)} | |||
* or null if the locator String cannot be created. | |||
* using {@link #getElementByDOMPath(Element, String)} or null if | |||
* the locator String cannot be created. | |||
*/ | |||
private String getDOMPathForElement( | |||
com.google.gwt.user.client.Element element, | |||
com.google.gwt.user.client.Element baseElement) { | |||
com.google.gwt.user.client.Element e = element; | |||
private String getDOMPathForElement(Element element, Element baseElement) { | |||
Element e = element; | |||
String path = ""; | |||
while (true) { | |||
int childIndex = -1; | |||
com.google.gwt.user.client.Element siblingIterator = e; | |||
Element siblingIterator = e; | |||
while (siblingIterator != null) { | |||
childIndex++; | |||
siblingIterator = siblingIterator.getPreviousSiblingElement() |
@@ -17,6 +17,8 @@ package com.vaadin.client.componentlocator; | |||
import java.util.List; | |||
import com.google.gwt.dom.client.Element; | |||
/** | |||
* This interface should be implemented by all locator strategies. A locator | |||
* strategy is responsible for generating and decoding a string that identifies | |||
@@ -57,7 +59,7 @@ public interface LocatorStrategy { | |||
* @return A String locator that identifies the target element or null if a | |||
* String locator could not be created. | |||
*/ | |||
String getPathForElement(com.google.gwt.user.client.Element targetElement); | |||
String getPathForElement(Element targetElement); | |||
/** | |||
* Locates an element using a String locator (path) which identifies a DOM | |||
@@ -70,7 +72,7 @@ public interface LocatorStrategy { | |||
* @return The DOM element identified by {@code path} or null if the element | |||
* could not be located. | |||
*/ | |||
com.google.gwt.user.client.Element getElementByPath(String path); | |||
Element getElementByPath(String path); | |||
/** | |||
* Locates an element using a String locator (path) which identifies a DOM | |||
@@ -85,8 +87,8 @@ public interface LocatorStrategy { | |||
* @return The DOM element identified by {@code path} or null if the element | |||
* could not be located. | |||
*/ | |||
com.google.gwt.user.client.Element getElementByPathStartingAt(String path, | |||
com.google.gwt.user.client.Element root); | |||
Element getElementByPathStartingAt(String path, | |||
Element root); | |||
/** | |||
* Locates all elements that match a String locator (path) which identifies | |||
@@ -99,7 +101,7 @@ public interface LocatorStrategy { | |||
* @return List that contains all matched elements. Empty list if none | |||
* found. | |||
*/ | |||
List<com.google.gwt.user.client.Element> getElementsByPath(String path); | |||
List<Element> getElementsByPath(String path); | |||
/** | |||
* Locates all elements that match a String locator (path) which identifies | |||
@@ -117,6 +119,6 @@ public interface LocatorStrategy { | |||
* found. | |||
*/ | |||
List<com.google.gwt.user.client.Element> getElementsByPathStartingAt( | |||
String path, com.google.gwt.user.client.Element root); | |||
List<Element> getElementsByPathStartingAt( | |||
String path, Element root); | |||
} |
@@ -19,6 +19,7 @@ import java.util.ArrayList; | |||
import java.util.Arrays; | |||
import java.util.List; | |||
import com.google.gwt.dom.client.Element; | |||
import com.google.gwt.user.client.ui.RootPanel; | |||
import com.google.gwt.user.client.ui.Widget; | |||
import com.vaadin.client.ApplicationConnection; | |||
@@ -70,8 +71,7 @@ public class VaadinFinderLocatorStrategy implements LocatorStrategy { | |||
* {@inheritDoc} | |||
*/ | |||
@Override | |||
public String getPathForElement( | |||
com.google.gwt.user.client.Element targetElement) { | |||
public String getPathForElement(Element targetElement) { | |||
if (targetElement == null) { | |||
return ""; | |||
} | |||
@@ -116,8 +116,7 @@ public class VaadinFinderLocatorStrategy implements LocatorStrategy { | |||
* Target element | |||
* @return Best selector string formatted with a post filter | |||
*/ | |||
private String getBestSelector(List<String> selectors, | |||
com.google.gwt.user.client.Element target) { | |||
private String getBestSelector(List<String> selectors, Element target) { | |||
// The last selector gives us smallest list index for target element. | |||
String bestSelector = selectors.get(selectors.size() - 1); | |||
int min = getElementsByPath(bestSelector).indexOf(target); | |||
@@ -215,9 +214,8 @@ public class VaadinFinderLocatorStrategy implements LocatorStrategy { | |||
* @return a list of ConnectorPath objects, in descending order towards the | |||
* common root container. | |||
*/ | |||
private List<ConnectorPath> getConnectorHierarchyForElement( | |||
com.google.gwt.user.client.Element elem) { | |||
com.google.gwt.user.client.Element e = elem; | |||
private List<ConnectorPath> getConnectorHierarchyForElement(Element elem) { | |||
Element e = elem; | |||
ComponentConnector c = Util.findPaintable(client, e); | |||
List<ConnectorPath> connectorHierarchy = new ArrayList<ConnectorPath>(); | |||
@@ -235,7 +233,7 @@ public class VaadinFinderLocatorStrategy implements LocatorStrategy { | |||
} | |||
} | |||
e = (com.google.gwt.user.client.Element) e.getParentElement(); | |||
e = e.getParentElement(); | |||
if (e != null) { | |||
c = Util.findPaintable(client, e); | |||
e = c != null ? c.getWidget().getElement() : null; | |||
@@ -276,15 +274,14 @@ public class VaadinFinderLocatorStrategy implements LocatorStrategy { | |||
* {@inheritDoc} | |||
*/ | |||
@Override | |||
public List<com.google.gwt.user.client.Element> getElementsByPath( | |||
String path) { | |||
public List<Element> getElementsByPath(String path) { | |||
List<SelectorPredicate> postFilters = SelectorPredicate | |||
.extractPostFilterPredicates(path); | |||
if (postFilters.size() > 0) { | |||
path = path.substring(1, path.lastIndexOf(')')); | |||
} | |||
List<com.google.gwt.user.client.Element> elements = new ArrayList<com.google.gwt.user.client.Element>(); | |||
List<Element> elements = new ArrayList<Element>(); | |||
if (isNotificationExpression(path)) { | |||
for (VNotification n : findNotificationsByPath(path)) { | |||
@@ -305,8 +302,7 @@ public class VaadinFinderLocatorStrategy implements LocatorStrategy { | |||
if (p.getIndex() >= elements.size()) { | |||
elements.clear(); | |||
} else { | |||
com.google.gwt.user.client.Element e = elements.get(p | |||
.getIndex()); | |||
Element e = elements.get(p.getIndex()); | |||
elements.clear(); | |||
elements.add(e); | |||
} | |||
@@ -320,8 +316,8 @@ public class VaadinFinderLocatorStrategy implements LocatorStrategy { | |||
* {@inheritDoc} | |||
*/ | |||
@Override | |||
public com.google.gwt.user.client.Element getElementByPath(String path) { | |||
List<com.google.gwt.user.client.Element> elements = getElementsByPath(path); | |||
public Element getElementByPath(String path) { | |||
List<Element> elements = getElementsByPath(path); | |||
if (elements.isEmpty()) { | |||
return null; | |||
} | |||
@@ -332,10 +328,8 @@ public class VaadinFinderLocatorStrategy implements LocatorStrategy { | |||
* {@inheritDoc} | |||
*/ | |||
@Override | |||
public com.google.gwt.user.client.Element getElementByPathStartingAt( | |||
String path, com.google.gwt.user.client.Element root) { | |||
List<com.google.gwt.user.client.Element> elements = getElementsByPathStartingAt( | |||
path, root); | |||
public Element getElementByPathStartingAt(String path, Element root) { | |||
List<Element> elements = getElementsByPathStartingAt(path, root); | |||
if (elements.isEmpty()) { | |||
return null; | |||
} | |||
@@ -347,16 +341,15 @@ public class VaadinFinderLocatorStrategy implements LocatorStrategy { | |||
* {@inheritDoc} | |||
*/ | |||
@Override | |||
public List<com.google.gwt.user.client.Element> getElementsByPathStartingAt( | |||
String path, com.google.gwt.user.client.Element root) { | |||
public List<Element> getElementsByPathStartingAt(String path, Element root) { | |||
List<SelectorPredicate> postFilters = SelectorPredicate | |||
.extractPostFilterPredicates(path); | |||
if (postFilters.size() > 0) { | |||
path = path.substring(1, path.lastIndexOf(')')); | |||
} | |||
List<com.google.gwt.user.client.Element> elements = getElementsByPathStartingAtConnector( | |||
path, Util.findPaintable(client, root)); | |||
List<Element> elements = getElementsByPathStartingAtConnector(path, | |||
Util.findPaintable(client, root)); | |||
for (SelectorPredicate p : postFilters) { | |||
// Post filtering supports only indexes and follows instruction | |||
@@ -366,8 +359,7 @@ public class VaadinFinderLocatorStrategy implements LocatorStrategy { | |||
if (p.getIndex() >= elements.size()) { | |||
elements.clear(); | |||
} else { | |||
com.google.gwt.user.client.Element e = elements.get(p | |||
.getIndex()); | |||
Element e = elements.get(p.getIndex()); | |||
elements.clear(); | |||
elements.add(e); | |||
} | |||
@@ -424,8 +416,8 @@ public class VaadinFinderLocatorStrategy implements LocatorStrategy { | |||
* @return the list of elements identified by path or empty list if not | |||
* found. | |||
*/ | |||
private List<com.google.gwt.user.client.Element> getElementsByPathStartingAtConnector( | |||
String path, ComponentConnector root) { | |||
private List<Element> getElementsByPathStartingAtConnector(String path, | |||
ComponentConnector root) { | |||
String[] pathComponents = path.split(SUBPART_SEPARATOR); | |||
List<ComponentConnector> connectors; | |||
if (pathComponents[0].length() > 0) { | |||
@@ -435,7 +427,7 @@ public class VaadinFinderLocatorStrategy implements LocatorStrategy { | |||
connectors = Arrays.asList(root); | |||
} | |||
List<com.google.gwt.user.client.Element> output = new ArrayList<com.google.gwt.user.client.Element>(); | |||
List<Element> output = new ArrayList<Element>(); | |||
if (null != connectors && !connectors.isEmpty()) { | |||
if (pathComponents.length > 1) { | |||
// We have subparts |
@@ -15,6 +15,7 @@ | |||
*/ | |||
package com.vaadin.client.debug.internal; | |||
import com.google.gwt.dom.client.Element; | |||
import com.google.gwt.event.dom.client.ClickEvent; | |||
import com.google.gwt.event.dom.client.ClickHandler; | |||
import com.google.gwt.event.dom.client.KeyCodes; | |||
@@ -108,7 +109,7 @@ public class HierarchySection implements Section { | |||
hierarchyPanel.addListener(new SelectConnectorListener() { | |||
@Override | |||
public void select(ServerConnector connector, | |||
com.google.gwt.user.client.Element element) { | |||
Element element) { | |||
printState(connector, true); | |||
} | |||
}); | |||
@@ -116,7 +117,7 @@ public class HierarchySection implements Section { | |||
analyzeLayoutsPanel.addListener(new SelectConnectorListener() { | |||
@Override | |||
public void select(ServerConnector connector, | |||
com.google.gwt.user.client.Element element) { | |||
Element element) { | |||
printState(connector, true); | |||
} | |||
}); | |||
@@ -241,10 +242,9 @@ public class HierarchySection implements Section { | |||
} | |||
if (event.getTypeInt() == Event.ONMOUSEMOVE) { | |||
Highlight.hideAll(); | |||
com.google.gwt.user.client.Element eventTarget = Util | |||
.getElementFromPoint(event.getNativeEvent() | |||
.getClientX(), event.getNativeEvent() | |||
.getClientY()); | |||
Element eventTarget = Util.getElementFromPoint(event | |||
.getNativeEvent().getClientX(), event.getNativeEvent() | |||
.getClientY()); | |||
if (VDebugWindow.get().getElement().isOrHasChild(eventTarget)) { | |||
infoPanel.clear(); | |||
return; | |||
@@ -274,10 +274,9 @@ public class HierarchySection implements Section { | |||
event.consume(); | |||
event.getNativeEvent().stopPropagation(); | |||
stopFind(); | |||
com.google.gwt.user.client.Element eventTarget = Util | |||
.getElementFromPoint(event.getNativeEvent() | |||
.getClientX(), event.getNativeEvent() | |||
.getClientY()); | |||
Element eventTarget = Util.getElementFromPoint(event | |||
.getNativeEvent().getClientX(), event.getNativeEvent() | |||
.getClientY()); | |||
for (ApplicationConnection a : ApplicationConfiguration | |||
.getRunningApplications()) { | |||
ComponentConnector connector = Util.getConnectorForElement( |
@@ -17,6 +17,7 @@ package com.vaadin.client.debug.internal; | |||
import java.util.HashSet; | |||
import com.google.gwt.dom.client.Element; | |||
import com.google.gwt.dom.client.Style; | |||
import com.google.gwt.dom.client.Style.Position; | |||
import com.google.gwt.dom.client.Style.Unit; | |||
@@ -50,7 +51,7 @@ public class Highlight { | |||
private static final int MIN_WIDTH = 3; | |||
private static final int MIN_HEIGHT = 3; | |||
static HashSet<com.google.gwt.user.client.Element> highlights; | |||
static HashSet<Element> highlights; | |||
/** | |||
* Highlight the {@link Widget} for the given {@link ComponentConnector}. | |||
@@ -63,7 +64,7 @@ public class Highlight { | |||
* ComponentConnector | |||
* @return Highlight element | |||
*/ | |||
static com.google.gwt.user.client.Element show(ComponentConnector connector) { | |||
static Element show(ComponentConnector connector) { | |||
return show(connector, DEFAULT_COLOR); | |||
} | |||
@@ -82,7 +83,7 @@ public class Highlight { | |||
* @return Highlight element, or <code>null</code> if the connector isn't a | |||
* component | |||
*/ | |||
static com.google.gwt.user.client.Element showOnly(ServerConnector connector) { | |||
static Element showOnly(ServerConnector connector) { | |||
hideAll(); | |||
if (connector instanceof ComponentConnector) { | |||
return show((ComponentConnector) connector); | |||
@@ -105,8 +106,7 @@ public class Highlight { | |||
* Color of highlight | |||
* @return Highlight element | |||
*/ | |||
static com.google.gwt.user.client.Element show( | |||
ComponentConnector connector, String color) { | |||
static Element show(ComponentConnector connector, String color) { | |||
if (connector != null) { | |||
Widget w = connector.getWidget(); | |||
return show(w, color); | |||
@@ -125,7 +125,7 @@ public class Highlight { | |||
* Widget to highlight | |||
* @return Highlight element | |||
*/ | |||
static com.google.gwt.user.client.Element show(Widget widget) { | |||
static Element show(Widget widget) { | |||
return show(widget, DEFAULT_COLOR); | |||
} | |||
@@ -142,7 +142,7 @@ public class Highlight { | |||
* Color of highlight | |||
* @return Highlight element | |||
*/ | |||
static com.google.gwt.user.client.Element show(Widget widget, String color) { | |||
static Element show(Widget widget, String color) { | |||
if (widget != null) { | |||
show(widget.getElement(), color); | |||
} | |||
@@ -160,8 +160,7 @@ public class Highlight { | |||
* Element to highlight | |||
* @return Highlight element | |||
*/ | |||
static com.google.gwt.user.client.Element show( | |||
com.google.gwt.user.client.Element element) { | |||
static Element show(Element element) { | |||
return show(element, DEFAULT_COLOR); | |||
} | |||
@@ -178,14 +177,13 @@ public class Highlight { | |||
* Color of highlight | |||
* @return Highlight element | |||
*/ | |||
static com.google.gwt.user.client.Element show( | |||
com.google.gwt.user.client.Element element, String color) { | |||
static Element show(Element element, String color) { | |||
if (element != null) { | |||
if (highlights == null) { | |||
highlights = new HashSet<com.google.gwt.user.client.Element>(); | |||
highlights = new HashSet<Element>(); | |||
} | |||
com.google.gwt.user.client.Element highlight = DOM.createDiv(); | |||
Element highlight = DOM.createDiv(); | |||
Style style = highlight.getStyle(); | |||
style.setTop(element.getAbsoluteTop(), Unit.PX); | |||
style.setLeft(element.getAbsoluteLeft(), Unit.PX); | |||
@@ -223,7 +221,7 @@ public class Highlight { | |||
* @param highlight | |||
* Highlight to hide | |||
*/ | |||
static void hide(com.google.gwt.user.client.Element highlight) { | |||
static void hide(Element highlight) { | |||
if (highlight != null && highlight.getParentElement() != null) { | |||
highlight.getParentElement().removeChild(highlight); | |||
highlights.remove(highlight); | |||
@@ -235,7 +233,7 @@ public class Highlight { | |||
*/ | |||
static void hideAll() { | |||
if (highlights != null) { | |||
for (com.google.gwt.user.client.Element highlight : highlights) { | |||
for (Element highlight : highlights) { | |||
if (highlight.getParentElement() != null) { | |||
highlight.getParentElement().removeChild(highlight); | |||
} |
@@ -15,6 +15,7 @@ | |||
*/ | |||
package com.vaadin.client.debug.internal; | |||
import com.google.gwt.dom.client.Element; | |||
import com.vaadin.client.ServerConnector; | |||
/** | |||
@@ -33,5 +34,5 @@ public interface SelectConnectorListener { | |||
* selected element of the connector or null if unknown | |||
*/ | |||
public void select(ServerConnector connector, | |||
com.google.gwt.user.client.Element element); | |||
Element element); | |||
} |
@@ -20,6 +20,7 @@ import java.util.HashMap; | |||
import java.util.List; | |||
import java.util.Map; | |||
import com.google.gwt.dom.client.Element; | |||
import com.vaadin.client.ServerConnector; | |||
import com.vaadin.client.componentlocator.ComponentLocator; | |||
import com.vaadin.client.componentlocator.SelectorPredicate; | |||
@@ -35,7 +36,7 @@ import com.vaadin.client.componentlocator.SelectorPredicate; | |||
*/ | |||
public class SelectorPath { | |||
private final String path; | |||
private final com.google.gwt.user.client.Element element; | |||
private final Element element; | |||
private final ComponentLocator locator; | |||
private static Map<String, Integer> counter = new HashMap<String, Integer>(); | |||
private static Map<String, String> legacyNames = new HashMap<String, String>(); | |||
@@ -45,8 +46,7 @@ public class SelectorPath { | |||
legacyNames.put("ScrollTable", "Table"); | |||
} | |||
protected SelectorPath(ServerConnector c, | |||
com.google.gwt.user.client.Element e) { | |||
protected SelectorPath(ServerConnector c, Element e) { | |||
element = e; | |||
locator = new ComponentLocator(c.getConnection()); | |||
path = locator.getPathForElement(e); | |||
@@ -56,7 +56,7 @@ public class SelectorPath { | |||
return path; | |||
} | |||
public com.google.gwt.user.client.Element getElement() { | |||
public Element getElement() { | |||
return element; | |||
} | |||
@@ -18,6 +18,7 @@ package com.vaadin.client.debug.internal; | |||
import java.util.HashMap; | |||
import java.util.Map; | |||
import com.google.gwt.dom.client.Element; | |||
import com.google.gwt.event.dom.client.ClickEvent; | |||
import com.google.gwt.event.dom.client.ClickHandler; | |||
import com.google.gwt.event.dom.client.KeyCodes; | |||
@@ -72,7 +73,7 @@ public class TestBenchSection implements Section { | |||
public void onMouseOver(MouseOverEvent event) { | |||
Highlight.hideAll(); | |||
com.google.gwt.user.client.Element element = path.getElement(); | |||
Element element = path.getElement(); | |||
if (null != element) { | |||
Highlight.show(element); | |||
} | |||
@@ -192,8 +193,7 @@ public class TestBenchSection implements Section { | |||
Highlight.hideAll(); | |||
} | |||
private void pickSelector(ServerConnector connector, | |||
com.google.gwt.user.client.Element element) { | |||
private void pickSelector(ServerConnector connector, Element element) { | |||
SelectorPath p = new SelectorPath(connector, Util | |||
.findPaintable(connector.getConnection(), element).getWidget() | |||
@@ -216,10 +216,9 @@ public class TestBenchSection implements Section { | |||
} | |||
if (event.getTypeInt() == Event.ONMOUSEMOVE | |||
|| event.getTypeInt() == Event.ONCLICK) { | |||
com.google.gwt.user.client.Element eventTarget = Util | |||
.getElementFromPoint(event.getNativeEvent() | |||
.getClientX(), event.getNativeEvent() | |||
.getClientY()); | |||
Element eventTarget = Util.getElementFromPoint(event | |||
.getNativeEvent().getClientX(), event.getNativeEvent() | |||
.getClientY()); | |||
if (VDebugWindow.get().getElement().isOrHasChild(eventTarget)) { | |||
if (isFindMode() && event.getTypeInt() == Event.ONCLICK) { | |||
stopFind(); | |||
@@ -259,8 +258,7 @@ public class TestBenchSection implements Section { | |||
}; | |||
private ComponentConnector findConnector( | |||
com.google.gwt.user.client.Element element) { | |||
private ComponentConnector findConnector(Element element) { | |||
for (ApplicationConnection a : ApplicationConfiguration | |||
.getRunningApplications()) { | |||
ComponentConnector connector = Util.getConnectorForElement(a, a |
@@ -15,6 +15,7 @@ | |||
*/ | |||
package com.vaadin.client.ui; | |||
import com.google.gwt.dom.client.Element; | |||
import com.google.gwt.dom.client.NativeEvent; | |||
import com.google.gwt.event.dom.client.ContextMenuEvent; | |||
import com.google.gwt.event.dom.client.ContextMenuHandler; | |||
@@ -48,7 +49,7 @@ public abstract class AbstractClickEventHandler implements MouseDownHandler, | |||
/** | |||
* The element where the last mouse down event was registered. | |||
*/ | |||
private com.google.gwt.user.client.Element lastMouseDownTarget; | |||
private Element lastMouseDownTarget; | |||
/** | |||
* Set to true by {@link #mouseUpPreviewHandler} if it gets a mouseup at the | |||
@@ -71,8 +72,8 @@ public abstract class AbstractClickEventHandler implements MouseDownHandler, | |||
// Event's reported target not always correct if event | |||
// capture is in use | |||
com.google.gwt.user.client.Element elementUnderMouse = Util | |||
.getElementUnderMouse(event.getNativeEvent()); | |||
Element elementUnderMouse = Util.getElementUnderMouse(event | |||
.getNativeEvent()); | |||
if (lastMouseDownTarget != null | |||
&& elementUnderMouse == lastMouseDownTarget) { | |||
mouseUpPreviewMatched = true; |
@@ -46,9 +46,7 @@ public class FocusElementPanel extends SimpleFocusablePanel { | |||
style.setLeft(0, Unit.PX); | |||
getElement().appendChild(focusElement); | |||
/* Sink from focusElement too as focus and blur don't bubble */ | |||
DOM.sinkEvents( | |||
(com.google.gwt.user.client.Element) focusElement.cast(), | |||
Event.FOCUSEVENTS); | |||
DOM.sinkEvents(focusElement, Event.FOCUSEVENTS); | |||
// revert to original, not focusable | |||
getElement().setPropertyObject("tabIndex", null); | |||
} else { | |||
@@ -66,11 +64,9 @@ public class FocusElementPanel extends SimpleFocusablePanel { | |||
@Override | |||
public void setFocus(boolean focus) { | |||
if (focus) { | |||
FocusImpl.getFocusImplForPanel().focus( | |||
(com.google.gwt.user.client.Element) focusElement.cast()); | |||
FocusImpl.getFocusImplForPanel().focus(focusElement); | |||
} else { | |||
FocusImpl.getFocusImplForPanel().blur( | |||
(com.google.gwt.user.client.Element) focusElement.cast()); | |||
FocusImpl.getFocusImplForPanel().blur(focusElement); | |||
} | |||
} | |||
@@ -74,9 +74,7 @@ public class FocusableScrollPanel extends SimpleFocusablePanel implements | |||
style.setLeft(0, Unit.PX); | |||
getElement().appendChild(focusElement); | |||
/* Sink from focusElemet too as focusa and blur don't bubble */ | |||
DOM.sinkEvents( | |||
(com.google.gwt.user.client.Element) focusElement | |||
.cast(), Event.FOCUSEVENTS); | |||
DOM.sinkEvents(focusElement, Event.FOCUSEVENTS); | |||
// revert to original, not focusable | |||
getElement().setPropertyObject("tabIndex", null); | |||
@@ -97,13 +95,9 @@ public class FocusableScrollPanel extends SimpleFocusablePanel implements | |||
public void setFocus(boolean focus) { | |||
if (useFakeFocusElement()) { | |||
if (focus) { | |||
FocusImpl.getFocusImplForPanel().focus( | |||
(com.google.gwt.user.client.Element) focusElement | |||
.cast()); | |||
FocusImpl.getFocusImplForPanel().focus(focusElement); | |||
} else { | |||
FocusImpl.getFocusImplForPanel().blur( | |||
(com.google.gwt.user.client.Element) focusElement | |||
.cast()); | |||
FocusImpl.getFocusImplForPanel().blur(focusElement); | |||
} | |||
} else { | |||
super.setFocus(focus); |
@@ -20,6 +20,7 @@ import java.util.ArrayList; | |||
import java.util.Iterator; | |||
import com.google.gwt.core.client.Scheduler; | |||
import com.google.gwt.dom.client.Element; | |||
import com.google.gwt.user.client.Command; | |||
import com.google.gwt.user.client.DOM; | |||
import com.google.gwt.user.client.Event; | |||
@@ -141,7 +142,7 @@ public class ShortcutActionHandler { | |||
private void fireAction(final Event event, final ShortcutAction a, | |||
ComponentConnector target) { | |||
final com.google.gwt.user.client.Element et = DOM.eventGetTarget(event); | |||
final Element et = DOM.eventGetTarget(event); | |||
if (target == null) { | |||
target = Util.findPaintable(client, et); | |||
} | |||
@@ -192,7 +193,7 @@ public class ShortcutActionHandler { | |||
* <p> | |||
* TODO separate opera impl with generator | |||
*/ | |||
private static void shakeTarget(final com.google.gwt.user.client.Element e) { | |||
private static void shakeTarget(final Element e) { | |||
blur(e); | |||
if (BrowserInfo.get().isOpera()) { | |||
// will mess up with focus and blur event if the focus is not | |||
@@ -209,14 +210,14 @@ public class ShortcutActionHandler { | |||
} | |||
} | |||
private static native void blur(com.google.gwt.user.client.Element e) | |||
private static native void blur(Element e) | |||
/*-{ | |||
if(e.blur) { | |||
e.blur(); | |||
} | |||
}-*/; | |||
private static native void focus(com.google.gwt.user.client.Element e) | |||
private static native void focus(Element e) | |||
/*-{ | |||
if(e.blur) { | |||
e.focus(); |
@@ -17,6 +17,7 @@ package com.vaadin.client.ui; | |||
import com.google.gwt.dom.client.DivElement; | |||
import com.google.gwt.dom.client.Document; | |||
import com.google.gwt.dom.client.Element; | |||
import com.google.gwt.dom.client.Style; | |||
import com.google.gwt.user.client.DOM; | |||
import com.google.gwt.user.client.ui.ComplexPanel; | |||
@@ -35,7 +36,7 @@ public class VAbsoluteLayout extends ComplexPanel { | |||
private DivElement marginElement; | |||
protected final com.google.gwt.user.client.Element canvas = DOM.createDiv(); | |||
protected final Element canvas = DOM.createDiv(); | |||
/** | |||
* Default constructor |
@@ -19,6 +19,7 @@ package com.vaadin.client.ui; | |||
import java.util.Collections; | |||
import java.util.List; | |||
import com.google.gwt.dom.client.Element; | |||
import com.google.gwt.dom.client.Node; | |||
import com.google.gwt.dom.client.Style; | |||
import com.google.gwt.event.dom.client.TouchCancelEvent; | |||
@@ -61,16 +62,14 @@ public class VAbstractSplitPanel extends ComplexPanel { | |||
Widget secondChild; | |||
private final com.google.gwt.user.client.Element wrapper = DOM.createDiv(); | |||
private final Element wrapper = DOM.createDiv(); | |||
private final com.google.gwt.user.client.Element firstContainer = DOM | |||
.createDiv(); | |||
private final Element firstContainer = DOM.createDiv(); | |||
private final com.google.gwt.user.client.Element secondContainer = DOM | |||
.createDiv(); | |||
private final Element secondContainer = DOM.createDiv(); | |||
/** For internal use only. May be removed or replaced in the future. */ | |||
public final com.google.gwt.user.client.Element splitter = DOM.createDiv(); | |||
public final Element splitter = DOM.createDiv(); | |||
private boolean resizing; | |||
@@ -91,7 +90,7 @@ public class VAbstractSplitPanel extends ComplexPanel { | |||
/** For internal use only. May be removed or replaced in the future. */ | |||
public List<String> componentStyleNames = Collections.emptyList(); | |||
private com.google.gwt.user.client.Element draggingCurtain; | |||
private Element draggingCurtain; | |||
/** For internal use only. May be removed or replaced in the future. */ | |||
public ApplicationConnection client; | |||
@@ -114,7 +113,7 @@ public class VAbstractSplitPanel extends ComplexPanel { | |||
private TouchScrollHandler touchScrollHandler; | |||
protected com.google.gwt.user.client.Element scrolledContainer; | |||
protected Element scrolledContainer; | |||
protected int origScrollTop; | |||
@@ -571,8 +570,7 @@ public class VAbstractSplitPanel extends ComplexPanel { | |||
if (locked || !isEnabled()) { | |||
return; | |||
} | |||
final com.google.gwt.user.client.Element trg = event.getEventTarget() | |||
.cast(); | |||
final Element trg = event.getEventTarget().cast(); | |||
if (trg == splitter || trg == DOM.getChild(splitter, 0)) { | |||
resizing = true; | |||
DOM.setCapture(getElement()); |
@@ -20,6 +20,7 @@ import java.util.HashSet; | |||
import java.util.Iterator; | |||
import java.util.Set; | |||
import com.google.gwt.dom.client.Element; | |||
import com.google.gwt.event.dom.client.ClickEvent; | |||
import com.google.gwt.event.dom.client.ClickHandler; | |||
import com.google.gwt.user.client.DOM; | |||
@@ -291,9 +292,8 @@ public class VAccordion extends VTabsheetBase { | |||
private VCaption caption; | |||
private boolean open = false; | |||
private com.google.gwt.user.client.Element content = DOM.createDiv(); | |||
private com.google.gwt.user.client.Element captionNode = DOM | |||
.createDiv(); | |||
private Element content = DOM.createDiv(); | |||
private Element captionNode = DOM.createDiv(); | |||
private String styleName; | |||
public StackItem(UIDL tabUidl) { | |||
@@ -329,7 +329,7 @@ public class VAccordion extends VTabsheetBase { | |||
} | |||
public com.google.gwt.user.client.Element getContainerElement() { | |||
return content; | |||
return DOM.asOld(content); | |||
} | |||
public Widget getChildWidget() { |
@@ -22,6 +22,7 @@ import java.util.Comparator; | |||
import java.util.Date; | |||
import java.util.List; | |||
import com.google.gwt.dom.client.Element; | |||
import com.google.gwt.event.dom.client.ContextMenuEvent; | |||
import com.google.gwt.event.dom.client.ContextMenuHandler; | |||
import com.google.gwt.i18n.client.DateTimeFormat; | |||
@@ -256,7 +257,7 @@ public class VCalendar extends Composite implements VHasDropHandler { | |||
* @param e | |||
* The element to apply the hack on | |||
*/ | |||
private native void blockSelect(com.google.gwt.user.client.Element e) | |||
private native void blockSelect(Element e) | |||
/*-{ | |||
e.onselectstart = function() { | |||
return false; |
@@ -21,6 +21,7 @@ import java.util.Iterator; | |||
import com.google.gwt.aria.client.Roles; | |||
import com.google.gwt.aria.client.SelectedValue; | |||
import com.google.gwt.dom.client.Element; | |||
import com.google.gwt.dom.client.Node; | |||
import com.google.gwt.event.dom.client.BlurEvent; | |||
import com.google.gwt.event.dom.client.BlurHandler; | |||
@@ -2081,8 +2082,7 @@ public class VCalendarPanel extends FocusableFlexTable implements | |||
* @param subElement | |||
* @return true if {@code w} is a parent of subElement, false otherwise. | |||
*/ | |||
private boolean contains(Widget w, | |||
com.google.gwt.user.client.Element subElement) { | |||
private boolean contains(Widget w, Element subElement) { | |||
if (w == null || w.getElement() == null) { | |||
return false; | |||
} | |||
@@ -2136,8 +2136,8 @@ public class VCalendarPanel extends FocusableFlexTable implements | |||
} | |||
if (SUBPART_MONTH_YEAR_HEADER.equals(subPart)) { | |||
return (com.google.gwt.user.client.Element) getCellFormatter() | |||
.getElement(0, 2).getChild(0); | |||
return DOM.asOld((Element) getCellFormatter().getElement(0, 2) | |||
.getChild(0)); | |||
} | |||
return null; | |||
} |
@@ -16,6 +16,7 @@ | |||
package com.vaadin.client.ui; | |||
import com.google.gwt.dom.client.Element; | |||
import com.google.gwt.event.dom.client.ClickEvent; | |||
import com.google.gwt.event.dom.client.ClickHandler; | |||
import com.google.gwt.user.client.DOM; | |||
@@ -43,7 +44,7 @@ public class VCheckBox extends com.google.gwt.user.client.ui.CheckBox implements | |||
public ApplicationConnection client; | |||
/** For internal use only. May be removed or replaced in the future. */ | |||
public com.google.gwt.user.client.Element errorIndicatorElement; | |||
public Element errorIndicatorElement; | |||
/** For internal use only. May be removed or replaced in the future. */ | |||
public Icon icon; | |||
@@ -51,7 +52,7 @@ public class VCheckBox extends com.google.gwt.user.client.ui.CheckBox implements | |||
public VCheckBox() { | |||
setStyleName(CLASSNAME); | |||
com.google.gwt.user.client.Element el = DOM.getFirstChild(getElement()); | |||
Element el = DOM.getFirstChild(getElement()); | |||
while (el != null) { | |||
DOM.sinkEvents(el, | |||
(DOM.getEventsSunk(el) | VTooltip.TOOLTIP_EVENTS)); | |||
@@ -90,10 +91,9 @@ public class VCheckBox extends com.google.gwt.user.client.ui.CheckBox implements | |||
* | |||
* @return Element of the CheckBox itself | |||
*/ | |||
private com.google.gwt.user.client.Element getCheckBoxElement() { | |||
private Element getCheckBoxElement() { | |||
// FIXME: Would love to use a better way to access the checkbox element | |||
return (com.google.gwt.user.client.Element) getElement() | |||
.getFirstChildElement(); | |||
return getElement().getFirstChildElement(); | |||
} | |||
@Override |
@@ -18,6 +18,7 @@ package com.vaadin.client.ui; | |||
import com.google.gwt.core.client.Scheduler; | |||
import com.google.gwt.core.client.Scheduler.ScheduledCommand; | |||
import com.google.gwt.dom.client.Element; | |||
import com.google.gwt.dom.client.NodeList; | |||
import com.google.gwt.dom.client.TableRowElement; | |||
import com.google.gwt.dom.client.TableSectionElement; | |||
@@ -62,7 +63,7 @@ public class VContextMenu extends VOverlay implements SubPartAware { | |||
private int top; | |||
private com.google.gwt.user.client.Element focusedElement; | |||
private Element focusedElement; | |||
private VLazyExecutor delayedImageLoadExecutioner = new VLazyExecutor(100, | |||
new ScheduledCommand() { | |||
@@ -88,8 +89,7 @@ public class VContextMenu extends VOverlay implements SubPartAware { | |||
addCloseHandler(new CloseHandler<PopupPanel>() { | |||
@Override | |||
public void onClose(CloseEvent<PopupPanel> event) { | |||
com.google.gwt.user.client.Element currentFocus = Util | |||
.getFocusedElement(); | |||
Element currentFocus = Util.getFocusedElement(); | |||
if (focusedElement != null | |||
&& (currentFocus == null | |||
|| menu.getElement().isOrHasChild(currentFocus) || RootPanel |
@@ -19,6 +19,7 @@ package com.vaadin.client.ui; | |||
import java.util.HashMap; | |||
import java.util.Iterator; | |||
import com.google.gwt.dom.client.Element; | |||
import com.google.gwt.dom.client.ImageElement; | |||
import com.google.gwt.dom.client.NodeList; | |||
import com.google.gwt.dom.client.Style; | |||
@@ -48,7 +49,7 @@ public class VCustomLayout extends ComplexPanel { | |||
public static final String CLASSNAME = "v-customlayout"; | |||
/** Location-name to containing element in DOM map */ | |||
private final HashMap<String, com.google.gwt.user.client.Element> locationToElement = new HashMap<String, com.google.gwt.user.client.Element>(); | |||
private final HashMap<String, Element> locationToElement = new HashMap<String, Element>(); | |||
/** Location-name to contained widget map */ | |||
final HashMap<String, Widget> locationToWidget = new HashMap<String, Widget>(); | |||
@@ -75,7 +76,7 @@ public class VCustomLayout extends ComplexPanel { | |||
private boolean htmlInitialized = false; | |||
private com.google.gwt.user.client.Element elementWithNativeResizeFunction; | |||
private Element elementWithNativeResizeFunction; | |||
private String height = ""; | |||
@@ -122,8 +123,7 @@ public class VCustomLayout extends ComplexPanel { | |||
} | |||
// If no given location is found in the layout, and exception is throws | |||
com.google.gwt.user.client.Element elem = locationToElement | |||
.get(location); | |||
Element elem = locationToElement.get(location); | |||
if (elem == null && hasTemplate()) { | |||
throw new IllegalArgumentException("No location " + location | |||
+ " found"); | |||
@@ -207,7 +207,7 @@ public class VCustomLayout extends ComplexPanel { | |||
} | |||
/** Collect locations from template */ | |||
private void scanForLocations(com.google.gwt.user.client.Element elem) { | |||
private void scanForLocations(Element elem) { | |||
final String location = elem.getAttribute("location"); | |||
if (!"".equals(location)) { | |||
@@ -242,13 +242,10 @@ public class VCustomLayout extends ComplexPanel { | |||
* parent about possible size change. | |||
*/ | |||
private void initImgElements() { | |||
NodeList<com.google.gwt.dom.client.Element> nodeList = getElement() | |||
.getElementsByTagName("IMG"); | |||
NodeList<Element> nodeList = getElement().getElementsByTagName("IMG"); | |||
for (int i = 0; i < nodeList.getLength(); i++) { | |||
com.google.gwt.dom.client.ImageElement img = (ImageElement) nodeList | |||
.getItem(i); | |||
DOM.sinkEvents((com.google.gwt.user.client.Element) img.cast(), | |||
Event.ONLOAD); | |||
ImageElement img = ImageElement.as(nodeList.getItem(i)); | |||
DOM.sinkEvents(img, Event.ONLOAD); | |||
} | |||
} | |||
@@ -390,14 +387,12 @@ public class VCustomLayout extends ComplexPanel { | |||
} | |||
} | |||
private native void detachResizedFunction( | |||
com.google.gwt.user.client.Element element) | |||
private native void detachResizedFunction(Element element) | |||
/*-{ | |||
element.notifyChildrenOfSizeChange = null; | |||
}-*/; | |||
private native void publishResizedFunction( | |||
com.google.gwt.user.client.Element element) | |||
private native void publishResizedFunction(Element element) | |||
/*-{ | |||
var self = this; | |||
element.notifyChildrenOfSizeChange = $entry(function() { |
@@ -22,12 +22,14 @@ import java.util.Map; | |||
import com.google.gwt.core.client.GWT; | |||
import com.google.gwt.core.client.JsArrayString; | |||
import com.google.gwt.core.client.Scheduler; | |||
import com.google.gwt.dom.client.Element; | |||
import com.google.gwt.dom.client.NativeEvent; | |||
import com.google.gwt.event.dom.client.MouseDownEvent; | |||
import com.google.gwt.event.dom.client.MouseDownHandler; | |||
import com.google.gwt.event.dom.client.TouchStartEvent; | |||
import com.google.gwt.event.dom.client.TouchStartHandler; | |||
import com.google.gwt.user.client.Command; | |||
import com.google.gwt.user.client.DOM; | |||
import com.google.gwt.user.client.Event; | |||
import com.google.gwt.user.client.Timer; | |||
import com.google.gwt.user.client.ui.Widget; | |||
@@ -116,8 +118,7 @@ public class VDragAndDropWrapper extends VCustomComponent implements | |||
transferable.setDragSource(getConnector()); | |||
ComponentConnector paintable = Util.findPaintable(client, | |||
(com.google.gwt.user.client.Element) event.getEventTarget() | |||
.cast()); | |||
Element.as(event.getEventTarget())); | |||
Widget widget = paintable.getWidget(); | |||
transferable.setData("component", paintable); | |||
VDragEvent dragEvent = VDragAndDropManager.get().startDrag( | |||
@@ -160,11 +161,11 @@ public class VDragAndDropWrapper extends VCustomComponent implements | |||
/** For internal use only. May be removed or replaced in the future. */ | |||
public ValueMap html5DataFlavors; | |||
private com.google.gwt.user.client.Element dragStartElement; | |||
private Element dragStartElement; | |||
/** For internal use only. May be removed or replaced in the future. */ | |||
public void initDragStartMode() { | |||
com.google.gwt.user.client.Element div = getElement(); | |||
Element div = getElement(); | |||
if (dragStartMode == HTML5) { | |||
if (dragStartElement == null) { | |||
dragStartElement = getDragStartElement(); | |||
@@ -548,6 +549,11 @@ public class VDragAndDropWrapper extends VCustomComponent implements | |||
return ConnectorMap.get(client).getConnector(this); | |||
} | |||
/** | |||
* @deprecated As of 7.2, call or override | |||
* {@link #hookHtml5DragStart(Element)} instead | |||
*/ | |||
@Deprecated | |||
protected native void hookHtml5DragStart( | |||
com.google.gwt.user.client.Element el) | |||
/*-{ | |||
@@ -557,11 +563,21 @@ public class VDragAndDropWrapper extends VCustomComponent implements | |||
}), false); | |||
}-*/; | |||
/** | |||
* @since 7.2 | |||
*/ | |||
protected void hookHtml5DragStart(Element el) { | |||
hookHtml5DragStart(DOM.asOld(el)); | |||
} | |||
/** | |||
* Prototype code, memory leak risk. | |||
* | |||
* @param el | |||
* @deprecated As of 7.2, call or override {@link #hookHtml5Events(Element)} | |||
* instead | |||
*/ | |||
@Deprecated | |||
protected native void hookHtml5Events(com.google.gwt.user.client.Element el) | |||
/*-{ | |||
var me = this; | |||
@@ -583,6 +599,17 @@ public class VDragAndDropWrapper extends VCustomComponent implements | |||
}), false); | |||
}-*/; | |||
/** | |||
* Prototype code, memory leak risk. | |||
* | |||
* @param el | |||
* | |||
* @since 7.2 | |||
*/ | |||
protected void hookHtml5Events(Element el) { | |||
hookHtml5Events(DOM.asOld(el)); | |||
} | |||
public boolean updateDropDetails(VDragEvent drag) { | |||
VerticalDropLocation oldVL = verticalDropLocation; | |||
verticalDropLocation = DDUtil.getVerticalDropLocation(getElement(), |
@@ -18,6 +18,8 @@ package com.vaadin.client.ui; | |||
import com.google.gwt.dom.client.AnchorElement; | |||
import com.google.gwt.dom.client.Document; | |||
import com.google.gwt.dom.client.Element; | |||
import com.google.gwt.user.client.DOM; | |||
import com.vaadin.client.VConsole; | |||
public class VDragAndDropWrapperIE extends VDragAndDropWrapper { | |||
@@ -26,7 +28,7 @@ public class VDragAndDropWrapperIE extends VDragAndDropWrapper { | |||
@Override | |||
protected com.google.gwt.user.client.Element getDragStartElement() { | |||
VConsole.log("IE get drag start element..."); | |||
com.google.gwt.user.client.Element div = getElement(); | |||
Element div = getElement(); | |||
if (dragStartMode == HTML5) { | |||
if (anchor == null) { | |||
anchor = Document.get().createAnchorElement(); | |||
@@ -35,16 +37,17 @@ public class VDragAndDropWrapperIE extends VDragAndDropWrapper { | |||
div.appendChild(anchor); | |||
} | |||
VConsole.log("IE get drag start element..."); | |||
return (com.google.gwt.user.client.Element) anchor.cast(); | |||
return anchor.cast(); | |||
} else { | |||
if (anchor != null) { | |||
div.removeChild(anchor); | |||
anchor = null; | |||
} | |||
return div; | |||
return DOM.asOld(div); | |||
} | |||
} | |||
@Deprecated | |||
@Override | |||
protected native void hookHtml5DragStart( | |||
com.google.gwt.user.client.Element el) | |||
@@ -56,6 +59,12 @@ public class VDragAndDropWrapperIE extends VDragAndDropWrapper { | |||
})); | |||
}-*/; | |||
@Override | |||
protected void hookHtml5DragStart(Element el) { | |||
hookHtml5DragStart(DOM.asOld(el)); | |||
} | |||
@Deprecated | |||
@Override | |||
protected native void hookHtml5Events(com.google.gwt.user.client.Element el) | |||
/*-{ | |||
@@ -78,4 +87,9 @@ public class VDragAndDropWrapperIE extends VDragAndDropWrapper { | |||
})); | |||
}-*/; | |||
@Override | |||
protected void hookHtml5Events(Element el) { | |||
hookHtml5Events(DOM.asOld(el)); | |||
} | |||
} |
@@ -20,6 +20,7 @@ import java.util.HashMap; | |||
import java.util.Iterator; | |||
import java.util.Map; | |||
import com.google.gwt.dom.client.Element; | |||
import com.google.gwt.user.client.DOM; | |||
import com.google.gwt.user.client.Event; | |||
import com.google.gwt.user.client.ui.HTML; | |||
@@ -36,7 +37,7 @@ public class VEmbedded extends HTML { | |||
public static String CLASSNAME = "v-embedded"; | |||
/** For internal use only. May be removed or replaced in the future. */ | |||
public com.google.gwt.user.client.Element browserElement; | |||
public Element browserElement; | |||
/** For internal use only. May be removed or replaced in the future. */ | |||
public String type; |
@@ -27,6 +27,7 @@ import java.util.Set; | |||
import com.google.gwt.aria.client.Roles; | |||
import com.google.gwt.core.client.Scheduler; | |||
import com.google.gwt.core.client.Scheduler.ScheduledCommand; | |||
import com.google.gwt.dom.client.Element; | |||
import com.google.gwt.dom.client.Style; | |||
import com.google.gwt.dom.client.Style.Display; | |||
import com.google.gwt.dom.client.Style.Unit; | |||
@@ -208,10 +209,9 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler, | |||
/** For internal use only. May be removed or replaced in the future. */ | |||
public final SuggestionMenu menu; | |||
private final com.google.gwt.user.client.Element up = DOM.createDiv(); | |||
private final com.google.gwt.user.client.Element down = DOM.createDiv(); | |||
private final com.google.gwt.user.client.Element status = DOM | |||
.createDiv(); | |||
private final Element up = DOM.createDiv(); | |||
private final Element down = DOM.createDiv(); | |||
private final Element status = DOM.createDiv(); | |||
private boolean isPagingEnabled = true; | |||
@@ -233,7 +233,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler, | |||
getElement().getStyle().setZIndex(Z_INDEX); | |||
final com.google.gwt.user.client.Element root = getContainerElement(); | |||
final Element root = getContainerElement(); | |||
up.setInnerHTML("<span>Prev</span>"); | |||
DOM.sinkEvents(up, Event.ONCLICK); | |||
@@ -484,8 +484,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler, | |||
public void onBrowserEvent(Event event) { | |||
debug("VFS.SP: onBrowserEvent()"); | |||
if (event.getTypeInt() == Event.ONCLICK) { | |||
final com.google.gwt.user.client.Element target = DOM | |||
.eventGetTarget(event); | |||
final Element target = DOM.eventGetTarget(event); | |||
if (target == up || target == DOM.getChild(up, 0)) { | |||
lazyPageScroller.scrollUp(); | |||
} else if (target == down || target == DOM.getChild(down, 0)) { | |||
@@ -557,8 +556,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler, | |||
offsetHeight = getOffsetHeight(); | |||
final int desiredWidth = getMainWidth(); | |||
com.google.gwt.user.client.Element menuFirstChild = menu | |||
.getElement().getFirstChildElement().cast(); | |||
Element menuFirstChild = menu.getElement().getFirstChildElement(); | |||
int naturalMenuWidth = menuFirstChild.getOffsetWidth(); | |||
if (popupOuterPadding == -1) { | |||
@@ -871,7 +869,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler, | |||
return null; | |||
} | |||
com.google.gwt.user.client.Element menuItemRoot = subElement; | |||
Element menuItemRoot = subElement; | |||
while (menuItemRoot != null | |||
&& !menuItemRoot.getTagName().equalsIgnoreCase("td")) { | |||
menuItemRoot = menuItemRoot.getParentElement().cast(); | |||
@@ -1825,8 +1823,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler, | |||
*/ | |||
preventNextBlurEventInIE = false; | |||
com.google.gwt.user.client.Element focusedElement = Util | |||
.getIEFocusedElement(); | |||
Element focusedElement = Util.getIEFocusedElement(); | |||
if (getElement().isOrHasChild(focusedElement) | |||
|| suggestionPopup.getElement() | |||
.isOrHasChild(focusedElement)) { |
@@ -16,6 +16,7 @@ | |||
package com.vaadin.client.ui; | |||
import com.google.gwt.dom.client.Element; | |||
import com.google.gwt.event.dom.client.KeyDownEvent; | |||
import com.google.gwt.event.dom.client.KeyDownHandler; | |||
import com.google.gwt.event.shared.HandlerRegistration; | |||
@@ -37,13 +38,13 @@ public class VForm extends ComplexPanel implements KeyDownHandler { | |||
public Widget lo; | |||
/** For internal use only. May be removed or replaced in the future. */ | |||
public com.google.gwt.user.client.Element legend = DOM.createLegend(); | |||
public Element legend = DOM.createLegend(); | |||
/** For internal use only. May be removed or replaced in the future. */ | |||
public com.google.gwt.user.client.Element caption = DOM.createSpan(); | |||
public Element caption = DOM.createSpan(); | |||
/** For internal use only. May be removed or replaced in the future. */ | |||
public com.google.gwt.user.client.Element desc = DOM.createDiv(); | |||
public Element desc = DOM.createDiv(); | |||
/** For internal use only. May be removed or replaced in the future. */ | |||
public Icon icon; | |||
@@ -52,13 +53,13 @@ public class VForm extends ComplexPanel implements KeyDownHandler { | |||
public VErrorMessage errorMessage = new VErrorMessage(); | |||
/** For internal use only. May be removed or replaced in the future. */ | |||
public com.google.gwt.user.client.Element fieldContainer = DOM.createDiv(); | |||
public Element fieldContainer = DOM.createDiv(); | |||
/** For internal use only. May be removed or replaced in the future. */ | |||
public com.google.gwt.user.client.Element footerContainer = DOM.createDiv(); | |||
public Element footerContainer = DOM.createDiv(); | |||
/** For internal use only. May be removed or replaced in the future. */ | |||
public com.google.gwt.user.client.Element fieldSet = DOM.createFieldSet(); | |||
public Element fieldSet = DOM.createFieldSet(); | |||
/** For internal use only. May be removed or replaced in the future. */ | |||
public Widget footer; | |||
@@ -135,10 +136,4 @@ public class VForm extends ComplexPanel implements KeyDownHandler { | |||
} | |||
lo = newLayoutWidget; | |||
} | |||
/** For internal use only. May be removed or replaced in the future. */ | |||
@Override | |||
public void add(Widget child, com.google.gwt.user.client.Element container) { | |||
super.add(child, container); | |||
} | |||
} |
@@ -21,6 +21,7 @@ import java.util.HashMap; | |||
import java.util.List; | |||
import com.google.gwt.aria.client.Roles; | |||
import com.google.gwt.dom.client.Element; | |||
import com.google.gwt.event.dom.client.ClickEvent; | |||
import com.google.gwt.event.dom.client.ClickHandler; | |||
import com.google.gwt.user.client.DOM; | |||
@@ -119,7 +120,7 @@ public class VFormLayout extends SimplePanel { | |||
} | |||
public void setMargins(MarginInfo margins) { | |||
com.google.gwt.user.client.Element margin = getElement(); | |||
Element margin = getElement(); | |||
setStyleName(margin, CLASSNAME + "-" + StyleConstants.MARGIN_TOP, | |||
margins.hasTop()); | |||
setStyleName(margin, CLASSNAME + "-" + StyleConstants.MARGIN_RIGHT, | |||
@@ -218,11 +219,11 @@ public class VFormLayout extends SimplePanel { | |||
private final ComponentConnector owner; | |||
private com.google.gwt.user.client.Element requiredFieldIndicator; | |||
private Element requiredFieldIndicator; | |||
private Icon icon; | |||
private com.google.gwt.user.client.Element captionText; | |||
private Element captionText; | |||
/** | |||
* | |||
@@ -354,7 +355,7 @@ public class VFormLayout extends SimplePanel { | |||
public class ErrorFlag extends HTML { | |||
private static final String CLASSNAME = VFormLayout.CLASSNAME | |||
+ "-error-indicator"; | |||
com.google.gwt.user.client.Element errorIndicatorElement; | |||
Element errorIndicatorElement; | |||
private ComponentConnector owner; | |||
@@ -22,9 +22,11 @@ import java.util.List; | |||
import com.google.gwt.dom.client.DivElement; | |||
import com.google.gwt.dom.client.Document; | |||
import com.google.gwt.dom.client.Element; | |||
import com.google.gwt.dom.client.Style; | |||
import com.google.gwt.dom.client.Style.Position; | |||
import com.google.gwt.dom.client.Style.Unit; | |||
import com.google.gwt.user.client.DOM; | |||
import com.google.gwt.user.client.ui.ComplexPanel; | |||
import com.google.gwt.user.client.ui.Widget; | |||
import com.vaadin.client.ApplicationConnection; | |||
@@ -215,7 +217,7 @@ public class VGridLayout extends ComplexPanel { | |||
void layoutCellsVertically() { | |||
int verticalSpacing = getVerticalSpacing(); | |||
LayoutManager layoutManager = LayoutManager.get(client); | |||
com.google.gwt.user.client.Element element = getElement(); | |||
Element element = getElement(); | |||
int paddingTop = layoutManager.getPaddingTop(element); | |||
int paddingBottom = layoutManager.getPaddingBottom(element); | |||
@@ -256,7 +258,7 @@ public class VGridLayout extends ComplexPanel { | |||
void layoutCellsHorizontally() { | |||
LayoutManager layoutManager = LayoutManager.get(client); | |||
com.google.gwt.user.client.Element element = getElement(); | |||
Element element = getElement(); | |||
int x = layoutManager.getPaddingLeft(element); | |||
int paddingRight = layoutManager.getPaddingRight(element); | |||
int horizontalSpacing = getHorizontalSpacing(); | |||
@@ -612,8 +614,7 @@ public class VGridLayout extends ComplexPanel { | |||
if (component.isRelativeWidth()) { | |||
slot.getWrapperElement().getStyle().setWidth(100, Unit.PCT); | |||
} | |||
com.google.gwt.user.client.Element slotWrapper = slot | |||
.getWrapperElement(); | |||
Element slotWrapper = slot.getWrapperElement(); | |||
getElement().appendChild(slotWrapper); | |||
Widget widget = component.getWidget(); | |||
@@ -665,10 +666,32 @@ public class VGridLayout extends ComplexPanel { | |||
* this layout | |||
* @return The Paintable which the element is a part of. Null if the element | |||
* belongs to the layout and not to a child. | |||
* @deprecated As of 7.2, call or override {@link #getComponent(Element)} | |||
* instead | |||
*/ | |||
@Deprecated | |||
public ComponentConnector getComponent( | |||
com.google.gwt.user.client.Element element) { | |||
return Util.getConnectorForElement(client, this, element); | |||
} | |||
/** | |||
* Returns the deepest nested child component which contains "element". The | |||
* child component is also returned if "element" is part of its caption. | |||
* <p> | |||
* For internal use only. May be removed or replaced in the future. | |||
* | |||
* @param element | |||
* An element that is a nested sub element of the root element in | |||
* this layout | |||
* @return The Paintable which the element is a part of. Null if the element | |||
* belongs to the layout and not to a child. | |||
* | |||
* @since 7.2 | |||
*/ | |||
public ComponentConnector getComponent(Element element) { | |||
return getComponent(DOM.asOld(element)); | |||
} | |||
/** For internal use only. May be removed or replaced in the future. */ |
@@ -16,6 +16,7 @@ | |||
package com.vaadin.client.ui; | |||
import com.google.gwt.dom.client.Element; | |||
import com.google.gwt.event.dom.client.ClickEvent; | |||
import com.google.gwt.event.dom.client.ClickHandler; | |||
import com.google.gwt.user.client.DOM; | |||
@@ -57,14 +58,13 @@ public class VLink extends HTML implements ClickHandler { | |||
public int targetHeight; | |||
/** For internal use only. May be removed or replaced in the future. */ | |||
public com.google.gwt.user.client.Element errorIndicatorElement; | |||
public Element errorIndicatorElement; | |||
/** For internal use only. May be removed or replaced in the future. */ | |||
public final com.google.gwt.user.client.Element anchor = DOM.createAnchor(); | |||
public final Element anchor = DOM.createAnchor(); | |||
/** For internal use only. May be removed or replaced in the future. */ | |||
public final com.google.gwt.user.client.Element captionElement = DOM | |||
.createSpan(); | |||
public final Element captionElement = DOM.createSpan(); | |||
/** For internal use only. May be removed or replaced in the future. */ | |||
public Icon icon; | |||
@@ -120,8 +120,7 @@ public class VLink extends HTML implements ClickHandler { | |||
@Override | |||
public void onBrowserEvent(Event event) { | |||
final com.google.gwt.user.client.Element target = DOM | |||
.eventGetTarget(event); | |||
final Element target = DOM.eventGetTarget(event); | |||
if (event.getTypeInt() == Event.ONLOAD) { | |||
Util.notifyParentOfSizeChange(this, true); | |||
} |
@@ -17,6 +17,7 @@ | |||
package com.vaadin.client.ui; | |||
import com.google.gwt.dom.client.Document; | |||
import com.google.gwt.dom.client.Element; | |||
import com.google.gwt.dom.client.MediaElement; | |||
import com.google.gwt.dom.client.NodeList; | |||
import com.google.gwt.dom.client.SourceElement; | |||
@@ -81,8 +82,7 @@ public abstract class VMediaBase extends Widget { | |||
} | |||
public void addSource(String sourceUrl, String sourceType) { | |||
com.google.gwt.user.client.Element src = Document.get() | |||
.createElement(SourceElement.TAG).cast(); | |||
Element src = Document.get().createElement(SourceElement.TAG); | |||
src.setAttribute("src", sourceUrl); | |||
src.setAttribute("type", sourceType); | |||
media.appendChild(src); |
@@ -21,6 +21,7 @@ import java.util.List; | |||
import com.google.gwt.core.client.GWT; | |||
import com.google.gwt.core.client.Scheduler; | |||
import com.google.gwt.core.client.Scheduler.ScheduledCommand; | |||
import com.google.gwt.dom.client.Element; | |||
import com.google.gwt.dom.client.Style; | |||
import com.google.gwt.dom.client.Style.Overflow; | |||
import com.google.gwt.dom.client.Style.Unit; | |||
@@ -89,7 +90,7 @@ public class VMenuBar extends SimpleFocusablePanel implements | |||
/** Widget fields **/ | |||
protected boolean subMenu; | |||
protected ArrayList<CustomMenuItem> items; | |||
protected com.google.gwt.user.client.Element containerElement; | |||
protected Element containerElement; | |||
protected VOverlay popup; | |||
protected VMenuBar visibleChildMenu; | |||
protected boolean menuVisible = false; | |||
@@ -270,7 +271,7 @@ public class VMenuBar extends SimpleFocusablePanel implements | |||
* Remove all the items in this menu | |||
*/ | |||
public void clearItems() { | |||
com.google.gwt.user.client.Element e = getContainerElement(); | |||
Element e = getContainerElement(); | |||
while (DOM.getChildCount(e) > 0) { | |||
DOM.removeChild(e, DOM.getChild(e, 0)); | |||
} | |||
@@ -284,7 +285,7 @@ public class VMenuBar extends SimpleFocusablePanel implements | |||
*/ | |||
@Override | |||
public com.google.gwt.user.client.Element getContainerElement() { | |||
return containerElement; | |||
return DOM.asOld(containerElement); | |||
} | |||
/** | |||
@@ -368,8 +369,7 @@ public class VMenuBar extends SimpleFocusablePanel implements | |||
return; | |||
} | |||
com.google.gwt.user.client.Element targetElement = DOM | |||
.eventGetTarget(e); | |||
Element targetElement = DOM.eventGetTarget(e); | |||
CustomMenuItem targetItem = null; | |||
for (int i = 0; i < items.size(); i++) { | |||
CustomMenuItem item = items.get(i); | |||
@@ -1514,7 +1514,7 @@ public class VMenuBar extends SimpleFocusablePanel implements | |||
return null; | |||
} | |||
com.google.gwt.user.client.Element menuItemRoot = subElement; | |||
Element menuItemRoot = subElement; | |||
while (menuItemRoot != null && menuItemRoot.getParentElement() != null | |||
&& menuItemRoot.getParentElement() != getElement()) { | |||
menuItemRoot = menuItemRoot.getParentElement().cast(); | |||
@@ -1537,7 +1537,10 @@ public class VMenuBar extends SimpleFocusablePanel implements | |||
* @param element | |||
* Element used in search | |||
* @return Menu item or null if not found | |||
* @deprecated As of 7.2, call or override | |||
* {@link #getMenuItemWithElement(Element)} instead | |||
*/ | |||
@Deprecated | |||
public CustomMenuItem getMenuItemWithElement( | |||
com.google.gwt.user.client.Element element) { | |||
for (int i = 0; i < items.size(); i++) { | |||
@@ -1556,4 +1559,17 @@ public class VMenuBar extends SimpleFocusablePanel implements | |||
return null; | |||
} | |||
/** | |||
* Get menu item with given DOM element | |||
* | |||
* @param element | |||
* Element used in search | |||
* @return Menu item or null if not found | |||
* | |||
* @since 7.2 | |||
*/ | |||
public CustomMenuItem getMenuItemWithElement(Element element) { | |||
return getMenuItemWithElement(DOM.asOld(element)); | |||
} | |||
} |
@@ -23,6 +23,7 @@ import java.util.Iterator; | |||
import com.google.gwt.aria.client.Roles; | |||
import com.google.gwt.core.client.GWT; | |||
import com.google.gwt.dom.client.Element; | |||
import com.google.gwt.event.dom.client.KeyCodes; | |||
import com.google.gwt.user.client.DOM; | |||
import com.google.gwt.user.client.Event; | |||
@@ -288,7 +289,7 @@ public class VNotification extends VOverlay { | |||
} | |||
public void setPosition(com.vaadin.shared.Position position) { | |||
final com.google.gwt.user.client.Element el = getElement(); | |||
final Element el = getElement(); | |||
DOM.setStyleAttribute(el, "top", ""); | |||
DOM.setStyleAttribute(el, "left", ""); | |||
DOM.setStyleAttribute(el, "bottom", ""); | |||
@@ -345,7 +346,7 @@ public class VNotification extends VOverlay { | |||
} | |||
} | |||
private void setOpacity(com.google.gwt.user.client.Element el, int opacity) { | |||
private void setOpacity(Element el, int opacity) { | |||
DOM.setStyleAttribute(el, "opacity", "" + (opacity / 100.0)); | |||
if (BrowserInfo.get().isIE()) { | |||
DOM.setStyleAttribute(el, "filter", "Alpha(opacity=" + opacity |
@@ -19,6 +19,7 @@ package com.vaadin.client.ui; | |||
import com.google.gwt.animation.client.Animation; | |||
import com.google.gwt.aria.client.Roles; | |||
import com.google.gwt.dom.client.Document; | |||
import com.google.gwt.dom.client.Element; | |||
import com.google.gwt.dom.client.IFrameElement; | |||
import com.google.gwt.dom.client.Style; | |||
import com.google.gwt.dom.client.Style.BorderStyle; | |||
@@ -129,7 +130,7 @@ public class VOverlay extends PopupPanel implements CloseHandler<PopupPanel> { | |||
/* | |||
* The shadow element for this overlay. | |||
*/ | |||
private com.google.gwt.user.client.Element shadow; | |||
private Element shadow; | |||
/* | |||
* The creator of this VOverlay (the widget that made the instance, not the | |||
@@ -481,8 +482,7 @@ public class VOverlay extends PopupPanel implements CloseHandler<PopupPanel> { | |||
// Animate the size | |||
positionAndSize.setAnimationFromCenterProgress(progress); | |||
com.google.gwt.user.client.Element container = getElement() | |||
.getParentElement().cast(); | |||
Element container = getElement().getParentElement(); | |||
if (isShadowEnabled()) { | |||
updateShadowPosition(progress, zIndex, positionAndSize); | |||
@@ -535,9 +535,7 @@ public class VOverlay extends PopupPanel implements CloseHandler<PopupPanel> { | |||
} | |||
private void updateShimPosition(PositionAndSize positionAndSize) { | |||
updatePositionAndSize( | |||
(com.google.gwt.user.client.Element) com.google.gwt.user.client.Element | |||
.as(getShimElement()), positionAndSize); | |||
updatePositionAndSize(getShimElement(), positionAndSize); | |||
} | |||
/** | |||
@@ -552,7 +550,7 @@ public class VOverlay extends PopupPanel implements CloseHandler<PopupPanel> { | |||
return info.isIE() && info.isBrowserVersionNewerOrEqual(8, 0); | |||
} | |||
private void updatePositionAndSize(com.google.gwt.user.client.Element e, | |||
private void updatePositionAndSize(Element e, | |||
PositionAndSize positionAndSize) { | |||
e.getStyle().setLeft(positionAndSize.getLeft(), Unit.PX); | |||
e.getStyle().setTop(positionAndSize.getTop(), Unit.PX); | |||
@@ -693,7 +691,7 @@ public class VOverlay extends PopupPanel implements CloseHandler<PopupPanel> { | |||
ApplicationConnection ac) { | |||
String id = ac.getConfiguration().getRootPanelId(); | |||
id = id += "-overlays"; | |||
com.google.gwt.user.client.Element container = DOM.getElementById(id); | |||
Element container = DOM.getElementById(id); | |||
if (container == null) { | |||
container = DOM.createDiv(); | |||
container.setId(id); | |||
@@ -703,7 +701,7 @@ public class VOverlay extends PopupPanel implements CloseHandler<PopupPanel> { | |||
container.addClassName(CLASSNAME_CONTAINER); | |||
RootPanel.get().getElement().appendChild(container); | |||
} | |||
return container; | |||
return DOM.asOld(container); | |||
} | |||
/** |
@@ -18,6 +18,7 @@ package com.vaadin.client.ui; | |||
import com.google.gwt.dom.client.DivElement; | |||
import com.google.gwt.dom.client.Document; | |||
import com.google.gwt.dom.client.Element; | |||
import com.google.gwt.user.client.DOM; | |||
import com.google.gwt.user.client.Event; | |||
import com.google.gwt.user.client.ui.SimplePanel; | |||
@@ -38,23 +39,19 @@ public class VPanel extends SimplePanel implements ShortcutActionHandlerOwner, | |||
public String id; | |||
/** For internal use only. May be removed or replaced in the future. */ | |||
public final com.google.gwt.user.client.Element captionNode = DOM | |||
.createDiv(); | |||
public final Element captionNode = DOM.createDiv(); | |||
private final com.google.gwt.user.client.Element captionText = DOM | |||
.createSpan(); | |||
private final Element captionText = DOM.createSpan(); | |||
private Icon icon; | |||
/** For internal use only. May be removed or replaced in the future. */ | |||
public final com.google.gwt.user.client.Element bottomDecoration = DOM | |||
.createDiv(); | |||
public final Element bottomDecoration = DOM.createDiv(); | |||
/** For internal use only. May be removed or replaced in the future. */ | |||
public final com.google.gwt.user.client.Element contentNode = DOM | |||
.createDiv(); | |||
public final Element contentNode = DOM.createDiv(); | |||
private com.google.gwt.user.client.Element errorIndicatorElement; | |||
private Element errorIndicatorElement; | |||
/** For internal use only. May be removed or replaced in the future. */ | |||
public ShortcutActionHandler shortcutHandler; | |||
@@ -128,7 +125,7 @@ public class VPanel extends SimplePanel implements ShortcutActionHandlerOwner, | |||
@Override | |||
protected com.google.gwt.user.client.Element getContainerElement() { | |||
return contentNode; | |||
return DOM.asOld(contentNode); | |||
} | |||
/** For internal use only. May be removed or replaced in the future. */ |
@@ -22,6 +22,7 @@ import com.google.gwt.aria.client.Id; | |||
import com.google.gwt.aria.client.LiveValue; | |||
import com.google.gwt.aria.client.Roles; | |||
import com.google.gwt.core.client.GWT; | |||
import com.google.gwt.dom.client.Element; | |||
import com.google.gwt.event.dom.client.ClickEvent; | |||
import com.google.gwt.event.dom.client.ClickHandler; | |||
import com.google.gwt.event.dom.client.DomEvent; | |||
@@ -81,7 +82,7 @@ public class VPopupCalendar extends VTextualDate implements Field, | |||
private Label selectedDate; | |||
private com.google.gwt.user.client.Element descriptionForAssisitveDevicesElement; | |||
private Element descriptionForAssisitveDevicesElement; | |||
public VPopupCalendar() { | |||
super(); |
@@ -20,6 +20,7 @@ import java.util.HashSet; | |||
import java.util.Iterator; | |||
import java.util.Set; | |||
import com.google.gwt.dom.client.Element; | |||
import com.google.gwt.event.dom.client.ClickEvent; | |||
import com.google.gwt.event.dom.client.ClickHandler; | |||
import com.google.gwt.event.dom.client.KeyCodes; | |||
@@ -178,7 +179,7 @@ public class VPopupView extends HTML implements Iterable<Widget> { | |||
super.onDetach(); | |||
} | |||
private static native void nativeBlur(com.google.gwt.user.client.Element e) | |||
private static native void nativeBlur(Element e) | |||
/*-{ | |||
if(e && e.blur) { | |||
e.blur(); | |||
@@ -203,7 +204,7 @@ public class VPopupView extends HTML implements Iterable<Widget> { | |||
private boolean hasHadMouseOver = false; | |||
private boolean hideOnMouseOut = true; | |||
private final Set<com.google.gwt.user.client.Element> activeChildren = new HashSet<com.google.gwt.user.client.Element>(); | |||
private final Set<Element> activeChildren = new HashSet<Element>(); | |||
private ShortcutActionHandler shortcutActionHandler; | |||
@@ -228,8 +229,7 @@ public class VPopupView extends HTML implements Iterable<Widget> { | |||
// to use ONMOUSEMOVE that doesn't target the popup | |||
@Override | |||
public boolean onEventPreview(Event event) { | |||
com.google.gwt.user.client.Element target = DOM | |||
.eventGetTarget(event); | |||
Element target = DOM.eventGetTarget(event); | |||
boolean eventTargetsPopup = DOM.isOrHasChild(getElement(), target); | |||
int type = DOM.eventGetType(event); | |||
@@ -305,7 +305,7 @@ public class VPopupView extends HTML implements Iterable<Widget> { | |||
} | |||
// Notify children that have used the keyboard | |||
for (com.google.gwt.user.client.Element e : activeChildren) { | |||
for (Element e : activeChildren) { | |||
try { | |||
nativeBlur(e); | |||
} catch (Exception ignored) { |
@@ -16,6 +16,7 @@ | |||
package com.vaadin.client.ui; | |||
import com.google.gwt.dom.client.Element; | |||
import com.google.gwt.dom.client.Style.Unit; | |||
import com.google.gwt.user.client.DOM; | |||
import com.google.gwt.user.client.ui.HasEnabled; | |||
@@ -36,8 +37,8 @@ import com.vaadin.shared.ui.progressindicator.ProgressBarState; | |||
*/ | |||
public class VProgressBar extends Widget implements HasEnabled { | |||
com.google.gwt.user.client.Element wrapper = DOM.createDiv(); | |||
com.google.gwt.user.client.Element indicator = DOM.createDiv(); | |||
Element wrapper = DOM.createDiv(); | |||
Element indicator = DOM.createDiv(); | |||
private boolean indeterminate = false; | |||
private float state = 0.0f; |
@@ -21,6 +21,7 @@ import java.util.Map; | |||
import java.util.Map.Entry; | |||
import com.google.gwt.core.client.Scheduler; | |||
import com.google.gwt.dom.client.Element; | |||
import com.google.gwt.event.dom.client.BlurHandler; | |||
import com.google.gwt.event.dom.client.KeyDownEvent; | |||
import com.google.gwt.event.dom.client.KeyDownHandler; | |||
@@ -213,8 +214,7 @@ public class VRichTextArea extends Composite implements Field, KeyPressHandler, | |||
* Detects space used by components paddings and borders. | |||
*/ | |||
private void detectExtraSizes() { | |||
com.google.gwt.user.client.Element clone = Util.cloneNode(getElement(), | |||
false); | |||
Element clone = Util.cloneNode(getElement(), false); | |||
DOM.setElementAttribute(clone, "id", ""); | |||
DOM.setStyleAttribute(clone, "visibility", "hidden"); | |||
DOM.setStyleAttribute(clone, "position", "absolute"); |
@@ -30,6 +30,7 @@ import com.google.gwt.core.client.JavaScriptObject; | |||
import com.google.gwt.core.client.Scheduler; | |||
import com.google.gwt.core.client.Scheduler.ScheduledCommand; | |||
import com.google.gwt.dom.client.Document; | |||
import com.google.gwt.dom.client.Element; | |||
import com.google.gwt.dom.client.NativeEvent; | |||
import com.google.gwt.dom.client.Node; | |||
import com.google.gwt.dom.client.NodeList; | |||
@@ -487,7 +488,7 @@ public class VScrollTable extends FlowPanel implements HasWidgets, | |||
private final HashMap<Object, String> actionMap = new HashMap<Object, String>(); | |||
private String[] visibleColOrder; | |||
private boolean initialContentReceived = false; | |||
private com.google.gwt.user.client.Element scrollPositionElement; | |||
private Element scrollPositionElement; | |||
/** For internal use only. May be removed or replaced in the future. */ | |||
public boolean enabled; | |||
@@ -1913,8 +1914,7 @@ public class VScrollTable extends FlowPanel implements HasWidgets, | |||
super.onDetach(); | |||
// ensure that scrollPosElement will be detached | |||
if (scrollPositionElement != null) { | |||
final com.google.gwt.user.client.Element parent = DOM | |||
.getParent(scrollPositionElement); | |||
final Element parent = DOM.getParent(scrollPositionElement); | |||
if (parent != null) { | |||
DOM.removeChild(parent, scrollPositionElement); | |||
} | |||
@@ -2504,15 +2504,15 @@ public class VScrollTable extends FlowPanel implements HasWidgets, | |||
public class HeaderCell extends Widget { | |||
com.google.gwt.user.client.Element td = DOM.createTD(); | |||
Element td = DOM.createTD(); | |||
com.google.gwt.user.client.Element captionContainer = DOM.createDiv(); | |||
Element captionContainer = DOM.createDiv(); | |||
com.google.gwt.user.client.Element sortIndicator = DOM.createDiv(); | |||
Element sortIndicator = DOM.createDiv(); | |||
com.google.gwt.user.client.Element colResizeWidget = DOM.createDiv(); | |||
Element colResizeWidget = DOM.createDiv(); | |||
com.google.gwt.user.client.Element floatingCopyOfHeaderCell; | |||
Element floatingCopyOfHeaderCell; | |||
private boolean sortable = false; | |||
private final String cid; | |||
@@ -3214,15 +3214,14 @@ public class VScrollTable extends FlowPanel implements HasWidgets, | |||
HashMap<String, HeaderCell> availableCells = new HashMap<String, HeaderCell>(); | |||
com.google.gwt.user.client.Element div = DOM.createDiv(); | |||
com.google.gwt.user.client.Element hTableWrapper = DOM.createDiv(); | |||
com.google.gwt.user.client.Element hTableContainer = DOM.createDiv(); | |||
com.google.gwt.user.client.Element table = DOM.createTable(); | |||
com.google.gwt.user.client.Element headerTableBody = DOM.createTBody(); | |||
com.google.gwt.user.client.Element tr = DOM.createTR(); | |||
Element div = DOM.createDiv(); | |||
Element hTableWrapper = DOM.createDiv(); | |||
Element hTableContainer = DOM.createDiv(); | |||
Element table = DOM.createTable(); | |||
Element headerTableBody = DOM.createTBody(); | |||
Element tr = DOM.createTR(); | |||
private final com.google.gwt.user.client.Element columnSelector = DOM | |||
.createDiv(); | |||
private final Element columnSelector = DOM.createDiv(); | |||
private int focusedSlot = -1; | |||
@@ -3530,7 +3529,7 @@ public class VScrollTable extends FlowPanel implements HasWidgets, | |||
public void moveCell(int oldIndex, int newIndex) { | |||
final HeaderCell hCell = getHeaderCell(oldIndex); | |||
final com.google.gwt.user.client.Element cell = hCell.getElement(); | |||
final Element cell = hCell.getElement(); | |||
visibleCells.remove(oldIndex); | |||
DOM.removeChild(tr, cell); | |||
@@ -3563,15 +3562,13 @@ public class VScrollTable extends FlowPanel implements HasWidgets, | |||
private void focusSlot(int index) { | |||
removeSlotFocus(); | |||
if (index > 0) { | |||
com.google.gwt.user.client.Element child = tr | |||
.getChild(index - 1).getFirstChild().cast(); | |||
Element child = tr.getChild(index - 1).getFirstChild().cast(); | |||
child.setClassName(VScrollTable.this.getStylePrimaryName() | |||
+ "-resizer"); | |||
child.addClassName(VScrollTable.this.getStylePrimaryName() | |||
+ "-focus-slot-right"); | |||
} else { | |||
com.google.gwt.user.client.Element child = tr.getChild(index) | |||
.getFirstChild().cast(); | |||
Element child = tr.getChild(index).getFirstChild().cast(); | |||
child.setClassName(VScrollTable.this.getStylePrimaryName() | |||
+ "-resizer"); | |||
child.addClassName(VScrollTable.this.getStylePrimaryName() | |||
@@ -3585,13 +3582,12 @@ public class VScrollTable extends FlowPanel implements HasWidgets, | |||
return; | |||
} | |||
if (focusedSlot == 0) { | |||
com.google.gwt.user.client.Element child = tr | |||
.getChild(focusedSlot).getFirstChild().cast(); | |||
Element child = tr.getChild(focusedSlot).getFirstChild().cast(); | |||
child.setClassName(VScrollTable.this.getStylePrimaryName() | |||
+ "-resizer"); | |||
} else if (focusedSlot > 0) { | |||
com.google.gwt.user.client.Element child = tr | |||
.getChild(focusedSlot - 1).getFirstChild().cast(); | |||
Element child = tr.getChild(focusedSlot - 1).getFirstChild() | |||
.cast(); | |||
child.setClassName(VScrollTable.this.getStylePrimaryName() | |||
+ "-resizer"); | |||
} | |||
@@ -3779,9 +3775,8 @@ public class VScrollTable extends FlowPanel implements HasWidgets, | |||
* A cell in the footer | |||
*/ | |||
public class FooterCell extends Widget { | |||
private final com.google.gwt.user.client.Element td = DOM.createTD(); | |||
private final com.google.gwt.user.client.Element captionContainer = DOM | |||
.createDiv(); | |||
private final Element td = DOM.createTD(); | |||
private final Element captionContainer = DOM.createDiv(); | |||
private char align = ALIGN_LEFT; | |||
private int width = -1; | |||
private float expandRatio = 0; | |||
@@ -4084,9 +4079,8 @@ public class VScrollTable extends FlowPanel implements HasWidgets, | |||
// value (greater of header and data | |||
// cols) | |||
final int hw = ((com.google.gwt.user.client.Element) getElement() | |||
.getLastChild()).getOffsetWidth() | |||
+ getHeaderPadding(); | |||
final int hw = ((Element) getElement().getLastChild()) | |||
.getOffsetWidth() + getHeaderPadding(); | |||
if (columnIndex < 0) { | |||
columnIndex = 0; | |||
for (Iterator<Widget> it = tHead.iterator(); it | |||
@@ -4140,12 +4134,12 @@ public class VScrollTable extends FlowPanel implements HasWidgets, | |||
ArrayList<Widget> visibleCells = new ArrayList<Widget>(); | |||
HashMap<String, FooterCell> availableCells = new HashMap<String, FooterCell>(); | |||
com.google.gwt.user.client.Element div = DOM.createDiv(); | |||
com.google.gwt.user.client.Element hTableWrapper = DOM.createDiv(); | |||
com.google.gwt.user.client.Element hTableContainer = DOM.createDiv(); | |||
com.google.gwt.user.client.Element table = DOM.createTable(); | |||
com.google.gwt.user.client.Element headerTableBody = DOM.createTBody(); | |||
com.google.gwt.user.client.Element tr = DOM.createTR(); | |||
Element div = DOM.createDiv(); | |||
Element hTableWrapper = DOM.createDiv(); | |||
Element hTableContainer = DOM.createDiv(); | |||
Element table = DOM.createTable(); | |||
Element headerTableBody = DOM.createTBody(); | |||
Element tr = DOM.createTR(); | |||
public TableFooter() { | |||
@@ -4406,7 +4400,7 @@ public class VScrollTable extends FlowPanel implements HasWidgets, | |||
*/ | |||
public void moveCell(int oldIndex, int newIndex) { | |||
final FooterCell hCell = getFooterCell(oldIndex); | |||
final com.google.gwt.user.client.Element cell = hCell.getElement(); | |||
final Element cell = hCell.getElement(); | |||
visibleCells.remove(oldIndex); | |||
DOM.removeChild(tr, cell); | |||
@@ -4437,13 +4431,13 @@ public class VScrollTable extends FlowPanel implements HasWidgets, | |||
*/ | |||
private boolean tBodyMeasurementsDone = false; | |||
com.google.gwt.user.client.Element preSpacer = DOM.createDiv(); | |||
com.google.gwt.user.client.Element postSpacer = DOM.createDiv(); | |||
Element preSpacer = DOM.createDiv(); | |||
Element postSpacer = DOM.createDiv(); | |||
com.google.gwt.user.client.Element container = DOM.createDiv(); | |||
Element container = DOM.createDiv(); | |||
TableSectionElement tBodyElement = Document.get().createTBodyElement(); | |||
com.google.gwt.user.client.Element table = DOM.createTable(); | |||
Element table = DOM.createTable(); | |||
private int firstRendered; | |||
private int lastRendered; | |||
@@ -4502,8 +4496,7 @@ public class VScrollTable extends FlowPanel implements HasWidgets, | |||
if (BrowserInfo.get().requiresTouchScrollDelegate()) { | |||
NodeList<Node> childNodes = container.getChildNodes(); | |||
for (int i = 0; i < childNodes.getLength(); i++) { | |||
com.google.gwt.user.client.Element item = (com.google.gwt.user.client.Element) childNodes | |||
.getItem(i); | |||
Element item = (Element) childNodes.getItem(i); | |||
item.getStyle().setProperty("webkitTransform", | |||
"translate3d(0,0,0)"); | |||
} | |||
@@ -4980,8 +4973,7 @@ public class VScrollTable extends FlowPanel implements HasWidgets, | |||
for (Widget row : renderedRows) { | |||
if (!(row instanceof VScrollTableGeneratedRow)) { | |||
TableRowElement tr = row.getElement().cast(); | |||
com.google.gwt.user.client.Element wrapperdiv = tr | |||
.getCells().getItem(columnIndex) | |||
Element wrapperdiv = tr.getCells().getItem(columnIndex) | |||
.getFirstChildElement().cast(); | |||
return wrapperdiv.getOffsetWidth(); | |||
} | |||
@@ -5086,8 +5078,7 @@ public class VScrollTable extends FlowPanel implements HasWidgets, | |||
while (rows.hasNext()) { | |||
final VScrollTableRow row = (VScrollTableRow) rows.next(); | |||
final com.google.gwt.user.client.Element td = DOM.getChild( | |||
row.getElement(), oldIndex); | |||
final Element td = DOM.getChild(row.getElement(), oldIndex); | |||
if (td != null) { | |||
DOM.removeChild(row.getElement(), td); | |||
@@ -5238,8 +5229,7 @@ public class VScrollTable extends FlowPanel implements HasWidgets, | |||
} | |||
protected void setCellWidth(int cellIx, int width) { | |||
final com.google.gwt.user.client.Element cell = DOM.getChild( | |||
getElement(), cellIx); | |||
final Element cell = DOM.getChild(getElement(), cellIx); | |||
Style wrapperStyle = cell.getFirstChildElement().getStyle(); | |||
int wrapperWidth = width; | |||
if (BrowserInfo.get().isWebkit() | |||
@@ -5394,8 +5384,7 @@ public class VScrollTable extends FlowPanel implements HasWidgets, | |||
protected void initCellWithText(String text, char align, | |||
String style, boolean textIsHTML, boolean sorted, | |||
String description, final TableCellElement td) { | |||
final com.google.gwt.user.client.Element container = DOM | |||
.createDiv(); | |||
final Element container = DOM.createDiv(); | |||
container.setClassName(VScrollTable.this.getStylePrimaryName() | |||
+ "-cell-wrapper"); | |||
@@ -5436,8 +5425,7 @@ public class VScrollTable extends FlowPanel implements HasWidgets, | |||
protected void updateCellStyleNames(TableCellElement td, | |||
String primaryStyleName) { | |||
com.google.gwt.user.client.Element container = td | |||
.getFirstChild().cast(); | |||
Element container = td.getFirstChild().cast(); | |||
container.setClassName(primaryStyleName + "-cell-wrapper"); | |||
/* | |||
@@ -5468,8 +5456,7 @@ public class VScrollTable extends FlowPanel implements HasWidgets, | |||
protected void initCellWithWidget(Widget w, char align, | |||
String style, boolean sorted, final TableCellElement td) { | |||
final com.google.gwt.user.client.Element container = DOM | |||
.createDiv(); | |||
final Element container = DOM.createDiv(); | |||
String className = VScrollTable.this.getStylePrimaryName() | |||
+ "-cell-content"; | |||
if (style != null && !style.equals("")) { | |||
@@ -5536,8 +5523,7 @@ public class VScrollTable extends FlowPanel implements HasWidgets, | |||
* Whether the event is sent immediately | |||
* @return Whether a click event was sent | |||
*/ | |||
private boolean handleClickEvent(Event event, | |||
com.google.gwt.user.client.Element targetTdOrTr, | |||
private boolean handleClickEvent(Event event, Element targetTdOrTr, | |||
boolean immediate) { | |||
if (!client.hasEventListeners(VScrollTable.this, | |||
TableConstants.ITEM_CLICK_EVENT_ID)) { | |||
@@ -5572,8 +5558,7 @@ public class VScrollTable extends FlowPanel implements HasWidgets, | |||
com.google.gwt.dom.client.Element target) { | |||
TooltipInfo info = null; | |||
final com.google.gwt.user.client.Element targetTdOrTr = getTdOrTr((com.google.gwt.user.client.Element) target | |||
.cast()); | |||
final Element targetTdOrTr = getTdOrTr(target); | |||
if (targetTdOrTr != null | |||
&& "td".equals(targetTdOrTr.getTagName().toLowerCase())) { | |||
TableCellElement td = (TableCellElement) targetTdOrTr | |||
@@ -5588,19 +5573,18 @@ public class VScrollTable extends FlowPanel implements HasWidgets, | |||
return info; | |||
} | |||
private com.google.gwt.user.client.Element getTdOrTr( | |||
com.google.gwt.user.client.Element target) { | |||
com.google.gwt.user.client.Element thisTrElement = getElement(); | |||
private Element getTdOrTr(Element target) { | |||
Element thisTrElement = getElement(); | |||
if (target == thisTrElement) { | |||
// This was a on the TR element | |||
return target; | |||
} | |||
// Iterate upwards until we find the TR element | |||
com.google.gwt.user.client.Element element = target; | |||
Element element = target; | |||
while (element != null | |||
&& element.getParentElement().cast() != thisTrElement) { | |||
element = element.getParentElement().cast(); | |||
&& element.getParentElement() != thisTrElement) { | |||
element = element.getParentElement(); | |||
} | |||
return element; | |||
} | |||
@@ -5615,7 +5599,7 @@ public class VScrollTable extends FlowPanel implements HasWidgets, | |||
boolean touchEventHandled = false; | |||
if (enabled && hasNativeTouchScrolling) { | |||
final com.google.gwt.user.client.Element targetTdOrTr = getEventTargetTdOrTr(event); | |||
final Element targetTdOrTr = getEventTargetTdOrTr(event); | |||
final int type = event.getTypeInt(); | |||
switch (type) { | |||
@@ -5728,7 +5712,7 @@ public class VScrollTable extends FlowPanel implements HasWidgets, | |||
if (enabled && !touchEventHandled) { | |||
final int type = event.getTypeInt(); | |||
final com.google.gwt.user.client.Element targetTdOrTr = getEventTargetTdOrTr(event); | |||
final Element targetTdOrTr = getEventTargetTdOrTr(event); | |||
if (type == Event.ONCONTEXTMENU) { | |||
showContextMenu(event); | |||
if (enabled | |||
@@ -5848,8 +5832,7 @@ public class VScrollTable extends FlowPanel implements HasWidgets, | |||
// Remove IE text selection hack | |||
if (BrowserInfo.get().isIE()) { | |||
((com.google.gwt.user.client.Element) event | |||
.getEventTarget().cast()) | |||
((Element) event.getEventTarget().cast()) | |||
.setPropertyJSO("onselectstart", | |||
null); | |||
} | |||
@@ -5991,8 +5974,7 @@ public class VScrollTable extends FlowPanel implements HasWidgets, | |||
// Prevent default text selection in IE | |||
if (BrowserInfo.get().isIE()) { | |||
((com.google.gwt.user.client.Element) event | |||
.getEventTarget().cast()) | |||
((Element) event.getEventTarget().cast()) | |||
.setPropertyJSO( | |||
"onselectstart", | |||
getPreventTextSelectionIEHack()); | |||
@@ -6052,7 +6034,7 @@ public class VScrollTable extends FlowPanel implements HasWidgets, | |||
} | |||
protected void startRowDrag(Event event, final int type, | |||
com.google.gwt.user.client.Element targetTdOrTr) { | |||
Element targetTdOrTr) { | |||
VTransferable transferable = new VTransferable(); | |||
transferable.setDragSource(ConnectorMap.get(client) | |||
.getConnector(VScrollTable.this)); | |||
@@ -6072,21 +6054,17 @@ public class VScrollTable extends FlowPanel implements HasWidgets, | |||
&& rowKeyIsSelected(rowKey)) { | |||
// Create a drag image of ALL rows | |||
ev.createDragImage( | |||
(com.google.gwt.user.client.Element) scrollBody.tBodyElement | |||
.cast(), true); | |||
ev.createDragImage(scrollBody.tBodyElement, true); | |||
// Hide rows which are not selected | |||
com.google.gwt.user.client.Element dragImage = ev | |||
.getDragImage(); | |||
Element dragImage = ev.getDragImage(); | |||
int i = 0; | |||
for (Iterator<Widget> iterator = scrollBody.iterator(); iterator | |||
.hasNext();) { | |||
VScrollTableRow next = (VScrollTableRow) iterator | |||
.next(); | |||
com.google.gwt.user.client.Element child = (com.google.gwt.user.client.Element) dragImage | |||
.getChild(i++); | |||
Element child = (Element) dragImage.getChild(i++); | |||
if (!rowKeyIsSelected(next.rowKey)) { | |||
child.getStyle().setVisibility(Visibility.HIDDEN); | |||
@@ -6111,10 +6089,8 @@ public class VScrollTable extends FlowPanel implements HasWidgets, | |||
* @return TD or TR element that the event targets (the actual event | |||
* target is this element or a child of it) | |||
*/ | |||
private com.google.gwt.user.client.Element getEventTargetTdOrTr( | |||
Event event) { | |||
final com.google.gwt.user.client.Element eventTarget = event | |||
.getEventTarget().cast(); | |||
private Element getEventTargetTdOrTr(Event event) { | |||
final Element eventTarget = event.getEventTarget().cast(); | |||
Widget widget = Util.findWidget(eventTarget, null); | |||
if (widget != this) { | |||
@@ -6422,9 +6398,8 @@ public class VScrollTable extends FlowPanel implements HasWidgets, | |||
.getVisibleCellCount(); ix++) { | |||
spanWidth += tHead.getHeaderCell(ix).getOffsetWidth(); | |||
} | |||
Util.setWidthExcludingPaddingAndBorder( | |||
(com.google.gwt.user.client.Element) getElement() | |||
.getChild(cellIx), spanWidth, 13, false); | |||
Util.setWidthExcludingPaddingAndBorder((Element) getElement() | |||
.getChild(cellIx), spanWidth, 13, false); | |||
} | |||
} | |||
@@ -7123,17 +7098,15 @@ public class VScrollTable extends FlowPanel implements HasWidgets, | |||
private void updateDropDetails(VDragEvent drag) { | |||
dropDetails = new TableDDDetails(); | |||
com.google.gwt.user.client.Element elementOver = drag | |||
.getElementOver(); | |||
Element elementOver = drag.getElementOver(); | |||
VScrollTableRow row = Util.findWidget(elementOver, getRowClass()); | |||
if (row != null) { | |||
dropDetails.overkey = row.rowKey; | |||
com.google.gwt.user.client.Element tr = row.getElement(); | |||
com.google.gwt.user.client.Element element = elementOver; | |||
Element tr = row.getElement(); | |||
Element element = elementOver; | |||
while (element != null && element.getParentElement() != tr) { | |||
element = (com.google.gwt.user.client.Element) element | |||
.getParentElement(); | |||
element = element.getParentElement(); | |||
} | |||
int childIndex = DOM.getChildIndex(tr, element); | |||
dropDetails.colkey = tHead.getHeaderCell(childIndex) | |||
@@ -7609,8 +7582,7 @@ public class VScrollTable extends FlowPanel implements HasWidgets, | |||
* ...and sometimes it sends blur events even though the focus | |||
* handler is still active. (#10464) | |||
*/ | |||
com.google.gwt.user.client.Element focusedElement = Util | |||
.getIEFocusedElement(); | |||
Element focusedElement = Util.getIEFocusedElement(); | |||
if (Util.getConnectorForElement(client, getParent(), focusedElement) == this | |||
&& focusedElement != null | |||
&& focusedElement != scrollBodyPanel.getFocusElement()) { | |||
@@ -7884,8 +7856,7 @@ public class VScrollTable extends FlowPanel implements HasWidgets, | |||
int colIx = Integer.valueOf(result.getGroup(2)); | |||
VScrollTableRow row = scrollBody.getRowByRowIndex(rowIx); | |||
if (row != null) { | |||
com.google.gwt.user.client.Element rowElement = row | |||
.getElement(); | |||
Element rowElement = row.getElement(); | |||
if (colIx < rowElement.getChildCount()) { | |||
return rowElement.getChild(colIx).getFirstChild().cast(); | |||
} |
@@ -18,6 +18,7 @@ package com.vaadin.client.ui; | |||
import com.google.gwt.core.client.Scheduler; | |||
import com.google.gwt.core.client.Scheduler.ScheduledCommand; | |||
import com.google.gwt.dom.client.Element; | |||
import com.google.gwt.dom.client.Style.Display; | |||
import com.google.gwt.dom.client.Style.Overflow; | |||
import com.google.gwt.dom.client.Style.Unit; | |||
@@ -79,17 +80,17 @@ public class VSlider extends SimpleFocusablePanel implements Field, | |||
}; | |||
/* DOM element for slider's base */ | |||
private final com.google.gwt.user.client.Element base; | |||
private final Element base; | |||
private final int BASE_BORDER_WIDTH = 1; | |||
/* DOM element for slider's handle */ | |||
private final com.google.gwt.user.client.Element handle; | |||
private final Element handle; | |||
/* DOM element for decrement arrow */ | |||
private final com.google.gwt.user.client.Element smaller; | |||
private final Element smaller; | |||
/* DOM element for increment arrow */ | |||
private final com.google.gwt.user.client.Element bigger; | |||
private final Element bigger; | |||
/* Temporary dragging/animation variables */ | |||
private boolean dragging = false; | |||
@@ -198,8 +199,7 @@ public class VSlider extends SimpleFocusablePanel implements Field, | |||
return; | |||
} | |||
final com.google.gwt.user.client.Element p = getElement() | |||
.getParentElement().cast(); | |||
final Element p = getElement().getParentElement(); | |||
if (p.getPropertyInt(domProperty) > 50) { | |||
if (isVertical()) { | |||
setHeight(); | |||
@@ -214,8 +214,7 @@ public class VSlider extends SimpleFocusablePanel implements Field, | |||
@Override | |||
public void execute() { | |||
final com.google.gwt.user.client.Element p = getElement() | |||
.getParentElement().cast(); | |||
final Element p = getElement().getParentElement(); | |||
if (p.getPropertyInt(domProperty) > (MIN_SIZE + 5)) { | |||
if (isVertical()) { | |||
setHeight(); | |||
@@ -266,8 +265,7 @@ public class VSlider extends SimpleFocusablePanel implements Field, | |||
if (disabled || readonly) { | |||
return; | |||
} | |||
final com.google.gwt.user.client.Element targ = DOM | |||
.eventGetTarget(event); | |||
final Element targ = DOM.eventGetTarget(event); | |||
if (DOM.eventGetType(event) == Event.ONMOUSEWHEEL) { | |||
processMouseWheelEvent(event); |
@@ -25,6 +25,7 @@ import com.google.gwt.aria.client.Roles; | |||
import com.google.gwt.aria.client.SelectedValue; | |||
import com.google.gwt.core.client.Scheduler; | |||
import com.google.gwt.dom.client.DivElement; | |||
import com.google.gwt.dom.client.Element; | |||
import com.google.gwt.dom.client.Style; | |||
import com.google.gwt.dom.client.Style.Visibility; | |||
import com.google.gwt.dom.client.TableCellElement; | |||
@@ -112,11 +113,11 @@ public class VTabsheet extends VTabsheetBase implements Focusable, | |||
+ "-focus"; | |||
private TabCaption tabCaption; | |||
com.google.gwt.user.client.Element td = getElement(); | |||
Element td = getElement(); | |||
private VCloseHandler closeHandler; | |||
private boolean enabledOnServer = true; | |||
private com.google.gwt.user.client.Element div; | |||
private Element div; | |||
private TabBar tabBar; | |||
private boolean hiddenOnServer = false; | |||
@@ -163,7 +164,7 @@ public class VTabsheet extends VTabsheetBase implements Focusable, | |||
@Override | |||
protected com.google.gwt.user.client.Element getContainerElement() { | |||
// Attach caption element to div, not td | |||
return div; | |||
return DOM.asOld(div); | |||
} | |||
public boolean isEnabledOnServer() { | |||
@@ -310,7 +311,7 @@ public class VTabsheet extends VTabsheetBase implements Focusable, | |||
public static class TabCaption extends VCaption { | |||
private boolean closable = false; | |||
private com.google.gwt.user.client.Element closeButton; | |||
private Element closeButton; | |||
private Tab tab; | |||
TabCaption(Tab tab, ApplicationConnection client) { | |||
@@ -406,7 +407,7 @@ public class VTabsheet extends VTabsheetBase implements Focusable, | |||
} | |||
public com.google.gwt.user.client.Element getCloseButton() { | |||
return closeButton; | |||
return DOM.asOld(closeButton); | |||
} | |||
} | |||
@@ -414,10 +415,9 @@ public class VTabsheet extends VTabsheetBase implements Focusable, | |||
static class TabBar extends ComplexPanel implements ClickHandler, | |||
VCloseHandler { | |||
private final com.google.gwt.user.client.Element tr = DOM.createTR(); | |||
private final Element tr = DOM.createTR(); | |||
private final com.google.gwt.user.client.Element spacerTd = DOM | |||
.createTD(); | |||
private final Element spacerTd = DOM.createTD(); | |||
private Tab selected; | |||
@@ -426,10 +426,10 @@ public class VTabsheet extends VTabsheetBase implements Focusable, | |||
TabBar(VTabsheet tabsheet) { | |||
this.tabsheet = tabsheet; | |||
com.google.gwt.user.client.Element el = DOM.createTable(); | |||
Element el = DOM.createTable(); | |||
Roles.getPresentationRole().set(el); | |||
com.google.gwt.user.client.Element tbody = DOM.createTBody(); | |||
Element tbody = DOM.createTBody(); | |||
DOM.appendChild(el, tbody); | |||
DOM.appendChild(tbody, tr); | |||
setStyleName(spacerTd, CLASSNAME + "-spacertd"); | |||
@@ -449,7 +449,7 @@ public class VTabsheet extends VTabsheetBase implements Focusable, | |||
} | |||
protected com.google.gwt.user.client.Element getContainerElement() { | |||
return tr; | |||
return DOM.asOld(tr); | |||
} | |||
public int getTabCount() { | |||
@@ -477,8 +477,8 @@ public class VTabsheet extends VTabsheetBase implements Focusable, | |||
@Override | |||
public void onClick(ClickEvent event) { | |||
TabCaption caption = (TabCaption) event.getSource(); | |||
com.google.gwt.user.client.Element targetElement = event | |||
.getNativeEvent().getEventTarget().cast(); | |||
Element targetElement = event.getNativeEvent().getEventTarget() | |||
.cast(); | |||
// the tab should not be focused if the close button was clicked | |||
if (targetElement == caption.getCloseButton()) { | |||
return; | |||
@@ -645,7 +645,7 @@ public class VTabsheet extends VTabsheetBase implements Focusable, | |||
/** For internal use only. May be removed or replaced in the future. */ | |||
// tabbar and 'scroller' container | |||
public final com.google.gwt.user.client.Element tabs; | |||
public final Element tabs; | |||
Tab focusedTab; | |||
/** | |||
* The tabindex property (position in the browser's focus cycle.) Named like | |||
@@ -656,11 +656,11 @@ public class VTabsheet extends VTabsheetBase implements Focusable, | |||
private static final FocusImpl focusImpl = FocusImpl.getFocusImplForPanel(); | |||
// tab-scroller element | |||
private final com.google.gwt.user.client.Element scroller; | |||
private final Element scroller; | |||
// tab-scroller next button element | |||
private final com.google.gwt.user.client.Element scrollerNext; | |||
private final Element scrollerNext; | |||
// tab-scroller prev button element | |||
private final com.google.gwt.user.client.Element scrollerPrev; | |||
private final Element scrollerPrev; | |||
/** | |||
* The index of the first visible tab (when scrolled) | |||
@@ -671,9 +671,9 @@ public class VTabsheet extends VTabsheetBase implements Focusable, | |||
/** For internal use only. May be removed or replaced in the future. */ | |||
public final VTabsheetPanel tp = new VTabsheetPanel(); | |||
/** For internal use only. May be removed or replaced in the future. */ | |||
public final com.google.gwt.user.client.Element contentNode; | |||
public final Element contentNode; | |||
private final com.google.gwt.user.client.Element deco; | |||
private final Element deco; | |||
/** For internal use only. May be removed or replaced in the future. */ | |||
public boolean waitingForResponse; | |||
@@ -1131,9 +1131,8 @@ public class VTabsheet extends VTabsheetBase implements Focusable, | |||
} | |||
private boolean isClippedTabs() { | |||
return (tb.getOffsetWidth() - DOM.getElementPropertyInt( | |||
(com.google.gwt.user.client.Element) tb.getContainerElement() | |||
.getLastChild().cast(), "offsetWidth")) > getOffsetWidth() | |||
return (tb.getOffsetWidth() - DOM.getElementPropertyInt((Element) tb | |||
.getContainerElement().getLastChild().cast(), "offsetWidth")) > getOffsetWidth() | |||
- (isScrolledTabs() ? scroller.getOffsetWidth() : 0); | |||
} | |||
@@ -16,6 +16,7 @@ | |||
package com.vaadin.client.ui; | |||
import com.google.gwt.dom.client.Element; | |||
import com.google.gwt.user.client.DOM; | |||
import com.google.gwt.user.client.ui.ComplexPanel; | |||
import com.google.gwt.user.client.ui.Widget; | |||
@@ -52,13 +53,13 @@ public class VTabsheetPanel extends ComplexPanel { | |||
*/ | |||
@Override | |||
public void add(Widget w) { | |||
com.google.gwt.user.client.Element el = createContainerElement(); | |||
Element el = createContainerElement(); | |||
DOM.appendChild(getElement(), el); | |||
super.add(w, el); | |||
} | |||
private com.google.gwt.user.client.Element createContainerElement() { | |||
com.google.gwt.user.client.Element el = DOM.createDiv(); | |||
private Element createContainerElement() { | |||
Element el = DOM.createDiv(); | |||
DOM.setStyleAttribute(el, "position", "absolute"); | |||
hide(el); | |||
touchScrollHandler.addElement(el); | |||
@@ -85,15 +86,15 @@ public class VTabsheetPanel extends ComplexPanel { | |||
* if <code>beforeIndex</code> is out of range | |||
*/ | |||
public void insert(Widget w, int beforeIndex) { | |||
com.google.gwt.user.client.Element el = createContainerElement(); | |||
Element el = createContainerElement(); | |||
DOM.insertChild(getElement(), el, beforeIndex); | |||
super.insert(w, el, beforeIndex, false); | |||
} | |||
@Override | |||
public boolean remove(Widget w) { | |||
com.google.gwt.user.client.Element child = w.getElement(); | |||
com.google.gwt.user.client.Element parent = null; | |||
Element child = w.getElement(); | |||
Element parent = null; | |||
if (child != null) { | |||
parent = DOM.getParent(child); | |||
} | |||
@@ -134,13 +135,13 @@ public class VTabsheetPanel extends ComplexPanel { | |||
unHide(DOM.getParent(visibleWidget.getElement())); | |||
} | |||
private void hide(com.google.gwt.user.client.Element e) { | |||
private void hide(Element e) { | |||
DOM.setStyleAttribute(e, "visibility", "hidden"); | |||
DOM.setStyleAttribute(e, "top", "-100000px"); | |||
DOM.setStyleAttribute(e, "left", "-100000px"); | |||
} | |||
private void unHide(com.google.gwt.user.client.Element e) { | |||
private void unHide(Element e) { | |||
DOM.setStyleAttribute(e, "top", "0px"); | |||
DOM.setStyleAttribute(e, "left", "0px"); | |||
DOM.setStyleAttribute(e, "visibility", ""); | |||
@@ -164,8 +165,7 @@ public class VTabsheetPanel extends ComplexPanel { | |||
width = minWidth; | |||
} | |||
com.google.gwt.user.client.Element wrapperDiv = (com.google.gwt.user.client.Element) visibleWidget | |||
.getElement().getParentElement(); | |||
Element wrapperDiv = visibleWidget.getElement().getParentElement(); | |||
// width first | |||
getElement().getStyle().setPropertyPx("width", width); |
@@ -16,6 +16,7 @@ | |||
package com.vaadin.client.ui; | |||
import com.google.gwt.dom.client.Element; | |||
import com.google.gwt.event.dom.client.BlurEvent; | |||
import com.google.gwt.event.dom.client.BlurHandler; | |||
import com.google.gwt.event.dom.client.ChangeEvent; | |||
@@ -86,7 +87,7 @@ public class VTextField extends TextBoxBase implements Field, ChangeHandler, | |||
this(DOM.createInputText()); | |||
} | |||
protected VTextField(com.google.gwt.user.client.Element node) { | |||
protected VTextField(Element node) { | |||
super(node); | |||
setStyleName(CLASSNAME); | |||
addChangeHandler(this); | |||
@@ -240,8 +241,7 @@ public class VTextField extends TextBoxBase implements Field, ChangeHandler, | |||
} | |||
/** For internal use only. May be removed or replaced in the future. */ | |||
public native void attachCutEventListener( | |||
com.google.gwt.user.client.Element el) | |||
public native void attachCutEventListener(Element el) | |||
/*-{ | |||
var me = this; | |||
el.oncut = $entry(function() { | |||
@@ -249,8 +249,7 @@ public class VTextField extends TextBoxBase implements Field, ChangeHandler, | |||
}); | |||
}-*/; | |||
protected native void detachCutEventListener( | |||
com.google.gwt.user.client.Element el) | |||
protected native void detachCutEventListener(Element el) | |||
/*-{ | |||
el.oncut = null; | |||
}-*/; | |||
@@ -470,7 +469,7 @@ public class VTextField extends TextBoxBase implements Field, ChangeHandler, | |||
return !"off".equals(wrap); | |||
} | |||
private native void addOnInputListener(com.google.gwt.user.client.Element el) | |||
private native void addOnInputListener(Element el) | |||
/*-{ | |||
var self = this; | |||
el.oninput = $entry(function() { | |||
@@ -478,8 +477,7 @@ public class VTextField extends TextBoxBase implements Field, ChangeHandler, | |||
}); | |||
}-*/; | |||
private native void removeOnInputListener( | |||
com.google.gwt.user.client.Element el) | |||
private native void removeOnInputListener(Element el) | |||
/*-{ | |||
el.oninput = null; | |||
}-*/; |
@@ -31,6 +31,7 @@ import com.google.gwt.aria.client.SelectedValue; | |||
import com.google.gwt.core.client.JavaScriptObject; | |||
import com.google.gwt.core.client.Scheduler; | |||
import com.google.gwt.core.client.Scheduler.ScheduledCommand; | |||
import com.google.gwt.dom.client.Element; | |||
import com.google.gwt.dom.client.NativeEvent; | |||
import com.google.gwt.dom.client.Node; | |||
import com.google.gwt.event.dom.client.BlurEvent; | |||
@@ -236,15 +237,14 @@ public class VTree extends FocusElementPanel implements VHasDropHandler, | |||
if (event.getTypeInt() == Event.ONMOUSEDOWN) { | |||
// Prevent default text selection in IE | |||
if (BrowserInfo.get().isIE()) { | |||
((com.google.gwt.user.client.Element) event.getEventTarget() | |||
.cast()).setPropertyJSO("onselectstart", | |||
applyDisableTextSelectionIEHack()); | |||
((Element) event.getEventTarget().cast()).setPropertyJSO( | |||
"onselectstart", applyDisableTextSelectionIEHack()); | |||
} | |||
} else if (event.getTypeInt() == Event.ONMOUSEUP) { | |||
// Remove IE text selection hack | |||
if (BrowserInfo.get().isIE()) { | |||
((com.google.gwt.user.client.Element) event.getEventTarget() | |||
.cast()).setPropertyJSO("onselectstart", null); | |||
((Element) event.getEventTarget().cast()).setPropertyJSO( | |||
"onselectstart", null); | |||
} | |||
} else if (event.getTypeInt() == Event.ONKEYUP) { | |||
if (selectionHasChanged) { | |||
@@ -338,8 +338,7 @@ public class VTree extends FocusElementPanel implements VHasDropHandler, | |||
} | |||
private String findCurrentMouseOverKey( | |||
com.google.gwt.user.client.Element elementOver) { | |||
private String findCurrentMouseOverKey(Element elementOver) { | |||
TreeNode treeNode = Util.findWidget(elementOver, TreeNode.class); | |||
return treeNode == null ? null : treeNode.key; | |||
} | |||
@@ -517,9 +516,9 @@ public class VTree extends FocusElementPanel implements VHasDropHandler, | |||
/** For internal use only. May be removed or replaced in the future. */ | |||
public boolean childrenLoaded; | |||
com.google.gwt.user.client.Element nodeCaptionDiv; | |||
Element nodeCaptionDiv; | |||
protected com.google.gwt.user.client.Element nodeCaptionSpan; | |||
protected Element nodeCaptionSpan; | |||
/** For internal use only. May be removed or replaced in the future. */ | |||
public FlowPanel childNodeContainer; | |||
@@ -692,8 +691,7 @@ public class VTree extends FocusElementPanel implements VHasDropHandler, | |||
public void onBrowserEvent(Event event) { | |||
super.onBrowserEvent(event); | |||
final int type = DOM.eventGetType(event); | |||
final com.google.gwt.user.client.Element target = DOM | |||
.eventGetTarget(event); | |||
final Element target = DOM.eventGetTarget(event); | |||
if (type == Event.ONLOAD && target == icon.getElement()) { | |||
iconLoaded.trigger(); | |||
@@ -894,7 +892,7 @@ public class VTree extends FocusElementPanel implements VHasDropHandler, | |||
nodeCaptionDiv = DOM.createDiv(); | |||
DOM.setElementProperty(nodeCaptionDiv, "className", CLASSNAME | |||
+ "-caption"); | |||
com.google.gwt.user.client.Element wrapper = DOM.createDiv(); | |||
Element wrapper = DOM.createDiv(); | |||
wrapper.setId(labelId); | |||
wrapper.setAttribute("for", treeItemId); | |||
@@ -2098,7 +2096,7 @@ public class VTree extends FocusElementPanel implements VHasDropHandler, | |||
if (expandCollapse) { | |||
return treeNode.getElement(); | |||
} else { | |||
return treeNode.nodeCaptionSpan; | |||
return DOM.asOld(treeNode.nodeCaptionSpan); | |||
} | |||
} catch (Exception e) { | |||
// Invalid locator string or node could not be found |
@@ -25,6 +25,7 @@ import com.google.gwt.animation.client.Animation; | |||
import com.google.gwt.core.client.Scheduler; | |||
import com.google.gwt.core.client.Scheduler.ScheduledCommand; | |||
import com.google.gwt.dom.client.Document; | |||
import com.google.gwt.dom.client.Element; | |||
import com.google.gwt.dom.client.ImageElement; | |||
import com.google.gwt.dom.client.SpanElement; | |||
import com.google.gwt.dom.client.Style.Display; | |||
@@ -169,8 +170,8 @@ public class VTreeTable extends VScrollTable { | |||
protected boolean addTreeSpacer(UIDL rowUidl) { | |||
if (cellShowsTreeHierarchy(getElement().getChildCount() - 1)) { | |||
com.google.gwt.user.client.Element container = (com.google.gwt.user.client.Element) getElement() | |||
.getLastChild().getFirstChild(); | |||
Element container = (Element) getElement().getLastChild() | |||
.getFirstChild(); | |||
if (rowUidl.hasAttribute("icon")) { | |||
// icons are in first content cell in TreeTable | |||
@@ -261,8 +262,7 @@ public class VTreeTable extends VScrollTable { | |||
} | |||
private int getCellWidthFromDom(int cellIndex) { | |||
final com.google.gwt.user.client.Element cell = DOM.getChild( | |||
getElement(), cellIndex); | |||
final Element cell = DOM.getChild(getElement(), cellIndex); | |||
String w = cell.getStyle().getProperty("width"); | |||
if (w == null || "".equals(w) || !w.endsWith("px")) { | |||
return -1; | |||
@@ -420,9 +420,8 @@ public class VTreeTable extends VScrollTable { | |||
.getVisibleCellCount(); ix++) { | |||
spanWidth += tHead.getHeaderCell(ix).getOffsetWidth(); | |||
} | |||
Util.setWidthExcludingPaddingAndBorder( | |||
(com.google.gwt.user.client.Element) getElement() | |||
.getChild(cellIx), spanWidth, 13, false); | |||
Util.setWidthExcludingPaddingAndBorder((Element) getElement() | |||
.getChild(cellIx), spanWidth, 13, false); | |||
} | |||
} | |||
@@ -524,7 +523,7 @@ public class VTreeTable extends VScrollTable { | |||
} | |||
private void copyTRBackgroundsToTDs(VScrollTableRow row) { | |||
com.google.gwt.user.client.Element tr = row.getElement(); | |||
Element tr = row.getElement(); | |||
ComputedStyle cs = new ComputedStyle(tr); | |||
String backgroundAttachment = cs | |||
.getProperty("backgroundAttachment"); | |||
@@ -533,8 +532,7 @@ public class VTreeTable extends VScrollTable { | |||
String backgroundImage = cs.getProperty("backgroundImage"); | |||
String backgroundOrigin = cs.getProperty("backgroundOrigin"); | |||
for (int ix = 0; ix < tr.getChildCount(); ix++) { | |||
com.google.gwt.user.client.Element td = tr.getChild(ix) | |||
.cast(); | |||
Element td = tr.getChild(ix).cast(); | |||
if (!elementHasBackground(td)) { | |||
td.getStyle().setProperty("backgroundAttachment", | |||
backgroundAttachment); | |||
@@ -550,8 +548,7 @@ public class VTreeTable extends VScrollTable { | |||
} | |||
} | |||
private boolean elementHasBackground( | |||
com.google.gwt.user.client.Element element) { | |||
private boolean elementHasBackground(Element element) { | |||
ComputedStyle cs = new ComputedStyle(element); | |||
String clr = cs.getProperty("backgroundColor"); | |||
String img = cs.getProperty("backgroundImage"); | |||
@@ -570,10 +567,9 @@ public class VTreeTable extends VScrollTable { | |||
} | |||
private void restoreStyleForTDsInRow(VScrollTableRow row) { | |||
com.google.gwt.user.client.Element tr = row.getElement(); | |||
Element tr = row.getElement(); | |||
for (int ix = 0; ix < tr.getChildCount(); ix++) { | |||
com.google.gwt.user.client.Element td = tr.getChild(ix) | |||
.cast(); | |||
Element td = tr.getChild(ix).cast(); | |||
td.getStyle().clearProperty("backgroundAttachment"); | |||
td.getStyle().clearProperty("backgroundClip"); | |||
td.getStyle().clearProperty("backgroundColor"); | |||
@@ -619,8 +615,8 @@ public class VTreeTable extends VScrollTable { | |||
private class RowExpandAnimation extends Animation { | |||
private final List<VScrollTableRow> rows; | |||
private com.google.gwt.user.client.Element cloneDiv; | |||
private com.google.gwt.user.client.Element cloneTable; | |||
private Element cloneDiv; | |||
private Element cloneTable; | |||
private AnimationPreparator preparator; | |||
/** | |||
@@ -645,7 +641,7 @@ public class VTreeTable extends VScrollTable { | |||
} | |||
private void cloneAndAppendRow(VScrollTableRow row) { | |||
com.google.gwt.user.client.Element clonedTR = null; | |||
Element clonedTR = null; | |||
clonedTR = row.getElement().cloneNode(true).cast(); | |||
clonedTR.getStyle().setVisibility(Visibility.VISIBLE); | |||
cloneTable.appendChild(clonedTR); | |||
@@ -667,10 +663,8 @@ public class VTreeTable extends VScrollTable { | |||
} | |||
private void insertAnimatingDiv() { | |||
com.google.gwt.user.client.Element tableBody = getElement() | |||
.cast(); | |||
com.google.gwt.user.client.Element tableBodyParent = tableBody | |||
.getParentElement().cast(); | |||
Element tableBody = getElement(); | |||
Element tableBodyParent = tableBody.getParentElement(); | |||
tableBodyParent.insertAfter(cloneDiv, tableBody); | |||
} | |||
@@ -715,27 +709,24 @@ public class VTreeTable extends VScrollTable { | |||
resetCellWrapperDivsDisplayProperty(row); | |||
row.removeStyleName("v-table-row-animating"); | |||
} | |||
com.google.gwt.user.client.Element tableBodyParent = (com.google.gwt.user.client.Element) getElement() | |||
.getParentElement(); | |||
Element tableBodyParent = getElement().getParentElement(); | |||
tableBodyParent.removeChild(cloneDiv); | |||
} | |||
private void setCellWrapperDivsToDisplayNone(VScrollTableRow row) { | |||
com.google.gwt.user.client.Element tr = row.getElement(); | |||
Element tr = row.getElement(); | |||
for (int ix = 0; ix < tr.getChildCount(); ix++) { | |||
getWrapperDiv(tr, ix).getStyle().setDisplay(Display.NONE); | |||
} | |||
} | |||
private com.google.gwt.user.client.Element getWrapperDiv( | |||
com.google.gwt.user.client.Element tr, int tdIx) { | |||
com.google.gwt.user.client.Element td = tr.getChild(tdIx) | |||
.cast(); | |||
private Element getWrapperDiv(Element tr, int tdIx) { | |||
Element td = tr.getChild(tdIx).cast(); | |||
return td.getChild(0).cast(); | |||
} | |||
private void resetCellWrapperDivsDisplayProperty(VScrollTableRow row) { | |||
com.google.gwt.user.client.Element tr = row.getElement(); | |||
Element tr = row.getElement(); | |||
for (int ix = 0; ix < tr.getChildCount(); ix++) { | |||
getWrapperDiv(tr, ix).getStyle().clearProperty("display"); | |||
} |
@@ -21,6 +21,7 @@ import com.google.gwt.core.client.Scheduler; | |||
import com.google.gwt.core.client.Scheduler.ScheduledCommand; | |||
import com.google.gwt.dom.client.DivElement; | |||
import com.google.gwt.dom.client.Document; | |||
import com.google.gwt.dom.client.Element; | |||
import com.google.gwt.dom.client.FormElement; | |||
import com.google.gwt.event.dom.client.ClickEvent; | |||
import com.google.gwt.event.dom.client.ClickHandler; | |||
@@ -152,8 +153,7 @@ public class VUpload extends SimplePanel { | |||
setStyleName(CLASSNAME); | |||
} | |||
private static native void setEncoding( | |||
com.google.gwt.user.client.Element form, String encoding) | |||
private static native void setEncoding(Element form, String encoding) | |||
/*-{ | |||
form.enctype = encoding; | |||
// For IE8 | |||
@@ -172,14 +172,12 @@ public class VUpload extends SimplePanel { | |||
setStyleName(getElement(), CLASSNAME + "-immediate", immediate); | |||
} | |||
private static native void fireNativeClick( | |||
com.google.gwt.user.client.Element element) | |||
private static native void fireNativeClick(Element element) | |||
/*-{ | |||
element.click(); | |||
}-*/; | |||
private static native void fireNativeBlur( | |||
com.google.gwt.user.client.Element element) | |||
private static native void fireNativeBlur(Element element) | |||
/*-{ | |||
element.blur(); | |||
}-*/; |
@@ -17,6 +17,7 @@ | |||
package com.vaadin.client.ui; | |||
import com.google.gwt.dom.client.Document; | |||
import com.google.gwt.dom.client.Element; | |||
import com.google.gwt.dom.client.Style.Unit; | |||
import com.google.gwt.dom.client.VideoElement; | |||
import com.vaadin.client.Util; | |||
@@ -41,8 +42,7 @@ public class VVideo extends VMediaBase { | |||
* | |||
* @param el | |||
*/ | |||
private native void updateDimensionsWhenMetadataLoaded( | |||
com.google.gwt.user.client.Element el) | |||
private native void updateDimensionsWhenMetadataLoaded(Element el) | |||
/*-{ | |||
var self = this; | |||
el.addEventListener('loadedmetadata', $entry(function(e) { |
@@ -28,6 +28,7 @@ import com.google.gwt.aria.client.Roles; | |||
import com.google.gwt.core.client.Scheduler; | |||
import com.google.gwt.core.client.Scheduler.ScheduledCommand; | |||
import com.google.gwt.dom.client.Document; | |||
import com.google.gwt.dom.client.Element; | |||
import com.google.gwt.dom.client.NativeEvent; | |||
import com.google.gwt.dom.client.Style; | |||
import com.google.gwt.dom.client.Style.Position; | |||
@@ -90,15 +91,15 @@ public class VWindow extends VWindowOverlay implements | |||
public static final int Z_INDEX = 10000; | |||
/** For internal use only. May be removed or replaced in the future. */ | |||
public com.google.gwt.user.client.Element contents; | |||
public Element contents; | |||
/** For internal use only. May be removed or replaced in the future. */ | |||
public com.google.gwt.user.client.Element header; | |||
public Element header; | |||
/** For internal use only. May be removed or replaced in the future. */ | |||
public com.google.gwt.user.client.Element footer; | |||
public Element footer; | |||
private com.google.gwt.user.client.Element resizeBox; | |||
private Element resizeBox; | |||
/** For internal use only. May be removed or replaced in the future. */ | |||
public final FocusableScrollPanel contentPanel = new FocusableScrollPanel(); | |||
@@ -120,10 +121,10 @@ public class VWindow extends VWindowOverlay implements | |||
private int origH; | |||
/** For internal use only. May be removed or replaced in the future. */ | |||
public com.google.gwt.user.client.Element closeBox; | |||
public Element closeBox; | |||
/** For internal use only. May be removed or replaced in the future. */ | |||
public com.google.gwt.user.client.Element maximizeRestoreBox; | |||
public Element maximizeRestoreBox; | |||
/** For internal use only. May be removed or replaced in the future. */ | |||
public ApplicationConnection client; | |||
@@ -151,11 +152,11 @@ public class VWindow extends VWindowOverlay implements | |||
/** For internal use only. May be removed or replaced in the future. */ | |||
public boolean resizeLazy = false; | |||
private com.google.gwt.user.client.Element modalityCurtain; | |||
private com.google.gwt.user.client.Element draggingCurtain; | |||
private com.google.gwt.user.client.Element resizingCurtain; | |||
private Element modalityCurtain; | |||
private Element draggingCurtain; | |||
private Element resizingCurtain; | |||
private com.google.gwt.user.client.Element headerText; | |||
private Element headerText; | |||
private boolean closable = true; | |||
@@ -163,8 +164,8 @@ public class VWindow extends VWindowOverlay implements | |||
private String assistivePrefix; | |||
private String assistivePostfix; | |||
private com.google.gwt.user.client.Element topTabStop; | |||
private com.google.gwt.user.client.Element bottomTabStop; | |||
private Element topTabStop; | |||
private Element bottomTabStop; | |||
private NativePreviewHandler topEventBlocker; | |||
private NativePreviewHandler bottomEventBlocker; | |||
@@ -187,7 +188,7 @@ public class VWindow extends VWindowOverlay implements | |||
/** For internal use only. May be removed or replaced in the future. */ | |||
public boolean immediate; | |||
private com.google.gwt.user.client.Element wrapper; | |||
private Element wrapper; | |||
/** For internal use only. May be removed or replaced in the future. */ | |||
public boolean visibilityChangesDisabled; | |||
@@ -334,7 +335,7 @@ public class VWindow extends VWindowOverlay implements | |||
modalityCurtain = DOM.createDiv(); | |||
modalityCurtain.setClassName(CLASSNAME + "-modalitycurtain"); | |||
} | |||
return modalityCurtain; | |||
return DOM.asOld(modalityCurtain); | |||
} | |||
protected void constructDOM() { | |||
@@ -682,7 +683,7 @@ public class VWindow extends VWindowOverlay implements | |||
} | |||
private void fixIE8FocusCaptureIssue() { | |||
com.google.gwt.user.client.Element e = DOM.createInputText(); | |||
Element e = DOM.createInputText(); | |||
Style elemStyle = e.getStyle(); | |||
elemStyle.setPosition(Position.ABSOLUTE); | |||
elemStyle.setTop(-10, Unit.PX); | |||
@@ -772,7 +773,7 @@ public class VWindow extends VWindowOverlay implements | |||
} | |||
} | |||
private com.google.gwt.user.client.Element getDraggingCurtain() { | |||
private Element getDraggingCurtain() { | |||
if (draggingCurtain == null) { | |||
draggingCurtain = createCurtain(); | |||
draggingCurtain.setClassName(CLASSNAME + "-draggingCurtain"); | |||
@@ -781,7 +782,7 @@ public class VWindow extends VWindowOverlay implements | |||
return draggingCurtain; | |||
} | |||
private com.google.gwt.user.client.Element getResizingCurtain() { | |||
private Element getResizingCurtain() { | |||
if (resizingCurtain == null) { | |||
resizingCurtain = createCurtain(); | |||
resizingCurtain.setClassName(CLASSNAME + "-resizingCurtain"); | |||
@@ -790,8 +791,8 @@ public class VWindow extends VWindowOverlay implements | |||
return resizingCurtain; | |||
} | |||
private com.google.gwt.user.client.Element createCurtain() { | |||
com.google.gwt.user.client.Element curtain = DOM.createDiv(); | |||
private Element createCurtain() { | |||
Element curtain = DOM.createDiv(); | |||
DOM.setStyleAttribute(curtain, "position", "absolute"); | |||
DOM.setStyleAttribute(curtain, "top", "0px"); | |||
@@ -934,7 +935,7 @@ public class VWindow extends VWindowOverlay implements | |||
if (contents == null) { | |||
return super.getContainerElement(); | |||
} | |||
return contents; | |||
return DOM.asOld(contents); | |||
} | |||
private Event headerDragPending; | |||
@@ -945,8 +946,7 @@ public class VWindow extends VWindowOverlay implements | |||
final int type = event.getTypeInt(); | |||
final com.google.gwt.user.client.Element target = DOM | |||
.eventGetTarget(event); | |||
final Element target = DOM.eventGetTarget(event); | |||
if (resizing || resizeBox == target) { | |||
onResizeEvent(event); | |||
@@ -1255,8 +1255,7 @@ public class VWindow extends VWindowOverlay implements | |||
return true; | |||
} | |||
final com.google.gwt.user.client.Element target = event | |||
.getEventTarget().cast(); | |||
final Element target = event.getEventTarget().cast(); | |||
if (!DOM.isOrHasChild(getTopmostWindow().getElement(), target)) { | |||
// not within the modal window, but let's see if it's in the | |||
// debug window | |||
@@ -1374,7 +1373,7 @@ public class VWindow extends VWindowOverlay implements | |||
"All values in parameter description need to be non-null"); | |||
} | |||
com.google.gwt.user.client.Element element = ((ComponentConnector) connectors[index]) | |||
Element element = ((ComponentConnector) connectors[index]) | |||
.getWidget().getElement(); | |||
AriaHelper.ensureHasId(element); | |||
ids[index] = Id.of(element); |
@@ -16,6 +16,7 @@ | |||
package com.vaadin.client.ui; | |||
import com.google.gwt.dom.client.Element; | |||
import com.google.gwt.user.client.DOM; | |||
import com.google.gwt.user.client.ui.RootPanel; | |||
import com.vaadin.client.ApplicationConnection; | |||
@@ -42,8 +43,8 @@ public class VWindowOverlay extends VOverlay { | |||
if (ac == null) { | |||
return super.getOverlayContainer(); | |||
} else { | |||
com.google.gwt.user.client.Element overlayContainer = getOverlayContainer(ac); | |||
return overlayContainer; | |||
Element overlayContainer = getOverlayContainer(ac); | |||
return DOM.asOld(overlayContainer); | |||
} | |||
} | |||
@@ -61,7 +62,7 @@ public class VWindowOverlay extends VOverlay { | |||
ApplicationConnection ac) { | |||
String id = ac.getConfiguration().getRootPanelId(); | |||
id = id += "-window-overlays"; | |||
com.google.gwt.user.client.Element container = DOM.getElementById(id); | |||
Element container = DOM.getElementById(id); | |||
if (container == null) { | |||
container = DOM.createDiv(); | |||
container.setId(id); | |||
@@ -72,6 +73,6 @@ public class VWindowOverlay extends VOverlay { | |||
RootPanel.get().getElement().appendChild(container); | |||
} | |||
return container; | |||
return DOM.asOld(container); | |||
} | |||
} |
@@ -17,6 +17,8 @@ package com.vaadin.client.ui.absolutelayout; | |||
import java.util.List; | |||
import com.google.gwt.dom.client.Element; | |||
import com.google.gwt.user.client.DOM; | |||
import com.vaadin.client.ComponentConnector; | |||
import com.vaadin.client.ConnectorHierarchyChangeEvent; | |||
import com.vaadin.client.DirectionalManagedLayout; | |||
@@ -91,13 +93,32 @@ public class AbsoluteLayoutConnector extends | |||
* this layout | |||
* @return The Paintable which the element is a part of. Null if the element | |||
* belongs to the layout and not to a child. | |||
* @deprecated As of 7.2, call or override | |||
* {@link #getConnectorForElement(Element)} instead | |||
*/ | |||
@Deprecated | |||
protected ComponentConnector getConnectorForElement( | |||
com.google.gwt.user.client.Element element) { | |||
return Util.getConnectorForElement(getConnection(), getWidget(), | |||
element); | |||
} | |||
/** | |||
* Returns the deepest nested child component which contains "element". The | |||
* child component is also returned if "element" is part of its caption. | |||
* | |||
* @param element | |||
* An element that is a nested sub element of the root element in | |||
* this layout | |||
* @return The Paintable which the element is a part of. Null if the element | |||
* belongs to the layout and not to a child. | |||
* | |||
* @since 7.2 | |||
*/ | |||
protected ComponentConnector getConnectorForElement(Element element) { | |||
return getConnectorForElement(DOM.asOld(element)); | |||
} | |||
/* | |||
* (non-Javadoc) | |||
* |
@@ -19,6 +19,7 @@ package com.vaadin.client.ui.aria; | |||
import com.google.gwt.aria.client.Id; | |||
import com.google.gwt.aria.client.InvalidValue; | |||
import com.google.gwt.aria.client.Roles; | |||
import com.google.gwt.dom.client.Element; | |||
import com.google.gwt.user.client.DOM; | |||
import com.google.gwt.user.client.ui.Widget; | |||
@@ -37,8 +38,7 @@ public class AriaHelper { | |||
* @param captionElements | |||
* Element with of caption to bind | |||
*/ | |||
public static void bindCaption(Widget widget, | |||
com.google.gwt.user.client.Element captionElement) { | |||
public static void bindCaption(Widget widget, Element captionElement) { | |||
assert widget != null : "Valid Widget required"; | |||
if (widget instanceof HandlesAriaCaption) { | |||
@@ -47,7 +47,8 @@ public class AriaHelper { | |||
((HandlesAriaCaption) widget).bindAriaCaption(null); | |||
} else { | |||
ensureHasId(captionElement); | |||
((HandlesAriaCaption) widget).bindAriaCaption(captionElement); | |||
((HandlesAriaCaption) widget).bindAriaCaption(DOM | |||
.asOld(captionElement)); | |||
} | |||
} else if (captionElement != null) { | |||
// Handle the default case | |||
@@ -102,8 +103,7 @@ public class AriaHelper { | |||
* @param required | |||
* boolean, true when the element is required | |||
*/ | |||
public static void handleInputRequired( | |||
com.google.gwt.user.client.Element element, boolean required) { | |||
public static void handleInputRequired(Element element, boolean required) { | |||
if (required) { | |||
Roles.getTextboxRole().setAriaRequiredProperty(element, required); | |||
} else { | |||
@@ -139,8 +139,7 @@ public class AriaHelper { | |||
* @param invalid | |||
* boolean, true when the element input has an error | |||
*/ | |||
public static void handleInputInvalid( | |||
com.google.gwt.user.client.Element element, boolean invalid) { | |||
public static void handleInputInvalid(Element element, boolean invalid) { | |||
if (invalid) { | |||
Roles.getTextboxRole().setAriaInvalidState(element, | |||
InvalidValue.TRUE); | |||
@@ -157,7 +156,7 @@ public class AriaHelper { | |||
* Element to check | |||
* @return String with the id of the element | |||
*/ | |||
public static String ensureHasId(com.google.gwt.user.client.Element element) { | |||
public static String ensureHasId(Element element) { | |||
assert element != null : "Valid Element required"; | |||
String id = element.getId(); | |||
@@ -179,8 +178,8 @@ public class AriaHelper { | |||
* @param boolean assistiveOnly true when element should only be visible for | |||
* assistive devices, false to make the element visible for all | |||
*/ | |||
public static void setVisibleForAssistiveDevicesOnly( | |||
com.google.gwt.user.client.Element element, boolean assistiveOnly) { | |||
public static void setVisibleForAssistiveDevicesOnly(Element element, | |||
boolean assistiveOnly) { | |||
if (assistiveOnly) { | |||
element.addClassName(ASSISTIVE_DEVICE_ONLY_STYLE); | |||
} else { |
@@ -24,6 +24,7 @@ import java.util.Iterator; | |||
import java.util.List; | |||
import com.google.gwt.core.shared.GWT; | |||
import com.google.gwt.dom.client.Element; | |||
import com.google.gwt.dom.client.NativeEvent; | |||
import com.google.gwt.event.dom.client.ContextMenuEvent; | |||
import com.google.gwt.i18n.client.DateTimeFormat; | |||
@@ -285,8 +286,7 @@ public class CalendarConnector extends AbstractComponentConnector implements | |||
*/ | |||
DateCell cell = (DateCell) widget; | |||
int slotIndex = DOM.getChildIndex( | |||
cell.getElement(), | |||
(com.google.gwt.user.client.Element) ne | |||
cell.getElement(), (Element) ne | |||
.getEventTarget().cast()); | |||
DateCellSlot slot = cell.getSlot(slotIndex); | |||
return CalendarConnector.this.getActionsBetween( | |||
@@ -420,8 +420,7 @@ public class CalendarConnector extends AbstractComponentConnector implements | |||
@Override | |||
public TooltipInfo getTooltipInfo(com.google.gwt.dom.client.Element element) { | |||
TooltipInfo tooltipInfo = null; | |||
Widget w = Util.findWidget( | |||
(com.google.gwt.user.client.Element) element, null); | |||
Widget w = Util.findWidget(element, null); | |||
if (w instanceof HasTooltipKey) { | |||
tooltipInfo = GWT.create(TooltipInfo.class); | |||
String title = tooltips.get(((HasTooltipKey) w).getTooltipKey()); |
@@ -342,8 +342,7 @@ public class DateCell extends FocusableComplexPanel implements | |||
} | |||
public int getSlotBorder() { | |||
return Util | |||
.measureVerticalBorder((com.google.gwt.user.client.Element) slotElements[0]); | |||
return Util.measureVerticalBorder(slotElements[0]); | |||
} | |||
private void drawDayEvents(List<DateCellGroup> groups) { | |||
@@ -504,7 +503,7 @@ public class DateCell extends FocusableComplexPanel implements | |||
updatePositionFor(dayEvent, targetDay, calendarEvent); | |||
} | |||
add(dayEvent, (com.google.gwt.user.client.Element) main); | |||
add(dayEvent, main); | |||
} | |||
// date methods are not deprecated in GWT | |||
@@ -561,8 +560,7 @@ public class DateCell extends FocusableComplexPanel implements | |||
} | |||
index++; | |||
} | |||
this.insert(dayEvent, (com.google.gwt.user.client.Element) main, index, | |||
true); | |||
this.insert(dayEvent, main, index, true); | |||
} | |||
public void removeEvent(DateCellDayEvent dayEvent) { | |||
@@ -784,11 +782,28 @@ public class DateCell extends FocusableComplexPanel implements | |||
return today != null; | |||
} | |||
/** | |||
* @deprecated As of 7.2, call or override | |||
* {@link #addEmphasisStyle(Element)} instead | |||
*/ | |||
@Deprecated | |||
public void addEmphasisStyle(com.google.gwt.user.client.Element elementOver) { | |||
String originalStylename = getStyleName(elementOver); | |||
setStyleName(elementOver, originalStylename + DRAGEMPHASISSTYLE); | |||
} | |||
/** | |||
* @since 7.2 | |||
*/ | |||
public void addEmphasisStyle(Element elementOver) { | |||
addEmphasisStyle(DOM.asOld(elementOver)); | |||
} | |||
/** | |||
* @deprecated As of 7.2, call or override | |||
* {@link #removeEmphasisStyle(Element)} instead | |||
*/ | |||
@Deprecated | |||
public void removeEmphasisStyle( | |||
com.google.gwt.user.client.Element elementOver) { | |||
String originalStylename = getStyleName(elementOver); | |||
@@ -798,6 +813,13 @@ public class DateCell extends FocusableComplexPanel implements | |||
- DRAGEMPHASISSTYLE.length())); | |||
} | |||
/** | |||
* @since 7.2 | |||
*/ | |||
public void removeEmphasisStyle(Element elementOver) { | |||
removeEmphasisStyle(DOM.asOld(elementOver)); | |||
} | |||
@Override | |||
public void onContextMenu(ContextMenuEvent event) { | |||
if (weekgrid.getCalendar().getMouseEventListener() != null) { |
@@ -70,8 +70,8 @@ public class DateCellDayEvent extends FocusableHTML implements | |||
private int startXrelative; | |||
private boolean disabled; | |||
private final WeekGrid weekGrid; | |||
private com.google.gwt.user.client.Element topResizeBar; | |||
private com.google.gwt.user.client.Element bottomResizeBar; | |||
private Element topResizeBar; | |||
private Element bottomResizeBar; | |||
private Element clickTarget; | |||
private final Integer eventIndex; | |||
private int slotHeight; |
@@ -15,6 +15,7 @@ | |||
*/ | |||
package com.vaadin.client.ui.calendar.schedule.dd; | |||
import com.google.gwt.dom.client.Element; | |||
import com.google.gwt.user.client.DOM; | |||
import com.vaadin.client.Util; | |||
import com.vaadin.client.ui.calendar.CalendarConnector; | |||
@@ -36,7 +37,7 @@ public class CalendarMonthDropHandler extends CalendarDropHandler { | |||
super(connector); | |||
} | |||
private com.google.gwt.user.client.Element currentTargetElement; | |||
private Element currentTargetElement; | |||
private SimpleDayCell currentTargetDay; | |||
/* | |||
@@ -100,10 +101,9 @@ public class CalendarMonthDropHandler extends CalendarDropHandler { | |||
* The element to check | |||
* @return | |||
*/ | |||
private boolean isLocationValid( | |||
com.google.gwt.user.client.Element elementOver) { | |||
com.google.gwt.user.client.Element monthGridElement = calendarConnector | |||
.getWidget().getMonthGrid().getElement(); | |||
private boolean isLocationValid(Element elementOver) { | |||
Element monthGridElement = calendarConnector.getWidget().getMonthGrid() | |||
.getElement(); | |||
// drops are not allowed in: | |||
// - weekday header |
@@ -15,6 +15,7 @@ | |||
*/ | |||
package com.vaadin.client.ui.calendar.schedule.dd; | |||
import com.google.gwt.dom.client.Element; | |||
import com.google.gwt.user.client.DOM; | |||
import com.vaadin.client.Util; | |||
import com.vaadin.client.ui.calendar.CalendarConnector; | |||
@@ -33,7 +34,7 @@ import com.vaadin.client.ui.dd.VDragEvent; | |||
*/ | |||
public class CalendarWeekDropHandler extends CalendarDropHandler { | |||
private com.google.gwt.user.client.Element currentTargetElement; | |||
private Element currentTargetElement; | |||
private DateCell currentTargetDay; | |||
public CalendarWeekDropHandler(CalendarConnector connector) { | |||
@@ -99,18 +100,16 @@ public class CalendarWeekDropHandler extends CalendarDropHandler { | |||
* The element to check | |||
* @return | |||
*/ | |||
private boolean isLocationValid( | |||
com.google.gwt.user.client.Element elementOver) { | |||
com.google.gwt.user.client.Element weekGridElement = calendarConnector | |||
.getWidget().getWeekGrid().getElement(); | |||
com.google.gwt.user.client.Element timeBarElement = calendarConnector | |||
.getWidget().getWeekGrid().getTimeBar().getElement(); | |||
com.google.gwt.user.client.Element todayBarElement = null; | |||
private boolean isLocationValid(Element elementOver) { | |||
Element weekGridElement = calendarConnector.getWidget().getWeekGrid() | |||
.getElement(); | |||
Element timeBarElement = calendarConnector.getWidget().getWeekGrid() | |||
.getTimeBar().getElement(); | |||
Element todayBarElement = null; | |||
if (calendarConnector.getWidget().getWeekGrid().hasToday()) { | |||
todayBarElement = (com.google.gwt.user.client.Element) calendarConnector | |||
.getWidget().getWeekGrid().getDateCellOfToday() | |||
.getTodaybarElement(); | |||
todayBarElement = calendarConnector.getWidget().getWeekGrid() | |||
.getDateCellOfToday().getTodaybarElement(); | |||
} | |||
// drops are not allowed in: |
@@ -15,6 +15,7 @@ | |||
*/ | |||
package com.vaadin.client.ui.colorpicker; | |||
import com.google.gwt.dom.client.Element; | |||
import com.google.gwt.event.dom.client.ClickEvent; | |||
import com.google.gwt.event.dom.client.ClickHandler; | |||
import com.google.gwt.event.dom.client.HasClickHandlers; | |||
@@ -93,10 +94,9 @@ public class VColorPickerGrid extends AbsolutePanel implements ClickHandler, | |||
if (changedColor.length == changedX.length | |||
&& changedX.length == changedY.length) { | |||
for (int c = 0; c < changedColor.length; c++) { | |||
com.google.gwt.user.client.Element element = grid | |||
.getCellFormatter().getElement( | |||
Integer.parseInt(changedX[c]), | |||
Integer.parseInt(changedY[c])); | |||
Element element = grid.getCellFormatter().getElement( | |||
Integer.parseInt(changedX[c]), | |||
Integer.parseInt(changedY[c])); | |||
element.getStyle().setProperty("background", | |||
changedColor[c]); | |||
} |
@@ -15,6 +15,7 @@ | |||
*/ | |||
package com.vaadin.client.ui.dd; | |||
import com.google.gwt.dom.client.Element; | |||
import com.google.gwt.dom.client.NativeEvent; | |||
import com.google.gwt.user.client.Window; | |||
import com.vaadin.client.Util; | |||
@@ -23,25 +24,22 @@ import com.vaadin.shared.ui.dd.VerticalDropLocation; | |||
public class DDUtil { | |||
public static VerticalDropLocation getVerticalDropLocation( | |||
com.google.gwt.user.client.Element element, NativeEvent event, | |||
double topBottomRatio) { | |||
public static VerticalDropLocation getVerticalDropLocation(Element element, | |||
NativeEvent event, double topBottomRatio) { | |||
int offsetHeight = element.getOffsetHeight(); | |||
return getVerticalDropLocation(element, offsetHeight, event, | |||
topBottomRatio); | |||
} | |||
public static VerticalDropLocation getVerticalDropLocation( | |||
com.google.gwt.user.client.Element element, int offsetHeight, | |||
NativeEvent event, double topBottomRatio) { | |||
public static VerticalDropLocation getVerticalDropLocation(Element element, | |||
int offsetHeight, NativeEvent event, double topBottomRatio) { | |||
int clientY = Util.getTouchOrMouseClientY(event); | |||
return getVerticalDropLocation(element, offsetHeight, clientY, | |||
topBottomRatio); | |||
} | |||
public static VerticalDropLocation getVerticalDropLocation( | |||
com.google.gwt.user.client.Element element, int offsetHeight, | |||
int clientY, double topBottomRatio) { | |||
public static VerticalDropLocation getVerticalDropLocation(Element element, | |||
int offsetHeight, int clientY, double topBottomRatio) { | |||
// Event coordinates are relative to the viewport, element absolute | |||
// position is relative to the document. Make element position relative | |||
@@ -60,7 +58,7 @@ public class DDUtil { | |||
} | |||
public static HorizontalDropLocation getHorizontalDropLocation( | |||
com.google.gwt.user.client.Element element, NativeEvent event, | |||
Element element, NativeEvent event, | |||
double leftRightRatio) { | |||
int clientX = Util.getTouchOrMouseClientX(event); | |||
@@ -144,13 +144,11 @@ public class VDragAndDropManager { | |||
} | |||
if (currentDropHandler != null) { | |||
currentDrag | |||
.setElementOver((com.google.gwt.user.client.Element) targetElement); | |||
currentDrag.setElementOver(targetElement); | |||
currentDropHandler.dragEnter(currentDrag); | |||
} | |||
} else if (findDragTarget != null) { | |||
currentDrag | |||
.setElementOver((com.google.gwt.user.client.Element) targetElement); | |||
currentDrag.setElementOver(targetElement); | |||
currentDropHandler.dragOver(currentDrag); | |||
} | |||
// prevent text selection on IE | |||
@@ -162,8 +160,7 @@ public class VDragAndDropManager { | |||
// ApplicationConnection.getConsole().log( | |||
// "Target just modified on " | |||
// + event.getType()); | |||
currentDrag | |||
.setElementOver((com.google.gwt.user.client.Element) targetElement); | |||
currentDrag.setElementOver(targetElement); | |||
break; | |||
} | |||
@@ -191,8 +188,7 @@ public class VDragAndDropManager { | |||
// ApplicationConnection.getConsole().log( | |||
// "DropHandler now" | |||
// + currentDropHandler.getPaintable()); | |||
currentDrag | |||
.setElementOver((com.google.gwt.user.client.Element) targetElement); | |||
currentDrag.setElementOver(targetElement); | |||
target.dragEnter(currentDrag); | |||
} else if (target == null && currentDropHandler != null) { | |||
// ApplicationConnection.getConsole().log("Invalid state!?"); | |||
@@ -223,8 +219,7 @@ public class VDragAndDropManager { | |||
case Event.ONMOUSEMOVE: | |||
case Event.ONTOUCHMOVE: | |||
if (currentDropHandler != null) { | |||
currentDrag | |||
.setElementOver((com.google.gwt.user.client.Element) targetElement); | |||
currentDrag.setElementOver(targetElement); | |||
currentDropHandler.dragOver(currentDrag); | |||
} | |||
nativeEvent.preventDefault(); | |||
@@ -473,8 +468,7 @@ public class VDragAndDropManager { | |||
*/ | |||
private VDropHandler findDragTarget(Element element) { | |||
try { | |||
Widget w = Util.findWidget( | |||
(com.google.gwt.user.client.Element) element, null); | |||
Widget w = Util.findWidget(element, null); | |||
if (w == null) { | |||
return null; | |||
} |
@@ -19,11 +19,13 @@ import java.util.HashMap; | |||
import java.util.Map; | |||
import com.google.gwt.dom.client.Document; | |||
import com.google.gwt.dom.client.Element; | |||
import com.google.gwt.dom.client.NativeEvent; | |||
import com.google.gwt.dom.client.Style.Unit; | |||
import com.google.gwt.dom.client.TableElement; | |||
import com.google.gwt.dom.client.TableSectionElement; | |||
import com.google.gwt.event.dom.client.MouseOverEvent; | |||
import com.google.gwt.user.client.DOM; | |||
import com.vaadin.client.BrowserInfo; | |||
import com.vaadin.client.Util; | |||
@@ -49,7 +51,7 @@ public class VDragEvent { | |||
private HashMap<String, Object> dropDetails = new HashMap<String, Object>(); | |||
private com.google.gwt.user.client.Element elementOver; | |||
private Element elementOver; | |||
VDragEvent(VTransferable t, NativeEvent startEvent) { | |||
transferable = t; | |||
@@ -95,17 +97,29 @@ public class VDragEvent { | |||
*/ | |||
public com.google.gwt.user.client.Element getElementOver() { | |||
if (elementOver != null) { | |||
return elementOver; | |||
return DOM.asOld(elementOver); | |||
} else if (currentGwtEvent != null) { | |||
return currentGwtEvent.getEventTarget().cast(); | |||
} | |||
return null; | |||
} | |||
/** | |||
* @deprecated As of 7.2, call or override {@link #setElementOver(Element)} | |||
* instead | |||
*/ | |||
@Deprecated | |||
public void setElementOver(com.google.gwt.user.client.Element targetElement) { | |||
elementOver = targetElement; | |||
} | |||
/** | |||
* @since 7.2 | |||
*/ | |||
public void setElementOver(Element targetElement) { | |||
setElementOver(DOM.asOld(targetElement)); | |||
} | |||
/** | |||
* Sets the drag image used for current drag and drop operation. Drag image | |||
* is displayed next to mouse cursor during drag and drop. | |||
@@ -120,11 +134,35 @@ public class VDragEvent { | |||
* to HTML5 DataTransfer | |||
* | |||
* @param node | |||
* @deprecated As of 7.2, call or override {@link #setDragImage(Element)} | |||
* instead | |||
*/ | |||
@Deprecated | |||
public void setDragImage(com.google.gwt.user.client.Element node) { | |||
setDragImage(node, DEFAULT_OFFSET, DEFAULT_OFFSET); | |||
} | |||
/** | |||
* Sets the drag image used for current drag and drop operation. Drag image | |||
* is displayed next to mouse cursor during drag and drop. | |||
* <p> | |||
* The element to be used as drag image will automatically get CSS style | |||
* name "v-drag-element". | |||
* | |||
* TODO decide if this method should be here or in {@link VTransferable} (in | |||
* HTML5 it is in DataTransfer) or {@link VDragAndDropManager} | |||
* | |||
* TODO should be possible to override behavior. Like to proxy the element | |||
* to HTML5 DataTransfer | |||
* | |||
* @param node | |||
* | |||
* @since 7.2 | |||
*/ | |||
public void setDragImage(Element node) { | |||
setDragImage(DOM.asOld(node)); | |||
} | |||
/** | |||
* TODO consider using similar smaller (than map) api as in Transferable | |||
* | |||
@@ -149,12 +187,36 @@ public class VDragEvent { | |||
* the horizontal offset of drag image from mouse cursor | |||
* @param offsetY | |||
* the vertical offset of drag image from mouse cursor | |||
* @deprecated As of 7.2, call or override | |||
* {@link #setDragImage(Element,int,int)} instead | |||
*/ | |||
@Deprecated | |||
public void setDragImage(com.google.gwt.user.client.Element element, | |||
int offsetX, int offsetY) { | |||
element.getStyle().setMarginLeft(offsetX, Unit.PX); | |||
element.getStyle().setMarginTop(offsetY, Unit.PX); | |||
VDragAndDropManager.get().setDragElement(element); | |||
} | |||
/** | |||
* Sets the drag image used for current drag and drop operation. Drag image | |||
* is displayed next to mouse cursor during drag and drop. | |||
* <p> | |||
* The element to be used as drag image will automatically get CSS style | |||
* name "v-drag-element". | |||
* | |||
* @param element | |||
* the dom element to be positioned next to mouse cursor | |||
* @param offsetX | |||
* the horizontal offset of drag image from mouse cursor | |||
* @param offsetY | |||
* the vertical offset of drag image from mouse cursor | |||
* | |||
* @since 7.2 | |||
*/ | |||
public void setDragImage(Element element, int offsetX, int offsetY) { | |||
setDragImage(DOM.asOld(element), offsetX, offsetY); | |||
} | |||
/** | |||
@@ -162,8 +224,7 @@ public class VDragEvent { | |||
* if drag image is not currently set for this drag operation. | |||
*/ | |||
public com.google.gwt.user.client.Element getDragImage() { | |||
return (com.google.gwt.user.client.Element) VDragAndDropManager.get() | |||
.getDragElement(); | |||
return DOM.asOld(VDragAndDropManager.get().getDragElement()); | |||
} | |||
/** | |||
@@ -173,11 +234,13 @@ public class VDragEvent { | |||
* @param alignImageToEvent | |||
* if true, proxy image is aligned to start event, else next to | |||
* mouse cursor | |||
* @deprecated As of 7.2, call or override | |||
* {@link #createDragImage(Element,boolean)} instead | |||
*/ | |||
@Deprecated | |||
public void createDragImage(com.google.gwt.user.client.Element element, | |||
boolean alignImageToEvent) { | |||
com.google.gwt.user.client.Element cloneNode = (com.google.gwt.user.client.Element) element | |||
.cloneNode(true); | |||
Element cloneNode = (Element) element.cloneNode(true); | |||
if (BrowserInfo.get().isIE()) { | |||
if (cloneNode.getTagName().toLowerCase().equals("tr")) { | |||
TableElement table = Document.get().createTableElement(); | |||
@@ -201,4 +264,17 @@ public class VDragEvent { | |||
} | |||
/** | |||
* Automatically tries to create a proxy image from given element. | |||
* | |||
* @param element | |||
* @param alignImageToEvent | |||
* if true, proxy image is aligned to start event, else next to | |||
* mouse cursor | |||
* @since 7.2 | |||
*/ | |||
public void createDragImage(Element element, boolean alignImageToEvent) { | |||
createDragImage(DOM.asOld(element), alignImageToEvent); | |||
} | |||
} |
@@ -19,6 +19,7 @@ package com.vaadin.client.ui.embedded; | |||
import java.util.Map; | |||
import com.google.gwt.dom.client.Document; | |||
import com.google.gwt.dom.client.Element; | |||
import com.google.gwt.dom.client.NativeEvent; | |||
import com.google.gwt.dom.client.Node; | |||
import com.google.gwt.dom.client.NodeList; | |||
@@ -77,13 +78,13 @@ public class EmbeddedConnector extends AbstractComponentConnector implements | |||
getWidget().type = uidl.getStringAttribute("type"); | |||
if (getWidget().type.equals("image")) { | |||
getWidget().addStyleName(VEmbedded.CLASSNAME + "-image"); | |||
com.google.gwt.user.client.Element el = null; | |||
Element el = null; | |||
boolean created = false; | |||
NodeList<Node> nodes = getWidget().getElement().getChildNodes(); | |||
if (nodes != null && nodes.getLength() == 1) { | |||
Node n = nodes.getItem(0); | |||
if (n.getNodeType() == Node.ELEMENT_NODE) { | |||
com.google.gwt.user.client.Element e = (com.google.gwt.user.client.Element) n; | |||
Element e = (Element) n; | |||
if (e.getTagName().equals("IMG")) { | |||
el = e; | |||
} |
@@ -114,18 +114,14 @@ public class FormLayoutConnector extends AbstractLayoutConnector { | |||
TooltipInfo info = null; | |||
if (element != getWidget().getElement()) { | |||
Object node = Util.findWidget( | |||
(com.google.gwt.user.client.Element) element, | |||
VFormLayout.Caption.class); | |||
Object node = Util.findWidget(element, VFormLayout.Caption.class); | |||
if (node != null) { | |||
VFormLayout.Caption caption = (VFormLayout.Caption) node; | |||
info = caption.getOwner().getTooltipInfo(element); | |||
} else { | |||
node = Util.findWidget( | |||
(com.google.gwt.user.client.Element) element, | |||
VFormLayout.ErrorFlag.class); | |||
node = Util.findWidget(element, VFormLayout.ErrorFlag.class); | |||
if (node != null) { | |||
VFormLayout.ErrorFlag flag = (VFormLayout.ErrorFlag) node; |
@@ -16,6 +16,7 @@ | |||
package com.vaadin.client.ui.layout; | |||
import com.google.gwt.dom.client.Document; | |||
import com.google.gwt.dom.client.Element; | |||
import com.google.gwt.dom.client.Style; | |||
import com.google.gwt.dom.client.Style.Position; | |||
import com.google.gwt.dom.client.Style.Unit; | |||
@@ -26,8 +27,7 @@ import com.vaadin.shared.ui.AlignmentInfo; | |||
public abstract class VLayoutSlot { | |||
private final com.google.gwt.user.client.Element wrapper = Document.get() | |||
.createDivElement().cast(); | |||
private final Element wrapper = Document.get().createDivElement(); | |||
private AlignmentInfo alignment; | |||
private VCaption caption; | |||
@@ -289,7 +289,7 @@ public abstract class VLayoutSlot { | |||
} | |||
public com.google.gwt.user.client.Element getWrapperElement() { | |||
return wrapper; | |||
return DOM.asOld(wrapper); | |||
} | |||
public void setExpandRatio(double expandRatio) { |
@@ -37,6 +37,7 @@ import java.util.ArrayList; | |||
import java.util.List; | |||
import com.google.gwt.core.client.Scheduler; | |||
import com.google.gwt.dom.client.Element; | |||
import com.google.gwt.user.client.Command; | |||
import com.google.gwt.user.client.DOM; | |||
import com.google.gwt.user.client.Event; | |||
@@ -72,7 +73,7 @@ import com.vaadin.client.ui.VOverlay; | |||
@Deprecated | |||
public class MenuBar extends Widget implements PopupListener { | |||
private final com.google.gwt.user.client.Element body; | |||
private final Element body; | |||
private final ArrayList<MenuItem> items = new ArrayList<MenuItem>(); | |||
private MenuBar parentMenu; | |||
private PopupPanel popup; | |||
@@ -97,18 +98,18 @@ public class MenuBar extends Widget implements PopupListener { | |||
public MenuBar(boolean vertical) { | |||
super(); | |||
final com.google.gwt.user.client.Element table = DOM.createTable(); | |||
final Element table = DOM.createTable(); | |||
body = DOM.createTBody(); | |||
DOM.appendChild(table, body); | |||
if (!vertical) { | |||
final com.google.gwt.user.client.Element tr = DOM.createTR(); | |||
final Element tr = DOM.createTR(); | |||
DOM.appendChild(body, tr); | |||
} | |||
this.vertical = vertical; | |||
final com.google.gwt.user.client.Element outer = DOM.createDiv(); | |||
final Element outer = DOM.createDiv(); | |||
DOM.appendChild(outer, table); | |||
setElement(outer); | |||
@@ -123,7 +124,7 @@ public class MenuBar extends Widget implements PopupListener { | |||
* the item to be added | |||
*/ | |||
public void addItem(MenuItem item) { | |||
com.google.gwt.user.client.Element tr; | |||
Element tr; | |||
if (vertical) { | |||
tr = DOM.createTR(); | |||
DOM.appendChild(body, tr); | |||
@@ -210,7 +211,7 @@ public class MenuBar extends Widget implements PopupListener { | |||
* Removes all menu items from this menu bar. | |||
*/ | |||
public void clearItems() { | |||
final com.google.gwt.user.client.Element container = getItemContainerElement(); | |||
final Element container = getItemContainerElement(); | |||
while (DOM.getChildCount(container) > 0) { | |||
DOM.removeChild(container, DOM.getChild(container, 0)); | |||
} | |||
@@ -283,7 +284,7 @@ public class MenuBar extends Widget implements PopupListener { | |||
return; | |||
} | |||
final com.google.gwt.user.client.Element container = getItemContainerElement(); | |||
final Element container = getItemContainerElement(); | |||
DOM.removeChild(container, DOM.getChild(container, idx)); | |||
items.remove(idx); | |||
} | |||
@@ -410,10 +411,9 @@ public class MenuBar extends Widget implements PopupListener { | |||
// If the event target is part of the parent menu, suppress | |||
// the | |||
// event altogether. | |||
final com.google.gwt.user.client.Element target = DOM | |||
.eventGetTarget(event); | |||
final com.google.gwt.user.client.Element parentMenuElement = item | |||
.getParentMenu().getElement(); | |||
final Element target = DOM.eventGetTarget(event); | |||
final Element parentMenuElement = item.getParentMenu() | |||
.getElement(); | |||
if (DOM.isOrHasChild(parentMenuElement, target)) { | |||
return false; | |||
} | |||
@@ -491,7 +491,7 @@ public class MenuBar extends Widget implements PopupListener { | |||
} | |||
} | |||
private MenuItem findItem(com.google.gwt.user.client.Element hItem) { | |||
private MenuItem findItem(Element hItem) { | |||
for (int i = 0; i < items.size(); ++i) { | |||
final MenuItem item = items.get(i); | |||
if (DOM.isOrHasChild(item.getElement(), hItem)) { | |||
@@ -502,7 +502,7 @@ public class MenuBar extends Widget implements PopupListener { | |||
return null; | |||
} | |||
private com.google.gwt.user.client.Element getItemContainerElement() { | |||
private Element getItemContainerElement() { | |||
if (vertical) { | |||
return body; | |||
} else { |
@@ -197,7 +197,7 @@ public class MenuBarConnector extends AbstractComponentConnector implements | |||
if (element != getWidget().getElement()) { | |||
VMenuBar.CustomMenuItem item = getWidget().getMenuItemWithElement( | |||
(com.google.gwt.user.client.Element) element); | |||
element); | |||
if (item != null) { | |||
info = item.getTooltip(); | |||
} |
@@ -17,6 +17,7 @@ package com.vaadin.client.ui.orderedlayout; | |||
import java.util.List; | |||
import com.google.gwt.dom.client.Element; | |||
import com.google.gwt.dom.client.Style.Unit; | |||
import com.google.gwt.user.client.ui.Widget; | |||
import com.vaadin.client.ApplicationConnection; | |||
@@ -98,18 +99,16 @@ public abstract class AbstractOrderedLayoutConnector extends | |||
public void onElementResize(ElementResizeEvent e) { | |||
// Get all needed element references | |||
com.google.gwt.user.client.Element captionElement = (com.google.gwt.user.client.Element) e | |||
.getElement().cast(); | |||
Element captionElement = e.getElement(); | |||
// Caption position determines if the widget element is the first or | |||
// last child inside the caption wrap | |||
CaptionPosition pos = getWidget().getCaptionPositionFromElement( | |||
(com.google.gwt.user.client.Element) captionElement | |||
.getParentElement().cast()); | |||
captionElement.getParentElement()); | |||
// The default is the last child | |||
com.google.gwt.user.client.Element widgetElement = captionElement | |||
.getParentElement().getLastChild().cast(); | |||
Element widgetElement = captionElement.getParentElement() | |||
.getLastChild().cast(); | |||
// ...but if caption position is bottom or right, the widget is the | |||
// first child | |||
@@ -375,8 +374,7 @@ public abstract class AbstractOrderedLayoutConnector extends | |||
@Override | |||
public TooltipInfo getTooltipInfo(com.google.gwt.dom.client.Element element) { | |||
if (element != getWidget().getElement()) { | |||
Slot slot = Util.findWidget( | |||
(com.google.gwt.user.client.Element) element, Slot.class); | |||
Slot slot = Util.findWidget(element, Slot.class); | |||
if (slot != null && slot.getCaptionElement() != null | |||
&& slot.getParent() == getWidget() | |||
&& slot.getCaptionElement().isOrHasChild(element)) { | |||
@@ -616,8 +614,7 @@ public abstract class AbstractOrderedLayoutConnector extends | |||
for (ComponentConnector child : getChildComponents()) { | |||
Widget childWidget = child.getWidget(); | |||
Slot slot = getWidget().getSlot(childWidget); | |||
com.google.gwt.user.client.Element captionElement = slot | |||
.getCaptionElement(); | |||
Element captionElement = slot.getCaptionElement(); | |||
CaptionPosition captionPosition = slot.getCaptionPosition(); | |||
int pixelHeight = layoutManager.getOuterHeight(childWidget |
@@ -21,6 +21,7 @@ import java.util.List; | |||
import com.google.gwt.aria.client.Roles; | |||
import com.google.gwt.core.client.GWT; | |||
import com.google.gwt.dom.client.Document; | |||
import com.google.gwt.dom.client.Element; | |||
import com.google.gwt.user.client.DOM; | |||
import com.google.gwt.user.client.Event; | |||
import com.google.gwt.user.client.Timer; | |||
@@ -48,13 +49,13 @@ public final class Slot extends SimplePanel { | |||
public static final String SLOT_CLASSNAME = "v-slot"; | |||
private com.google.gwt.user.client.Element spacer; | |||
private com.google.gwt.user.client.Element captionWrap; | |||
private com.google.gwt.user.client.Element caption; | |||
private com.google.gwt.user.client.Element captionText; | |||
private Element spacer; | |||
private Element captionWrap; | |||
private Element caption; | |||
private Element captionText; | |||
private Icon icon; | |||
private com.google.gwt.user.client.Element errorIcon; | |||
private com.google.gwt.user.client.Element requiredIcon; | |||
private Element errorIcon; | |||
private Element requiredIcon; | |||
private ElementResizeListener captionResizeListener; | |||
@@ -71,7 +72,7 @@ public final class Slot extends SimplePanel { | |||
@Override | |||
public void onElementResize(ElementResizeEvent e) { | |||
com.google.gwt.user.client.Element caption = getCaptionElement(); | |||
Element caption = getCaptionElement(); | |||
if (caption != null) { | |||
Util.forceIE8Redraw(caption); | |||
} | |||
@@ -332,7 +333,7 @@ public final class Slot extends SimplePanel { | |||
* @return | |||
*/ | |||
public com.google.gwt.user.client.Element getSpacingElement() { | |||
return spacer; | |||
return DOM.asOld(spacer); | |||
} | |||
/** | |||
@@ -464,8 +465,7 @@ public final class Slot extends SimplePanel { | |||
// Caption wrappers | |||
Widget widget = getWidget(); | |||
final com.google.gwt.user.client.Element focusedElement = Util | |||
.getFocusedElement(); | |||
final Element focusedElement = Util.getFocusedElement(); | |||
// By default focus will not be lost | |||
boolean focusLost = false; | |||
if (captionText != null || icon != null || error != null || required) { | |||
@@ -581,8 +581,7 @@ public final class Slot extends SimplePanel { | |||
if (focusLost) { | |||
// Find out what element is currently focused. | |||
com.google.gwt.user.client.Element currentFocus = Util | |||
.getFocusedElement(); | |||
Element currentFocus = Util.getFocusedElement(); | |||
if (currentFocus != null | |||
&& currentFocus.equals(Document.get().getBody())) { | |||
// Focus has moved to BodyElement and should be moved back to | |||
@@ -631,7 +630,7 @@ public final class Slot extends SimplePanel { | |||
* Get the slots caption element | |||
*/ | |||
public com.google.gwt.user.client.Element getCaptionElement() { | |||
return caption; | |||
return DOM.asOld(caption); | |||
} | |||
private boolean relativeWidth = false; | |||
@@ -730,7 +729,7 @@ public final class Slot extends SimplePanel { | |||
if (captionWrap == null) { | |||
return getElement(); | |||
} else { | |||
return captionWrap; | |||
return DOM.asOld(captionWrap); | |||
} | |||
} | |||
@@ -18,6 +18,7 @@ package com.vaadin.client.ui.orderedlayout; | |||
import java.util.HashMap; | |||
import java.util.Map; | |||
import com.google.gwt.dom.client.Element; | |||
import com.google.gwt.dom.client.Node; | |||
import com.google.gwt.dom.client.Style; | |||
import com.google.gwt.dom.client.Style.Unit; | |||
@@ -48,7 +49,7 @@ public class VAbstractOrderedLayout extends FlowPanel { | |||
private Map<Widget, Slot> widgetToSlot = new HashMap<Widget, Slot>(); | |||
private com.google.gwt.user.client.Element expandWrapper; | |||
private Element expandWrapper; | |||
private LayoutManager layoutManager; | |||
@@ -140,8 +141,12 @@ public class VAbstractOrderedLayout extends FlowPanel { | |||
/** | |||
* {@inheritDoc} | |||
* | |||
* @deprecated As of 7.2, use or override | |||
* {@link #insert(Widget, Element, int, boolean)} instead. | |||
*/ | |||
@Override | |||
@Deprecated | |||
protected void insert(Widget child, | |||
com.google.gwt.user.client.Element container, int beforeIndex, | |||
boolean domInsert) { | |||
@@ -156,7 +161,8 @@ public class VAbstractOrderedLayout extends FlowPanel { | |||
getChildren().insert(child, beforeIndex); | |||
// Physical attach. | |||
container = expandWrapper != null ? expandWrapper : getElement(); | |||
container = expandWrapper != null ? DOM.asOld(expandWrapper) | |||
: getElement(); | |||
if (domInsert) { | |||
if (spacing) { | |||
if (beforeIndex != 0) { | |||
@@ -183,6 +189,17 @@ public class VAbstractOrderedLayout extends FlowPanel { | |||
adopt(child); | |||
} | |||
/** | |||
* {@inheritDoc} | |||
* | |||
* @since 7.2 | |||
*/ | |||
@Override | |||
protected void insert(Widget child, Element container, int beforeIndex, | |||
boolean domInsert) { | |||
insert(child, DOM.asOld(container), beforeIndex, domInsert); | |||
} | |||
/** | |||
* Remove a slot from the layout | |||
* | |||
@@ -220,7 +237,9 @@ public class VAbstractOrderedLayout extends FlowPanel { | |||
* @param widgetElement | |||
* The element of the widget ( Same as getWidget().getElement() ) | |||
* @return | |||
* @deprecated As of 7.2, call or override {@link #getSlot(Element)} instead | |||
*/ | |||
@Deprecated | |||
public Slot getSlot(com.google.gwt.user.client.Element widgetElement) { | |||
for (Map.Entry<Widget, Slot> entry : widgetToSlot.entrySet()) { | |||
if (entry.getKey().getElement() == widgetElement) { | |||
@@ -230,6 +249,20 @@ public class VAbstractOrderedLayout extends FlowPanel { | |||
return null; | |||
} | |||
/** | |||
* Gets a slot based on the widget element. If no slot is found then null is | |||
* returned. | |||
* | |||
* @param widgetElement | |||
* The element of the widget ( Same as getWidget().getElement() ) | |||
* @return | |||
* | |||
* @since 7.2 | |||
*/ | |||
public Slot getSlot(Element widgetElement) { | |||
return getSlot(DOM.asOld(widgetElement)); | |||
} | |||
/** | |||
* Set the layout manager for the layout | |||
* | |||
@@ -257,7 +290,10 @@ public class VAbstractOrderedLayout extends FlowPanel { | |||
* The wrapping element | |||
* | |||
* @return The caption position | |||
* @deprecated As of 7.2, call or override | |||
* {@link #getCaptionPositionFromElement(Element)} instead | |||
*/ | |||
@Deprecated | |||
public CaptionPosition getCaptionPositionFromElement( | |||
com.google.gwt.user.client.Element captionWrap) { | |||
RegExp captionPositionRegexp = RegExp.compile("v-caption-on-(\\S+)"); | |||
@@ -274,6 +310,21 @@ public class VAbstractOrderedLayout extends FlowPanel { | |||
return captionPosition; | |||
} | |||
/** | |||
* Deducts the caption position by examining the wrapping element. | |||
* <p> | |||
* For internal use only. May be removed or replaced in the future. | |||
* | |||
* @param captionWrap | |||
* The wrapping element | |||
* | |||
* @return The caption position | |||
* @since 7.2 | |||
*/ | |||
public CaptionPosition getCaptionPositionFromElement(Element captionWrap) { | |||
return getCaptionPositionFromElement(DOM.asOld(captionWrap)); | |||
} | |||
/** | |||
* Update the offset off the caption relative to the slot | |||
* <p> | |||
@@ -281,11 +332,13 @@ public class VAbstractOrderedLayout extends FlowPanel { | |||
* | |||
* @param caption | |||
* The caption element | |||
* @deprecated As of 7.2, call or override | |||
* {@link #updateCaptionOffset(Element)} instead | |||
*/ | |||
@Deprecated | |||
public void updateCaptionOffset(com.google.gwt.user.client.Element caption) { | |||
com.google.gwt.user.client.Element captionWrap = caption | |||
.getParentElement().cast(); | |||
Element captionWrap = caption.getParentElement(); | |||
Style captionWrapStyle = captionWrap.getStyle(); | |||
captionWrapStyle.clearPaddingTop(); | |||
@@ -342,6 +395,19 @@ public class VAbstractOrderedLayout extends FlowPanel { | |||
} | |||
} | |||
/** | |||
* Update the offset off the caption relative to the slot | |||
* <p> | |||
* For internal use only. May be removed or replaced in the future. | |||
* | |||
* @param caption | |||
* The caption element | |||
* @since 7.2 | |||
*/ | |||
public void updateCaptionOffset(Element caption) { | |||
updateCaptionOffset(DOM.asOld(caption)); | |||
} | |||
/** | |||
* Set the margin of the layout | |||
* | |||
@@ -415,7 +481,7 @@ public class VAbstractOrderedLayout extends FlowPanel { | |||
// Give each expanded child its own share | |||
for (Slot slot : widgetToSlot.values()) { | |||
com.google.gwt.user.client.Element slotElement = slot.getElement(); | |||
Element slotElement = slot.getElement(); | |||
slotElement.removeAttribute("aria-hidden"); | |||
Style slotStyle = slotElement.getStyle(); | |||
@@ -483,8 +549,7 @@ public class VAbstractOrderedLayout extends FlowPanel { | |||
lastExpandSize = -1; | |||
while (expandWrapper.getChildCount() > 0) { | |||
com.google.gwt.user.client.Element el = expandWrapper.getChild( | |||
0).cast(); | |||
Element el = expandWrapper.getChild(0).cast(); | |||
getElement().appendChild(el); | |||
if (vertical) { | |||
el.getStyle().clearHeight(); |
@@ -18,11 +18,13 @@ package com.vaadin.client.ui.splitpanel; | |||
import java.util.LinkedList; | |||
import java.util.List; | |||
import com.google.gwt.dom.client.Element; | |||
import com.google.gwt.dom.client.NativeEvent; | |||
import com.google.gwt.event.dom.client.DomEvent; | |||
import com.google.gwt.event.dom.client.DomEvent.Type; | |||
import com.google.gwt.event.shared.EventHandler; | |||
import com.google.gwt.event.shared.HandlerRegistration; | |||
import com.google.gwt.user.client.DOM; | |||
import com.google.gwt.user.client.Event; | |||
import com.google.gwt.user.client.ui.Widget; | |||
import com.vaadin.client.ComponentConnector; | |||
@@ -96,8 +98,7 @@ public abstract class AbstractSplitPanelConnector extends | |||
@Override | |||
protected boolean shouldFireEvent(DomEvent<?> event) { | |||
com.google.gwt.user.client.Element target = event.getNativeEvent() | |||
.getEventTarget().cast(); | |||
Element target = event.getNativeEvent().getEventTarget().cast(); | |||
if (!getWidget().splitter.isOrHasChild(target)) { | |||
return false; | |||
} | |||
@@ -107,7 +108,7 @@ public abstract class AbstractSplitPanelConnector extends | |||
@Override | |||
protected com.google.gwt.user.client.Element getRelativeToElement() { | |||
return getWidget().splitter; | |||
return DOM.asOld(getWidget().splitter); | |||
} | |||
@Override |
@@ -396,9 +396,7 @@ public class TableConnector extends AbstractHasComponentsConnector implements | |||
TooltipInfo info = null; | |||
if (element != getWidget().getElement()) { | |||
Object node = Util.findWidget( | |||
(com.google.gwt.user.client.Element) element, | |||
VScrollTableRow.class); | |||
Object node = Util.findWidget(element, VScrollTableRow.class); | |||
if (node != null) { | |||
VScrollTableRow row = (VScrollTableRow) node; |
@@ -119,9 +119,7 @@ public class TabsheetConnector extends TabsheetBaseConnector implements | |||
// Find a tooltip for the tab, if the element is a tab | |||
if (element != getWidget().getElement()) { | |||
Object node = Util.findWidget( | |||
(com.google.gwt.user.client.Element) element, | |||
VTabsheet.TabCaption.class); | |||
Object node = Util.findWidget(element, VTabsheet.TabCaption.class); | |||
if (node != null) { | |||
VTabsheet.TabCaption caption = (VTabsheet.TabCaption) node; |
@@ -332,9 +332,7 @@ public class TreeConnector extends AbstractComponentConnector implements | |||
// Try to find a tooltip for a node | |||
if (element != getWidget().getElement()) { | |||
Object node = Util.findWidget( | |||
(com.google.gwt.user.client.Element) element, | |||
TreeNode.class); | |||
Object node = Util.findWidget(element, TreeNode.class); | |||
if (node != null) { | |||
TreeNode tnode = (TreeNode) node; |
@@ -123,9 +123,7 @@ public class TreeTableConnector extends TableConnector { | |||
TooltipInfo info = null; | |||
if (element != getWidget().getElement()) { | |||
Object node = Util.findWidget( | |||
(com.google.gwt.user.client.Element) element, | |||
VTreeTableRow.class); | |||
Object node = Util.findWidget(element, VTreeTableRow.class); | |||
if (node != null) { | |||
VTreeTableRow row = (VTreeTableRow) node; |
@@ -22,6 +22,7 @@ import java.util.List; | |||
import com.google.gwt.core.client.Scheduler; | |||
import com.google.gwt.core.client.Scheduler.ScheduledCommand; | |||
import com.google.gwt.dom.client.Document; | |||
import com.google.gwt.dom.client.Element; | |||
import com.google.gwt.dom.client.HeadElement; | |||
import com.google.gwt.dom.client.LinkElement; | |||
import com.google.gwt.dom.client.NativeEvent; | |||
@@ -169,8 +170,7 @@ public class UIConnector extends AbstractSingleComponentContainerConnector | |||
@Override | |||
public void onScroll(ScrollEvent event) { | |||
com.google.gwt.user.client.Element element = getWidget() | |||
.getElement(); | |||
Element element = getWidget().getElement(); | |||
int newScrollTop = element.getScrollTop(); | |||
int newScrollLeft = element.getScrollLeft(); | |||
if (newScrollTop != lastSentScrollTop |
@@ -229,7 +229,7 @@ public class WindowConnector extends AbstractSingleComponentContainerConnector | |||
Style childStyle = layoutElement.getStyle(); | |||
// IE8 needs some hackery to measure its content correctly | |||
Util.forceIE8Redraw((com.google.gwt.user.client.Element) layoutElement); | |||
Util.forceIE8Redraw(layoutElement); | |||
if (content.isRelativeHeight() && !BrowserInfo.get().isIE9()) { | |||
childStyle.setPosition(Position.ABSOLUTE); |
@@ -16,6 +16,7 @@ | |||
package com.vaadin.tests.minitutorials.v7a2; | |||
import com.google.gwt.dom.client.Element; | |||
import com.vaadin.client.ui.AbstractComponentConnector; | |||
import com.vaadin.client.ui.SimpleManagedLayout; | |||
import com.vaadin.client.ui.layout.ElementResizeEvent; | |||
@@ -49,8 +50,7 @@ public class MyPickerConnector extends AbstractComponentConnector implements | |||
@Override | |||
protected void init() { | |||
com.google.gwt.user.client.Element button = getWidget().getWidget(1) | |||
.getElement(); | |||
Element button = getWidget().getWidget(1).getElement(); | |||
getLayoutManager().addElementResizeListener(button, listener); | |||
getLayoutManager().registerDependency(this, button); | |||
@@ -58,8 +58,7 @@ public class MyPickerConnector extends AbstractComponentConnector implements | |||
@Override | |||
public void onUnregister() { | |||
com.google.gwt.user.client.Element button = getWidget().getWidget(1) | |||
.getElement(); | |||
Element button = getWidget().getWidget(1).getElement(); | |||
getLayoutManager().removeElementResizeListener(button, listener); | |||
getLayoutManager().unregisterDependency(this, button); | |||
@@ -67,8 +66,7 @@ public class MyPickerConnector extends AbstractComponentConnector implements | |||
@Override | |||
public void layout() { | |||
com.google.gwt.user.client.Element button = getWidget().getWidget(1) | |||
.getElement(); | |||
Element button = getWidget().getWidget(1).getElement(); | |||
int buttonWidth = getLayoutManager().getOuterWidth(button); | |||
buttonWidth -= getLayoutManager().getMarginRight(button); | |||
getWidget().adjustButtonSpace(buttonWidth); |