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

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

Introduction

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

Prototype

public int getAbsoluteLeft() 

Source Link

Document

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

Usage

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 {/*from  w ww .  j av a  2  s  .  co  m*/
        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}/*  w w w  . j a v a2s  .  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();
    }
}