Example usage for com.google.gwt.user.client DOM getFirstChild

List of usage examples for com.google.gwt.user.client DOM getFirstChild

Introduction

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

Prototype

public static Element getFirstChild(Element elem) 

Source Link

Document

Gets the first child element of the given element.

Usage

From source file:asquare.gwt.tk.client.ui.RowPanel.java

License:Apache License

@Override
public Element getCellElement(int cellIndex) {
    GwtUtil.rangeCheck(0, getCellCount(), cellIndex, false);

    Element tr = DOM.getChild(getBody(), cellIndex);
    Element td = DOM.getFirstChild(tr);
    return td;//from   w w  w .  j  ava2s . c  om
}

From source file:cc.alcina.framework.gwt.client.widget.dialog.DecoratorPanel.java

License:Apache License

/**
 * Creates a new panel using the specified style names to apply to each row.
 * Each row will contain three cells (Left, Center, and Right). The Center
 * cell in the containerIndex row will contain the {@link Widget}.
 * //from  w w  w .ja  v a  2s. c  o  m
 * @param rowStyles
 *            an array of style names to apply to each row
 * @param containerIndex
 *            the index of the container row
 */
DecoratorPanel(String[] rowStyles, int containerIndex) {
    super(DOM.createTable());
    // Add a tbody
    Element table = getElement();
    tbody = DOM.createTBody();
    DOM.appendChild(table, tbody);
    DOM.setElementPropertyInt(table, "cellSpacing", 0);
    DOM.setElementPropertyInt(table, "cellPadding", 0);
    // Add each row
    for (int i = 0; i < rowStyles.length; i++) {
        Element row = createTR(rowStyles[i]);
        DOM.appendChild(tbody, row);
        if (i == containerIndex) {
            containerElem = DOM.getFirstChild(DOM.getChild(row, 1));
        }
    }
    // Set the overall style name
    setStyleName(DEFAULT_STYLENAME);
}

From source file:cc.alcina.framework.gwt.client.widget.dialog.DecoratorPanel.java

License:Apache License

/**
 * Get a specific Element from the panel.
 * //from  w w w.ja v a2s  .c o  m
 * @param row
 *            the row index
 * @param cell
 *            the cell index
 * @return the Element at the given row and cell
 */
protected Element getCellElement(int row, int cell) {
    Element tr = DOM.getChild(tbody, row);
    Element td = DOM.getChild(tr, cell);
    return DOM.getFirstChild(td);
}

From source file:cc.alcina.framework.gwt.client.widget.dialog.RelativePopupPanel.java

License:Apache License

/**
 * Get the element that {@link PopupImpl} uses. PopupImpl creates an element
 * that goes inside of the outer element, so all methods in PopupImpl are
 * relative to the first child of the outer element, not the outer element
 * itself./* www.j a  va  2s. c o m*/
 * 
 * @return the Element that {@link PopupImpl} creates and expects
 */
private Element getPopupImplElement() {
    return DOM.getFirstChild(super.getContainerElement());
}

From source file:com.ait.toolkit.flash.widget.client.swf.ui.SWFWidget.java

License:Open Source License

protected void onUnload() {
    // GWT.log("onUnload", null);
    getElement().removeChild(DOM.getFirstChild(getElement()));
    isSWFInjected = false;/*from  w w  w .j  a v  a  2s  .c o  m*/
    super.onUnload();
}

From source file:com.ait.toolkit.flash.widget.client.swf.ui.SWFWidget.java

License:Open Source License

public void setHeight(String height) {
    height = height.trim().toLowerCase();
    super.setHeight(height); // Width validation
    GWT.log(getHeight() + " =? " + height, null);
    if (getHeight().equals(height)) {
        if (isSWFInjected) {
            Element elem = DOM.getFirstChild(getElement());
            DOM.setElementAttribute(elem, "height", height);
        }/*from   w ww .  j  a  v a 2 s  . c om*/
    }

}

From source file:com.ait.toolkit.flash.widget.client.swf.ui.SWFWidget.java

License:Open Source License

public void setWidth(String width) {
    width = width.trim().toLowerCase();//from   w ww.j  a v  a 2  s  .c  o m
    super.setWidth(width); // Width validation

    if (getWidth().equals(width)) {
        // throw new RuntimeException("CSS widths should not be negative");

        if (isSWFInjected) {
            Element elem = DOM.getFirstChild(getElement());
            DOM.setElementAttribute(elem, "width", width);
        }
    }
}

From source file:com.eduworks.gwt.client.pagebuilder.PageAssembler.java

License:Apache License

/** Builds everything that has been readied into the rPanelName given in template setup, clears ready list after. */
public static void buildContents() {
    body.clear();/*from   ww w  .  j a v  a 2s. co  m*/
    Element childNode;
    while ((childNode = DOM.getFirstChild(body.getElement())) != null)
        DOM.removeChild(body.getElement(), childNode);

    for (int i = 0; i < contents.size(); i++)
        body.add(contents.get(i));

    //fillSiteName();
    fillBuildNumber();
    runCustomJSHooks();
    contents.clear();
}

From source file:com.eduworks.gwt.client.pagebuilder.PageAssembler.java

License:Apache License

public static void clearContents() {
    iDCounter = 0;//from  www .  j  a  va2  s.  c  om
    body.clear();
    Element childNode;
    while ((childNode = DOM.getFirstChild(body.getElement())) != null)
        DOM.removeChild(body.getElement(), childNode);

    contents.clear();
    RootPanel.get(CONTENT_HEADER).clear();
    RootPanel.get(CONTENT_FOOTER).clear();
    RootPanel.get(rootPanelName).clear();
}

From source file:com.extjs.gxt.ui.client.core.XDOM.java

License:sencha.com license

/**
 * Creates an element form the given markup.
 * //from w w  w .ja v  a  2 s  . c  om
 * @param html the markup
 * @return the new element
 */
public static Element create(String html) {
    Element div = DOM.createDiv();
    DOM.setInnerHTML(div, html);
    Element firstChild = DOM.getFirstChild(div);
    // support text node creation
    return (firstChild != null) ? firstChild : div;
}