com.google.gwt.safehtml.shared.SafeHtmlUtils Java Examples

The following examples show how to use com.google.gwt.safehtml.shared.SafeHtmlUtils. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: HtmlMarkdownUtils.java    From actor-platform with GNU Affero General Public License v3.0 6 votes vote down vote up
public static String renderText(MDText[] texts) {
    StringBuilder builder = new StringBuilder();

    for (MDText text : texts) {
        if (text instanceof MDRawText) {
            final MDRawText rawText = (MDRawText) text;
            builder.append(SafeHtmlUtils.htmlEscape(rawText.getRawText()).replace("\n", "<br/>"));
        } else if (text instanceof MDSpan) {
            final MDSpan span = (MDSpan) text;
            builder.append(spanElement(span.getSpanType(), renderText(span.getChild())));
        } else if (text instanceof MDUrl) {
            final MDUrl url = (MDUrl) text;
            builder.append(urlElement(url));
        }
    }

    return builder.toString();
}
 
Example #2
Source File: MockComponent.java    From appinventor-extensions with Apache License 2.0 6 votes vote down vote up
/**
 * Constructs a tree item for the component which will be displayed in the
 * source structure explorer.
 *
 * @return  tree item for this component
 */
protected TreeItem buildTree() {
  // Instantiate new tree item for this component
  // Note: We create a ClippedImagePrototype because we need something that can be
  // used to get HTML for the iconImage. AbstractImagePrototype requires
  // an ImageResource, which we don't necessarily have.
  TreeItem itemNode = new TreeItem(
      new HTML("<span>" + iconImage.getElement().getString() + SafeHtmlUtils.htmlEscapeAllowEntities(getName()) + "</span>")) {
    @Override
    protected Focusable getFocusable() {
      return nullFocusable;
    }
  };
  itemNode.setUserObject(sourceStructureExplorerItem);
  return itemNode;
}
 
Example #3
Source File: HtmlMarkdownUtils.java    From actor-platform with GNU Affero General Public License v3.0 6 votes vote down vote up
private static String urlElement(MDUrl url) {
    // Sanitizing URL
    String href = UriUtils.sanitizeUri(url.getUrl());

    // "DeSanitize" custom url scheme
    if (url.getUrl().startsWith("send:")) {
        href = UriUtils.encodeAllowEscapes(url.getUrl());
    } else {
        // HotFixing url without prefix
        if (!href.equals("#") && !href.contains("://")) {
            href = "http://" + href;
        }
    }

    return "<a " +
            "target=\"_blank\" " +
            "onClick=\"window.messenger.handleLinkClick(event)\" " +
            "href=\"" + href + "\">" +
            SafeHtmlUtils.htmlEscape(url.getUrlTitle()) +
            "</a>";
}
 
Example #4
Source File: UploadStep.java    From core with GNU Lesser General Public License v2.1 6 votes vote down vote up
@Override
protected boolean onNext(final Context context) {
    String filename = SafeHtmlUtils.fromString(fileUpload.getFilename()).asString();
    if (Strings.isNullOrEmpty(filename)) {
        wizard.showError(Console.CONSTANTS.pleaseChooseFile());
        return false;
    } else {
        wizard.clearError();
        String name = filename;
        int fakePathIndex = filename.lastIndexOf("\\");
        if (fakePathIndex != -1) {
            name = filename.substring(fakePathIndex + 1, filename.length());
        }
        context.upload.setName(name);
        context.upload.setRuntimeName(name);
        return true;
    }
}
 
Example #5
Source File: FilterBox.java    From unitime with Apache License 2.0 6 votes vote down vote up
private SuggestionMenuItem(final Suggestion suggestion) {
	super(suggestion.getDisplayString() == null
			? suggestion.getChip().getLabel() + " <span class='item-command'>" + suggestion.getChip().getTranslatedCommand() + "</span>"
			: SafeHtmlUtils.htmlEscape(suggestion.getDisplayString()) + (suggestion.getHint() == null ? "" : " " + suggestion.getHint()),
		true,
		new Command() {
			@Override
			public void execute() {
				hideSuggestions();
				setStatus(ARIA.suggestionSelected(suggestion.toAriaString(FilterBox.this)));
				applySuggestion(suggestion);
				iLastValue = getValue();
				setAriaLabel(toAriaString());
				fireSelectionEvent(suggestion);
				ValueChangeEvent.fire(FilterBox.this, getValue());
			}
		});
	setStyleName("item");
	getElement().setAttribute("whiteSpace", "nowrap");
	iSuggestion = suggestion;
}
 
Example #6
Source File: PooledConnectionFactoryRuntimeView.java    From core with GNU Lesser General Public License v2.1 6 votes vote down vote up
Widget asWidget() {
    serverName = new ContentHeaderLabel();

    ProvidesKey<Property> providesKey = Property::getName;
    table = new DefaultCellTable<>(10, providesKey);
    provider = new ListDataProvider<>(providesKey);
    provider.addDataDisplay(table);
    selectionModel = new SingleSelectionModel<>(providesKey);

    setupTable();

    formPanel = new VerticalPanel();
    formPanel.setStyleName("fill-layout-width");

    MultipleToOneLayout layout = new MultipleToOneLayout()
            .setPlain(true)
            .setHeadlineWidget(serverName)
            .setDescription(SafeHtmlUtils.fromString(Console.CONSTANTS.subsys_messaging_pooled_stats_desc()))
            .setMaster(Console.MESSAGES.available("Pooled Connection Factory"), table)
            .setMasterTools(setupMasterTools())
            .addDetail("Pool Statistics", formPanel.asWidget());

    return layout.build();
}
 
Example #7
Source File: ServiceProviderHandlerEditor.java    From core with GNU Lesser General Public License v2.1 6 votes vote down vote up
@Override
public Widget asWidget() {
    AddressTemplate parameterAddress = AddressTemplate.of("{selected.profile}/subsystem=picketlink-federation/" +
            "federation={federation}/service-provider={service.provider}/handler={handler}/handler-parameter=*");
    ResourceDescription propertyDescription = resourceDescription.getChildDescription("handler-parameter");

    SubResourcePropertyManager propertyManager = new SubResourcePropertyManager(parameterAddress,
            new HandlerContext(statementContext), dispatcher);
    SubResourceAddPropertyDialog addDialog = new SubResourceAddPropertyDialog(propertyManager, securityContext,
            propertyDescription);
    parameter = new PropertyEditor.Builder(propertyManager)
            // using parameterAddress would cause an exception
            .operationAddress(FederationPresenter.SERVICE_PROVIDER_HANDLER_TEMPLATE.append("handler-parameter=*"))
            .addDialog(addDialog)
            .build();

    MultipleToOneLayout layoutBuilder = new MultipleToOneLayout()
            .setPlain(true)
            .setHeadline("SAML Handler")
            .setDescription(SafeHtmlUtils.fromString(resourceDescription.get(DESCRIPTION).asString()))
            .setMasterTools(tools())
            .setMaster(Console.MESSAGES.available("SAML Handler"), table())
            .addDetail(Console.CONSTANTS.common_label_attributes(), formPanel())
            .addDetail("Handler Parameters", parameter.asWidget());
    return layoutBuilder.build();
}
 
Example #8
Source File: IdentityProviderHandlerEditor.java    From core with GNU Lesser General Public License v2.1 6 votes vote down vote up
@Override
public Widget asWidget() {
    AddressTemplate parameterAddress = AddressTemplate.of("{selected.profile}/subsystem=picketlink-federation/" +
            "federation={federation}/identity-provider={identity.provider}/handler={handler}/handler-parameter=*");
    ResourceDescription propertyDescription = resourceDescription.getChildDescription("handler-parameter");

    SubResourcePropertyManager propertyManager = new SubResourcePropertyManager(parameterAddress,
            new HandlerContext(statementContext), dispatcher);
    SubResourceAddPropertyDialog addDialog = new SubResourceAddPropertyDialog(propertyManager, securityContext,
            propertyDescription);
    parameter = new PropertyEditor.Builder(propertyManager)
            // using parameterAddress would cause an exception
            .operationAddress(FederationPresenter.IDENTITY_PROVIDER_HANDLER_TEMPLATE.append("handler-parameter=*"))
            .addDialog(addDialog)
            .build();

    MultipleToOneLayout layoutBuilder = new MultipleToOneLayout()
            .setPlain(true)
            .setHeadline("SAML Handler")
            .setDescription(SafeHtmlUtils.fromString(resourceDescription.get(DESCRIPTION).asString()))
            .setMasterTools(tools())
            .setMaster(Console.MESSAGES.available("SAML Handler"), table())
            .addDetail(Console.CONSTANTS.common_label_attributes(), formPanel())
            .addDetail("Handler Parameters", parameter.asWidget());
    return layoutBuilder.build();
}
 
Example #9
Source File: WorkerPanel.java    From core with GNU Lesser General Public License v2.1 6 votes vote down vote up
@Override
public Widget createWidget() {

    SecurityContext securityContext = presenter.getSecurityFramework().getSecurityContext(presenter.getProxy().getNameToken());
    ResourceDescription definition = presenter.getDescriptionRegistry().lookup(address);

    ToolStrip tools = buildTools();
    DefaultCellTable<Property> table = setupTable();
    Widget formPanel = buildFormPanel(definition, securityContext);

    // putting everything together
    MultipleToOneLayout layoutBuilder = new MultipleToOneLayout()
            .setPlain(true)
            .setHeadline("Workers")
            .setDescription(SafeHtmlUtils.fromString(
                    Console.CONSTANTS.pleaseChooseWorker()))
            .setMasterTools(tools)
            .setMaster(Console.MESSAGES.available("Worker"), table)
            .addDetail(Console.CONSTANTS.common_label_attributes(), formPanel);
    return layoutBuilder.build();
}
 
Example #10
Source File: BufferPoolPanel.java    From core with GNU Lesser General Public License v2.1 6 votes vote down vote up
@Override
public Widget createWidget() {

    SecurityContext securityContext = presenter.getSecurityFramework().getSecurityContext(presenter.getProxy().getNameToken());
    ResourceDescription definition = presenter.getDescriptionRegistry().lookup(address);

    ToolStrip tools = buildTools();
    DefaultCellTable<Property> table = setupTable();
    Widget formPanel = buildFormPanel(definition, securityContext);

    // putting everything together
    MultipleToOneLayout layoutBuilder = new MultipleToOneLayout()
            .setPlain(true)
            .setHeadline("Buffer Pools")
            .setDescription(SafeHtmlUtils.fromString(
                    Console.CONSTANTS.pleaseChoseBufferPool()))
            .setMasterTools(tools)
            .setMaster(Console.MESSAGES.available("Buffer Pool"), table)
            .addDetail(Console.CONSTANTS.common_label_attributes(), formPanel);
    return layoutBuilder.build();
}
 
Example #11
Source File: ProviderView.java    From core with GNU Lesser General Public License v2.1 6 votes vote down vote up
public void updateFrom(Property provider) {
    this.provider = provider;

    title.setHTML("JMS Messaging Provider: " + SafeHtmlUtils.fromString(provider.getName()).asString());
    commonForm.getForm().edit(provider.getValue());
    secForm.getForm().edit(provider.getValue());
    journalForm.getForm().edit(provider.getValue());
    ModelNode path = provider.getValue().get("path");
    clusterCredentialRefFormAsset.getForm().edit(provider.getValue().get("cluster-credential-reference"));
    if (path.isDefined()) {
        bindingsDirForm.getForm().edit(path.get("bindings-directory"));
        journalDirForm.getForm().edit(path.get("journal-directory"));
        largeMessagesDirForm.getForm().edit(path.get("large-messages-directory"));
        pagingDirForm.getForm().edit(path.get("paging-directory"));
    }
}
 
Example #12
Source File: FakeMessagesProvider.java    From gwtmockito with Apache License 2.0 6 votes vote down vote up
/**
 * Returns a new instance of the given type that implements methods as
 * described in the class description.
 *
 * @param type interface to be implemented by the returned type.
 */
@Override
@SuppressWarnings("unchecked") // safe since the proxy implements type
public T getFake(Class<?> type) {
  return (T) Proxy.newProxyInstance(FakeMessagesProvider.class.getClassLoader(), new Class<?>[] {type},
      new InvocationHandler() {
        @Override
        public Object invoke(Object proxy, Method method, Object[] args) throws Exception {
          if (method.getName().equals("ensureInjected")) {
            return true;
          } else if (method.getName().equals("hashCode")) {
            return proxy.getClass().hashCode();
          } else if (method.getName().equals("equals")) {
            return proxy.getClass().equals(args[0].getClass());
          } else if (method.getReturnType() == String.class) {
            return buildMessage(method, args);
          } else if (method.getReturnType() == SafeHtml.class) {
            return SafeHtmlUtils.fromTrustedString(buildMessage(method, args));
          } else {
            throw new IllegalArgumentException(method.getName()
                + " must return either String or SafeHtml");
          }
        }
      });
}
 
Example #13
Source File: SingleErrorDisplay.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 5 votes vote down vote up
public void show(String title, String message) {
	this.titleOutput.setInnerSafeHtml(SafeHtmlUtils.fromString(title));
	this.messageOutput.setText(message);
	if (!this.showing) {
		RootPanel.get().add(this.modal);
		this.modal.show();
	}
	this.showing = true;
}
 
Example #14
Source File: HandlerEditor.java    From core with GNU Lesser General Public License v2.1 5 votes vote down vote up
protected void onRemove(final String name) {
    Feedback.confirm(Console.MESSAGES.deleteTitle(SafeHtmlUtils.fromString(name).asString()),
            Console.MESSAGES.deleteConfirm("pre handler " + " '" + name + "'"),
            isConfirmed -> {
                if (isConfirmed) {
                    AddressTemplate preHandlerResource = addressTemplate.replaceWildcards(configName);
                    circuit.dispatch(new DeleteHandler(preHandlerResource, name));
                }
            });
}
 
Example #15
Source File: DomainPropertiesView.java    From core with GNU Lesser General Public License v2.1 5 votes vote down vote up
public Widget asWidget() {
    // forms
    final SecurityContext securityContext = presenter.getSecurityFramework()
            .getSecurityContext(presenter.getProxy().getNameToken());

    ResourceDescription localCacheDescription = presenter.getDescriptionRegistry().lookup(SecDomainFinder.SECURITY_DOMAIN);

    final ModelNodeFormBuilder.FormAssets formAssets = new ModelNodeFormBuilder()
            .setAddress(SecDomainFinder.SECURITY_DOMAIN.getTemplate())
            .setConfigOnly()
            .setSecurityContext(securityContext)
            .setResourceDescription(presenter.getDescriptionRegistry().lookup(SecDomainFinder.SECURITY_DOMAIN))
            .build();

    form = formAssets.getForm();
    form.setToolsCallback(new FormCallback() {
        @Override
        public void onSave(Map changeset) {
            presenter.onSaveDomain(SecDomainFinder.SECURITY_DOMAIN, domain.getName(), form.getChangedValues());
        }

        @Override
        public void onCancel(Object entity) {

        }
    });


    SimpleLayout layout = new SimpleLayout()
            .setPlain(true)
            .setHeadline(Console.MESSAGES.securityDomainDescription(SafeHtmlUtils.fromString(domain.getName()).asString()))
            .setDescription(localCacheDescription.get("description").asString())
            .addContent(Console.CONSTANTS.help(), formAssets.getHelp().asWidget())
            .addContent(Console.CONSTANTS.common_label_attributes(), form.asWidget());

    return layout.build();
}
 
Example #16
Source File: GwtTreeCell.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public void render(Context context, TreeState.TreeNodeState value, SafeHtmlBuilder sb) {
  GwtHorizontalLayoutImpl layout = GwtComboBoxImplConnector.buildItem(value);

  SafeHtml safeValue = SafeHtmlUtils.fromSafeConstant(layout.toString());

  sb.append(safeValue);
}
 
Example #17
Source File: DataSourceEditor.java    From core with GNU Lesser General Public License v2.1 5 votes vote down vote up
public void updateDataSource(DataSource ds) {

        this.selectedEntity = ds;
        details.updateFrom(ds);

        String suffix = ds.isEnabled() ? " (enabled)" : " (disabled)";
        title.setHTML(SafeHtmlUtils.fromString("JDBC datasource '" + ds.getName() + "'" + suffix).asString());

        String nextState = ds.isEnabled() ? Console.CONSTANTS.common_label_disable() : Console.CONSTANTS
                .common_label_enable();
        disableBtn.setText(nextState);

        // some cleanup has to be done manually
        connectionProps.clearProperties();

        connectionEditor.getForm().edit(ds);

        ModelNode datasourceBean = presenter.getDataSourceAdapter().fromEntity(ds);
        securityFormAsset.getForm().edit(datasourceBean);
        if (ds.getCredentialReference() != null) {
            ModelNode bean = presenter.getCredentialReferenceAdapter().fromEntity(ds.getCredentialReference());
            credentialReferenceFormAsset.getForm().edit(bean);
        } else {
            // if there is no credential-reference in the model, an empty one allows for edit operation.
            credentialReferenceFormAsset.getForm().editTransient(new ModelNode());
        }

        validationEditor.getForm().edit(ds);
        timeoutEditor.getForm().edit(ds);
        statementEditor.getForm().edit(ds);

        // used to be selection model callbacks
        presenter.loadPoolConfig(false, ds.getName());
        presenter.onLoadConnectionProperties(ds.getName());
    }
 
Example #18
Source File: ErrorAlert.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 5 votes vote down vote up
public ErrorAlert(String title, String message, String errorDetails, Severity severity) {
	Binder.BINDER.createAndBindUi(this);
	StyleUtils.addStyle(this.detailButton, Alert.STYLE_ALERT_LINK);
	this.titleOutput.setInnerSafeHtml(SafeHtmlUtils.fromString(title));
	this.messageOutput.setText(message);
	this.detailOutput.setInnerSafeHtml(SafeHtmlUtils.fromString(errorDetails));
	this.alert.setType(this.getAlertTypeFromSeverity(severity));
	this.collapseHelper = CollapseHelper.apply(this.detailButton, this.detailOutput, true);
	this.collapseHelper.addCollapseHandler(this);
}
 
Example #19
Source File: LayerCatalogDialog.java    From geowe-core with GNU General Public License v3.0 5 votes vote down vote up
private ColumnModel<LayerDef> createColumnList(LayerDefProperties props, 
		RowExpander<LayerDef> rowExpander) {
	
	rowExpander.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
	rowExpander.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
	
	ColumnConfig<LayerDef, String> nameColumn = new ColumnConfig<LayerDef, String>(
			props.name(), 200, SafeHtmlUtils.fromTrustedString("<b>"
					+ UIMessages.INSTANCE.layerManagerToolText() + "</b>"));
	nameColumn.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);		
	
	ColumnConfig<LayerDef, String> typeColumn = new ColumnConfig<LayerDef, String>(
			props.type(), 75, UICatalogMessages.INSTANCE.type());
	typeColumn.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
	typeColumn.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);		
	
	ColumnConfig<LayerDef, ImageResource> iconColumn = new ColumnConfig<LayerDef, ImageResource>(
			props.icon(), 32, "");
	iconColumn.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
	iconColumn.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
	iconColumn.setCell(new ImageResourceCell() {
		@Override
		public void render(Context context, ImageResource value, SafeHtmlBuilder sb) {
			super.render(context, value, sb);
		}
	});
			
	List<ColumnConfig<LayerDef, ?>> columns = new ArrayList<ColumnConfig<LayerDef, ?>>();
	columns.add(rowExpander);
	columns.add(iconColumn);		
	columns.add(nameColumn);
	columns.add(typeColumn);		
	
	return new ColumnModel<LayerDef>(columns);
}
 
Example #20
Source File: VSliderPanel.java    From vaadin-sliderpanel with MIT License 5 votes vote down vote up
public void setCaption(final String caption, final boolean captionAsHtml) {
    String captionContent = caption != null ? caption : "";
    if (!captionAsHtml) {
        captionContent = SafeHtmlUtils.htmlEscape(captionContent);
    }
    this.captionNode.setInnerHTML(captionContent);
}
 
Example #21
Source File: ConnectorEditor.java    From core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public Widget asWidget() {
    MultipleToOneLayout layoutBuilder = new MultipleToOneLayout()
            .setPlain(true)
            .setHeadline(title + "s")
            .setDescription(SafeHtmlUtils.fromString(resourceDescription.get(DESCRIPTION).asString()))
            .setMasterTools(tools())
            .setMaster(Console.MESSAGES.available(title), table())
            .addDetail(Console.CONSTANTS.common_label_attributes(), formPanel())
            .addDetail(Console.CONSTANTS.common_label_properties(), propertyEditor().asWidget())
            .addDetail("Security", saslSecurityEditor.asWidget())
            .addDetail("Security Properties", securityProperties.asWidget())
            .addDetail("Policy", saslPolicyEditor.asWidget());
    return layoutBuilder.build();
}
 
Example #22
Source File: ConnectionEditor.java    From core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public Widget asWidget() {
    MultipleToOneLayout layoutBuilder = new MultipleToOneLayout()
            .setPlain(true)
            .setHeadline(title + "s")
            .setDescription(SafeHtmlUtils.fromString(resourceDescription.get(DESCRIPTION).asString()))
            .setMasterTools(tools())
            .setMaster(Console.MESSAGES.available(title), table())
            .addDetail(Console.CONSTANTS.common_label_attributes(), formPanel())
            .addDetail(Console.CONSTANTS.common_label_properties(), propertyEditor().asWidget());
    return layoutBuilder.build();
}
 
Example #23
Source File: XADataSourceEditor.java    From core with GNU Lesser General Public License v2.1 5 votes vote down vote up
public void updateDataSource(XADataSource ds) {

        this.selectedEntity = ds;

        // requires manual cleanup
        propertyEditor.clearValues();

        details.updateFrom(ds);

        String suffix = ds.isEnabled() ? " (enabled)" : " (disabled)";
        title.setHTML(SafeHtmlUtils.fromString("JDBC datasource '" + ds.getName() + "'" + suffix));

        String nextState = ds.isEnabled() ? Console.CONSTANTS.common_label_disable() : Console.CONSTANTS
                .common_label_enable();
        disableBtn.setText(nextState);

        details.getForm().edit(ds);
        connectionEditor.getForm().edit(ds);
        ModelNode datasourceBean = presenter.getXaDataSourceAdapter().fromEntity(ds);
        securityFormAsset.getForm().edit(datasourceBean);

        if (ds.getCredentialReference() != null) {
            ModelNode bean = presenter.getCredentialReferenceAdapter().fromEntity(ds.getCredentialReference());
            credentialReferenceFormAsset.getForm().edit(bean);
        } else {
            // if there is no credential-reference in the model, an empty one allows for edit operation.
            credentialReferenceFormAsset.getForm().editTransient(new ModelNode());
        }

        validationEditor.getForm().edit(ds);
        timeoutEditor.getForm().edit(ds);
        recoveryFormAsset.getForm().edit(datasourceBean);

        presenter.loadXAProperties(ds.getName());
        presenter.loadPoolConfig(true, ds.getName());
    }
 
Example #24
Source File: GwtMockitoTest.java    From gwtmockito with Apache License 2.0 5 votes vote down vote up
@Test
public void shouldCreateFakeMessages() {
  SampleMessages messages = GWT.create(SampleMessages.class);

  assertEquals("noArgs", messages.noArgs());
  assertEquals("oneArg(somearg)", messages.oneArg("somearg"));
  assertEquals("twoArgs(onearg, twoarg)", messages.twoArgs("onearg", "twoarg"));
  assertEquals("safeHtml(arg)",
      messages.safeHtml(SafeHtmlUtils.fromTrustedString("arg")).asString());
  assertEquals("safeHtmlWithUri(argX, http://uriY)",
      messages.safeHtmlWithUri(SafeHtmlUtils.fromTrustedString("argX"),
          UriUtils.fromSafeConstant("http://uriY")).asString());
}
 
Example #25
Source File: PooledConnectionFactoryView.java    From core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@SuppressWarnings("unchecked")
Widget asWidget() {
    serverName = new ContentHeaderLabel();

    ProvidesKey<Property> providesKey = Property::getName;
    table = new DefaultCellTable<>(10, providesKey);
    provider = new ListDataProvider<>(providesKey);
    provider.addDataDisplay(table);
    selectionModel = new SingleSelectionModel<>(providesKey);

    setupTable();

    VerticalPanel formPanel = new VerticalPanel();
    formPanel.setStyleName("fill-layout-width");
    formPanel.add(modelForm.getHelp().asWidget());
    formPanel.add(modelForm.getForm().asWidget());

    MultipleToOneLayout layout = new MultipleToOneLayout()
            .setPlain(true)
            .setHeadlineWidget(serverName)
            .setDescription(SafeHtmlUtils.fromString(pooledConnectionDescription.get(DESCRIPTION).asString()))
            .setMaster(Console.MESSAGES.available("Pooled Connection Factory"), table)
            .setMasterTools(setupMasterTools())
            .addDetail(Console.CONSTANTS.common_label_attributes(), formPanel.asWidget());

    return layout.build();
}
 
Example #26
Source File: SingletonEditor.java    From core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public Widget asWidget() {
    SimpleLayout layout = new SimpleLayout()
            .setPlain(true)
            .setHeadline(resourceName)
            .setDescription(SafeHtmlUtils.fromString(resourceDescription.get(DESCRIPTION).asString()))
            .addContent("Attributes", formPanel());
    return layout.build();
}
 
Example #27
Source File: IdentityProviderTrustedDomainEditor.java    From core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public Widget asWidget() {
    MultipleToOneLayout layoutBuilder = new MultipleToOneLayout()
            .setPlain(true)
            .setHeadline("Trusted Domain")
            .setDescription(SafeHtmlUtils.fromString(resourceDescription.get(DESCRIPTION).asString()))
            .setMasterTools(tools())
            .setMaster(Console.MESSAGES.available("Trusted Domains"), table());
    return layoutBuilder.build();
}
 
Example #28
Source File: SelectPatchStep.java    From core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
protected void onNext(ApplyContext context) {
    errorMessages.setVisible(false);
    context.filename = SafeHtmlUtils.fromString(context.fileUpload.getFilename()).asString();
    if (context.filename == null || context.filename.length() == 0) {
        errorMessages.setVisible(true);
    } else {
        super.onNext(context);
    }
}
 
Example #29
Source File: AriaLink.java    From core with GNU Lesser General Public License v2.1 5 votes vote down vote up
public AriaLink(String title) {
    super("<a href='javascript:void(0)' aria-label='"+ SafeHtmlUtils.htmlEscape(title)+"' style='vertical-align:bottom;'>"+title+"</a>");
    getElement().setTabIndex(0);

    this.sinkEvents(Event.ONKEYDOWN);

    addStyleName("inline-link");
}
 
Example #30
Source File: ServerConfigView.java    From core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public void updateFrom(Server server) {
    headline.setHTML("Server '"+ SafeHtmlUtils.fromString(server.getName()).asString() +"' on Host '"+server.getHostName()+"'");

    details.clearValues();
    jvmEditor.clearValues();
    propertyEditor.clearValues();

    details.updateFrom(server);

    // lazily fetch jvm and property settings
    presenter.onServerConfigSelectionChanged(server);

}