本文整理匯總了Java中com.google.gwt.user.client.ui.UIObject.getOffsetWidth方法的典型用法代碼示例。如果您正苦於以下問題:Java UIObject.getOffsetWidth方法的具體用法?Java UIObject.getOffsetWidth怎麽用?Java UIObject.getOffsetWidth使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.google.gwt.user.client.ui.UIObject
的用法示例。
在下文中一共展示了UIObject.getOffsetWidth方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: position
import com.google.gwt.user.client.ui.UIObject; //導入方法依賴的package包/類
private void position(final UIObject relativeObject, int offsetWidth, int offsetHeight) {
int textBoxOffsetWidth = relativeObject.getOffsetWidth();
int offsetWidthDiff = offsetWidth - textBoxOffsetWidth;
int left = relativeObject.getAbsoluteLeft();
if (offsetWidthDiff > 0) {
int windowRight = Window.getClientWidth() + Window.getScrollLeft();
int windowLeft = Window.getScrollLeft();
int distanceToWindowRight = windowRight - left;
int distanceFromWindowLeft = left - windowLeft;
if (distanceToWindowRight < offsetWidth && distanceFromWindowLeft >= offsetWidthDiff) {
left -= offsetWidthDiff;
}
}
int top = relativeObject.getAbsoluteTop();
int windowTop = Window.getScrollTop();
int windowBottom = Window.getScrollTop() + Window.getClientHeight();
int distanceFromWindowTop = top - windowTop;
int distanceToWindowBottom = windowBottom - (top + relativeObject.getOffsetHeight());
if (distanceToWindowBottom < offsetHeight && distanceFromWindowTop >= offsetHeight) {
top -= offsetHeight;
} else {
top += relativeObject.getOffsetHeight();
}
setPopupPosition(left, top);
}
示例2: getElementWidth
import com.google.gwt.user.client.ui.UIObject; //導入方法依賴的package包/類
public static int getElementWidth(UIObject uiObject) {
return uiObject.getOffsetWidth() - getHorizPadding(uiObject) - getHorizBorder(uiObject);
}