Example usage for com.google.gwt.user.client.ui Widget getAbsoluteTop

List of usage examples for com.google.gwt.user.client.ui Widget getAbsoluteTop

Introduction

In this page you can find the example usage for com.google.gwt.user.client.ui Widget getAbsoluteTop.

Prototype

public int getAbsoluteTop() 

Source Link

Document

Gets the object's absolute top position in pixels, as measured from the browser window's client area.

Usage

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  v a 2 s. c om*/

    menuWindow.show();
}

From source file:org.vaadin.sasha.portallayout.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 {/* w ww  .  ja v a2s.  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()));
        }

        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);
        }

        context.dropController = getIntersectDropController(context.mouseX, context.mouseY);
        if (context.dropController != null) {
            context.dropController.onEnter(context);
        }
        movablePanel = container;
    }

    movablePanel.addStyleName(APPLICATION_STYLE_NAME);
    movablePanel.addStyleName(DragClientBundle.INSTANCE.css().movablePanel());

    calcBoundaryOffset();
    dropTargetClientWidth = DOMUtil.getClientWidth(boundaryPanel.getElement());
    dropTargetClientHeight = DOMUtil.getClientHeight(boundaryPanel.getElement());
}

From source file:org.wwarn.mapcore.client.panel.Tooltip.java

License:Open Source License

private boolean isMouseOutOfWidget(MouseEvent<?> event, Widget widget) {
    int x = event.getClientX();
    int y = event.getClientY();
    return x <= widget.getAbsoluteLeft() || x >= widget.getAbsoluteLeft() + widget.getOffsetWidth()
            || y <= widget.getAbsoluteTop() || y >= widget.getAbsoluteTop() + widget.getOffsetHeight();
}

From source file:org.xwiki.gwt.wysiwyg.client.plugin.color.ColorPlugin.java

License:Open Source License

/**
 * {@inheritDoc}/*ww w. j a v a 2s. co  m*/
 * 
 * @see ClickHandler#onClick(ClickEvent)
 */
public void onClick(ClickEvent event) {
    Widget sender = (Widget) event.getSource();
    Command command = buttons.get(sender);
    if (command != null) {
        currentCommand = command;

        String color = getTextArea().getCommandManager().getStringValue(command);
        getColorPicker().setColor(color);

        int left = sender.getAbsoluteLeft();
        int top = sender.getAbsoluteTop() + sender.getOffsetHeight();
        getColorPicker().setPopupPosition(left, top);

        getColorPicker().show();
    }
}