Java Code Examples for com.google.gwt.user.client.DOM#getElementPropertyInt()

The following examples show how to use com.google.gwt.user.client.DOM#getElementPropertyInt() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DatasetWidget.java    From EasyML with Apache License 2.0 6 votes vote down vote up
@Override
protected void init() {
	clientWidth = DOM.getElementPropertyInt(label.getElement(), "clientHeight");
	clientWidth = DOM.getElementPropertyInt(label.getElement(), "clientHeight");
	clientHeight = DOM.getElementPropertyInt(label.getElement(), "clientHeight");
	offsetWidth = label.getOffsetWidth();
	offsetHeight = label.getOffsetHeight();
	offsetTop = DOM.getElementPropertyInt(label.getElement(), "offsetTop");
	offsetLeft = DOM.getElementPropertyInt(label.getElement(), "offsetLeft");

	boder = (offsetHeight - clientHeight) / 2;

	custom();

	this.setPixelSize((int) offsetWidth + offsetLeft * 2, (int) offsetHeight
			+ offsetTop * 2);
}
 
Example 2
Source File: BaseWidget.java    From EasyML with Apache License 2.0 6 votes vote down vote up
/**
 * Init BaseWidget: clientWidth/Height, offsetWidth/Height,border,
 * Set PixelSize of BaseWidget, and call custom to draw NodeShape shape
 * Must be called after the control is attached, so call the init function in the onAttach function
 */
protected void init() {
	clientWidth = DOM.getElementPropertyInt(label.getElement(), "clientWidth");
	if (clientWidth < 100) {
		label.setWidth("100px");
	}
	clientWidth = DOM.getElementPropertyInt(label.getElement(), "clientWidth");
	clientHeight = DOM
			.getElementPropertyInt(label.getElement(), "clientHeight");
	offsetWidth = label.getOffsetWidth();
	offsetHeight = label.getOffsetHeight();
	offsetTop = DOM.getElementPropertyInt(label.getElement(), "offsetTop");
	offsetLeft = DOM.getElementPropertyInt(label.getElement(), "offsetLeft");

	boder = (offsetHeight - clientHeight) / 2;
	clientLeft = (offsetWidth - clientWidth)/2;

	custom();

	this.setPixelSize((int) offsetWidth + offsetLeft * 2, (int) offsetHeight
			+ offsetTop * 2);
}
 
Example 3
Source File: MiniProgressBar.java    From appinventor-extensions with Apache License 2.0 5 votes vote down vote up
/**
 * Redraw the progress bar when something changes the layout.
 */
public void redraw() {
  if (isAttached()) {
    int width = DOM.getElementPropertyInt(getElement(), "clientWidth");
    int height = DOM.getElementPropertyInt(getElement(), "clientHeight");
    onResize(width, height);
  }
}
 
Example 4
Source File: MiniProgressBar.java    From appinventor-extensions with Apache License 2.0 3 votes vote down vote up
/**
 * This method is called when the dimensions of the parent element change.
 * Subclasses should override this method as needed.
 *
 * Move the text to the center of the progress bar.
 *
 * @param width the new client width of the element
 * @param height the new client height of the element
 */
public void onResize(int width, int height) {
  if (textVisible) {
    int textWidth = DOM.getElementPropertyInt(textElement, "offsetWidth");
    int left = (width / 2) - (textWidth / 2);
    DOM.setStyleAttribute(textElement, "left", left + "px");
  }
}