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

The following are Jave code examples for showing how to use setRight() of the com.google.gwt.dom.client.Style 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: djvu-html5   File: Scrollbar.java   View Source Code Vote up 6 votes
public void setThumb(double center, double width) {
	Style style = getElement().getStyle();
	if (width >= 1) {
		style.setVisibility(Visibility.HIDDEN);
		return;
	} else {
		style.setVisibility(Visibility.VISIBLE);
	}
	if (isHorizontal) {
		style.setLeft(100 * (center - width / 2), Unit.PCT);
		style.setRight(100 * (1 - center - width / 2), Unit.PCT);
	} else {
		style.setTop(100.0 * (center - width / 2), Unit.PCT);
		style.setBottom(100 * (1 - center - width / 2), Unit.PCT);
	}
}
 
Example 2
Project: Wiab.pro   File: DomUtil.java   View Source Code Vote up 5 votes
/**
 * Puts cover element on the covered element.
 * The cover and covered elements have the same position and size.
 * 
 * @param cover the cover element
 * @param covered the covered element
 */
public static void putCover(Element cover, Element covered) {
    Element parent = covered.getParentElement();
    Rect coveredRect = DomUtil.getElementAbsoluteRect(covered);
    Rect parentRect = DomUtil.getElementAbsoluteRect(parent);
    Style coverStyle = cover.getStyle();
    coverStyle.setPosition(Style.Position.ABSOLUTE);      
    coverStyle.setTop(coveredRect.getTop() - parentRect.getTop(), Style.Unit.PX);
    coverStyle.setLeft(coveredRect.getLeft() - parentRect.getLeft(), Style.Unit.PX);
    coverStyle.setRight(parentRect.getRight() - coveredRect.getRight(), Style.Unit.PX);
    coverStyle.setBottom(parentRect.getBottom() - coveredRect.getBottom(), Style.Unit.PX);      
    parent.appendChild(cover);    
}