當前位置: 首頁>>代碼示例>>Java>>正文


Java AbsolutePanel.setWidgetPosition方法代碼示例

本文整理匯總了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);
	}
}
 
開發者ID:luox12,項目名稱:onecmdb,代碼行數:25,代碼來源:DragControl.java

示例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);
		}
	}
 
開發者ID:Rise-Vision,項目名稱:rva,代碼行數:17,代碼來源:PresentationLayoutWidget.java

示例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 + ")");
//      }
//      }
//    }
  }
 
開發者ID:robertwaszkowski,項目名稱:gwt-connectors,代碼行數:23,代碼來源:WidgetUtils.java

示例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);
}
 
開發者ID:luox12,項目名稱:onecmdb,代碼行數:16,代碼來源:OneCMDBApplication.java

示例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);
	}
}
 
開發者ID:Rise-Vision,項目名稱:rva,代碼行數:12,代碼來源:WindowPanel.java


注:本文中的com.google.gwt.user.client.ui.AbsolutePanel.setWidgetPosition方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。