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;
}
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());
}
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;
}
Aggregations