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.administration.accesscontrol.ui.Templates.java
License:Open Source License
static SafeHtml memberPreview(final Assignment assignment, int memberAssignments) { int otherAssignments = max(0, memberAssignments - 1); Principal member = assignment.getPrincipal(); SafeHtmlBuilder builder = new SafeHtmlBuilder(); builder.appendHtmlConstant("<p>"); if (!assignment.isInclude()) { builder.appendEscaped("Excluded from role ").appendEscaped(assignment.getRole().getName()) .appendEscaped(". "); }//w w w . j a va 2 s .c om if (otherAssignments == 0) { builder.appendEscaped("Not used in other assignments. "); } else if (otherAssignments == 1) { builder.appendEscaped("Used in one other assignment. "); } else { builder.appendEscaped("Used in ").append(otherAssignments).appendEscaped(" other assignments. "); } if (member.getRealm() != null) { builder.appendEscaped("Bound to realm '").appendEscaped(member.getRealm()).appendEscaped("'."); } builder.appendHtmlConstant("</p>"); return PREVIEWS.member(member.getName(), builder.toSafeHtml()); }
From source file:org.jboss.as.console.client.administration.role.ui.MembersDialog.java
License:Open Source License
@Override public Widget asWidget() { VerticalPanel layout = new VerticalPanel(); layout.setStyleName("window-content"); SafeHtmlBuilder builder = new SafeHtmlBuilder(); if (internal.isEmpty()) { builder.append(TEMPLATES.noMembers(internal.getRole().getName())); } else {//from w w w. j ava 2 s. com builder.append(TEMPLATES.title(internal.getRole().getName())); builder.appendHtmlConstant("<ol class=\"outer-list\">"); boolean includeAll = internal.getRole().isIncludeAll(); List<RoleAssignment.PrincipalRealmTupel> includes = internal.getIncludes(); if (includeAll || !includes.isEmpty()) { builder.appendHtmlConstant( "<li class=\"header\">Included principals</li><ul class=\"inner-list icons-ul\">"); if (includeAll) { builder.append(TEMPLATES.includeAll("User")); } if (!includes.isEmpty()) { for (RoleAssignment.PrincipalRealmTupel include : includes) { if (include.principal.getType() == USER) { builder.append(TEMPLATES.principal("user", "User", UIHelper.principalAsSafeHtml(include.principal, include.realm))); } else { builder.append(TEMPLATES.principal("group", "Group", UIHelper.principalAsSafeHtml(include.principal, include.realm))); } } } builder.appendHtmlConstant("</ul>"); } else { builder.appendHtmlConstant("<li class=\"header\">No principals are included</li>"); } List<RoleAssignment.PrincipalRealmTupel> excludes = internal.getExcludes(); if (!excludes.isEmpty()) { builder.appendHtmlConstant( "<li class=\"header\">Excluded principals</li><ul class=\"inner-list icons-ul\">"); for (RoleAssignment.PrincipalRealmTupel exclude : excludes) { if (exclude.principal.getType() == USER) { builder.append(TEMPLATES.principal("user", "User", UIHelper.principalAsSafeHtml(exclude.principal, exclude.realm))); } else { builder.append(TEMPLATES.principal("group", "Group", UIHelper.principalAsSafeHtml(exclude.principal, exclude.realm))); } } builder.appendHtmlConstant("</ul>"); } else { builder.appendHtmlConstant("<li class=\"header\">No principals are excluded</li>"); } builder.appendHtmlConstant("</ol>"); } HTML html = new HTML(builder.toSafeHtml()); html.addStyleName("members-dialog"); layout.add(html); DialogueOptions options = new DialogueOptions(Console.CONSTANTS.common_label_done(), new ClickHandler() { @Override public void onClick(ClickEvent event) { presenter.closeWindow(); } }, Console.CONSTANTS.common_label_cancel(), new ClickHandler() { @Override public void onClick(final ClickEvent event) { presenter.closeWindow(); } }); options.showCancel(false); return new WindowContentBuilder(new ScrollPanel(layout), options).build(); }
From source file:org.jboss.as.console.client.core.Header.java
License:Open Source License
private Widget getLinksSection() { linksPane = new HTMLPanel(createLinks()); linksPane.getElement().setId("header-links-section"); linksPane.getElement().setAttribute("role", "menubar"); linksPane.getElement().setAttribute("aria-controls", "main-content-area"); String[][] sections = bootstrap.isStandalone() ? SECTIONS_STANADLONE : SECTIONS; for (String[] section : sections) { final String name = section[0]; final String id = "header-" + name; SafeHtmlBuilder html = new SafeHtmlBuilder(); html.appendHtmlConstant("<div class='header-link-label'>"); html.appendHtmlConstant("<span role='menuitem'>"); html.appendHtmlConstant(section[1]); html.appendHtmlConstant("</span>"); html.appendHtmlConstant("</div>"); HTML widget = new HTML(html.toSafeHtml()); widget.setStyleName("fill-layout"); widget.addClickHandler(new ClickHandler() { @Override//from w ww .j a v a 2s. c o m public void onClick(ClickEvent event) { placeManager.revealPlace(new PlaceRequest(name)); } }); linksPane.add(widget, id); } //subnavigation = createSubnavigation(); //linksPane.add(subnavigation, "subnavigation"); return linksPane; }
From source file:org.jboss.as.console.client.core.Header.java
License:Open Source License
private String createLinks() { String[][] sections = bootstrap.getProperty(BootstrapContext.STANDALONE).equals("true") ? SECTIONS_STANADLONE// www. j a va2 s . com : SECTIONS; SafeHtmlBuilder headerString = new SafeHtmlBuilder(); if (sections.length > 0) { headerString.appendHtmlConstant( "<table border=0 class='header-links' cellpadding=0 cellspacing=0 border=0>"); headerString.appendHtmlConstant("<tr id='header-links-ref'>"); headerString.appendHtmlConstant("<td><img src=\"images/blank.png\" width=1/></td>"); for (String[] section : sections) { final String name = section[0]; final String id = "header-" + name; String styleClass = "header-link"; String styleAtt = "vertical-align:middle; text-align:center"; String td = "<td style='" + styleAtt + "' id='" + id + "' class='" + styleClass + "'></td>"; headerString.appendHtmlConstant(td); //headerString.append(title); //headerString.appendHtmlConstant("<td ><img src=\"images/blank.png\" width=1 height=32/></td>"); } headerString.appendHtmlConstant("</tr>"); headerString.appendHtmlConstant("</table>"); headerString.appendHtmlConstant("<div id='subnavigation' style='float:right;clear:right;'/>"); } return headerString.toSafeHtml().asString(); }
From source file:org.jboss.as.console.client.core.message.MessageCell.java
License:Open Source License
@Override public void render(Context context, Message message, SafeHtmlBuilder safeHtmlBuilder) { //ImageResource icon = MessageCenterView.getSeverityIcon(message.getSeverity()); //AbstractImagePrototype prototype = AbstractImagePrototype.create(icon); String styles = (context.getIndex() % 2 > 0) ? "message-list-item message-list-item-odd" : "message-list-item"; String rowStyle = message.isNew() ? "" : "class='message-list-item-old'"; safeHtmlBuilder.appendHtmlConstant("<table width='100%' cellpadding=4 cellspacing=0>"); safeHtmlBuilder.appendHtmlConstant("<tr valign='middle' " + rowStyle + ">"); safeHtmlBuilder.appendHtmlConstant("<td width='10%'>"); safeHtmlBuilder.appendHtmlConstant(message.getSeverity().getTag()); safeHtmlBuilder.appendHtmlConstant("</td><td width='90%'>"); safeHtmlBuilder.appendHtmlConstant("<div class='" + styles + "'>"); String actualMessage = message.getConciseMessage().length() > 30 ? message.getConciseMessage().substring(0, 30) + " ..." : message.getConciseMessage(); //safeHtmlBuilder.appendHtmlConstant(TEMPLATE.message(styles, actualMessage)); safeHtmlBuilder.appendHtmlConstant(actualMessage); safeHtmlBuilder.appendHtmlConstant("</div>"); safeHtmlBuilder.appendHtmlConstant("</td></tr></table>"); }
From source file:org.jboss.as.console.client.core.message.MessageCenterView.java
License:Open Source License
private void showDetail(final Message msg) { msg.setNew(false);/*ww w .j a v a 2s. c om*/ final DefaultWindow window = new DefaultWindow(Console.CONSTANTS.common_label_messageDetailTitle()); window.setWidth(480); window.setHeight(360); window.setGlassEnabled(true); //ImageResource icon = MessageCenterView.getSeverityIcon(msg.getSeverity()); //AbstractImagePrototype prototype = AbstractImagePrototype.create(icon); SafeHtmlBuilder html = new SafeHtmlBuilder(); // TODO: XSS prevention? html.appendHtmlConstant(msg.getSeverity().getTag()); html.appendHtmlConstant(" "); 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", new ClickHandler() { @Override public void onClick(ClickEvent clickEvent) { window.hide(); } }, Console.CONSTANTS.common_label_cancel(), new ClickHandler() { @Override public void onClick(ClickEvent clickEvent) { window.hide(); } }); options.getSubmit().setAttribute("aria-describedby", "consise-message detail-message"); Widget windowContent = new WindowContentBuilder(widget, options).build(); TrappedFocusPanel trap = new TrappedFocusPanel(windowContent) { @Override protected void onAttach() { super.onAttach(); Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() { @Override public void execute() { getFocus().onFirstButton(); } }); } }; window.setWidget(trap); window.addCloseHandler(new CloseHandler<PopupPanel>() { @Override public void onClose(CloseEvent<PopupPanel> event) { messagePopup.getMessageList().getSelectionModel().setSelected(msg, false); messagePopup.hide(); } }); messagePopup.hide(); window.center(); }
From source file:org.jboss.as.console.client.core.settings.SettingsView.java
License:Open Source License
@Inject public SettingsView(EventBus eventBus) { super(eventBus); window = new DefaultWindow(Console.CONSTANTS.common_label_settings()); VerticalPanel layout = new VerticalPanel(); layout.setStyleName("window-content"); form = new Form<CommonSettings>(CommonSettings.class); ComboBoxItem localeItem = new ComboBoxItem(Preferences.Key.LOCALE.getToken(), Preferences.Key.LOCALE.getTitle()); localeItem.setDefaultToFirstOption(true); localeItem.setValueMap(new String[] { "en", "de", "zh_Hans", "pt_BR", "fr", "es", "ja" }); //CheckBoxItem useCache = new CheckBoxItem(Preferences.Key.USE_CACHE.getToken(), Preferences.Key.USE_CACHE.getTitle()); CheckBoxItem enableAnalytics = new CheckBoxItem(Preferences.Key.ANALYTICS.getToken(), Preferences.Key.ANALYTICS.getTitle()); form.setFields(localeItem, enableAnalytics); Widget formWidget = form.asWidget(); formWidget.getElement().setAttribute("style", "margin:15px"); DialogueOptions options = new DialogueOptions(Console.CONSTANTS.common_label_save(), new ClickHandler() { @Override//from w ww. ja v a 2s. c o m public void onClick(ClickEvent event) { presenter.onSaveDialogue(form.getUpdatedEntity()); presenter.hideView(); Feedback.confirm(Console.MESSAGES.restartRequired(), Console.MESSAGES.restartRequiredConfirm(), new Feedback.ConfirmationHandler() { @Override public void onConfirmation(boolean isConfirmed) { // Ignore: it crashes the browser.. /*if(isConfirmed){ Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() { @Override public void execute() { reload(); } }); } */ } }); } }, Console.CONSTANTS.common_label_cancel(), new ClickHandler() { @Override public void onClick(ClickEvent event) { presenter.onCancelDialogue(); } }); options.getElement().setAttribute("style", "padding:10px"); SafeHtmlBuilder html = new SafeHtmlBuilder(); html.appendHtmlConstant("<ul>"); html.appendHtmlConstant("<li>").appendEscaped("Locale: The user interface language."); html.appendHtmlConstant("<li>").appendEscaped( "Analytics: We track browser and operating system information in order to improve the user interface. "); html.appendEscaped("You can disable the analytics feature at anytime."); html.appendHtmlConstant("</ul>"); StaticHelpPanel help = new StaticHelpPanel(html.toSafeHtml()); layout.add(help.asWidget()); layout.add(form.asWidget()); window.setWidth(480); window.setHeight(360); window.trapWidget(new WindowContentBuilder(layout, options).build()); window.setGlassEnabled(true); window.center(); }
From source file:org.jboss.as.console.client.domain.groups.deployment.ContentRepositoryPanel.java
License:Open Source License
@SuppressWarnings("unchecked") private Widget initUI() { String[] columnHeaders = new String[] { Console.CONSTANTS.common_label_name(), Console.CONSTANTS.common_label_runtimeName() }; List<Column> columns = makeNameAndRuntimeColumns(); DeploymentDataKeyProvider<DeploymentRecord> keyProvider = new DeploymentDataKeyProvider<DeploymentRecord>(); deploymentsTable = new DefaultCellTable<DeploymentRecord>(8, keyProvider); for (int i = 0; i < columnHeaders.length; i++) { deploymentsTable.addColumn(columns.get(i), columnHeaders[i]); }/*from w ww . j a v a 2s . c om*/ deploymentsTable.addColumn(new TextColumn<DeploymentRecord>() { @Override public String getValue(DeploymentRecord deployment) { return String.valueOf(contentRepository.getNumberOfAssignments(deployment)); } }, "Assignments"); deploymentSelection = new SingleSelectionModel<DeploymentRecord>(keyProvider); deploymentsTable.setSelectionModel(deploymentSelection); deploymentData = new ListDataProvider<DeploymentRecord>(); deploymentData.addDataDisplay(deploymentsTable); SafeHtmlBuilder tableFooter = new SafeHtmlBuilder(); tableFooter.appendHtmlConstant( "<span style='font-size:10px;color:#A7ABB4;'>[1] File System Deployment</span>"); Form<DeploymentRecord> form = new Form<DeploymentRecord>(DeploymentRecord.class); form.setNumColumns(2); form.setEnabled(true); TextAreaItem name = new TextAreaItem("name", "Name"); TextAreaItem runtimeName = new TextAreaItem("runtimeName", "Runtime Name"); final ListItem groups = new ListItem("assignments", "Assigned Groups"); form.setFields(name, runtimeName, groups); form.bind(deploymentsTable); deploymentSelection.addSelectionChangeHandler(new SelectionChangeEvent.Handler() { @Override public void onSelectionChange(SelectionChangeEvent event) { DeploymentRecord selection = deploymentSelection.getSelectedObject(); if (selection != null) { List<String> serverGroups = contentRepository.getServerGroups(selection); groups.setValue(serverGroups); } } }); final ToolStrip toolStrip = new ToolStrip(); filter = new DeploymentFilter(deploymentData); toolStrip.addToolWidget(filter.asWidget()); ToolButton addContentBtn = new ToolButton(Console.CONSTANTS.common_label_add(), new ClickHandler() { @Override public void onClick(ClickEvent event) { presenter.launchNewDeploymentDialoge(null, false); } }); addContentBtn.ensureDebugId(Console.DEBUG_CONSTANTS.debug_label_addContent_deploymentsOverview()); toolStrip.addToolButtonRight(addContentBtn); toolStrip.addToolButtonRight(new ToolButton(Console.CONSTANTS.common_label_remove(), new ClickHandler() { @Override public void onClick(ClickEvent clickEvent) { final DeploymentRecord selection = deploymentSelection.getSelectedObject(); if (selection != null) { new DeploymentCommandDelegate(ContentRepositoryPanel.this.presenter, DeploymentCommand.REMOVE_FROM_DOMAIN).execute(selection); } } })); toolStrip.addToolButtonRight(new ToolButton("Assign", new ClickHandler() { @Override public void onClick(ClickEvent clickEvent) { final DeploymentRecord selection = deploymentSelection.getSelectedObject(); if (selection != null) { new DeploymentCommandDelegate(ContentRepositoryPanel.this.presenter, DeploymentCommand.ADD_TO_GROUP).execute(selection); } } })); toolStrip.addToolButtonRight(new ToolButton("Replace", new ClickHandler() { @Override public void onClick(ClickEvent clickEvent) { final DeploymentRecord selection = deploymentSelection.getSelectedObject(); if (selection != null) { new DeploymentCommandDelegate(ContentRepositoryPanel.this.presenter, DeploymentCommand.UPDATE_CONTENT).execute(selection); } } })); Form<DeploymentRecord> form2 = new Form<DeploymentRecord>(DeploymentRecord.class); form2.setNumColumns(2); form2.setEnabled(true); TextAreaItem path = new TextAreaItem("path", "Path"); TextBoxItem relative = new TextBoxItem("relativeTo", "Relative To"); form2.setFields(path, relative); form2.bind(deploymentsTable); MultipleToOneLayout layout = new MultipleToOneLayout().setPlain(true) .setHeadline(Console.CONSTANTS.common_label_contentRepository()) .setMaster(Console.MESSAGES.available("Deployment Content"), deploymentsTable) .setMasterTools(toolStrip).setMasterFooter(new HTML(tableFooter.toSafeHtml())) .setDescription( "The content repository contains all deployed content. Contents need to be assigned to sever groups in order to become effective.") .addDetail(Console.CONSTANTS.common_label_attributes(), form.asWidget()) .addDetail("Path", form2.asWidget()); return layout.build(); }
From source file:org.jboss.as.console.client.shared.subsys.jca.DataSourcePresenter.java
License:Open Source License
public void launchNewDatasourceWizard() { driverRegistry.refreshDrivers(new SimpleCallback<List<JDBCDriver>>() { @Override/*from ww w. j ava2 s . c o m*/ public void onSuccess(List<JDBCDriver> drivers) { if (drivers.size() > 0) { window = new DefaultWindow(Console.MESSAGES.createTitle("Datasource")); window.setWidth(480); window.setHeight(450); window.setWidget( new NewDatasourceWizard(DataSourcePresenter.this, drivers, bootstrap).asWidget()); window.setGlassEnabled(true); window.center(); } else { SafeHtmlBuilder html = new SafeHtmlBuilder(); html.appendHtmlConstant(Console.CONSTANTS.subsys_jca_datasource_error_loadDriver_desc()); Feedback.alert(Console.CONSTANTS.subsys_jca_datasource_error_loadDriver(), html.toSafeHtml()); } } }); }
From source file:org.jboss.as.console.client.shared.subsys.jca.DataSourcePresenter.java
License:Open Source License
public void launchNewXADatasourceWizard() { driverRegistry.refreshDrivers(new SimpleCallback<List<JDBCDriver>>() { @Override/* w w w. j ava 2s. com*/ public void onSuccess(List<JDBCDriver> drivers) { if (drivers.size() > 0) { window = new DefaultWindow(Console.MESSAGES.createTitle("XA Datasource")); window.setWidth(480); window.setHeight(450); window.addCloseHandler(new CloseHandler<PopupPanel>() { @Override public void onClose(CloseEvent<PopupPanel> event) { } }); window.setWidget( new NewXADatasourceWizard(DataSourcePresenter.this, drivers, bootstrap).asWidget()); window.setGlassEnabled(true); window.center(); } else { SafeHtmlBuilder html = new SafeHtmlBuilder(); html.appendHtmlConstant(Console.CONSTANTS.subsys_jca_datasource_error_loadDriver_desc()); Feedback.alert(Console.CONSTANTS.subsys_jca_datasource_error_loadDriver(), html.toSafeHtml()); } } }); }