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

fi.evolver.ai.vaadin.component.ChatAvatarLoadingItem Maven / Gradle / Ivy

There is a newer version: 1.5.5
Show newest version
package fi.evolver.ai.vaadin.component;

import java.io.Serial;

import com.vaadin.flow.component.Component;
import com.vaadin.flow.component.html.Div;
import com.vaadin.flow.component.html.Paragraph;
import com.vaadin.flow.component.progressbar.ProgressBar;

import fi.evolver.utils.string.StringUtils;

public class ChatAvatarLoadingItem extends ChatAvatarItem {
	@Serial
	private static final long serialVersionUID = 1L;

	public ChatAvatarLoadingItem(String user) {
		this(user, null);
	}

	public ChatAvatarLoadingItem(String user, String message) {
		super(user, generateContent(message));
	}

	protected static Component generateContent(String message) {
		ProgressBar progressBar = new ProgressBar();
		progressBar.setIndeterminate(true);
		progressBar.setWidthFull();
		Div content = new Div();
		if (StringUtils.hasText(message))
			content.add(new Paragraph(message));
		content.add(progressBar);
		content.setWidthFull();
		return content;
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy