本文整理匯總了Java中com.google.gwt.user.client.ui.AbsolutePanel.setWidgetPosition方法的典型用法代碼示例。如果您正苦於以下問題:Java AbsolutePanel.setWidgetPosition方法的具體用法?Java AbsolutePanel.setWidgetPosition怎麽用?Java AbsolutePanel.setWidgetPosition使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.google.gwt.user.client.ui.AbsolutePanel
的用法示例。
在下文中一共展示了AbsolutePanel.setWidgetPosition方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onMouseMove
import com.google.gwt.user.client.ui.AbsolutePanel; //導入方法依賴的package包/類
public void onMouseMove(Widget source, int x, int y) {
if (dragging) {
// System.out.println("MOUSE MOVE:" + x + "," + y);
AbsolutePanel rootPanel = getAbsoluteWidgetPanel(dragWidget);
int newX = x + dragWidget.getAbsoluteLeft() - xOffset;
int newY = y + dragWidget.getAbsoluteTop() - yOffset;
int rootOffsetY = newY - rootPanel.getAbsoluteTop();
int rootOffsetX = newX-rootPanel.getAbsoluteLeft();
if (rootOffsetX < 0) {
rootOffsetX = 0;
}
if (rootOffsetY < 0) {
rootOffsetY = 0;
}
rootPanel.setWidgetPosition(dragWidget, rootOffsetX, rootOffsetY);
}
}
示例2: setWidgetPixelPosition
import com.google.gwt.user.client.ui.AbsolutePanel; //導入方法依賴的package包/類
private void setWidgetPixelPosition(Widget placeholderWidget, PlaceholderInfo placeholder, int offset) {
// if (placeholderWidget.getParent() != null) {
// DOM.setStyleAttribute(placeholderWidget.getElement(), "position", "absolute");
// DOM.setStyleAttribute(placeholderWidget.getElement(), "left", (placeholder.getLeft() + offset) + placeholder.getLeftUnits());
// DOM.setStyleAttribute(placeholderWidget.getElement(), "top", (placeholder.getTop() + offset) + placeholder.getTopUnits());
// }
int top = getPixelSize(placeholder.getTop(), height, placeholder.getTopUnits());
int left = getPixelSize(placeholder.getLeft(), width, placeholder.getLeftUnits());
if (placeholderWidget.getParent() != null) {
AbsolutePanel parent = (AbsolutePanel) placeholderWidget.getParent();
parent.setWidgetPosition(placeholderWidget, left + offset, top + offset);
}
}
示例3: setWidgetPosition
import com.google.gwt.user.client.ui.AbsolutePanel; //導入方法依賴的package包/類
public static void setWidgetPosition(AbsolutePanel parent, Widget widget, int left, int top) {
if (parent != null) {
parent.setWidgetPosition(widget, left, top);
} else {
LOG.severe("Unable to set widget position, parent is null");
}
// WidgetLocation location = new WidgetLocation(widget, parent);
// if (location.getLeft() != left || location.getTop() != top) {
// parent.setWidgetPosition(widget, left + (left - location.getLeft()), top + (top - location.getTop()));
// location = new WidgetLocation(widget, parent);
// if (location.getLeft() != left || location.getTop() != top) {
// if (location.getLeft() != left) {
// LOG.warning("Moved widget to wrong LEFT location (current: " + location.getLeft() +
// " should be: " + left + ")");
// }
// if (location.getTop() != top) {
// LOG.warning("Moved widget to wrong TOP location (current: " + location.getTop() +
// " should be: " + top + ")");
// }
// }
// }
}
示例4: center
import com.google.gwt.user.client.ui.AbsolutePanel; //導入方法依賴的package包/類
private void center(AbsolutePanel panel, Widget w) {
int left = panel.getAbsoluteLeft();
int top = panel.getAbsoluteTop();
int aHeight = Window.getClientHeight();
int aWidth = Window.getClientWidth();
int wHeight = w.getOffsetHeight();
int wWidth = w.getOffsetWidth();
int centerLeft = left + (aWidth/2) - (wWidth/2);
int centerTop = top + (aHeight/2) - (wHeight/2);
panel.setWidgetPosition(w, centerLeft, centerTop);
}
示例5: moveBy
import com.google.gwt.user.client.ui.AbsolutePanel; //導入方法依賴的package包/類
public void moveBy(int right, int down) {
AbsolutePanel parent = (AbsolutePanel) getParent();
Location location = new WidgetLocation(this, parent);
int left = location.getLeft() + right;
int top = location.getTop() + down;
parent.setWidgetPosition(this, left, top);
if (getPreviewWidget() != null) {
parent.setWidgetPosition(getPreviewWidget(), left + 5, top + 5);
}
}