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

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

Introduction

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

Prototype

@Override
    public void setInnerHTML(String html) 

Source Link

Usage

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

License:Open Source License

protected boolean beforeExpand(ModelData model, Element body, El row, int rowIndex) {
    if (fireEvent(Events.BeforeExpand)) {
        body.setInnerHTML(getBodyContent(model, rowIndex));
        return true;
    }/*from  w  w  w . ja v a  2s . c  o m*/
    return false;
}

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

License:Open Source License

protected void render() {
    scrollBarWidth = XDOM.getScrollBarWidth();

    Element div = DOM.createDiv();

    div.setInnerHTML(bodyHTML.toString());
    scrollEl = new El(El.fly(div).getSubChild(2));
    dataEl = scrollEl.firstChild();//from   w w w  .  j  av  a  2  s. c  o m
    DOM.appendChild(table.getElement(), DOM.getFirstChild(div));

    if (table.getVerticalLines()) {
        table.addStyleName("my-tbl-vlines");
    }

    if (!GXT.isIE) {
        DOM.setElementPropertyInt(table.getElement(), "tabIndex", 0);
    }

    DOM.sinkEvents(scrollEl.dom, Event.ONSCROLL);

    if (!GXT.isGecko) {
        table.disableTextSelection(true);
    }

    table.el().addEventsSunk(Event.ONCLICK | Event.ONDBLCLICK | Event.MOUSEEVENTS | Event.KEYEVENTS);
}

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

License:Open Source License

protected void renderItemValue(TableItem item, int index, Object value) {
    Element textElem = getTextCellElement(item, index);
    if (textElem != null) {
        Element child = DOM.getChild(textElem, 0);
        if (child != null) {
            DOM.removeChild(textElem, DOM.getChild(textElem, 0));
        }//from ww  w .jav  a2  s  . com
        DOM.setInnerHTML(textElem, "");
        if (value instanceof Widget) {
            Widget widget = (Widget) value;
            textElem.setClassName(widgetStyle);
            DOM.appendChild(textElem, widget.getElement());
            if (table.isAttached()) {
                ComponentHelper.doAttach(widget);
            }
        } else {
            String s = table.getRenderedValue(item, index, value);
            textElem.setInnerHTML(s);
        }
    }
    applyCellStyles(item);
}

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

License:sencha.com license

protected void renderChildren(M parent) {
    StringBuilder markup = new StringBuilder();
    int depth = store.getDepth(parent);
    List<M> children = parent == null ? store.getRootItems() : store.getChildren(parent);
    if (children.size() == 0) {
        return;//from  www. j a va2s  . c  om
    }

    for (M child : children) {
        register(child);
    }
    for (int i = 0; i < children.size(); i++) {
        markup.append(renderChild(parent, children.get(i), depth, TreeViewRenderMode.MAIN));
    }
    Element container = getContainer(parent);
    container.setInnerHTML(markup.toString());

    for (int i = 0; i < children.size(); i++) {
        M child = children.get(i);
        TreeNode node = findNode(child);

        if (autoExpand) {
            setExpanded(child, true);
        } else if (node.expand && !node.isLeaf()) {
            node.expand = false;
            setExpanded(child, true);
        } else if (loader != null) {
            if (autoLoad) {
                if (store.isFiltered()) {
                    renderChildren(child);
                } else {
                    if (loader.hasChildren(child)) {
                        loader.loadChildren(child);
                    }
                }
            }
        } else if (autoLoad) {
            renderChildren(child);
        }
    }

    TreeNode n = findNode(parent);
    if (n != null) {
        onCheckCascade(n.m, n.checked);
        n.childrenRendered = true;
    }
    if (parent == null) {
        ensureFocusElement();
    }
    update();
}

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

License:sencha.com license

public void onTextChange(TreeNode node, SafeHtml text) {
    Element textEl = getTextElement(node);
    if (textEl != null) {
        String html = text.asString();
        textEl.setInnerHTML(Util.isEmptyString(html) ? "&#160;" : html);
    }/*from   www . j av  a2 s .c om*/
}

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

License:Open Source License

protected void updateText(int column, String value) {
    Element textElem = getTextCellElement(column);
    if (textElem != null) {
        textElem.setInnerHTML(value);
    }/*from   w w w .  ja  v a  2 s .c  o  m*/
}

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

License:Open Source License

protected void renderItemValue(TreeTableItem item, int index, Object value) {
    Element textElem = getTextCellElement(item, index);
    if (textElem != null) {
        DOM.setInnerHTML(textElem, "");
        if (value instanceof Widget) {
            Widget widget = (Widget) value;
            textElem.setClassName(widgetStyle);
            DOM.appendChild(textElem, widget.getElement());
            if (treeTable.isAttached()) {
                ComponentHelper.doAttach(widget);
            }/*www  .  j  a  va 2  s.  c  o m*/
        } else {
            String s = treeTable.getRenderedValue(item, index, value);
            textElem.setInnerHTML(s);
        }
    }
    applyCellStyles(item);
}

From source file:com.gwt2go.dev.client.ui.widget.DialogBoxExt.java

License:Apache License

/**
 * Makes a new caption and replace the old one.
 * //w w  w  . ja  v  a  2  s . co  m
 * @param txt
 * @param w
 */
private void setCaption(String txt, Widget w) {
    captionPanel.setWidth("100%");
    captionPanel.add(new HTML(txt));
    captionPanel.add(w);
    captionPanel.setCellHorizontalAlignment(w, HasHorizontalAlignment.ALIGN_RIGHT);
    // make sure that only when you click on this icon the widget will be 
    // closed!, don't make the field too width
    captionPanel.setCellWidth(w, "1%");
    captionPanel.addStyleName("Caption");

    // Get the cell element that holds the caption
    Element td = getCellElement(0, 1);

    // Remove the old caption
    td.setInnerHTML("");

    // append our horizontal panel
    td.appendChild(captionPanel.getElement());
}

From source file:com.spaceapplications.vaadin.addon.eventtimeline.gwt.client.VEventLabel.java

public VEventLabel(VEvent event, float w, float h) {
    this.event = event;

    setStylePrimaryName(VEventTimelineDisplay.CLASSNAME_EVENT);

    final Element caption = DOM.createDiv();
    // FIXME: the limits to show the caption are hard-coded by now
    if (w > 45 && h > 20) {
        caption.setInnerText(Util.escapeHTML(event.getCaption()));
    } else {/*from  w  w  w  .j  ava2 s .  co m*/
        caption.setInnerHTML("");
    }

    caption.addClassName(VEventTimelineDisplay.CLASSNAME_EVENT_CAPTION);
    getElement().appendChild(caption);

    Element eventContent = DOM.createDiv();
    eventContent.addClassName(VEventTimelineDisplay.CLASSNAME_EVENT_CONTENT);
    eventContent.setInnerHTML(event.getDescription());
    getElement().appendChild(eventContent);

    if (event.getStyleName() != null && event.getStyleName().length() > 0) {
        addStyleName(event.getStyleName());
    }

    setWidth(w + "px");
    setHeight(h + "px");
}

From source file:com.tensegrity.wpalo.client.ui.widgets.SeparatorField.java

License:Open Source License

@Override
protected void onRender(Element parent, int index) {
    Element sep = DOM.createElement("sep");
    sep.setInnerHTML("<hr>");
    setElement(sep, parent, index);//from w w w  . j  a  v  a  2s . c o m
}