use of org.dominokit.domino.ui.loaders.LoaderEffect in project domino-ui-demo by DominoKit.
the class LoadersViewImpl method createCard.
private Card createCard(LoaderEffect effect, String loadingText, Background bodyBackground, Background headerBackground) {
Card card = Card.create(effect.toString(), effect.toString().toLowerCase() + " loader effect.").setBodyBackground(bodyBackground).setHeaderBackground(headerBackground);
EventListener loaderListener = e -> {
Loader loader = Loader.create(card.asElement(), effect).setLoadingText(loadingText).start();
new Timer() {
@Override
public void run() {
loader.stop();
}
}.schedule(7000);
};
Button button = Button.createDefault("CLICK ME").addClickListener(loaderListener);
card.appendContent(new Text(SAMPLE_CONTENT)).appendContent(Elements.br().asElement()).appendContent(Elements.br().asElement()).appendContent(Elements.div().attr("style", "text-align: center").add(button.asElement()).asElement());
return card;
}
Aggregations