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.drools.brms.client.ruleeditor.ActionToolbar.java

License:Apache License

/**
 * Show the stats change popup.//from   w  ww  .j a  v  a2 s  .c  o  m
 */
private void showStatusChanger(Widget w) {
    final StatusChangePopup pop = new StatusChangePopup(uuid, false);
    pop.setChangeStatusEvent(new Command() {
        public void execute() {
            setState(pop.getState());
        }
    });
    pop.setPopupPosition(w.getAbsoluteLeft(), w.getAbsoluteTop());
    pop.show();
}

From source file:org.drools.brms.client.ruleeditor.VersionViewer.java

License:Apache License

private void restore(Widget w) {

    final CheckinPopup pop = new CheckinPopup(w.getAbsoluteLeft() + 10, w.getAbsoluteTop() + 10,
            "Restore this version?");
    pop.setCommand(new Command() {
        public void execute() {
            RepositoryServiceFactory.getService().restoreVersion(versionUUID, headUUID, pop.getCheckinComment(),
                    new GenericCallback() {
                        public void onSuccess(Object data) {
                            hide();/*from  ww w  .ja  v  a2s  .  c  o  m*/
                            refresh.execute();
                        }
                    });
        }
    });
    pop.show();
}

From source file:org.drools.guvnor.client.asseteditor.drools.modeldriven.ui.ActionCallMethodWidget.java

License:Apache License

protected void showAddFieldPopup(Widget w) {

    final SuggestionCompletionEngine completions = this.getModeller().getSuggestionCompletions();

    final FormStylePopup popup = new FormStylePopup(DroolsGuvnorImages.INSTANCE.Wizard(),
            Constants.INSTANCE.ChooseAMethodToInvoke());
    final ListBox box = new ListBox();
    box.addItem("...");

    for (int i = 0; i < fieldCompletionTexts.length; i++) {
        box.addItem(fieldCompletionTexts[i], fieldCompletionValues[i]);
    }// www . j a v a2 s  . c  om

    box.setSelectedIndex(0);

    popup.addAttribute(Constants.INSTANCE.ChooseAMethodToInvoke(), box);
    box.addChangeHandler(new ChangeHandler() {

        public void onChange(ChangeEvent event) {
            model.state = ActionCallMethod.TYPE_DEFINED;

            String methodName = box.getItemText(box.getSelectedIndex());
            String methodNameWithParams = box.getValue(box.getSelectedIndex());

            model.methodName = methodName;
            List<String> fieldList = new ArrayList<String>();

            fieldList.addAll(completions.getMethodParams(variableClass, methodNameWithParams));

            int i = 0;
            for (String fieldParameter : fieldList) {
                model.addFieldValue(new ActionFieldFunction(methodName, String.valueOf(i), fieldParameter));
                i++;
            }

            getModeller().refreshWidget();
            popup.hide();
        }
    });
    popup.setPopupPosition(w.getAbsoluteLeft(), w.getAbsoluteTop());
    popup.show();

}

From source file:org.drools.guvnor.client.ruleeditor.ActionToolbar.java

License:Apache License

/**
 * Called when user wants to checkin./*from  w  ww. j a  v  a  2  s  .  c  o  m*/
 */
protected void doCheckinConfirm(Widget w) {
    final CheckinPopup pop = new CheckinPopup(w.getAbsoluteLeft(), w.getAbsoluteTop(), "Check in changes.");
    pop.setCommand(new Command() {
        public void execute() {
            checkinAction.doCheckin(pop.getCheckinComment());
            if (afterCheckinEvent != null)
                afterCheckinEvent.execute();
        }
    });
    pop.show();
}

From source file:org.drools.guvnor.client.ruleeditor.VersionBrowser.java

License:Apache License

private void restore(Widget w, final String versionUUID, final Command refresh) {

    final CheckinPopup pop = new CheckinPopup(w.getAbsoluteLeft() + 10, w.getAbsoluteTop() + 10,
            "Restore this version?");
    pop.setCommand(new Command() {
        public void execute() {
            RepositoryServiceFactory.getService().restoreVersion(versionUUID, uuid, pop.getCheckinComment(),
                    new GenericCallback() {
                        public void onSuccess(Object data) {
                            refresh.execute();
                        }/*from   w  w  w .  ja v  a2s  .com*/
                    });
        }
    });
    pop.show();
}

From source file:org.drools.guvnor.client.ruleeditor.VersionBrowser.java

License:Apache License

private void restore(Widget w, final Command refresh, final String versionUUID, final String headUUID) {

    final CheckinPopup pop = new CheckinPopup(w.getAbsoluteLeft() + 10, w.getAbsoluteTop() + 10,
            "Restore this version?");
    pop.setCommand(new Command() {
        public void execute() {
            RepositoryServiceFactory.getService().restoreVersion(versionUUID, headUUID, pop.getCheckinComment(),
                    new GenericCallback() {
                        public void onSuccess(Object data) {
                            refresh.execute();
                        }/* w  ww  . j  ava 2  s  .  c o  m*/
                    });
        }
    });
    pop.show();
}

From source file:org.ednovo.gooru.client.mvp.dnd.PickupDragController.java

License:Open Source 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 {//  ww w .  j a  v  a 2  s.com
        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>();
        draggedElementStartLeft = draggableAbsoluteLeft;
        draggedElementStartTop = draggableAbsoluteTop;

        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(context.boundaryPanel.getElement());
    dropTargetClientHeight = DOMUtil.getClientHeight(context.boundaryPanel.getElement());
}

From source file:org.freemedsoftware.gwt.client.Util.java

License:Open Source License

/**
 * Attaches the mouseover help popup//from   www .ja  v a  2 s  . c  o  m
 * 
 * @param widget
 *            - Widget for which mouseover help popup is required
 * 
 * @param title
 *            - title of the help dialog
 * 
 * @param help
 *            - detailed text explaining the topic
 * 
 */
public static void attachHelp(final Widget widget, String title, String help, final boolean showOnLeft) {
    final PopupPanel popup = new PopupPanel();
    final HTML html = new HTML();
    html.setHTML("<b>" + title + "</b><br/><br/>" + help);

    popup.add(html);
    popup.setStyleName("freemed-HelpPopup");
    if (widget instanceof FocusWidget) {
        ((FocusWidget) widget).addMouseOutHandler(new MouseOutHandler() {
            @Override
            public void onMouseOut(MouseOutEvent event) {
                // Hide help PopUp
                popup.hide();
            }

        });
        ((FocusWidget) widget).addMouseDownHandler(new MouseDownHandler() {
            @Override
            public void onMouseDown(MouseDownEvent event) {
                // Hide help PopUp
                popup.hide();
            }

        });
        ((FocusWidget) widget).addMouseMoveHandler(new MouseMoveHandler() {
            @Override
            public void onMouseMove(MouseMoveEvent event) {
                // Do nothing
                popup.show();
                popup.setPopupPosition(
                        widget.getAbsoluteLeft() + (showOnLeft ? -1 * popup.getOffsetWidth() : 20),
                        widget.getAbsoluteTop() + 20);
            }
        });
    } else if (widget instanceof Image) {
        ((Image) widget).addMouseOutHandler(new MouseOutHandler() {
            @Override
            public void onMouseOut(MouseOutEvent event) {
                // Hide help PopUp
                popup.hide();
            }

        });
        ((Image) widget).addMouseDownHandler(new MouseDownHandler() {
            @Override
            public void onMouseDown(MouseDownEvent event) {
                // Hide help PopUp
                popup.hide();
            }

        });
        ((Image) widget).addMouseMoveHandler(new MouseMoveHandler() {
            @Override
            public void onMouseMove(MouseMoveEvent event) {
                // Do nothing
                popup.show();
                popup.setPopupPosition(
                        widget.getAbsoluteLeft() + (showOnLeft ? -1 * popup.getOffsetWidth() : 20),
                        widget.getAbsoluteTop() + 20);
            }
        });
    }
}

From source file:org.gems.ajax.client.util.Util.java

License:Open Source License

public static int getDiagramX(Widget w) {
    return w.getAbsoluteLeft() - getContainerX(findParentDiagram(w));
}

From source file:org.geomajas.gwt2.plugin.corewidget.example.client.sample.map.MapLegendDropDown.java

License:Open Source License

private int calculateLeftInMap(int offsetWidth) {
    int left = calculateLeft(offsetWidth);

    int popupRight = left + popup.getOffsetWidth();
    Widget widget = (Widget) mapPresenter.getWidgetPane();
    int mapRight = widget.getAbsoluteLeft() + widget.getOffsetWidth();
    if (popupRight > mapRight) {
        // Align right:
        int buttonRight = getAbsoluteLeft() + getOffsetWidth();
        left = buttonRight - popup.getOffsetWidth();
    }/*from  w w  w  .java2 s . c  o  m*/

    return left;
}