List of usage examples for com.google.gwt.safehtml.shared SafeHtmlBuilder SafeHtmlBuilder
public SafeHtmlBuilder()
From source file:org.jboss.as.console.client.administration.role.ui.AccessControlProviderDialog.java
License:Open Source License
@Override public Widget asWidget() { VerticalPanel layout = new VerticalPanel(); layout.setStyleName("window-content"); SafeHtmlBuilder builder = new SafeHtmlBuilder(); builder.append(Console.MESSAGES.access_control_provider()); layout.add(new HTML(builder.toSafeHtml())); DialogueOptions options = new DialogueOptions(Console.CONSTANTS.common_label_done(), new ClickHandler() { @Override// ww w . j a v a 2 s . c o m 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.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 ww. ja va 2s. c om 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.administration.role.ui.RoleAssignmentHelpPanel.java
License:Open Source License
public RoleAssignmentHelpPanel(String userGroup) { super(new SafeHtmlBuilder() .append(TEMPLATES.help(userGroup, Console.CONSTANTS.administration_assignment_user_group_desc(), Console.CONSTANTS.administration_assignment_realm_desc(), Console.CONSTANTS.administration_assignment_type_desc(), Console.CONSTANTS.administration_assignment_roles_desc())) .toSafeHtml());// www .j a va 2s . c om }
From source file:org.jboss.as.console.client.administration.role.ui.ScopedRoleHelpPanel.java
License:Open Source License
public ScopedRoleHelpPanel() { super(new SafeHtmlBuilder() .append(TEMPLATES.help(Console.CONSTANTS.administration_scoped_role_base_role_desc(), Console.CONSTANTS.administration_scoped_role_scope_desc(), Console.CONSTANTS.administration_role_include_all_desc())) .toSafeHtml());// w ww . ja v a 2 s. c om }
From source file:org.jboss.as.console.client.administration.role.ui.StandardRoleHelpPanel.java
License:Open Source License
public StandardRoleHelpPanel() { super(new SafeHtmlBuilder().append(TEMPLATES.help(Console.CONSTANTS.administration_role_include_all_desc())) .toSafeHtml()); }
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// www .j ava2 s . 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/*from w w w.ja v a2s . co m*/ : 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.MessageCenterView.java
License:Open Source License
private void showDetail(final Message msg) { msg.setNew(false);/* w ww .j a va2 s . com*/ 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 www. j a va 2s . co 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 va2 s . co m 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(); }