List of usage examples for com.google.gwt.user.client.ui Widget getAbsoluteLeft
public int getAbsoluteLeft()
From source file:org.semanticsoft.vaaclipse.widgets.client.ui.fastview.FastViewConnector.java
License:Open Source License
public void setPaneLocation() { VFastView fastView = getWidget();/*from w ww. j a va2s . c o m*/ if (fastView.side == null) return; //VConsole.log(RootPanel.get().toString()); //VExtendedVerticalLayout trimmedWindowClientArea = findTrimmedWindowClientArea(RootPanel.get()); Widget trimmedWindowClientArea = fastView.trimmedWindowClientArea; if (trimmedWindowClientArea != null) { VConsole.log("TrimmedWindowArea finded!"); int x, y; int w = 600, h = 400; if (Side.LEFT.equals(fastView.side)) { x = trimmedWindowClientArea.getAbsoluteLeft(); y = trimmedWindowClientArea.getAbsoluteTop(); } else if (Side.RIGHT.equals(fastView.side)) { x = trimmedWindowClientArea.getAbsoluteLeft() + trimmedWindowClientArea.getOffsetWidth() - w; y = trimmedWindowClientArea.getAbsoluteTop(); } else return; VConsole.log("Position: x=" + x + " y=" + y); fastView.setPopupPosition(x, y); fastView.setWidth(w + "px"); fastView.setHeight(h + "px"); } else VConsole.log("TrimmedWindowArea is null!"); }
From source file:org.semanticsoft.vaaclipse.widgets.client.ui.stackwidget.VStackWidget.java
License:Open Source License
public boolean updateRegion(VDragEvent event) { //VConsole.log("updateDropDetails: start"); Element element = event.getElementOver(); Widget targetWidget = Util.findWidget(element, null); if (targetWidget == null) { //VConsole.log("updateDropDetails: targetWidget is null. return."); return false; }//ww w . ja v a 2 s.c o m if (targetWidget != this) { //VConsole.log("updateDropDetails: targetWidget != this"); Widget parent = targetWidget.getParent(); while (parent != null && parent != this) { parent = parent.getParent(); } if (parent == null) { //VConsole.log("updateDropDetails: parent not finded"); return false; } targetWidget = parent; //VConsole.log("updateDropDetails: parent finded"); } MouseEventDetails details1 = MouseEventDetailsBuilder.buildMouseEventDetails(event.getCurrentGwtEvent(), getElement()); int mouseX = details1.getClientX(); int mouseY = details1.getClientY(); int barLeft = tabBar.getAbsoluteLeft(); int barTop = tabBar.getAbsoluteTop(); int barWidth = tabBar.getOffsetWidth(); int barHeight = tabBar.getOffsetHeight(); boolean overBar = mouseX > barLeft && mouseX < barLeft + barWidth && mouseY > barTop && mouseY < barTop + barHeight; if (overBar) { //VConsole.log("updateDropDetails: over bar"); removeDockZone(); event.getDropDetails().put("targetWidgetClassName", targetWidget.getClass().getName()); event.getDropDetails().put("dropType", "DropToTabsheetBar"); event.getDropDetails().put("targetWidgetAbsoluteLeft", targetWidget.getAbsoluteLeft()); event.getDropDetails().put("targetWidgetAbsoluteTop", targetWidget.getAbsoluteTop()); event.getDropDetails().put("targetWidgetOffsetWidth", targetWidget.getOffsetWidth()); event.getDropDetails().put("targetWidgetOffsetHeight", targetWidget.getOffsetHeight()); } else { //VConsole.log("updateDropDetails: not over bar"); Object sourceWidget = event.getTransferable().getDragSource(); if (!(sourceWidget instanceof VStackWidget) && !(sourceWidget instanceof StackWidgetConnector)) { //VConsole.log("updateDropDetails: return, because the sourceWidget is " + sourceWidget.getClass().getName()); return false; } if (sourceWidget instanceof StackWidgetConnector) sourceWidget = ((StackWidgetConnector) sourceWidget).getWidget(); //VConsole.log("updateDropDetails: sourceWidget is VStackWidget or StackWidgetConnector"); VStackWidget targetTabSheet = this; if (targetTabSheet == sourceWidget && targetTabSheet.getTabCount() <= 1) { //VConsole.log("updateDropDetails: return, because target is match to source and has only one (current draggable) tab"); return false; } VExtendedVerticalLayout outerArea = findOuterArea(targetTabSheet); Widget boundingWidget = null; if (outerArea != null) { //VConsole.log("updateDropDetails: outer area is finded"); if ("area".equals(outerArea.getVariableValue(E4_ELEMENT_TYPE))) boundingWidget = outerArea; } else { boundingWidget = targetTabSheet; //VConsole.log("updateDropDetails: outer area not finded, boundingWidget = targetTabSheet"); } if (boundingWidget == null) { //VConsole.log("updateDropDetails: return, because boundingWidget not founded"); return false; } event.getDropDetails().put("targetWidgetClassName", boundingWidget.getClass().getName()); event.getDropDetails().put("dropType", "DropToTabsheetBody"); event.getDropDetails().put("targetWidgetAbsoluteLeft", boundingWidget.getAbsoluteLeft()); event.getDropDetails().put("targetWidgetAbsoluteTop", boundingWidget.getAbsoluteTop()); event.getDropDetails().put("targetWidgetOffsetWidth", boundingWidget.getOffsetWidth()); event.getDropDetails().put("targetWidgetOffsetHeight", boundingWidget.getOffsetHeight()); int x0 = boundingWidget.getAbsoluteLeft(); int y0 = boundingWidget.getAbsoluteTop(); int dx = boundingWidget.getOffsetWidth(); int dy = boundingWidget.getOffsetHeight(); int docPrcnt = 30; double docX = dx * docPrcnt / 100; double docY = dy * docPrcnt / 100; double d = 1; Vector mousePos = Vector.valueOf(mouseX, mouseY); Integer side = GeomUtils.findDockSide(x0, y0, dx, dy, docX, docY, mousePos); //VConsole.log("updateDropDetails: finded dock side = " + side + ", old dock side = " + dockSide); if (side != null) { double _x = 0, _y = 0, _w = 0, _h = 0; if (side == Side.LEFT) { _x = d; _y = d; _w = docX - d; _h = dy - 2 * d; } else if (side == Side.TOP) { _x = d; _y = d; _w = dx - 2 * d; _h = docY - d; } else if (side == Side.RIGHT) { _x = dx - docX; _y = d; _w = docX - d; _h = dy - 2 * d; } else if (side == Side.BOTTOM) { _x = d; _y = dy - docY; _w = dx - 2 * d; _h = docY - d; } else if (side == Side.CENTER) { _x = d; _y = d; _w = dx - 2 * d; _h = dy - 2 * d; } else return false; _x = x0 + _x; _y = y0 + _y; if (dockZone1 == null) { dockZone1 = DOM.createDiv(); dockZone2 = DOM.createDiv(); dockZone3 = DOM.createDiv(); dockZone4 = DOM.createDiv(); } //VConsole.log("updateDropDetails: x=" + _x + "; y=" + _y + "; w=" + _w + "; h=" + _h); if (side != dockSide) { //VConsole.log("updateDropDetails: dock side will be updated"); int l = 3; String style1 = "position: absolute; left: " + _x + "px; top: " + _y + "px; width: " + _w + "px; height: " + l + "px; background-image: url(" + baseURL + "VAADIN/themes/dragdrop/vaadock/img/dockzone.png); z-index: 20000;"; dockZone1.setAttribute("style", style1); String style2 = "position: absolute; left: " + _x + "px; top: " + (_y + _h - l) + "px; width: " + _w + "px; height: " + l + "px; background-image: url(" + baseURL + "VAADIN/themes/dragdrop/vaadock/img/dockzone.png); z-index: 20000;"; dockZone2.setAttribute("style", style2); String style3 = "position: absolute; left: " + _x + "px; top: " + _y + "px; width: " + l + "px; height: " + _h + "px; background-image: url(" + baseURL + "VAADIN/themes/dragdrop/vaadock/img/dockzone.png); z-index: 20000;"; dockZone3.setAttribute("style", style3); String style4 = "position: absolute; left: " + (_x + _w - l) + "px; top: " + _y + "px; width: " + l + "px; height: " + _h + "px; background-image: url(" + baseURL + "VAADIN/themes/dragdrop/vaadock/img/dockzone.png); z-index: 20000;"; dockZone4.setAttribute("style", style4); //setStyleName(dockZone, "v-etot-sukin-syn"); //dockZoneContainer = boundingWidget.getElement(); dockZoneContainer = RootPanel.get().getElement(); DOM.appendChild(dockZoneContainer, dockZone1); DOM.appendChild(dockZoneContainer, dockZone2); DOM.appendChild(dockZoneContainer, dockZone3); DOM.appendChild(dockZoneContainer, dockZone4); dockSide = side; } } } return true; }
From source file:org.thechiselgroup.biomixer.client.core.geometry.Rectangle.java
License:Apache License
public static Rectangle fromWidget(Widget widget) { int x = widget.getAbsoluteLeft(); int y = widget.getAbsoluteTop(); int height = widget.getOffsetHeight(); int width = widget.getOffsetWidth(); return new Rectangle(x, y, width, height); }
From source file:org.thechiselgroup.biomixer.client.dnd.resources.DefaultResourceSetAvatarDragController.java
License:Apache License
/** * Creates a shade element that has bounds of drop target element, but an * absolute location, and is positioned behind the drop target. *//*from w w w. java2 s .co m*/ private Element createShadeElement(Widget dropTarget) { Element shade = DOM.createSpan(); shade.addClassName(CSS_SHADE_CLASS); CSS.setZIndex(shade, CSS_SHADE_Z_INDEX); WindowPanel window = getWindow(dropTarget); CSS.setAbsoluteBounds(shade, dropTarget.getAbsoluteLeft() - window.getAbsoluteLeft(), dropTarget.getAbsoluteTop() - window.getAbsoluteTop(), dropTarget.getOffsetWidth(), dropTarget.getOffsetHeight()); return shade; }
From source file:org.uberfire.client.views.pfly.dnd.CompassWidgetImpl.java
License:Apache License
private void showDropTarget(final DragContext context, final CompassPosition p) { int x = 0;//from w w w . jav a2s. c o m int y = 0; int width = 0; int height = 0; final Widget dropTargetParent = context.dropController.getDropTarget(); switch (p) { case SELF: x = dropTargetParent.getAbsoluteLeft(); y = dropTargetParent.getAbsoluteTop(); width = dropTargetParent.getOffsetWidth(); height = dropTargetParent.getOffsetHeight(); highlightActiveDropTarget(centre); showDropTarget(x, y, width, height); break; case NORTH: x = dropTargetParent.getAbsoluteLeft(); y = dropTargetParent.getAbsoluteTop(); width = dropTargetParent.getOffsetWidth(); height = (int) (dropTargetParent.getOffsetHeight() * 0.50); highlightActiveDropTarget(north); showDropTarget(x, y, width, height); break; case SOUTH: x = dropTargetParent.getAbsoluteLeft(); height = (int) (dropTargetParent.getOffsetHeight() * 0.50); y = dropTargetParent.getOffsetHeight() + dropTargetParent.getAbsoluteTop() - height; width = dropTargetParent.getOffsetWidth(); highlightActiveDropTarget(south); showDropTarget(x, y, width, height); break; case EAST: width = (int) (dropTargetParent.getOffsetWidth() * 0.50); x = dropTargetParent.getOffsetWidth() + dropTargetParent.getAbsoluteLeft() - width; y = dropTargetParent.getAbsoluteTop(); height = dropTargetParent.getOffsetHeight(); highlightActiveDropTarget(east); showDropTarget(x, y, width, height); break; case WEST: x = dropTargetParent.getAbsoluteLeft(); y = dropTargetParent.getAbsoluteTop(); width = (int) (dropTargetParent.getOffsetWidth() * 0.50); height = dropTargetParent.getOffsetHeight(); highlightActiveDropTarget(west); showDropTarget(x, y, width, height); break; default: highlightActiveDropTarget(null); hideDropTarget(); } }
From source file:org.uberfire.client.views.pfly.notifications.NotificationPopupsManagerView.java
License:Apache License
private int getLeftPosition(final Widget widget) { int left = widget.getAbsoluteLeft(); // if left is negative (due to scrolling) we try to align with the parent // to make sure the notifications are always visible if (left < 0 && widget.getParent() != null) { left = getLeftPosition(widget.getParent()); }/*from w ww. j a v a2 s. c om*/ return Math.max(left, 0); }
From source file:org.uberfire.client.workbench.widgets.dnd.CompassWidget.java
License:Apache License
private void showDropTarget(final DragContext context, final Position p) { int x = 0;//from w w w. j ava 2 s .c o m int y = 0; int width = 0; int height = 0; final Widget dropTargetParent = context.dropController.getDropTarget(); switch (p) { case SELF: x = dropTargetParent.getAbsoluteLeft(); y = dropTargetParent.getAbsoluteTop(); width = dropTargetParent.getOffsetWidth(); height = dropTargetParent.getOffsetHeight(); showDropTarget(x, y, width, height); break; case NORTH: x = dropTargetParent.getAbsoluteLeft(); y = dropTargetParent.getAbsoluteTop(); width = dropTargetParent.getOffsetWidth(); height = (int) (dropTargetParent.getOffsetHeight() * 0.50); showDropTarget(x, y, width, height); break; case SOUTH: x = dropTargetParent.getAbsoluteLeft(); height = (int) (dropTargetParent.getOffsetHeight() * 0.50); y = dropTargetParent.getOffsetHeight() + dropTargetParent.getAbsoluteTop() - height; width = dropTargetParent.getOffsetWidth(); showDropTarget(x, y, width, height); break; case EAST: width = (int) (dropTargetParent.getOffsetWidth() * 0.50); x = dropTargetParent.getOffsetWidth() + dropTargetParent.getAbsoluteLeft() - width; y = dropTargetParent.getAbsoluteTop(); height = dropTargetParent.getOffsetHeight(); showDropTarget(x, y, width, height); break; case WEST: x = dropTargetParent.getAbsoluteLeft(); y = dropTargetParent.getAbsoluteTop(); width = (int) (dropTargetParent.getOffsetWidth() * 0.50); height = dropTargetParent.getOffsetHeight(); showDropTarget(x, y, width, height); break; default: hideDropTarget(); } }
From source file:org.utgenome.gwt.utgb.client.track.lib.old.OldUTGBSubOperationImpl.java
License:Apache License
public void execute(Widget sender, int x, int y) { final TrackGroup trackGroup = getTrack().getTrackGroup(); final Map<String, String> parameterMap = new HashMap<String, String>(); final String[] propertyNameArray = OldUTGBProperty.getPropertyNameArray(); final TrackGroupProperty propertyReader = trackGroup.getPropertyReader(); for (int i = 0; i < propertyNameArray.length; i++) { final String key = propertyNameArray[i]; final String value = propertyReader.getProperty(key); parameterMap.put(key, value);/*from w w w . j av a2s.c om*/ } final TrackWindow trackWindow = trackGroup.getTrackWindow(); final long startIndex = trackWindow.getStartOnGenome(); final long endIndex = trackWindow.getEndOnGenome(); parameterMap.put("start", Long.toString(startIndex)); parameterMap.put("end", Long.toString(endIndex)); parameterMap.put("width", Integer.toString(((OldUTGBTrack) track).getMainPanelWidth())); { final Widget absoluteParentPanel = sender.getParent(); final int parentAbsX = absoluteParentPanel.getAbsoluteLeft(); final int parentAbsY = absoluteParentPanel.getAbsoluteTop(); final int selfAbsX = sender.getAbsoluteLeft(); final int selfAbsY = sender.getAbsoluteTop(); final int relativeX = selfAbsX - parentAbsX + x; final int relativeY = selfAbsY - parentAbsY + y; parameterMap.put("pos", Integer.toString(relativeX) + "," + Integer.toString(relativeY)); // parameterMap.put("y", Integer.toString(relativeY)); } final String fullURL = url.getURL(parameterMap); RPCServiceManager.getRPCService().getHTTPContent(fullURL, new Command(sender, x, y)); }
From source file:org.utgenome.gwt.utgb.client.track.operation.MenuOperation.java
License:Apache License
public void execute(Widget sender, int x, int y) { final MenuPopupWindow menuWindow = new MenuPopupWindow(title, true, menuItems); { // set location final int offsetX = sender.getAbsoluteLeft(); final int offsetY = sender.getAbsoluteTop(); menuWindow.setPopupPosition(offsetX + x, offsetY + y); }/*from w w w . j a va2s . c o m*/ menuWindow.show(); }
From source file:org.utgenome.gwt.utgb.client.track.TrackRangeSelector.java
License:Apache License
/** * An event handler when a mouse down event is reported from a child widget of the trackPanel. * //from ww w . j a v a 2 s. c o m * @param x * @param y */ public void onMouseDownFromChild(Widget sender, int x, int y) { // int xOnWindow = x - trackPanel.getFocusPanel().getAbsoluteLeft(); // if (xOnWindow < 0) // xOnWindow = 0; // onMouseDown(trackPanel.getFocusPanel(), xOnWindow, y); onMouseDown(trackPanel.getFocusPanel().getElement(), x + sender.getAbsoluteLeft() - trackPanel.getAbsoluteLeft(), y); }