List of usage examples for com.google.gwt.user.client.ui Widget getAbsoluteLeft
public int getAbsoluteLeft()
From source file:com.allen_sauer.gwt.dnd.client.util.WidgetArea.java
License:Apache License
public WidgetArea(Widget widget, Widget reference) { setLeft(widget.getAbsoluteLeft()); setTop(widget.getAbsoluteTop());// ww w . j a v a2 s. c o m if (reference != null) { setLeft(getLeft() - reference.getAbsoluteLeft() - DOMUtil.getBorderLeft(reference.getElement())); setTop(getTop() - reference.getAbsoluteTop() - DOMUtil.getBorderTop(reference.getElement())); } setRight(getLeft() + widget.getOffsetWidth()); setBottom(getTop() + widget.getOffsetHeight()); Element elem = widget.getElement().getOffsetParent(); Element p; while (elem != null && (p = elem.getOffsetParent()) != null) { if (!"visible".equals(DOMUtil.getEffectiveStyle(elem, "overflow"))) { int left = elem.getAbsoluteLeft(); if (getLeft() < left) { setLeft(left); } int top = elem.getAbsoluteTop(); if (getTop() < top) { setTop(top); } int bottom = top + elem.getOffsetHeight(); if (getBottom() > bottom) { setBottom(Math.max(getTop(), bottom)); } int right = left + elem.getOffsetWidth(); if (getRight() > right) { setRight(Math.max(getLeft(), right)); } } elem = p; } }
From source file:com.allen_sauer.gwt.dnd.client.util.WidgetLocation.java
License:Apache License
private void internalSetReference(Widget reference) { // this.reference = reference; if (reference == null || reference == RootPanel.get()) { referenceAdjustLeft = 0;/*from ww w . ja v a 2s . c om*/ referenceAdjustTop = 0; } else { referenceAdjustLeft = reference.getAbsoluteLeft() + DOMUtil.getBorderLeft(reference.getElement()); referenceAdjustTop = reference.getAbsoluteTop() + DOMUtil.getBorderTop(reference.getElement()); } }
From source file:com.allen_sauer.gwt.dnd.client.util.WidgetLocation.java
License:Apache License
private void internalSetWidget(Widget widget) { // this.widget = widget; if (widget == null || widget == RootPanel.get()) { widgetLeft = 0;//from www. j a va 2 s . c o m widgetTop = 0; } else { widgetLeft = widget.getAbsoluteLeft() - widget.getElement().getScrollLeft(); widgetTop = widget.getAbsoluteTop() - widget.getElement().getScrollTop(); } }
From source file:com.appkit.interactions.client.dnd.PickupDragController.java
License:Apache License
@Override public void dragStart() { super.dragStart(); lastResetCacheTimeMillis = System.currentTimeMillis(); WidgetLocation currentDraggableLocation = new WidgetLocation(context.draggable, context.boundaryPanel); if (getBehaviorDragProxy()) { movablePanel = newDragProxy(context); context.boundaryPanel.add(movablePanel, currentDraggableLocation.getLeft(), currentDraggableLocation.getTop()); checkGWTIssue1813(movablePanel, context.boundaryPanel); } else {/*from www .j a v a 2s . c om*/ saveSelectedWidgetsLocationAndStyle(); AbsolutePanel container = new AbsolutePanel(); container.getElement().getStyle().setProperty("overflow", "visible"); container.setPixelSize(context.draggable.getOffsetWidth(), context.draggable.getOffsetHeight()); context.boundaryPanel.add(container, currentDraggableLocation.getLeft(), currentDraggableLocation.getTop()); checkGWTIssue1813(container, context.boundaryPanel); int draggableAbsoluteLeft = context.draggable.getAbsoluteLeft(); int draggableAbsoluteTop = context.draggable.getAbsoluteTop(); HashMap<Widget, CoordinateLocation> widgetLocation = new HashMap<Widget, CoordinateLocation>(); for (Widget widget : context.selectedWidgets) { widgetLocation.put(widget, new CoordinateLocation(widget.getAbsoluteLeft(), widget.getAbsoluteTop())); } context.dropController = getIntersectDropController(context.mouseX, context.mouseY); if (context.dropController != null) { context.dropController.onEnter(context); } for (Widget widget : context.selectedWidgets) { Location location = widgetLocation.get(widget); int relativeX = location.getLeft() - draggableAbsoluteLeft; int relativeY = location.getTop() - draggableAbsoluteTop; container.add(widget, relativeX, relativeY); } movablePanel = container; } movablePanel.addStyleName(DragClientBundle.INSTANCE.css().movablePanel()); calcBoundaryOffset(); dropTargetClientWidth = DOMUtil.getClientWidth(boundaryPanel.getElement()); dropTargetClientHeight = DOMUtil.getClientHeight(boundaryPanel.getElement()); }
From source file:com.apress.progwt.client.college.gui.ViewPanel.java
License:Apache License
public void onMouseDown(Widget sender, int x, int y) { // Log.debug("down "+(sender instanceof Island) +" x // "+x+" y "+y +" "+dragging); // Log.debug("mouse downd " + GWT.getTypeName(sender) + " // x " + x + " y " + y + " " // + sender.getAbsoluteLeft() + " " + sender.getAbsoluteTop()); // if (!dragEnabled || sender instanceof FocusPanel) { dragging = true;/* www.ja v a 2s .c om*/ // } dragStartX = x + sender.getAbsoluteLeft(); dragStartY = y + sender.getAbsoluteTop(); // Log.debug("down " + GWT.getTypeName(sender) + "dsx " + // dragStartX + " dsy " // + dragStartY + " x " + x + " y " + y + " " + // sender.getAbsoluteLeft() + " " // + sender.getAbsoluteTop()); unselect(); }
From source file:com.apress.progwt.client.college.gui.ViewPanel.java
License:Apache License
public void onMouseMove(Widget sender, int x, int y) { int lastx = x + sender.getAbsoluteLeft(); int lasty = y + sender.getAbsoluteTop(); clientMouseImpl.setLastXY(lastx, lasty); int dx = dragStartX - x - sender.getAbsoluteLeft(); int dy = dragStartY - y - sender.getAbsoluteTop(); // Log.debug("move "+(sender instanceof Island) +" x // "+x+" y "+y +" "+dragging); if (dragging) { moveByDelta(dx, dy);/*from w w w . j a v a2 s .co m*/ changeCollection.fireChange(this); } }
From source file:com.audata.client.widgets.ClassField.java
License:Open Source License
public void onClick(Widget sender) { int left = sender.getAbsoluteLeft(); int top = sender.getAbsoluteTop(); this.tb.showBrowser(left, top); }
From source file:com.cubusmail.gwtui.client.widgets.EmailAddressLink.java
License:Open Source License
public EmailAddressLink(GWTAddress address, boolean withSeparator) { super();/* www . j a v a 2 s . co m*/ FlowPanel panel = new FlowPanel(); initWidget(panel); DOM.setStyleAttribute(panel.getElement(), "whiteSpace", "nowrap"); DOM.setStyleAttribute(getElement(), "whiteSpace", "nowrap"); ImageHyperlink link = new ImageHyperlink(); link.setText(address.getInternetAddress()); AddContactFromEmailAddressAction addContactAction = new AddContactFromEmailAddressAction(); addContactAction.setAddress(address); NewMessageToEmailAddressAction newMessageAction = new NewMessageToEmailAddressAction(); newMessageAction.setAddress(address); this.contextMenu = new Menu(); this.contextMenu.addItem(UIFactory.createMenuItem(addContactAction)); this.contextMenu.addItem(UIFactory.createMenuItem(newMessageAction)); MouseListenerAdapter listener = new MouseListenerAdapter() { @Override public void onMouseDown(Widget sender, int x, int y) { contextMenu.showAt(sender.getAbsoluteLeft() + x + 10, sender.getAbsoluteTop() + y); } }; link.addLeftButtonListener(listener); link.addRightButtonListener(listener); panel.add(link); if (withSeparator) { panel.add(new HTML(", ")); } }
From source file:com.dianaui.universal.core.client.ui.DropDownMenu.java
License:Apache License
private void relativeTo(Widget relativeWidget) { getElement().getStyle().setLeft(relativeWidget.getAbsoluteLeft(), Style.Unit.PX); getElement().getStyle().setTop(relativeWidget.getAbsoluteTop() + relativeWidget.getOffsetHeight(), Style.Unit.PX);/* www. j a v a2 s. co m*/ }
From source file:com.dimdim.conference.ui.common.client.list.ListEntryPanelMouseListener.java
License:Open Source License
public void onMouseEnter(Widget sender) { try {/*from w w w . j ava2s . c o m*/ UIGlobals.closePreviousHoverPopup(); this.createPopupPanel(); int left = sender.getAbsoluteLeft() + UIGlobals.getHoverPopupWidthClearance(); int top = sender.getAbsoluteTop() - UIGlobals.getHoverPopupHeightClearance(); UIGlobals.setLastPopupPosition(left, top); this.theHoverPopup.setPopupPosition(left, top); // UIGlobals.showHoverPopup(this.theHoverPopup); ((ListEntryHoverPopupPanel) theHoverPopup).popupVisible(); // this.theHoverPopup.popupVisible(); // Window.alert("8"); // UIGlobals.consoleMiddleLeftHoverPopup = this.theHoverPopup; // this.theHoverPopup.showHoverPopup(); // Window.alert("9"); // this.theHoverPopup.setVisible(true); } catch (Exception e) { // Window.alert(e.getMessage()); } }