Example usage for com.google.gwt.safehtml.shared SafeHtmlBuilder appendHtmlConstant

List of usage examples for com.google.gwt.safehtml.shared SafeHtmlBuilder appendHtmlConstant

Introduction

In this page you can find the example usage for com.google.gwt.safehtml.shared SafeHtmlBuilder appendHtmlConstant.

Prototype

public SafeHtmlBuilder appendHtmlConstant(String html) 

Source Link

Document

Appends a compile-time-constant string, which will not be escaped.

Usage

From source file:org.ssgwt.client.ui.datagrid.column.ImageHoverColumn.SSHoverImageCell.java

License:Apache License

/**
 * This will create a image with the url passed in by the constructor and also on hover
 * of the image display a popup.//from w  w w .j av a2 s.  c  om
 *
 * @author Alec Erasmus <alec.erasmus@a24group.com>
 * @since  31 May 2013
 *
 * @param context -The context the cell is in
 * @param value - The value of the object that will be displayed in the popup
 * @param sb -The safe html builder.
 */
@Override
public void render(Context context, T value, SafeHtmlBuilder sb) {

    image = this.column.getImage(value);
    image.getElement().setAttribute("name", CELL_IMAGE_NAME);

    sb.append(template.openContainerTag());
    sb.appendHtmlConstant(image.toString());
    sb.append(template.closeContainerTag());
}

From source file:org.ssgwt.client.ui.datagrid.column.SSBooleanImageCell.java

License:Apache License

/**
 * This will create a image with the url passed in by the constructor
 *
 * @author Alec Erasmus <alec.erasmus@a24group.com>
 * @since 02 April 2013/*w ww  .j av  a 2s  . co m*/
 *
 * @param context -The context the cell is in
 * @param value - The value to be added in the cell but not the image thats going to be displayed
 * @param sb -The safe html builder.
 */
@Override
public void render(Context context, Boolean value, SafeHtmlBuilder sb) {
    String columnContentString = "";
    if (value == null) {
        value = false;
    }
    if (value && trueImageUrl != null) {
        columnContentString = "<img src='" + trueImageUrl + "' />";
    } else if (!value && falseImageUrl != null) {
        columnContentString = "<img src='" + falseImageUrl + "' />";
    }
    sb.appendHtmlConstant("<div>" + columnContentString + "</div>");
}

From source file:org.ssgwt.client.ui.datagrid.column.SSTextCell.java

License:Apache License

/**
 * This will create a label with text and a tooltip with the same text value
 *
 * @author Ruan Naude <nauderuan777@gmail.com>
 * @since 14 March 2013/*  w  w w .ja va2 s.  c  om*/
 *
 * @param context -The context the cell is in
 * @param value - The value to be added in the cell
 * @param sb -The safe html builder.
 */
@Override
public void render(Context context, String value, SafeHtmlBuilder sb) {
    if (value == null) {
        value = "";
    }
    sb.appendHtmlConstant("<div title=\"" + value + "\" >" + value + "</div>");
}

From source file:org.ssgwt.client.ui.datagrid.FilterSortCell.java

License:Apache License

/**
 * The function that renders the content of the Cell
 *//*from  w w  w . j  av a2s  .  c  o  m*/
@Override
public void render(Context context, HeaderDetails value, SafeHtmlBuilder sb) {
    this.headerDetails = value;
    this.filterActive = headerDetails.filterWidget.isFilterActive();
    if (filterActive) {
        filterImage = new Image(resources.filterIconActive());
    } else {
        filterImage = new Image(resources.filterIconInactive());
    }
    if (value.filterWidget != null) {
        value.filterWidget.setParentHeader(this);
    }
    filterImage.getElement().setAttribute("name", "filterIcon");
    sb.append(template.openContainerTag());
    sb.append(template.openContainerTagWithPadding());
    sb.append(template.openInlineContainerTag());
    sb.appendHtmlConstant(filterImage.toString());
    sb.append(template.closeContainerTag());
    sb.append(template.header(value.label));
    sb.append(template.closeContainerTag());
    sb.append(template.closeContainerTag());
}

From source file:org.ssgwt.client.ui.datagrid.HelpCell.java

License:Apache License

/**
 * The function that renders the content of the Cell
 * /*from   ww w  .  j  a v a 2s . c  o m*/
 * @author Ruan Naude<ruan.naude@a24group.com>
 * @since 4 July 2012
 */
@Override
public void render(Context context, Widget value, SafeHtmlBuilder sb) {
    helpImage = new Image(resources.helpIconUp());
    this.helpWidget = value;

    sb.append(template.openContainerTag());
    sb.appendHtmlConstant(helpImage.toString());
    sb.append(template.closeContainerTag());
}

From source file:org.ssgwt.client.ui.datagrid.SelectAllCell.java

License:Apache License

/**
 * The function that renders the content of the Cell
 *//*from   ww  w .  j a va  2  s  .  c o m*/
@Override
public void render(Context context, String value, SafeHtmlBuilder sb) {
    if (filterActive) {
        filterImage = new Image(resources.filterIconActive());
    } else {
        filterImage = new Image(resources.filterIconInactive());
    }
    sb.append(template.openContainerTag());
    sb.appendHtmlConstant(filterImage.toString());
    sb.append(template.closeContainerTag());
}

From source file:org.switchyard.console.client.ui.common.PercentageBarCell.java

License:Apache License

@Override
public void render(com.google.gwt.cell.client.Cell.Context context, Double value, SafeHtmlBuilder sb) {
    _barControl.setRatio(1.0, value);//ww  w .  ja v  a 2 s  .  c  o m
    sb.appendHtmlConstant(_widget.toString());
}

From source file:org.uberfire.ext.plugin.client.widget.cell.IconCell.java

License:Apache License

@Override
protected void render(Context context, SafeHtml data, SafeHtmlBuilder sb) {
    Icon icon = GWT.create(Icon.class);
    if (tooltip != null) {
        icon.setTitle(tooltip);//from   w w  w .  j a  v  a2s  .c o  m
    }
    icon.setSize(iconSize);
    icon.setType(iconType);
    sb.appendHtmlConstant(icon.getElement().getString());
}

From source file:org.uberfire.ext.widgets.common.client.tables.PopoverTextCell.java

License:Apache License

@Override
protected void render(Context context, SafeHtml data, SafeHtmlBuilder sb) {
    hideAllPopover();/*  ww  w .j av  a  2 s .  c om*/
    final String content = data.asString();
    if (Strings.isNullOrEmpty(content)) {
        return;
    }

    final Element div = DOM.createDiv();
    div.setId(DOM.createUniqueId());
    div.setInnerHTML(content);
    div.getStyle().setOverflow(Style.Overflow.HIDDEN);
    div.getStyle().setTextOverflow(Style.TextOverflow.ELLIPSIS);
    div.getStyle().setWhiteSpace(Style.WhiteSpace.NOWRAP);
    final String html = div.getString();
    sb.appendHtmlConstant(html);

    Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() {
        @Override
        public void execute() {
            initPopover(div.getId(), placement.name().toLowerCase());
        }
    });
}

From source file:org.uberfire.ext.widgets.common.client.tables.SortableHeader.java

License:Apache License

@Override
public void render(Cell.Context context, SafeHtmlBuilder sb) {
    sb.appendHtmlConstant("<div style='position: relative; cursor: pointer; padding: 0px;'>");
    sb.appendHtmlConstant("<span style='padding-right: 10px'>");
    sb.appendEscaped(text);/*w  ww  .j  a v a2 s  .  co m*/
    sb.appendHtmlConstant("</span>");
    // sb.appendHtmlConstant("<div style='position:absolute;right:0px;top:0px;'></div>");
    switch (sortDirection) {
    case NONE:
        // nothing
        break;
    case ASCENDING:
        sb.appendHtmlConstant(sortIndex == 0 ? UP_ARROW : SMALL_UP_ARROW);
        break;
    case DESCENDING:
        sb.appendHtmlConstant(sortIndex == 0 ? DOWN_ARROW : SMALL_DOWN_ARROW);
        break;
    default:
        throw new IllegalArgumentException("Unknown sortDirection (" + sortDirection + ").");
    }
    sb.appendHtmlConstant("</div>");
    // sb.appendHtmlConstant("<div>");
    // sb.appendHtmlConstant("</div></div>");
}