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);
}
}
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);
}
}
}
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);
}
}
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);
}
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);
}
}
Aggregations