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:us.softoption.tree.TTreeCustomCell.java

License:Open Source License

public void renderString(String valueStr, SafeHtmlBuilder sb) {

    //There are some special cases   

    if (valueStr.equals("Center"))
        ; //sb.appendHtmlConstant(svgWild/*svgCenter*/);
    else if (valueStr.equals("Horizontal")) {
        //valueStr="";
        sb.appendHtmlConstant(svgHorizontal);
        //   SafeHtml safeValue = SafeHtmlUtils.fromString(svgHorizontal); // make the unchanged valueStr safe
        //   sb.append(safeValue);              // not a TGWT node   

    } else if (valueStr.equals("Vertical")) {
        sb.appendHtmlConstant(svgVertical);

    } else if (valueStr.equals("LeftDiag")) {
        sb.appendHtmlConstant(svgLeftDiag);

    } else if (valueStr.equals("RightDiag")) {
        sb.appendHtmlConstant(svgRightDiag);

    } else {/*  ww  w.ja  v a2 s  .  c  o  m*/

        SafeHtml safeValue = SafeHtmlUtils.fromString(valueStr); // make the unchanged valueStr safe
        sb.append(safeValue); // not a TGWT node   

    }

}

From source file:us.softoption.tree.TTreeCustomCell.java

License:Open Source License

public void renderLabel(TGWTTestNode value, SafeHtmlBuilder sb) {

    if (value.fLabelOnly) {
        if (value.fLabel.equals("LeftDiag"))
            sb.appendHtmlConstant(svgLeftDiag);
        else if (value.fLabel.equals("RightDiag"))
            sb.appendHtmlConstant(svgRightDiag);
        else if (value.fLabel.equals("Vertical"))
            sb.appendHtmlConstant(svgVertical);

        /*//from   w  ww.j  av a  2  s .  c om
                  if (value.fLabel.equals("LeftDiag")){
                      sb.appendHtmlConstant(svgLeftDiag/*"<canvas id=\"c\" style=\"border: 1px solid #F00;\" " +
                 "width=\"50\" height=\"20\"></canvas>" +
                 "<script type=\"text/javascript\"> " +
                 "var c=document.getElementById(\"c\");" +
                 "var ctx=c.getContext(\"2d\");" +
                 "ctx.fillStyle=\"red\";" +
                 "ctx.fillRect(0,0,20,20); </script>"); 
                   }
                   else if (value.fLabel.equals("RightDiag")){
             sb.appendHtmlConstant(svgRightDiag
                           
                  //*"<canvas id=\"d\" style=\"border: 1px solid #F00;\" " +
                      //  "width=\"50\" height=\"20\"></canvas>");   
                       
                   } */
    }

}