Search in sources :

Example 1 with EventListener

use of elemental2.dom.EventListener 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)

Example 2 with EventListener

use of elemental2.dom.EventListener in project domino-ui-demo by DominoKit.

the class CollapseViewImpl method example.

private void example() {
    Collapsible collapsible = Collapsible.create(Elements.div().add(Elements.div().css("well").textContent(SAMPLE_CONTENT).asElement()).asElement());
    EventListener collapsibleListener = evt -> {
        if (collapsible.isCollapsed())
            collapsible.expand();
        else
            collapsible.collapse();
    };
    Button anchorButton = Button.create("LINK WITH HREF");
    anchorButton.justify();
    anchorButton.getClickableElement().addEventListener("click", collapsibleListener);
    Button button = Button.create("BUTTON");
    button.getClickableElement().addEventListener("click", collapsibleListener);
    element.appendChild(Row.create().addColumn(column.copy().addElement(Card.create("EXAMPLE", "click the buttons below to show and hide another element via class changes.").appendContent(anchorButton.htmlBuilder().css(CssStyles.M_B_15).component().setBackground(Background.PINK).asElement()).appendContent(new Text("\n")).appendContent(button.htmlBuilder().css(CssStyles.M_B_15).component().setBackground(Background.CYAN).asElement()).appendContent(collapsible.asElement()).asElement())).asElement());
    element.appendChild(Card.createCodeCard(CodeResource.INSTANCE.example()).asElement());
}
Also used : Icons(org.dominokit.domino.ui.icons.Icons) Accordion(org.dominokit.domino.ui.collapsible.Accordion) UiView(org.dominokit.domino.api.client.annotations.UiView) ComponentView(org.dominokit.domino.componentcase.shared.extension.ComponentView) AccordionPanel(org.dominokit.domino.ui.collapsible.AccordionPanel) CssStyles(org.dominokit.domino.ui.style.CssStyles) Column(org.dominokit.domino.ui.column.Column) BlockHeader(org.dominokit.domino.ui.header.BlockHeader) EventListener(elemental2.dom.EventListener) Color(org.dominokit.domino.ui.style.Color) Row(org.dominokit.domino.ui.row.Row) HTMLDivElement(elemental2.dom.HTMLDivElement) Text(elemental2.dom.Text) CollapseView(org.dominokit.domino.collapse.client.views.CollapseView) Collapsible(org.dominokit.domino.ui.collapsible.Collapsible) CodeResource(org.dominokit.domino.collapse.client.views.CodeResource) Card(org.dominokit.domino.ui.cards.Card) CollapsePresenter(org.dominokit.domino.collapse.client.presenters.CollapsePresenter) Button(org.dominokit.domino.ui.button.Button) Elements(org.jboss.gwt.elemento.core.Elements) Background(org.dominokit.domino.ui.style.Background) Button(org.dominokit.domino.ui.button.Button) Text(elemental2.dom.Text) Collapsible(org.dominokit.domino.ui.collapsible.Collapsible) EventListener(elemental2.dom.EventListener)

Example 3 with EventListener

use of elemental2.dom.EventListener in project domino-ui-demo by DominoKit.

the class ModalsViewImpl method createModalDialog.

private ModalDialog createModalDialog() {
    ModalDialog modal = ModalDialog.create("Modal title");
    modal.appendContent(new Text(SAMPLE_CONTENT));
    Button closeButton = Button.create("CLOSE").linkify();
    Button saveButton = Button.create("SAVE CHANGES").linkify();
    EventListener closeModalListener = evt -> modal.close();
    closeButton.getClickableElement().addEventListener("click", closeModalListener);
    saveButton.getClickableElement().addEventListener("click", closeModalListener);
    modal.appendFooterContent(saveButton.asElement());
    modal.appendFooterContent(closeButton.asElement());
    return modal;
}
Also used : Elements.div(org.jboss.gwt.elemento.core.Elements.div) UiView(org.dominokit.domino.api.client.annotations.UiView) ModalDialog(org.dominokit.domino.ui.modals.ModalDialog) ComponentView(org.dominokit.domino.componentcase.shared.extension.ComponentView) Column(org.dominokit.domino.ui.column.Column) ModalsPresenter(org.dominokit.domino.modals.client.presenters.ModalsPresenter) CodeResource(org.dominokit.domino.modals.client.views.CodeResource) BlockHeader(org.dominokit.domino.ui.header.BlockHeader) EventListener(elemental2.dom.EventListener) Color(org.dominokit.domino.ui.style.Color) ComponentRemoveHandler(org.dominokit.domino.componentcase.shared.extension.ComponentCase.ComponentRemoveHandler) Row(org.dominokit.domino.ui.row.Row) HTMLDivElement(elemental2.dom.HTMLDivElement) Text(elemental2.dom.Text) ModalsView(org.dominokit.domino.modals.client.views.ModalsView) Card(org.dominokit.domino.ui.cards.Card) Objects.nonNull(java.util.Objects.nonNull) Button(org.dominokit.domino.ui.button.Button) Background(org.dominokit.domino.ui.style.Background) Button(org.dominokit.domino.ui.button.Button) ModalDialog(org.dominokit.domino.ui.modals.ModalDialog) Text(elemental2.dom.Text) EventListener(elemental2.dom.EventListener)

Aggregations

EventListener (elemental2.dom.EventListener)3 HTMLDivElement (elemental2.dom.HTMLDivElement)3 Text (elemental2.dom.Text)3 UiView (org.dominokit.domino.api.client.annotations.UiView)3 ComponentView (org.dominokit.domino.componentcase.shared.extension.ComponentView)3 Button (org.dominokit.domino.ui.button.Button)3 Card (org.dominokit.domino.ui.cards.Card)3 Column (org.dominokit.domino.ui.column.Column)3 BlockHeader (org.dominokit.domino.ui.header.BlockHeader)3 Row (org.dominokit.domino.ui.row.Row)3 Background (org.dominokit.domino.ui.style.Background)3 Color (org.dominokit.domino.ui.style.Color)2 Elements (org.jboss.gwt.elemento.core.Elements)2 Timer (com.google.gwt.user.client.Timer)1 Objects.nonNull (java.util.Objects.nonNull)1 CollapsePresenter (org.dominokit.domino.collapse.client.presenters.CollapsePresenter)1 CodeResource (org.dominokit.domino.collapse.client.views.CodeResource)1 CollapseView (org.dominokit.domino.collapse.client.views.CollapseView)1 ComponentRemoveHandler (org.dominokit.domino.componentcase.shared.extension.ComponentCase.ComponentRemoveHandler)1 LoadersPresenter (org.dominokit.domino.loaders.client.presenters.LoadersPresenter)1