All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.imunity.vaadin.endpoint.common.HtmlLabelFactory Maven / Gradle / Ivy

The newest version!
/*
 * Copyright (c) 2021 Bixbit - Krzysztof Benedyczak. All rights reserved.
 * See LICENCE.txt file for licensing information.
 */

package io.imunity.vaadin.endpoint.common;

import com.google.common.html.HtmlEscapers;
import com.vaadin.flow.component.Html;
import pl.edu.icm.unity.base.message.MessageSource;

public class HtmlLabelFactory
{
	public static Html getHtmlLabel(MessageSource msg, String name, String msgKey, Object... unsafeArgs)
	{
		Object[] escapedArgs = escapeArgs(unsafeArgs);
		Html html = new Html(msg.getMessageNullArg(msgKey, escapedArgs));
		html.getElement().setProperty("label", name);
		return html;
	}

	private static Object[] escapeArgs(Object... unsafeArgs)
	{
		Object[] escapedArgs = new Object[unsafeArgs.length];
		for (int i=0; i




© 2015 - 2025 Weber Informatics LLC | Privacy Policy