Search in sources :

Example 1 with Background

use of org.dominokit.domino.ui.style.Background 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 Background

use of org.dominokit.domino.ui.style.Background in project domino-ui-demo by DominoKit.

the class CardsViewImpl method coloredCards.

private void coloredCards() {
    element.appendChild(BlockHeader.create("COLORED CARDS", "You can control the background color of card, card header and card body.").asElement());
    Column column = Column.create().onLarge(OnLarge.four).onMedium(OnMedium.four).onSmall(OnSmall.twelve).onXSmall(OnXSmall.twelve);
    element.appendChild(Row.create().addColumn(column.addElement(Card.create("Light Blue Card", "Description text here...").setBackground(Background.LIGHT_BLUE).appendContent(new Text(SAMPLE_CONTENT)).addHeaderAction(Icons.ALL.more_vert(), event -> DomGlobal.console.info("More action selected")).asElement())).addColumn(column.copy().addElement(Card.create("Light Green Card", "Description text here...").setBackground(Background.LIGHT_GREEN).appendContent(new Text(SAMPLE_CONTENT)).addHeaderAction(Icons.AV_ICONS.mic(), event -> DomGlobal.console.info("Play sound")).asElement())).addColumn(column.copy().addElement(Card.create("Amber card", "Description text here...").setBackground(Background.AMBER).appendContent(new Text(SAMPLE_CONTENT)).addHeaderAction(Icons.AV_ICONS.mic(), event -> DomGlobal.console.info("Play sound")).addHeaderAction(Icons.NAVIGATION_ICONS.more_vert(), event -> DomGlobal.console.info("More action selected")).asElement())).asElement());
    element.appendChild(Row.create().addColumn(column.copy().addElement(Card.create("Pink Card", "Description text here...").setHeaderBackground(Background.PINK).appendContent(new Text(SAMPLE_CONTENT)).addHeaderAction(Icons.ALL.more_vert(), event -> DomGlobal.console.info("More action selected")).asElement())).addColumn(column.copy().addElement(Card.create("Blue Grey Card", "Description text here...").setHeaderBackground(Background.BLUE_GREY).appendContent(new Text(SAMPLE_CONTENT)).addHeaderAction(Icons.AV_ICONS.mic(), event -> DomGlobal.console.info("Play sound")).asElement())).addColumn(column.copy().addElement(Card.create("Deep Orange card", "Description text here...").setHeaderBackground(Background.DEEP_ORANGE).appendContent(new Text(SAMPLE_CONTENT)).addHeaderAction(Icons.AV_ICONS.mic(), event -> DomGlobal.console.info("Play sound")).addHeaderAction(Icons.NAVIGATION_ICONS.more_vert(), event -> DomGlobal.console.info("More action selected")).asElement())).asElement());
    element.appendChild(Row.create().addColumn(column.copy().addElement(Card.create("Light Blue Card", "Description text here...").setHeaderBackground(Background.BLUE).setBodyBackground(Background.LIGHT_BLUE).appendContent(new Text(SAMPLE_CONTENT)).addHeaderAction(Icons.ALL.more_vert(), event -> DomGlobal.console.info("More action selected")).asElement())).addColumn(column.copy().addElement(Card.create("Light Green Card", "Description text here...").setHeaderBackground(Background.GREEN).setBodyBackground(Background.LIGHT_GREEN).appendContent(new Text(SAMPLE_CONTENT)).addHeaderAction(Icons.AV_ICONS.mic(), event -> DomGlobal.console.info("Play sound")).asElement())).addColumn(column.copy().addElement(Card.create("Amber card", "Description text here...").setHeaderBackground(Background.ORANGE).setBodyBackground(Background.AMBER).appendContent(new Text(SAMPLE_CONTENT)).addHeaderAction(Icons.AV_ICONS.mic(), event -> DomGlobal.console.info("Play sound")).addHeaderAction(Icons.NAVIGATION_ICONS.more_vert(), event -> DomGlobal.console.info("More action selected")).asElement())).asElement());
    element.appendChild(Card.createCodeCard(CodeResource.INSTANCE.coloredCards()).asElement());
}
Also used : Icons(org.dominokit.domino.ui.icons.Icons) UiView(org.dominokit.domino.api.client.annotations.UiView) CardsPresenter(org.dominokit.domino.cards.client.presenters.CardsPresenter) DomGlobal(elemental2.dom.DomGlobal) ComponentView(org.dominokit.domino.componentcase.shared.extension.ComponentView) CodeResource(org.dominokit.domino.cards.client.views.CodeResource) Column(org.dominokit.domino.ui.column.Column) BlockHeader(org.dominokit.domino.ui.header.BlockHeader) CardsView(org.dominokit.domino.cards.client.views.CardsView) Row(org.dominokit.domino.ui.row.Row) HTMLDivElement(elemental2.dom.HTMLDivElement) Text(elemental2.dom.Text) Card(org.dominokit.domino.ui.cards.Card) Elements(org.jboss.gwt.elemento.core.Elements) Background(org.dominokit.domino.ui.style.Background) Column(org.dominokit.domino.ui.column.Column) Text(elemental2.dom.Text)

Aggregations

HTMLDivElement (elemental2.dom.HTMLDivElement)2 Text (elemental2.dom.Text)2 UiView (org.dominokit.domino.api.client.annotations.UiView)2 ComponentView (org.dominokit.domino.componentcase.shared.extension.ComponentView)2 Card (org.dominokit.domino.ui.cards.Card)2 Column (org.dominokit.domino.ui.column.Column)2 BlockHeader (org.dominokit.domino.ui.header.BlockHeader)2 Row (org.dominokit.domino.ui.row.Row)2 Background (org.dominokit.domino.ui.style.Background)2 Elements (org.jboss.gwt.elemento.core.Elements)2 Timer (com.google.gwt.user.client.Timer)1 DomGlobal (elemental2.dom.DomGlobal)1 EventListener (elemental2.dom.EventListener)1 CardsPresenter (org.dominokit.domino.cards.client.presenters.CardsPresenter)1 CardsView (org.dominokit.domino.cards.client.views.CardsView)1 CodeResource (org.dominokit.domino.cards.client.views.CodeResource)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