List of usage examples for com.google.gwt.safehtml.shared SafeHtmlBuilder toSafeHtml
public SafeHtml toSafeHtml()
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 w w . jav a 2s . c o 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(); }
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 w w w . j ava 2s .c om 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/*from w ww. j a v a 2 s .co m*/ 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()); } } }); }
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);/*from w w w . jav a 2 s. com*/ 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.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 w w .ja v a 2 s . com*/ 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 {/*from w w w . j ava 2 s .c om*/ 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 assignmentPreview(final Assignment assignment) { Deployment deployment = assignment.getDeployment(); if (deployment == null) { SafeHtmlBuilder status = new SafeHtmlBuilder(); PreviewState.error(status, "No running server"); return PREVIEWS.noReferenceServer(assignment.getName(), assignment.getServerGroup(), status.toSafeHtml()); } else {// w w w .ja v a 2s .co m return deploymentPreview(deployment); } }
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 . ja va2 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(); }