List of usage examples for com.google.gwt.safehtml.shared SafeHtmlBuilder appendHtmlConstant
public SafeHtmlBuilder appendHtmlConstant(String html)
From source file:org.jboss.as.console.client.teiid.widgets.DefaultPopUpWindow.java
License:Open Source License
public DefaultPopUpWindow(String title, String content) { super(title); setWidth(500);/*w w w . j a va 2 s . c o m*/ setHeight(400); addCloseHandler(new CloseHandler<PopupPanel>() { @Override public void onClose(CloseEvent<PopupPanel> event) { } }); center(); // Add a close button at the bottom of the dialog HorizontalPanel closePanel = new HorizontalPanel(); closePanel.getElement().setAttribute("style", "margin-top:10px;width:100%"); Button closeButton = new Button("Close", new ClickHandler() { public void onClick(ClickEvent event) { hide(); } }); closePanel.add(closeButton); closeButton.getElement().setAttribute("style", "min-width:60px;"); closeButton.getElement().getParentElement().setAttribute("align", "right"); closeButton.getElement().getParentElement().setAttribute("width", "100%"); SafeHtmlBuilder html = new SafeHtmlBuilder(); html.appendHtmlConstant("<pre style='font-family:tahoma, verdana, sans-serif;' id='detail-message'>"); html.appendHtmlConstant(content == null ? "No Content Available" : content); html.appendHtmlConstant("</pre>"); final HTML widget = new HTML(html.toSafeHtml()); widget.getElement().setAttribute("style", "margin:5px"); Widget windowContent = new WindowContentBuilder(widget, closePanel).build(); TrappedFocusPanel trap = new TrappedFocusPanel(windowContent) { @Override protected void onAttach() { super.onAttach(); Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() { @Override public void execute() { getFocus().onFirstButton(); } }); } }; setWidget(trap); center(); }
From source file:org.jboss.as.console.client.teiid.widgets.TextAreaCell.java
License:Open Source License
@Override public void render(Context context, SafeHtml value, SafeHtmlBuilder sb) { sb.appendHtmlConstant("<div style=\"overflow-y: auto;white-space: normal;height: 25px;\" >"); if (value != null) { sb.append(value);/*www .j a va 2s. c o m*/ } sb.appendHtmlConstant("</div>"); }
From source file:org.jboss.as.console.client.v3.deployment.Templates.java
License:Open Source License
static SafeHtml contentPreview(final Content content) { String managed = "No"; String archive = "Yes"; if (content.get("managed").asBoolean()) managed = "Yes"; if (content.get("content").get(0).hasDefined("archive") && !content.get("content").get(0).get("archive").asBoolean()) { archive = "No"; }/*from w ww. ja v a2s .c om*/ if (content.getAssignments().isEmpty()) { return PREVIEWS.unassignedContent(content.getName(), managed, archive); } else { SafeHtmlBuilder details = new SafeHtmlBuilder(); details.appendHtmlConstant("<ul>"); for (Assignment assignment : content.getAssignments()) { details.appendHtmlConstant("<li>").appendEscaped(assignment.getServerGroup()) .appendHtmlConstant("</li>"); } details.appendHtmlConstant("</ul>"); return PREVIEWS.content(content.getName(), details.toSafeHtml(), managed, archive); } }
From source file:org.jboss.as.console.client.v3.deployment.Templates.java
License:Open Source License
static SafeHtml serverGroupPreview(final ServerGroupRecord serverGroup, int deployments) { SafeHtmlBuilder builder = new SafeHtmlBuilder(); builder.appendHtmlConstant("<p>"); if (deployments == -1) { builder.appendEscaped("Deployments for server group ").appendEscaped(serverGroup.getName()) .appendEscaped(" cannot be read."); } else if (deployments == 0) { builder.appendEscaped("Server group ").appendEscaped(serverGroup.getName()) .appendEscaped(" does not contain deployments."); } else {// w ww .j av a 2s. com builder.appendEscaped("Server group ").appendEscaped(serverGroup.getName()).appendEscaped(" contains ") .append(deployments).appendEscaped(" deployment(s)."); } builder.appendHtmlConstant("</p>"); return PREVIEWS.serverGroup(builder.toSafeHtml()); }
From source file:org.jboss.as.console.client.v3.deployment.Templates.java
License:Open Source License
static SafeHtml deploymentPreview(final Deployment deployment) { SafeHtmlBuilder enabledDisabledBuilder = new SafeHtmlBuilder(); if (deployment.isEnabled()) { PreviewState.good(enabledDisabledBuilder, "Deployment is enabled"); } else {//from w w w .j a v a2 s. c o m PreviewState.paused(enabledDisabledBuilder, "Deployment is disabled"); } SafeHtmlBuilder details = new SafeHtmlBuilder(); details.appendHtmlConstant("<h3>").appendEscaped("Overview").appendHtmlConstant("</h3>") .appendHtmlConstant("<ul>"); if (deployment.getEnabledTime() != null) { details.appendHtmlConstant("<li class='deployment-timestamp'>").appendEscaped("Last enabled at ") .appendEscaped(deployment.getEnabledTime()); } else { details.appendHtmlConstant("<li>").appendEscaped("The deployment was never enabled"); } // print if managed yes/no if (deployment.isManaged()) { details.appendHtmlConstant("<li>Managed: Yes"); } else { details.appendHtmlConstant("<li>Managed: No"); } // print if archive yes/no if (deployment.isArchive()) { details.appendHtmlConstant("<li>Archive: Yes"); } else { details.appendHtmlConstant("<li>Archive: No"); } if (deployment.getDisabledTime() != null) { details.appendHtmlConstant("<li class='deployment-timestamp'>").appendEscaped("Last disabled at ") .appendEscaped(deployment.getDisabledTime()); } else { details.appendHtmlConstant("<li>").appendEscaped("The deployment was never disabled"); } details.appendHtmlConstant("<li>").appendEscaped("Runtime name: ") .appendEscaped(deployment.getRuntimeName()); details.appendHtmlConstant("</ul>"); if (deployment.hasSubdeployments()) { details.appendHtmlConstant("<h3>").appendEscaped("Nested Deployments").appendHtmlConstant("</h3>") .appendHtmlConstant("<p>").appendEscaped("The deployment contains ") .appendEscaped(String.valueOf(deployment.getSubdeployments().size())) .appendEscaped(" nested deployments").appendHtmlConstant("</p>"); } return deployment.getReferenceServer().isStandalone() ? PREVIEWS.standaloneDeployment(deployment.getName(), enabledDisabledBuilder.toSafeHtml(), details.toSafeHtml()) : PREVIEWS.domainDeployment(deployment.getName(), deployment.getReferenceServer().getHost(), deployment.getReferenceServer().getServer(), enabledDisabledBuilder.toSafeHtml(), details.toSafeHtml()); }
From source file:org.jboss.as.console.client.v3.deployment.wizard.StaticHelp.java
License:Open Source License
static SafeHtml replace() { // TODO I18n or take from DMR SafeHtmlBuilder builder = new SafeHtmlBuilder(); builder.appendHtmlConstant("<table class='help-attribute-descriptions'>"); addHelpTextRow(builder, "Name:", Console.CONSTANTS.deploymentNameDescription()); addHelpTextRow(builder, "Runtime Name:", Console.CONSTANTS.deploymentRuntimeNameDescription()); return builder.toSafeHtml(); }
From source file:org.jboss.as.console.client.v3.deployment.wizard.StaticHelp.java
License:Open Source License
static SafeHtml deployment() { // TODO I18n or take from DMR SafeHtmlBuilder builder = new SafeHtmlBuilder(); builder.appendHtmlConstant("<table class='help-attribute-descriptions'>"); addHelpTextRow(builder, "Name:", Console.CONSTANTS.deploymentNameDescription()); addHelpTextRow(builder, "Runtime Name:", Console.CONSTANTS.deploymentRuntimeNameDescription()); addHelpTextRow(builder, "Enable:", Console.CONSTANTS.deploymentEnabledDescription()); return builder.toSafeHtml(); }
From source file:org.jboss.as.console.client.v3.deployment.wizard.StaticHelp.java
License:Open Source License
static SafeHtml unmanaged() { // TODO I18n or take from DMR SafeHtmlBuilder builder = new SafeHtmlBuilder(); builder.appendHtmlConstant("<table class='help-attribute-descriptions'>"); addHelpTextRow(builder, "Path:", Console.CONSTANTS.unmanagedDeploymentPathDescription()); addHelpTextRow(builder, "Relative To:", Console.CONSTANTS.unmanagedDeploymentRelativeToDescription()); addHelpTextRow(builder, "Is Archive?:", Console.CONSTANTS.unmanagedDeploymentArchiveDescription()); addHelpTextRow(builder, "Name:", Console.CONSTANTS.deploymentNameDescription()); addHelpTextRow(builder, "Runtime Name:", Console.CONSTANTS.deploymentRuntimeNameDescription()); if (Console.getBootstrapContext().isStandalone()) { addHelpTextRow(builder, "Enable:", Console.CONSTANTS.deploymentEnabledDescription()); }/*from w w w .jav a 2s . c o m*/ return builder.toSafeHtml(); }
From source file:org.jboss.as.console.client.v3.deployment.wizard.StaticHelp.java
License:Open Source License
private static void addHelpTextRow(SafeHtmlBuilder builder, String name, String desc) { builder.appendHtmlConstant("<tr class='help-field-row'>"); builder.appendHtmlConstant("<td class='help-field-name'>"); builder.appendEscaped(name);//from w w w . j a v a2s . c o m builder.appendHtmlConstant("</td>"); builder.appendHtmlConstant("<td class='help-field-desc'>"); builder.appendEscaped(desc); builder.appendHtmlConstant("</td>"); builder.appendHtmlConstant("</tr>"); }
From source file:org.jboss.ballroom.client.widgets.forms.DefaultGroupRenderer.java
License:Open Source License
@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);//from w w w . j a v a 2s . c o m itemKeys.remove(i); } } //int colWidth = 100/(metaData.getNumColumns()*2); int numColumns = metaData.getNumColumns(); builder.appendHtmlConstant("<colgroup class='cols_" + numColumns + "'>"); for (int col = 0; col < numColumns; 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 class='form-attribute-row' data-dmr-attr='" + values.get(i).getName() + "'>"); // TODO only works with single column int col = 0; for (col = 0; col < numColumns; 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); builder.appendHtmlConstant( "<p style='color:#999999;padding-left:8px'> Required fields are marked with an asterisk (<abbr class='req' title='required'>*</abbr>).</p>"); HTMLPanel panel = new HTMLPanel(builder.toSafeHtml()); // inline widget for (String key : itemKeys) { FormItem item = groupItems.get(key); final String widgetId = id + key; final String labelId = id + key + "_l"; // aria property key final String insertId = id + key + "_i"; Element input = item.getInputElement(); if (input != null) { input.setAttribute("id", widgetId); //widget.getElement().setAttribute("tabindex", "0"); input.setAttribute("aria-labelledby", labelId); input.setAttribute("aria-required", String.valueOf(item.isRequired())); } panel.add(item.asWidget(), insertId); } return panel; }