Browse Source

enhanced docs

svn changeset:11719/svn branch:6.3
tags/6.7.0.beta1
Matti Tahvonen 14 years ago
parent
commit
a74876dc07
1 changed files with 12 additions and 3 deletions
  1. 12
    3
      src/com/vaadin/terminal/gwt/client/Util.java

+ 12
- 3
src/com/vaadin/terminal/gwt/client/Util.java View File

* *
* Returns the topmost element of from given coordinates. * Returns the topmost element of from given coordinates.
* *
* TODO fix crossplat issues clientX vs pageX. See quircksmode
* TODO fix crossplat issues clientX vs pageX. See quircksmode. Not critical
* for vaadin as we scroll div istead of page.
* *
* @param x * @param x
* @param y * @param y


/** /**
* Helper method to find first instance of given Widget type found by * Helper method to find first instance of given Widget type found by
* traversing DOM upwards.
* traversing DOM upwards from given element.
* *
* @param element * @param element
* the element where to start seeking of Widget
* @param class1 * @param class1
* the Widget type to seek for
*/ */
public static <T> T findWidget(Element element, Class class1) {
public static <T> T findWidget(Element element,
Class<? extends Widget> class1) {
if (element != null) { if (element != null) {
/* First seek for the first EventListener (~Widget) from dom */
EventListener eventListener = null; EventListener eventListener = null;
while (eventListener == null && element != null) { while (eventListener == null && element != null) {
eventListener = Event.getEventListener(element); eventListener = Event.getEventListener(element);
} }
} }
if (eventListener != null) { if (eventListener != null) {
/*
* Then find the first widget of type class1 from widget
* hierarchy
*/
Widget w = (Widget) eventListener; Widget w = (Widget) eventListener;
while (w != null) { while (w != null) {
if (class1 == null || w.getClass() == class1) { if (class1 == null || w.getClass() == class1) {

Loading…
Cancel
Save