Example usage for com.google.gwt.user.client Element getAbsoluteLeft

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

Introduction

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

Prototype

@Override
    public int getAbsoluteLeft() 

Source Link

Usage

From source file:com.extjs.gxt.ui.client.widget.treepanel.TreePanel.java

License:sencha.com license

protected void moveFocus(Element selectedElem) {
    if (selectedElem == null)
        return;//from   w w w.j av  a 2 s.  c  o m
    int containerLeft = getAbsoluteLeft();
    int containerTop = getAbsoluteTop();

    int left = selectedElem.getAbsoluteLeft() - containerLeft;
    int top = selectedElem.getAbsoluteTop() - containerTop;

    int width = selectedElem.getOffsetWidth();
    int height = selectedElem.getOffsetHeight();

    if (width == 0 || height == 0) {
        focusEl.setLeftTop(0, 0);
        return;
    }
    focusEl.setLeftTop(left, top);
}

From source file:com.googlecode.kanbanik.client.components.WindowBox.java

License:Apache License

/**
 *
 * @param resize/* w  ww  .j a  v a2s . co m*/
 * @param clientX
 * @return
 */
private int getRelX(com.google.gwt.dom.client.Element resize, int clientX) {
    return clientX - resize.getAbsoluteLeft() + resize.getScrollLeft()
            + resize.getOwnerDocument().getScrollLeft();
}

From source file:com.ikon.frontend.client.widget.foldertree.ExtendedTree.java

License:Open Source License

/**
 * Detects whether mouse cursor is inside actual item.
 * // w ww.j  a  v a 2s  . co  m
 * @return returns true if mouse cursor is inside actual item
 */
private boolean isCursorInsideActualItem(TreeItem clickedItem) {
    if (clickedItem == null) {
        return false;
    }

    Element selectedElement = Dragable.getSelectedElement(clickedItem.getElement());

    if (selectedElement == null) {
        return false;
    }

    return mouseX >= selectedElement.getAbsoluteLeft() && mouseX <= selectedElement.getAbsoluteRight()
            && mouseY >= selectedElement.getAbsoluteTop() && mouseY <= selectedElement.getAbsoluteBottom();
}

From source file:com.mashery.examples.api.client.PagedTable.java

License:Open Source License

protected void showLoading(boolean loading) {
    if (loading) {
        firstButton.setEnabled(false);/* w w  w.  java2  s  . co  m*/
        prevButton.setEnabled(false);
        nextButton.setEnabled(false);
        lastButton.setEnabled(false);
        refreshPanel.setVisible(false);

        Element element = table.getElement();
        int x = element.getAbsoluteLeft();
        int y = element.getAbsoluteTop();
        int w = element.getAbsoluteRight() - x;
        int h = element.getAbsoluteBottom() - y;
        loadingPopup.setSize(w + "px", h + "px");
        loadingPopup.setPopupPosition(x, y);
        loadingPopup.show();
    } else {
        loadingPopup.hide();
        updateNavigationControls();
    }
}

From source file:com.tasktop.c2c.server.common.web.client.navigation.Navigation.java

License:Open Source License

/**
 * show the element with the given id// w  ww .ja  v a 2 s  .co m
 * 
 * @return true if the element was found
 */
public static boolean showIdElement(Element element, String elementId) {
    Element idElement = findElementById(element, elementId);
    if (idElement != null) {
        Window.scrollTo(idElement.getAbsoluteLeft(), idElement.getAbsoluteTop());
        return true;
    }
    return false;
}

From source file:com.tasktop.c2c.server.profile.web.ui.client.view.components.ProjectView.java

License:Open Source License

private ProjectView() {
    initWidget(uiBinder.createAndBindUi(this));
    setupSelectOnClick(mavenUrlTextBox);
    setupSelectOnClick(mavenDavUrlTextBox);
    readMoreAnchor.addClickHandler(new ClickHandler() {

        @Override/*from  w w  w  . java  2s . c  o m*/
        public void onClick(ClickEvent event) {
            if (wikiContentPanel.getWidget() != null) {
                Element element = wikiContentPanel.getWidget().getElement();
                Window.scrollTo(element.getAbsoluteLeft(), element.getAbsoluteTop());
            }
        }
    });
    wikiHomePageLink.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            Window.scrollTo(0, 0);
        }
    });
}

From source file:com.tensegrity.wpalo.client.ui.mvc.viewbrowser.ViewBrowser.java

License:Open Source License

private final void align(Editor editor) {
    Element icon = ui.getIconElement();
    int x = icon.getAbsoluteLeft() + icon.getOffsetWidth() + 2;
    int y = icon.getAbsoluteTop();
    int w = getOffsetWidth() + 15 - x;
    // Need to use the icon's offsetHeight, because otherwise
    // the editor will be too high for expanded folder elements
    int h = icon.getOffsetHeight();
    if (GXT.isIE) {
        h -= 2;// ww w  .  jav  a  2  s  . c  om
    }
    // getOffsetHeight() + 1;

    editor.setBounds(x, y, w, h);
}

From source file:com.tensegrity.wpalo.client.ui.mvc.viewbrowser.ViewBrowser.java

License:Open Source License

public boolean clickedOnIcon(Point mouseXY) {
    Element icon = ui.getIconElement();
    int iconX = icon.getAbsoluteLeft();
    int iconW = iconX + icon.getOffsetWidth();
    int iconY = icon.getAbsoluteTop();
    int iconH = iconY + icon.getOffsetHeight();
    return (mouseXY.x >= iconX && mouseXY.x <= iconW) && (mouseXY.y >= iconY && mouseXY.y <= iconH);
}

From source file:com.vaadin.terminal.gwt.client.ui.dd.DDUtil.java

License:Open Source License

/**
 * @deprecated use the version with the actual event
 * @param element/*w  w  w . j a  v  a  2s .c o m*/
 * @param clientX
 * @param leftRightRatio
 * @return
 */
@Deprecated
public static HorizontalDropLocation getHorizontalDropLocation(Element element, int clientX,
        double leftRightRatio) {

    int absoluteLeft = element.getAbsoluteLeft();
    int offsetWidth = element.getOffsetWidth();
    int fromTop = clientX - absoluteLeft;

    float percentageFromTop = (fromTop / (float) offsetWidth);
    if (percentageFromTop < leftRightRatio) {
        return HorizontalDropLocation.LEFT;
    } else if (percentageFromTop > 1 - leftRightRatio) {
        return HorizontalDropLocation.RIGHT;
    } else {
        return HorizontalDropLocation.CENTER;
    }
}

From source file:com.vaadin.terminal.gwt.client.ui.dd.VDragEvent.java

License:Open Source License

/**
 * Automatically tries to create a proxy image from given element.
 * /*  w w  w  .  jav a 2s.  c o  m*/
 * @param element
 * @param alignImageToEvent
 *            if true, proxy image is aligned to start event, else next to
 *            mouse cursor
 */
public void createDragImage(Element element, boolean alignImageToEvent) {
    Element cloneNode = (Element) element.cloneNode(true);
    if (BrowserInfo.get().isIE()) {
        if (cloneNode.getTagName().toLowerCase().equals("tr")) {
            TableElement table = Document.get().createTableElement();
            TableSectionElement tbody = Document.get().createTBodyElement();
            table.appendChild(tbody);
            tbody.appendChild(cloneNode);
            cloneNode = table.cast();
        }
    }
    if (alignImageToEvent) {
        int absoluteTop = element.getAbsoluteTop();
        int absoluteLeft = element.getAbsoluteLeft();
        int clientX = Util.getTouchOrMouseClientX(startEvent);
        int clientY = Util.getTouchOrMouseClientY(startEvent);
        int offsetX = absoluteLeft - clientX;
        int offsetY = absoluteTop - clientY;
        setDragImage(cloneNode, offsetX, offsetY);
    } else {
        setDragImage(cloneNode);
    }

}