Search in sources :

Example 6 with Element

use of com.google.gwt.user.client.Element in project perun by CESNET.

the class AdvancedStackPanel method setStackText.

/**
	 * Sets the text associated with a child by its index.
	 *
	 * @param index
	 *            the index of the child whose text is to be set
	 * @param text
	 *            the text to be associated with it
	 * @param asHTML
	 *            <code>true</code> to treat the specified text as HTML
	 */
public void setStackText(int index, String text, boolean asHTML) {
    if (index >= getWidgetCount()) {
        return;
    }
    Element tdWrapper = DOM.getChild(DOM.getChild(body, index * 2), 0);
    Element headerElem = DOM.getFirstChild(tdWrapper);
    if (asHTML) {
        DOM.setInnerHTML(getHeaderTextElem(headerElem), text);
    } else {
        DOM.setInnerText(getHeaderTextElem(headerElem), text);
    }
}
Also used : Element(com.google.gwt.user.client.Element)

Example 7 with Element

use of com.google.gwt.user.client.Element in project perun by CESNET.

the class AdvancedStackPanel method updateIndicesFrom.

private void updateIndicesFrom(int beforeIndex) {
    for (int i = beforeIndex, c = getWidgetCount(); i < c; ++i) {
        Element childTR = DOM.getChild(body, i * 2);
        Element childTD = DOM.getFirstChild(childTR);
        DOM.setElementPropertyInt(childTD, "__index", i);
        // Update the special style on the first element
        if (beforeIndex == 0) {
            setStyleName(childTD, DEFAULT_ITEM_STYLENAME + "-first", true);
        } else {
            setStyleName(childTD, DEFAULT_ITEM_STYLENAME + "-first", false);
        }
    }
}
Also used : Element(com.google.gwt.user.client.Element)

Example 8 with Element

use of com.google.gwt.user.client.Element in project perun by CESNET.

the class AdvancedStackPanel method onEnsureDebugId.

/**
	 * <b>Affected Elements:</b>
	 * <ul>
	 * <li>-text# = The element around the header at the specified index.</li>
	 * <li>-text-wrapper# = The element around the header at the specified
	 * index.</li>
	 * <li>-content# = The element around the body at the specified index.</li>
	 * </ul>
	 *
	 * @see UIObject#onEnsureDebugId(String)
	 */
@Override
protected void onEnsureDebugId(String baseID) {
    super.onEnsureDebugId(baseID);
    int numHeaders = DOM.getChildCount(body) >> 1;
    for (int i = 0; i < numHeaders; i++) {
        Element tdWrapper = DOM.getFirstChild(DOM.getChild(body, 2 * i));
        Element headerElem = DOM.getFirstChild(tdWrapper);
        Element bodyElem = DOM.getFirstChild(DOM.getChild(body, 2 * i + 1));
        ensureDebugId(tdWrapper, baseID, "text-wrapper" + i);
        ensureDebugId(bodyElem, baseID, "content" + i);
        ensureDebugId(getHeaderTextElem(headerElem), baseID, "text" + i);
    }
}
Also used : Element(com.google.gwt.user.client.Element)

Example 9 with Element

use of com.google.gwt.user.client.Element in project GwtMobile by dennisjzh.

the class ScrollPanel method onSwipeVertical.

@Override
public void onSwipeVertical(SwipeEvent e) {
    Element widgetEle = getWidget().getElement();
    int panelHeight = Utils.getHeight(this.getElement());
    int widgetHeight = widgetEle.getOffsetHeight();
    long current = getScrollPosition();
    if (// exceed top boundary
    (current >= 0) || (-current + panelHeight >= widgetHeight)) {
        // exceed bottom boundary
        return;
    }
    double speed = e.getSpeed();
    double timeFactor = 3000;
    long time = (long) Math.abs(speed * timeFactor);
    double dicstanceFactor = 0.25;
    long distance = (long) (speed * time * dicstanceFactor);
    //Utils.Console("speed " + speed + " time " + time + " distance " + distance + " current " + current);
    current += distance;
    if (current > 0) {
        //exceed top boundary
        double timeAdj = 1 - (double) current / distance;
        time = (long) (time * timeAdj);
        current = 0;
    } else if (-current + panelHeight > widgetHeight) {
        //exceed bottom boundary
        long bottom = panelHeight - widgetHeight;
        double timeAdj = 1 - (double) (current - bottom) / distance;
        time = (long) (time * timeAdj);
        current = bottom;
    }
    Utils.setTransitionDuration(widgetEle, time);
    setScrollPosition((int) current);
}
Also used : Element(com.google.gwt.user.client.Element)

Example 10 with Element

use of com.google.gwt.user.client.Element in project GwtMobile by dennisjzh.

the class ScrollPanel method setScrollPosition.

public void setScrollPosition(int pos) {
    if (_hasTextBox) {
        setStyleTop(pos);
    } else {
        Element element = getWidget().getElement();
        Utils.setTranslateY(element, pos);
    }
}
Also used : Element(com.google.gwt.user.client.Element)

Aggregations

Element (com.google.gwt.user.client.Element)27 BlurEvent (com.google.gwt.event.dom.client.BlurEvent)1 BlurHandler (com.google.gwt.event.dom.client.BlurHandler)1 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)1 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)1 FlexCellFormatter (com.google.gwt.user.client.ui.FlexTable.FlexCellFormatter)1 FormValidator (cz.metacentrum.perun.webgui.client.applicationresources.FormValidator)1 RegistrarFormItemGenerator (cz.metacentrum.perun.webgui.client.applicationresources.RegistrarFormItemGenerator)1