Java Code Examples for com.google.gwt.user.client.ui.Widget.getElement()

The following are Jave code examples for showing how to use getElement() of the com.google.gwt.user.client.ui.Widget class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: unitimes   File: FlowForm.java   View Source Code Vote up 6 votes
public int getCellForWidget(Widget w) {
	for (Element e = w.getElement(); e != null; e = DOM.getParent(e)) {
		if (e.getPropertyString("tagName").equalsIgnoreCase("span")) {
			if (DOM.getParent(e) == getElement())
				return DOM.getChildIndex(getElement(), e);
		}
		if (e == getElement()) { return -1; }
	}
	return -1;
}
 
Example 2
Project: bootstrap-formgroup   File: VaadinWidgetUtils.java   View Source Code Vote up 6 votes
public static Element getElementByVaadinWidget(Widget widget, VaadinWidgetType widgetType) {
    if (widgetType == null) {
        return widget.getElement();
    }

    switch (widgetType) {
        case TEXTFIELD:
            return widget.getElement();
        case DATEFIELD:
            return ((VAbstractTextualDate) widget).text.getElement();
        case COMBOBOX:
            return ((VComboBox) widget).tb.getElement();
        case CHECKBOXGROUP:
            // returning the outer div for styling purpose
            return widget.getElement();
        case CHECKBOX:
            // returning the outer div for styling purpose
            return widget.getElement();
        case NATIVESELECT:
            return ((VNativeSelect) widget).getListBox().getElement();
        default:
            return widget.getElement();
    }
}
 
Example 3
Project: empiria.player   File: HTML5VideoForcePosterHack.java   View Source Code Vote up 5 votes
private void createPosterImageOnParentElementOnce() {
    if (isPosterCreated) {
        return;
    }

    Widget parent = mediaBase.getParent();
    Element parentElement = parent.getElement();

    if (parentElement != null) {
        AbstractHTML5MediaExecutor executor = mediaExecutorDelegator.getExecutor();
        BaseMediaConfiguration baseMediaConfiguration = executor.getBaseMediaConfiguration();
        createPosterImageLayer(parentElement, baseMediaConfiguration);
        isPosterCreated = true;
    }
}
 
Example 4
Project: unitimes   File: UniTimeTable.java   View Source Code Vote up 5 votes
public int getRowForWidget(Widget w) {
	for (Element td = w.getElement(); td != null; td = DOM.getParent(td)) {
		if (td.getPropertyString("tagName").equalsIgnoreCase("td")) {
			Element tr = DOM.getParent(td);
			Element body = DOM.getParent(tr);
			if (body == getBodyElement())
				return DOM.getChildIndex(body, tr);
		}
		if (td == getBodyElement()) { return -1; }
	}
	return -1;
}
 
Example 5
Project: unitimes   File: SimpleForm.java   View Source Code Vote up 5 votes
public int getRowForWidget(Widget w) {
	for (Element td = w.getElement(); td != null; td = DOM.getParent(td)) {
		if (td.getPropertyString("tagName").equalsIgnoreCase("td")) {
			Element tr = DOM.getParent(td);
			Element body = DOM.getParent(tr);
			if (body == getBodyElement())
				return DOM.getChildIndex(body, tr);
		}
		if (td == getBodyElement()) { return -1; }
	}
	return -1;
}
 
Example 6
Project: appinventor-extensions   File: DragSourceSupport.java   View Source Code Vote up 5 votes
/**
 * Configures the specified drag-widget (that will be returned by
 * {@link DragSource#createDragWidget(int, int)}) so that the cursor's hot spot
 * will appear at the point (x,y) in the widget's coordinate system.
 */
public static void configureDragWidgetToAppearWithCursorAt(Widget w, int x, int y) {
  Element e = w.getElement();
  DOM.setStyleAttribute(e, "position", "absolute");
  DOM.setStyleAttribute(e, "left", -x + "px");
  DOM.setStyleAttribute(e, "top", -y + "px");
}
 
Example 7
Project: appinventor-extensions   File: MockComponentsUtil.java   View Source Code Vote up 5 votes
static String[] clearSizeStyle(Widget w) {
  Element element = w.getElement();
  String widthStyle = DOM.getStyleAttribute(element, "width");
  String heightStyle = DOM.getStyleAttribute(element, "height");
  if (widthStyle != null) {
    DOM.setStyleAttribute(element, "width", null);
  }
  if (heightStyle != null) {
    DOM.setStyleAttribute(element, "height", null);
  }
  return new String[] { widthStyle, heightStyle };
}
 
Example 8
Project: appinventor-extensions   File: MockComponentsUtil.java   View Source Code Vote up 5 votes
static void restoreSizeStyle(Widget w, String[] style) {
  Element element = w.getElement();
  if (style[0] != null) {
    DOM.setStyleAttribute(element, "width", style[0]);
  }
  if (style[1] != null) {
    DOM.setStyleAttribute(element, "height", style[1]);
  }
}
 
Example 9
Project: empiria.player   File: MathJaxGapContainer.java   View Source Code Vote up 4 votes
public Element getMathGapElement(String identifier) {
    Widget gap = mathGaps.get(identifier);
    return gap.getElement();
}
 
Example 10
Project: appinventor-extensions   File: ClonedWidget.java   View Source Code Vote up 4 votes
public ClonedWidget(Widget origWidget) {
  this(origWidget.getElement());
}