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

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

Introduction

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

Prototype

@Override
    public void setInnerText(String text) 

Source Link

Usage

From source file:org.openstreetmap.beboj.client.Beboj.java

License:GNU General Public License

private void configureDebugElements() {
    tb = new ToggleButton("Enable exteded debug log");
    RootPanel.get("left").add(tb);

    PushButton pb = new PushButton("Clear quick log");
    pb.addClickHandler(new ClickHandler() {
        @Override/*  ww w .  j av  a2  s  .co  m*/
        public void onClick(ClickEvent event) {
            Element log = RootPanel.get("log").getElement();
            log.setInnerText("");
        }
    });
    RootPanel.get("left").add(pb);
}

From source file:org.openstreetmap.beboj.client.Beboj.java

License:GNU General Public License

public static void log(String s) {
    Element log = RootPanel.get("log").getElement();
    String txt = log.getInnerText();
    if (log.getClientWidth() > 800)
        txt = "";
    log.setInnerText(txt + s);
}

From source file:org.overlord.commons.gwt.client.local.widgets.SortableTemplatedWidgetTable.java

License:Apache License

/**
 * Sets a column in the table to be sortable.  This will convert the content in the
 * "th" to be something the user can click on.  When the user clicks on it, the
 * internal state of the table will be altered *and* an event will be fired.
 * @param columnIndex/*from w w  w. j  a v a 2 s  . c  om*/
 * @param columnId
 */
public void setColumnSortable(int columnIndex, final String columnId) {
    Element thElement = null;
    NodeList<com.google.gwt.dom.client.Element> elementsByTagName = this.thead.getElementsByTagName("th"); //$NON-NLS-1$
    if (columnIndex <= elementsByTagName.getLength()) {
        thElement = elementsByTagName.getItem(columnIndex).cast();
    }
    if (thElement == null) {
        return;
    }

    String columnLabel = thElement.getInnerText();
    thElement.setInnerText(""); //$NON-NLS-1$

    SortableTableHeader widget = new SortableTableHeader(columnLabel, columnId);
    widget.removeFromParent();
    DOM.appendChild(thElement, widget.getElement());
    adopt(widget);
    widget.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            onColumnHeaderClick(columnId);
        }
    });
    columnIdMap.put(columnId, widget);
}

From source file:org.overlord.commons.gwt.client.local.widgets.WidgetTable.java

License:Apache License

/**
 * Creates the thead and th elements, with the given labels.
 * @param labels//from   w  ww . j  a  va  2s  . co m
 */
public void setColumnLabels(String... labels) {
    this.columnCount = labels.length;
    for (String label : labels) {
        Element thElement = Document.get().createTHElement().cast();
        thElement.setInnerText(label);
        DOM.appendChild(thead, thElement);
    }
}

From source file:org.seamless.gwt.component.client.widget.ImageTextButton.java

License:Open Source License

@Override
public void setText(String text) {
    this.text = text;
    Element span = DOM.createElement(centered ? "div" : "span");
    span.setInnerText(text);
    if (centered) {
        span.setAttribute("style", "white-space:nowrap; padding-top:0.2em; vertical-align:middle;");
    } else {//from   w w  w .j av  a 2s  . c o  m
        span.setAttribute("style", "white-space:nowrap; padding-left:0.5em; vertical-align:middle;");
    }
    DOM.insertChild(getElement(), span, 0);
}

From source file:org.spiffyui.client.widgets.dialog.Dialog.java

License:Apache License

/**
 * Replaces the inner text of the title.  Note: This can only be
 * called if the dialog is showing because otherwise it will be null.
 * @param title - the new title//from ww  w .jav  a 2 s . com
 */
public void replaceTitle(String title) {
    if (isVisible()) {
        Element e = DOM.getElementById(m_id + "_title");
        e.setInnerText(title);
    }
}

From source file:org.talend.mdm.webapp.stagingareabrowser.client.view.ResultsView.java

License:Open Source License

@Override
protected void registerEvent() {
    resultGrid.addListener(Events.RowDoubleClick, new Listener<GridEvent<ResultItem>>() {

        @Override/*from w w  w .j a  va2s . com*/
        public void handleEvent(GridEvent<ResultItem> ge) {
            ResultItem item = ge.getGrid().getStore().getAt(ge.getRowIndex());
            StringBuffer title = new StringBuffer();
            title.append(item.getEntity() + " "); //$NON-NLS-1$
            title.append(item.getKey() + " "); //$NON-NLS-1$

            if (ucx.getDateTimeFormat() != null && !"".equals(ucx.getDateTimeFormat())) { //$NON-NLS-1$
                title.append(DateTimeFormat.getFormat(ucx.getDateTimeFormat()).format(item.getDateTime()));
            }
            StringBuffer message = new StringBuffer();
            String color = "green"; //$NON-NLS-1$
            if (item.getStatus() >= 400) {
                color = "red"; //$NON-NLS-1$
            }
            message.append("<div style='width: 400px; margin-left: 50px;'>"); //$NON-NLS-1$
            message.append("<b style='color: " + color + ";'>" + item.getStatus() + ": " //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
                    + errorTitles.get(item.getStatus()) + "</b>"); //$NON-NLS-1$

            if (item.getStatus() >= 400) {
                Element el = DOM.createDiv();
                el.setInnerText(item.getError());
                message.append("<div style='margin-top: 5px; width: 380px; height: 100px; overflow: auto;'>"); //$NON-NLS-1$
                message.append(el.getInnerHTML());
                message.append("</div>"); //$NON-NLS-1$
            }

            message.append("</div>"); //$NON-NLS-1$
            if (item.getStatus() >= 400) {
                MessageBox.alert(title.toString(), message.toString(), null).getDialog().setWidth(500);
            } else {
                MessageBox.info(title.toString(), message.toString(), null).getDialog().setWidth(500);
            }
        }
    });
}

From source file:us.asciiroth.editor.client.ui.Fieldset.java

License:Apache License

public Fieldset(String legendText) {
    setElement(DOM.createFieldSet());/*from  ww w  . jav a2  s .  c o m*/
    setStyleName("n-metadata");
    Element legend = DOM.createLegend();
    legend.setInnerText(legendText);
    getElement().appendChild(legend);
}