Search in sources :

Example 1 with LoaderEffect

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;
}
Also used : UiView(org.dominokit.domino.api.client.annotations.UiView) LoadersPresenter(org.dominokit.domino.loaders.client.presenters.LoadersPresenter) ComponentView(org.dominokit.domino.componentcase.shared.extension.ComponentView) CodeResource(org.dominokit.domino.loaders.client.views.CodeResource) Column(org.dominokit.domino.ui.column.Column) BlockHeader(org.dominokit.domino.ui.header.BlockHeader) EventListener(elemental2.dom.EventListener) Loader(org.dominokit.domino.ui.loaders.Loader) Row(org.dominokit.domino.ui.row.Row) HTMLDivElement(elemental2.dom.HTMLDivElement) Text(elemental2.dom.Text) LoaderEffect(org.dominokit.domino.ui.loaders.LoaderEffect) Code(org.dominokit.domino.ui.code.Code) Card(org.dominokit.domino.ui.cards.Card) Timer(com.google.gwt.user.client.Timer) Button(org.dominokit.domino.ui.button.Button) Elements(org.jboss.gwt.elemento.core.Elements) LoadersView(org.dominokit.domino.loaders.client.views.LoadersView) Background(org.dominokit.domino.ui.style.Background) Timer(com.google.gwt.user.client.Timer) Button(org.dominokit.domino.ui.button.Button) Loader(org.dominokit.domino.ui.loaders.Loader) Text(elemental2.dom.Text) EventListener(elemental2.dom.EventListener) Card(org.dominokit.domino.ui.cards.Card)

Aggregations

Timer (com.google.gwt.user.client.Timer)1 EventListener (elemental2.dom.EventListener)1 HTMLDivElement (elemental2.dom.HTMLDivElement)1 Text (elemental2.dom.Text)1 UiView (org.dominokit.domino.api.client.annotations.UiView)1 ComponentView (org.dominokit.domino.componentcase.shared.extension.ComponentView)1 LoadersPresenter (org.dominokit.domino.loaders.client.presenters.LoadersPresenter)1 CodeResource (org.dominokit.domino.loaders.client.views.CodeResource)1 LoadersView (org.dominokit.domino.loaders.client.views.LoadersView)1 Button (org.dominokit.domino.ui.button.Button)1 Card (org.dominokit.domino.ui.cards.Card)1 Code (org.dominokit.domino.ui.code.Code)1 Column (org.dominokit.domino.ui.column.Column)1 BlockHeader (org.dominokit.domino.ui.header.BlockHeader)1 Loader (org.dominokit.domino.ui.loaders.Loader)1 LoaderEffect (org.dominokit.domino.ui.loaders.LoaderEffect)1 Row (org.dominokit.domino.ui.row.Row)1 Background (org.dominokit.domino.ui.style.Background)1 Elements (org.jboss.gwt.elemento.core.Elements)1