Java Code Examples for com.google.gwt.dom.client.Style#setPropertyPx()

The following examples show how to use com.google.gwt.dom.client.Style#setPropertyPx() . 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: GalleryTreeViewImpl.java    From dashbuilder with Apache License 2.0 5 votes vote down vote up
@PostConstruct
private void initUI() {
    initWidget(mainPanel);

    Tree tree = initNavigationTree();
    tree.setWidth("150px");
    Style leftStyle = mainPanel.getElement().getStyle();
    leftStyle.setPropertyPx("margin", 5);
    mainPanel.add(tree);
}
 
Example 2
Source File: Image.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 5 votes vote down vote up
private void resetSize() {
	Style imgStyle = this.imgElement.getStyle();
	imgStyle.clearProperty(Image.PROP_WIDTH);
	imgStyle.clearProperty(Image.PROP_HEIGHT);
	imgStyle.clearProperty(Image.PROP_MAX_WIDTH);
	imgStyle.clearProperty(Image.PROP_MAX_HEIGHT);

	if (this.widthPx > 0) {
		imgStyle.setPropertyPx(this.keepPropertions ? Image.PROP_MAX_WIDTH : Image.PROP_WIDTH, this.widthPx);
	}
	if (this.heightPx > 0) {
		imgStyle.setPropertyPx(this.keepPropertions ? Image.PROP_MAX_HEIGHT : Image.PROP_HEIGHT, this.heightPx);
	}
}
 
Example 3
Source File: Geometry.java    From gwt-traction with Apache License 2.0 4 votes vote down vote up
/**
 * Sets the position of a UIObject
 */
public static final void setPosition(UIObject o, Rect pos) {
    Style style = o.getElement().getStyle();
    style.setPropertyPx("left", pos.x);
    style.setPropertyPx("top", pos.y);
}