Package com.google.gwt.safehtml.shared

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


                    render = VALUE_TEMPLATE.render(labelId, value);
                }
            }
            else
            {
                render = new SafeHtmlBuilder().toSafeHtml();
            }
            safeHtmlBuilder.append(render);
        }
View Full Code Here


            boolean hasValue = icon!=null && !icon.equals("");

            if (hasValue)
            {
                SafeHtmlBuilder builder = new SafeHtmlBuilder();
                builder.appendHtmlConstant("<i class='" + icon + "'></i>");
                render = builder.toSafeHtml();
            }
            else
            {
                render = new SafeHtmlBuilder().toSafeHtml();
            }

            safeHtmlBuilder.append(render);
        }
View Full Code Here


  public HyperlinkCell(SafeHtml message, ActionCell.Delegate<String> delegate) {
    super("click", "keydown");
    this.delegate = delegate;
    this.html = new SafeHtmlBuilder().appendHtmlConstant(
        "<div tabindex=\"-1\" class='gwt-Hyperlink'>").append(message).appendHtmlConstant(
        "</div>").toSafeHtml();
  }
View Full Code Here

    private final static String tableSuffix = "</table>";

    @Override
    public Widget render(RenderMetaData metaData, String groupName, Map<String, FormItem> groupItems)
    {
        SafeHtmlBuilder builder = new SafeHtmlBuilder();
        builder.appendHtmlConstant(tablePrefix);

        // build html structure
        ArrayList<String> itemKeys = new ArrayList<String>(groupItems.keySet());
        ArrayList<FormItem> values = new ArrayList<FormItem>(groupItems.values());

        // Remove the hidden items from both lists. Iterate from the back so that removal doesn't
        // require adjustment of the numbering.
        for (int i=values.size() - 1; i >= 0; i--) {
            if (!values.get(i).render()) {
                values.remove(i);
                itemKeys.remove(i);
            }
        }

        //int colWidth = 100/(metaData.getNumColumns()*2);

        builder.appendHtmlConstant("<colgroup class='cols_"+metaData.getNumColumns()+"'>");
        for(int col=0; col<metaData.getNumColumns(); col++)
        {
            // it's two TD's per item (title & value)
            builder.appendHtmlConstant("<col class='form-item-title-col'/>");
            builder.appendHtmlConstant("<col class='form-item-col'/>");

        }
        builder.appendHtmlConstant("</colgroup>");

        int i=0;
        while(i<itemKeys.size())
        {
            builder.appendHtmlConstant("<tr>");

            int col=0;
            for(col=0; col<metaData.getNumColumns(); col++)
            {
                int next = i + col;
                if(next<itemKeys.size())
                {
                    FormItem item = values.get(next);
                    createItemCell(metaData, builder, itemKeys.get(next), item);
                }
                else
                {
                    break;
                }
            }

            builder.appendHtmlConstant("</tr>");
            i+=col;
        }

        builder.appendHtmlConstant(tableSuffix);

        HTMLPanel panel = new HTMLPanel(builder.toSafeHtml());

        // inline widget
        for(String key : itemKeys)
        {
            FormItem item = groupItems.get(key);
View Full Code Here


  public OptionCell(SafeHtml message, ActionCell.Delegate<String> delegate) {
    super("click", "keydown");
    this.delegate = delegate;
    this.html = new SafeHtmlBuilder().appendHtmlConstant(
        "<div tabindex=\"-1\" class='row-tools'>").append(message).appendHtmlConstant(
        "</div>").toSafeHtml();
  }
View Full Code Here

        this.delegate = delegate;

        this.popup = new PopupPanel();
        this.popup.setStyleName("default-popup");
        this.popup.setWidget(delegate.asWidget());
        this.html = new SafeHtmlBuilder().appendHtmlConstant( "<div tabindex=\"-1\" class='cell-popup'>"+title+"</div>").toSafeHtml();
    }
View Full Code Here

    }

    @Deprecated
    public static void alert(String title, String message)
    {
        alert(title, new SafeHtmlBuilder().appendEscaped(message).toSafeHtml());
    }
View Full Code Here

        html.add(plainView.asWidget(metaData),id);
        return html;
    }

    private HTMLPanel createFieldsetPanel(String groupName) {
        SafeHtmlBuilder builder = new SafeHtmlBuilder();

        builder.appendHtmlConstant("<fieldset id='"+id+"' class='default-fieldset'>");
        builder.appendHtmlConstant("<legend class='default-legend'>").appendEscaped(groupName).appendHtmlConstant("</legend>");
        builder.appendHtmlConstant("</fieldset>");

        return new HTMLPanel(builder.toSafeHtml());
    }
View Full Code Here


        ImageResource icon = MessageCenterView.getSeverityIcon(msg.getSeverity());
        AbstractImagePrototype prototype = AbstractImagePrototype.create(icon);

        SafeHtmlBuilder html = new SafeHtmlBuilder();

        // TODO: XSS prevention?
        html.appendHtmlConstant(prototype.getHTML());
        html.appendHtmlConstant("&nbsp;");
        html.appendHtmlConstant(msg.getFired().toString());
        html.appendHtmlConstant("<h3 id='consise-message'>");
        html.appendHtmlConstant(msg.getConciseMessage());
        html.appendHtmlConstant("</h3>");
        html.appendHtmlConstant("<p/>");

        String detail = msg.getDetailedMessage() != null ? msg.getDetailedMessage() : "";

        html.appendHtmlConstant("<pre style='font-family:tahoma, verdana, sans-serif;' id='detail-message'>");
        html.appendHtmlConstant(detail);
        html.appendHtmlConstant("</pre>");

        final HTML widget = new HTML(html.toSafeHtml());
        widget.getElement().setAttribute("style", "margin:5px");


        DialogueOptions options = new DialogueOptions(
                "OK",
View Full Code Here

        {
            super(Arrow.TOP);

            this.sinkEvents(Event.MOUSEEVENTS);

            SafeHtmlBuilder emptyMessage = new SafeHtmlBuilder();
            emptyMessage.appendHtmlConstant("<div style='padding:10px'>");
            emptyMessage.appendHtmlConstant(Console.CONSTANTS.common_label_noRecentMessages());
            emptyMessage.appendHtmlConstant("</div>");

            MessageCell messageCell = new MessageCell();
            messageList = new DefaultCellList<Message>(messageCell);
            messageList.setTabIndex(-1);
            messageList.addStyleName("message-list");
            messageList.setEmptyListWidget(new HTML(emptyMessage.toSafeHtml()));
            messageList.setKeyboardSelectionPolicy(HasKeyboardSelectionPolicy.KeyboardSelectionPolicy.ENABLED);

            final SingleSelectionModel<Message> selectionModel = new SingleSelectionModel<Message>();
            messageList.setSelectionModel(selectionModel);
            selectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
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.