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

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

Introduction

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

Prototype

@Override
    public int getPropertyInt(String name) 

Source Link

Usage

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

License:Open Source License

private void updateMPMonth(int month) {
    for (int i = 0; i < mpMonths.getCount(); i++) {
        Element elem = mpMonths.item(i);
        int xmonth = elem.getPropertyInt("xmonth");
        fly(elem).setStyleName("x-date-mp-sel", xmonth == month);
    }//from   w ww  . j  a  va2  s.c o m
}

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

License:sencha.com license

/**
 * Returns the index of the element./*from   ww  w.  ja  v a  2s. c om*/
 * 
 * @param element the element
 * @return the index
 */
public int indexOf(Element element) {
    if (element.getPropertyString("viewIndex") != null) {
        return element.getPropertyInt("viewIndex");
    }
    return all.indexOf(element);
}

From source file:com.extjs.gxt.ui.client.widget.table.TableView.java

License:Open Source License

/**
 * Reutrns the row index of the element.
 * /*from w ww .  j  av  a2  s .  co m*/
 * @param elem the row element or any child element
 * @return the row index or -1 if not found
 */
public int findRowIndex(Element elem) {
    Element r = findRow(elem);
    return r != null ? r.getPropertyInt("rowIndex") : -1;
}

From source file:com.vaadin.terminal.gwt.client.Util.java

License:Open Source License

public static int measureHorizontalBorder(Element element) {
    int borders;/*from   w ww .j  av  a 2  s.  co m*/

    if (BrowserInfo.get().isIE()) {
        String width = element.getStyle().getProperty("width");
        String height = element.getStyle().getProperty("height");

        int offsetWidth = element.getOffsetWidth();
        int offsetHeight = element.getOffsetHeight();
        if (offsetHeight < 1) {
            offsetHeight = 1;
        }
        if (offsetWidth < 1) {
            offsetWidth = 10;
        }
        element.getStyle().setPropertyPx("height", offsetHeight);
        element.getStyle().setPropertyPx("width", offsetWidth);

        borders = element.getOffsetWidth() - element.getClientWidth();

        element.getStyle().setProperty("width", width);
        element.getStyle().setProperty("height", height);
    } else {
        borders = element.getOffsetWidth() - element.getPropertyInt("clientWidth");
    }
    assert borders >= 0;

    return borders;
}

From source file:com.vaadin.terminal.gwt.client.Util.java

License:Open Source License

public static int measureVerticalBorder(Element element) {
    int borders;/*from  w  ww .  jav  a2s . c om*/
    if (BrowserInfo.get().isIE()) {
        String width = element.getStyle().getProperty("width");
        String height = element.getStyle().getProperty("height");

        int offsetWidth = element.getOffsetWidth();
        int offsetHeight = element.getOffsetHeight();
        if (offsetHeight < 1) {
            offsetHeight = 1;
        }
        if (offsetWidth < 1) {
            offsetWidth = 10;
        }
        element.getStyle().setPropertyPx("width", offsetWidth);

        element.getStyle().setPropertyPx("height", offsetHeight);

        borders = element.getOffsetHeight() - element.getPropertyInt("clientHeight");

        element.getStyle().setProperty("height", height);
        element.getStyle().setProperty("width", width);
    } else {
        borders = element.getOffsetHeight() - element.getPropertyInt("clientHeight");
    }
    assert borders >= 0;

    return borders;
}

From source file:com.vaadin.terminal.gwt.client.Util.java

License:Open Source License

public static int getNativeScrollbarSize() {
    if (detectedScrollbarSize < 0) {
        Element scroller = DOM.createDiv();
        scroller.getStyle().setProperty("width", "50px");
        scroller.getStyle().setProperty("height", "50px");
        scroller.getStyle().setProperty("overflow", "scroll");
        scroller.getStyle().setProperty("position", "absolute");
        scroller.getStyle().setProperty("marginLeft", "-5000px");
        RootPanel.getBodyElement().appendChild(scroller);
        detectedScrollbarSize = scroller.getOffsetWidth() - scroller.getPropertyInt("clientWidth");

        RootPanel.getBodyElement().removeChild(scroller);
    }/*www . ja  v  a  2  s .com*/
    return detectedScrollbarSize;
}

From source file:org.xwiki.gwt.user.client.ui.internal.TextBoxImplIE6.java

License:Open Source License

@Override
public int getSelectionLength(Element element) {
    if (isFocused(element)) {
        return super.getSelectionLength(element);
    } else {//  w  w w .  j  a  v a  2  s.c  om
        return element.getPropertyInt(SELECTION_LENGTH);
    }
}

From source file:org.xwiki.gwt.user.client.ui.internal.TextBoxImplIE6.java

License:Open Source License

@Override
public int getTextAreaCursorPos(Element element) {
    if (isFocused(element)) {
        return super.getTextAreaCursorPos(element);
    } else {//  w  ww.jav a2s .  com
        return element.getPropertyInt(CURSOR_POS);
    }
}

From source file:org.xwiki.gwt.user.client.ui.internal.TextBoxImplIE6.java

License:Open Source License

/**
 * Restores the selection inside the given element (e.g. text area, text input). If there's no saved selection the
 * caret is placed at the start.//from   ww w  .j  av  a  2 s .c  o m
 * 
 * @param element the element whose selection is restored.
 */
private void restoreSelection(Element element) {
    setSelectionRange(element, element.getPropertyInt(CURSOR_POS), element.getPropertyInt(SELECTION_LENGTH));
}