Package com.google.gwt.safehtml.shared

Examples of com.google.gwt.safehtml.shared.SafeHtmlBuilder


  public void testRenderViewDataDisabledUnchecked() {
    CheckboxCell cell = createCell();
    cell.setEnabled(false);
    Boolean value = Boolean.FALSE;
    cell.setViewData(DEFAULT_KEY, createCellViewData());
    SafeHtmlBuilder sb = new SafeHtmlBuilder();
    Context context = new Context(0, 0, DEFAULT_KEY);
    cell.render(context, value, sb);
    String expectedInnerHtmlViewData = getExpectedInnerHtmlViewDisabled();
    String asString = sb.toSafeHtml().asString();
    assertEquals(expectedInnerHtmlViewData, asString);
  }
View Full Code Here


     
      static public String buildHtmlHeader(HashMap<String, XmlListAchievement> hashMapAch, String nameAch) {
        //String nameAch = "Beasthunter";
        XmlListAchievement ach = hashMapAch.get(nameAch+".png");
          String title2 = ach.getDESCRIPTION().getVALUE();
        SafeHtmlBuilder sb = new SafeHtmlBuilder();
        String html = "<div id=\"achievement\" >" + " <div class=\"floatleft\"> " +    title2 + "</div>";
        return html;
      }
View Full Code Here

     
      static public String buildHtmlHeader(HashMap<String, XmlListAchievement> hashMapAch, String nameAch) {
        //String nameAch = "Beasthunter";
        XmlListAchievement ach = hashMapAch.get(nameAch+".png");
          String title2 = ach.getDESCRIPTION().getVALUE();
        SafeHtmlBuilder sb = new SafeHtmlBuilder();
        String html = "<div id=\"achievement\" >" + " <div class=\"floatleft\"> " +    title2 + "</div>";
        return html;
      }
View Full Code Here

         new AbstractSafeHtmlRenderer<String>()
         {
            @Override
            public SafeHtml render(String object)
            {
               SafeHtmlBuilder sb = new SafeHtmlBuilder();
               sb.appendHtmlConstant(object);
               return sb.toSafeHtml();
            }
         };
      objectExpandColumn_ = new Column<RObjectEntry, String>(
         new ClickableTextCell(expanderRenderer))
         {
View Full Code Here

      menu.showRelativeToUpward((UIObject) statusBar_.getScope());
   }
  
   private MenuItem createMenuItemForType(final TextFileType type)
   {
      SafeHtmlBuilder labelBuilder = new SafeHtmlBuilder();
      labelBuilder.appendEscaped(type.getLabel());

      MenuItem menuItem = new MenuItem(
         labelBuilder.toSafeHtml(),
         new Command()
         {
            public void execute()
            {
               docUpdateSentinel_.changeFileType(
View Full Code Here

         final Scope func = funcs.get(i);

         String childIndent = indent;
         if (!StringUtil.isNullOrEmpty(func.getLabel()))
         {
            SafeHtmlBuilder labelBuilder = new SafeHtmlBuilder();
            labelBuilder.appendHtmlConstant(indent);
            labelBuilder.appendEscaped(func.getLabel());

            final MenuItem menuItem = new MenuItem(
                  labelBuilder.toSafeHtml(),
                  new Command()
                  {
                     public void execute()
                     {
                        docDisplay_.navigateToPosition(toSourcePosition(func),
View Full Code Here

              
               StringBuilder indentBuilder = new StringBuilder();
               for (int level=0; level<item.getIndent(); level++)
                  indentBuilder.append("&nbsp;&nbsp;");
              
               SafeHtmlBuilder labelBuilder = new SafeHtmlBuilder();
               labelBuilder.appendHtmlConstant(indentBuilder.toString());
               labelBuilder.appendEscaped(title);

               final int targetSlide = i;
               final MenuItem menuItem = new MenuItem(
                  labelBuilder.toSafeHtml(),
                  new Command()
                  {
                     public void execute()
                     {
                        navigateToSlide(editor, targetSlide);
View Full Code Here

      filterRenderer_ = new AbstractSafeHtmlRenderer<String>()
      {
         @Override
         public SafeHtml render(String str)
         {
            SafeHtmlBuilder sb = new SafeHtmlBuilder();
            boolean hasMatch = false;
            String filterText = host_.getFilterText();
            if (filterText.length() > 0)
            {
               int idx = str.toLowerCase().indexOf(filterText);
               if (idx >= 0)
               {
                  hasMatch = true;
                  sb.appendEscaped(str.substring(0, idx));
                  sb.appendHtmlConstant(
                        "<span class=\"" +
                        environmentStyle_.filterMatch() +
                        "\">");
                  sb.appendEscaped(str.substring(idx,
                        idx + filterText.length()));
                  sb.appendHtmlConstant("</span>");
                  sb.appendEscaped(str.substring(idx + filterText.length(),
                        str.length()));
               }
            }
            if (!hasMatch)
               sb.appendEscaped(str);
            return sb.toSafeHtml();
         }
      };
   }
View Full Code Here

   }

   @Override
   public void updateSearchLabel(String query, String path)
   {
      SafeHtmlBuilder builder = new SafeHtmlBuilder();
      builder.appendEscaped("Results for ")
            .appendHtmlConstant("<strong>")
            .appendEscaped(query)
            .appendHtmlConstant("</strong>")
            .appendEscaped(" in ")
            .appendEscaped(path);
      searchLabel_.getElement().setInnerHTML(builder.toSafeHtml().asString());
   }
View Full Code Here

      return getJavaArray("matchOff");
   }

   public final SafeHtml getLineHTML()
   {
      SafeHtmlBuilder out = new SafeHtmlBuilder();

      ArrayList<Integer> on = getMatchOns();
      ArrayList<Integer> off = getMatchOffs();
      ArrayList<Pair<Boolean, Integer>> parts
                                      = new ArrayList<Pair<Boolean, Integer>>();
      while (on.size() + off.size() > 0)
      {
         int onVal = on.size() == 0 ? Integer.MAX_VALUE : on.get(0);
         int offVal = off.size() == 0 ? Integer.MAX_VALUE : off.get(0);
         if (onVal <= offVal)
            parts.add(new Pair<Boolean, Integer>(true, on.remove(0)));
         else
            parts.add(new Pair<Boolean, Integer>(false, off.remove(0)));
      }

      String line = getLineValue();

      // Use a counter to ensure tags are balanced.
      int openTags = 0;

      for (int i = 0; i < line.length(); i++)
      {
         while (parts.size() > 0 && parts.get(0).second == i)
         {
            if (parts.remove(0).first)
            {
               out.appendHtmlConstant("<strong>");
               openTags++;
            }
            else if (openTags > 0)
            {
               out.appendHtmlConstant("</strong>");
               openTags--;
            }
         }
         out.append(line.charAt(i));
      }

      while (openTags > 0)
      {
         openTags--;
         out.appendHtmlConstant("</strong>");
      }

      return out.toSafeHtml();
   }
View Full Code Here

TOP

Related Classes of com.google.gwt.safehtml.shared.SafeHtmlBuilder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.