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.bonitasoft.web.toolkit.client.ui.component.form.entry.FormEntry.java

License:Open Source License

@Override
protected Element makeElement() {
    Boolean isMandatory = false;/*  ww  w.  ja  va 2  s.co  m*/
    final Element entry = DOM.createDiv();
    entry.addClassName("formentry");
    entry.addClassName(getJsId().toString("formentry").toLowerCase());

    this.labelElement = DOM.createDiv();
    this.labelElement.addClassName("label");

    for (final Validator validator : getValidators()) {
        if (validator instanceof MandatoryValidator) {
            isMandatory = true;
            entry.addClassName("mandatory");
            break;
        }
    }

    final Element label = DOM.createLabel();
    label.setInnerText(this.label);
    label.setTitle(this.tooltip);
    label.setAttribute("for", this.uid.toLowerCase());

    if (isMandatory) {
        final Element mandatorySpan = DOM.createSpan();
        mandatorySpan.addClassName("mandatoryflag");
        mandatorySpan.setInnerText("*");
        label.appendChild(mandatorySpan);
    }

    this.labelElement.appendChild(label);

    if (this.description != null) {
        final Element description = DOM.createDiv();
        description.addClassName("description");
        description.setInnerText(this.description);
        this.labelElement.appendChild(description);
    }

    entry.appendChild(this.labelElement);

    final Element body = DOM.createDiv();
    body.addClassName("input");

    final Element input = makeInput(this.uid);

    if (this.inputElement == null) {
        this.inputElement = input;
    }

    body.appendChild(input);

    if (this.example != null) {
        final Element example = DOM.createDiv();
        example.addClassName("example");
        example.setInnerText(this.example);
        body.appendChild(example);
    }

    entry.appendChild(body);

    return entry;
}

From source file:org.bonitasoft.web.toolkit.client.ui.component.form.entry.Page.java

License:Open Source License

@Override
protected void postProcessHtml() {

    this.element.addClassName("wizardpage");

    final Element title = DOM.createElement("h1");
    title.setInnerText(this.title);
    this.element.insertFirst(title);

    if (this.showPrevious) {
        this.element.appendChild(new Button(new JsId("previous"), this.previousTitle, this.previousTooltip,
                new WizardAction(this) {

                    @Override/*from w  w w. j a  v  a 2  s . c o  m*/
                    public void execute() {
                        this.page.previous();
                    }
                }).getElement());
    }

    this.element
            .appendChild(new Button(new JsId("next"), this.nextTitle, this.nextTooltip, new WizardAction(this) {

                @Override
                public void execute() {
                    this.page.next();
                }
            }).getElement());

    if (this.showFinish) {
        this.element.appendChild(
                new Button(new JsId("finish"), this.finishTitle, this.finishTooltip, new WizardAction(this) {

                    @Override
                    public void execute() {
                        this.page.finish();
                    }
                }).getElement());
    }

    this.element.appendChild(
            new Button(new JsId("cancel"), this.cancelTitle, this.cancelTooltip, new WizardAction(this) {

                @Override
                public void execute() {
                    this.page.cancel();
                }
            }).getElement());

    super.postProcessHtml();
}

From source file:org.bonitasoft.web.toolkit.client.ui.component.form.entry.StaticText.java

License:Open Source License

@Override
protected Element makeInput(final String uid) {
    final Element input = DOM.createElement("div");
    input.setInnerText(this.defaultValue);
    input.setAttribute("name", getJsId().toString());
    input.setAttribute("title", this.tooltip);
    input.setId(uid);//  www. ja  v a  2s. co m
    return input;
}

From source file:org.bonitasoft.web.toolkit.client.ui.component.table.TableCell.java

License:Open Source License

@Override
protected Element makeElement() {
    Element rootElement = null;
    if (this.text == null) {
        rootElement = super.makeElement();
        rootElement.addClassName("empty");
    } else {/*ww w  .  java2s. c  o  m*/

        rootElement = DOM.createDiv();
        rootElement.addClassName("td");
        if (this.text.isEmpty()) {
            rootElement.addClassName("empty");
        }
        rootElement.setInnerText(this.text);
    }

    rootElement.addClassName("td_" + this.columnName.toLowerCase());

    return rootElement;
}

From source file:org.bonitasoft.web.toolkit.client.ui.component.table.TableColumn.java

License:Open Source License

/**
 * @see Component#makeElement()//from ww w. j  av a 2 s . c  o m
 * @return This method returns the generated element
 */
@Override
protected final Element makeElement() {
    final Element th = DOM.createElement("div");
    th.addClassName("th " + getJsId().toString("th"));
    th.setInnerText(this.label);

    // Sort on columns
    if (this.sortName != null) {
        th.addClassName("sortable");
        DOM.sinkEvents(th, Event.ONCLICK);
        DOM.setEventListener(th, new Action() {

            @Override
            public void execute() {
                if (TableColumn.this.sorted) {
                    TableColumn.this.sortAscending = !TableColumn.this.sortAscending;
                }
                TableColumn.this.table.setOrder(TableColumn.this.sortName, TableColumn.this.sortAscending);

                TableColumn.this.setSorted(true);

            }
        });
    }

    return th;
}

From source file:org.bonitasoft.web.toolkit.client.ui.page.itemListingPage.ItemListingPage.java

License:Open Source License

private Link createLinkFilter(final ItemListingFilter filter, final ChangeFilterAction action) {
    final Link link = new Link(new JsId(filter.getName().toLowerCase()), filter.getLabel(),
            filter.getTooltip() + (filter.hasAdditionnalInfo() ? " " + filter.getAdditionnalInfo() : ""),
            action);/* ww w .ja v a 2 s  .c  o m*/
    link.forceToolTip();
    action.setLink(link);
    filter.setLink(link);

    if (filter.hasAdditionnalInfo()) {
        final Element span = DOM.createSpan();
        span.setInnerText(filter.getAdditionnalInfo());
        HTML.append(link.getElement(), span);
    }

    if (filter.getImageUrl() != null) {
        final Image image = new Image(new Url("css/transparent.gif"), FILTERS_ICON_SIZE, FILTERS_ICON_SIZE,
                filter.getTooltip());
        if (filter.getImageUrl().isEmpty()) {
            image.addClass("empty");
            HTML.prepend(link.getElement(), image.getElement());
        } else {
            HTML.prepend(link.getElement(),
                    new Image(filter.getImageUrl(), FILTERS_ICON_SIZE, FILTERS_ICON_SIZE, filter.getTooltip())
                            .getElement());
        }
    }
    return link;
}

From source file:org.cruxframework.crux.widgets.client.rollingtabs.SimpleDecoratedPanel.java

License:Apache License

/**
 * @param middleCenterCell2/*from   w ww  .  j av  a2  s  .  c  om*/
 */
private void cleanEmptySpaces(Element cell) {
    String text = cell.getInnerText();

    if (text != null && text.trim().length() == 0) {
        cell.setInnerText("");
    }
}

From source file:org.geomajas.gwt.client.gfx.context.SvgGraphicsContext.java

License:Open Source License

/**
 * Draw a string of text onto the <code>GraphicsContext</code>.
 * /*from w ww .ja va2 s .c o m*/
 * @param parent
 *            parent group object
 * @param name
 *            The text's name.
 * @param text
 *            The actual string content.
 * @param position
 *            The upper left corner for the text to originate.
 * @param style
 *            The styling object for the text.
 */
public void drawText(Object parent, String name, String text, Coordinate position, FontStyle style) {
    if (isAttached()) {
        Element element = helper.createOrUpdateElement(parent, name, "text", style);
        if (text != null) {
            element.setInnerText(text);
        }

        if (position != null) {
            int fontSize = 12;
            if (style != null) {
                fontSize = style.getFontSize();
            }
            Dom.setElementAttribute(element, "x", Double.toString(position.getX()));
            Dom.setElementAttribute(element, "y", Double.toString(position.getY() + fontSize));
        }
    }
}

From source file:org.geomajas.sld.editor.expert.gwt2.client.SldEditorCustomToolBarButton.java

License:Open Source License

@Override
public void setText(String text) {

    this.text = text;
    Element span = DOM.createElement("span");
    span.setInnerText(text);
    DOM.insertChild(getElement(), span, 1);

}

From source file:org.hudsonci.gwt.common.ImageTextButton.java

License:Open Source License

@Override
public void setText(final String text) {
    this.text = text;
    Element span = DOM.createElement("span");
    span.setInnerText(text);
    span.setAttribute("style", "padding-left:3px; vertical-align:middle;");
    DOM.insertChild(getElement(), span, 0);
}