Search in sources :

Example 1 with DominoElement

use of org.dominokit.domino.ui.utils.DominoElement in project nalu-examples by NaluKit.

the class ErrorComponent method render.

@Override
public void render() {
    this.dialog = ModalDialog.create(">>To Be Set<<").large().setAutoClose(false);
    this.errorIcon = new Image(64, 64);
    this.errorIcon.setAttribute("src", "media/images/bug-128.png");
    this.route = DominoElement.div().element();
    this.message = DominoElement.div().styler(style -> {
        style.setMarginBottom("12px");
    }).element();
    DominoElement messageElement = DominoElement.div().styler(style -> {
        style.setWidth("100%");
    }).appendChild(DominoElement.div().styler(style -> style.setFloat("left")).appendChild(DominoElement.div().setTextContent("Route:").styler(style -> {
        style.setMarginBottom("6px");
        style.setProperty("font-weight", "bold");
    })).appendChild(DominoElement.div().appendChild(this.route).styler(style -> {
        style.setMarginBottom("24px");
        style.setProperty("font-weight", "bold");
    })).appendChild(DominoElement.div().setTextContent("Message:").styler(style -> {
        style.setMarginBottom("6px");
        style.setProperty("font-weight", "bold");
    })).appendChild(DominoElement.div().appendChild(this.message).styler(style -> {
        style.setMarginBottom("24px");
        style.setProperty("font-weight", "bold");
    })));
    FlexLayout flexLayout = FlexLayout.create().style().add("fill-height").get().setDirection(FlexDirection.LEFT_TO_RIGHT);
    FlexItem flexItemLeft = FlexItem.create().setAlignSelf(FlexAlign.START).setOrder(1).appendChild(this.errorIcon);
    flexLayout.appendChild(flexItemLeft);
    FlexItem flexItemRight = FlexItem.create().styler(style -> style.setMarginLeft("24px")).setAlignSelf(FlexAlign.START).setFlexGrow(1).setOrder(2).appendChild(messageElement);
    flexLayout.appendChild(flexItemRight);
    this.dialog.appendChild(flexLayout);
    this.dialog.appendFooterChild(Button.create("OK").addClickListener(e -> {
        this.hide();
        this.getController().doRouteHome();
    }));
}
Also used : FlexItem(org.dominokit.domino.ui.grid.flex.FlexItem) FlexDirection(org.dominokit.domino.ui.grid.flex.FlexDirection) ModalDialog(org.dominokit.domino.ui.modals.ModalDialog) DominoElement(org.dominokit.domino.ui.utils.DominoElement) AbstractErrorPopUpComponent(com.github.nalukit.nalu.client.component.AbstractErrorPopUpComponent) Image(elemental2.dom.Image) FlexAlign(org.dominokit.domino.ui.grid.flex.FlexAlign) HTMLDivElement(elemental2.dom.HTMLDivElement) Controller(com.github.nalukit.example.nalu.simpleapplication.client.ui.content.error.IErrorComponent.Controller) Map(java.util.Map) FlexLayout(org.dominokit.domino.ui.grid.flex.FlexLayout) ErrorType(com.github.nalukit.nalu.client.event.model.ErrorInfo.ErrorType) Button(org.dominokit.domino.ui.button.Button) FlexLayout(org.dominokit.domino.ui.grid.flex.FlexLayout) FlexItem(org.dominokit.domino.ui.grid.flex.FlexItem) Image(elemental2.dom.Image) DominoElement(org.dominokit.domino.ui.utils.DominoElement)

Example 2 with DominoElement

use of org.dominokit.domino.ui.utils.DominoElement in project nalu-examples by NaluKit.

the class ErrorComponent method render.

@Override
public void render() {
    this.dialog = ModalDialog.create(">>To Be Set<<").large().setAutoClose(false);
    this.errorIcon = new Image(64, 64);
    this.errorIcon.setAttribute("src", "media/images/bug-128.png");
    this.route = DominoElement.div().element();
    this.message = DominoElement.div().styler(style -> {
        style.setMarginBottom("12px");
    }).element();
    DominoElement messageElement = DominoElement.div().styler(style -> {
        style.setWidth("100%");
    }).appendChild(DominoElement.div().styler(style -> style.setFloat("left")).appendChild(DominoElement.div().setTextContent("Route:").styler(style -> {
        style.setMarginBottom("6px");
        style.setProperty("font-weight", "bold");
    })).appendChild(DominoElement.div().appendChild(this.route).styler(style -> {
        style.setMarginBottom("24px");
        style.setProperty("font-weight", "bold");
    })).appendChild(DominoElement.div().setTextContent("Message:").styler(style -> {
        style.setMarginBottom("6px");
        style.setProperty("font-weight", "bold");
    })).appendChild(DominoElement.div().appendChild(this.message).styler(style -> {
        style.setMarginBottom("24px");
        style.setProperty("font-weight", "bold");
    })));
    FlexLayout flexLayout = FlexLayout.create().style().add("fill-height").get().setDirection(FlexDirection.LEFT_TO_RIGHT);
    FlexItem flexItemLeft = FlexItem.create().setAlignSelf(FlexAlign.START).setOrder(1).setFlexGrow(1).appendChild(this.errorIcon);
    flexLayout.appendChild(flexItemLeft);
    FlexItem flexItemRight = FlexItem.create().styler(style -> style.setMarginLeft("24px")).setAlignSelf(FlexAlign.START).setOrder(2).appendChild(messageElement);
    flexLayout.appendChild(flexItemRight);
    this.dialog.appendChild(flexLayout);
    this.dialog.appendFooterChild(Button.create("OK").addClickListener(e -> {
        this.hide();
        this.getController().doRouteHome();
    }));
}
Also used : FlexItem(org.dominokit.domino.ui.grid.flex.FlexItem) FlexDirection(org.dominokit.domino.ui.grid.flex.FlexDirection) ModalDialog(org.dominokit.domino.ui.modals.ModalDialog) DominoElement(org.dominokit.domino.ui.utils.DominoElement) AbstractErrorPopUpComponent(com.github.nalukit.nalu.client.component.AbstractErrorPopUpComponent) Image(elemental2.dom.Image) FlexAlign(org.dominokit.domino.ui.grid.flex.FlexAlign) HTMLDivElement(elemental2.dom.HTMLDivElement) Map(java.util.Map) FlexLayout(org.dominokit.domino.ui.grid.flex.FlexLayout) Controller(com.github.nalukit.example.nalu.loginapplication.client.ui.error.IErrorComponent.Controller) ErrorType(com.github.nalukit.nalu.client.event.model.ErrorInfo.ErrorType) Button(org.dominokit.domino.ui.button.Button) FlexLayout(org.dominokit.domino.ui.grid.flex.FlexLayout) FlexItem(org.dominokit.domino.ui.grid.flex.FlexItem) Image(elemental2.dom.Image) DominoElement(org.dominokit.domino.ui.utils.DominoElement)

Example 3 with DominoElement

use of org.dominokit.domino.ui.utils.DominoElement in project domino-ui-demo by DominoKit.

the class SteppersViewImpl method customColors.

@SampleMethod
private void customColors() {
    TextBox nameTextBox = TextBox.create("Name").setRequired(true).setAutoValidation(true).setFixErrorsPosition(true).addLeftAddOn(Icons.ALL.label());
    TextBox emailTextBox = TextBox.create("Email").setRequired(true).setAutoValidation(true).setFixErrorsPosition(true).addLeftAddOn(Icons.ALL.email());
    TextBox phone = ElementUtil.numbersOnly(TextBox.create("Phone")).setRequired(true).setAutoValidation(true).setFixErrorsPosition(true).addLeftAddOn(Icons.ALL.phone());
    Button nextButton = Button.createDefault("Next").linkify().styler(style -> style.setMinWidth("120px").addCss(Styles.m_l_5, Styles.m_r_5));
    Button prevButton = Button.createDefault("Previous").linkify().styler(style -> style.setMinWidth("120px").addCss(Styles.m_l_5, Styles.m_r_5));
    Button finishButton = Button.createDefault("Finish").linkify().styler(style -> style.setMinWidth("120px").addCss(Styles.m_l_5, Styles.m_r_5));
    DominoElement<HTMLDivElement> completeContent = DominoElement.div().css(Styles.align_center).appendChild(h(3).textContent("Setup completed!")).appendChild(Icons.ALL.checkbox_multiple_marked_circle_outline_mdi().size48().setColor(Color.GREEN));
    Stepper stepper = Stepper.create().setStepStateColors(new Stepper.StepStateColors() {

        @Override
        public Color inactive() {
            return Color.BLACK;
        }

        @Override
        public Color active() {
            return Color.TEAL;
        }

        @Override
        public Color error() {
            return Color.PINK;
        }

        @Override
        public Color completed() {
            return Color.BLUE;
        }

        @Override
        public Color disabled() {
            return Color.BLUE_GREY;
        }
    }).apply(self -> self.appendChild(Step.create("Contact name", "Contact name step").appendChild(Row.create().appendChild(span6().appendChild(nameTextBox.apply(nameBox -> {
        KeyboardEvents.listenOnKeyDown(nameBox.getInputElement()).onEnter(evt -> {
            if (self.getActiveStep().validate().isValid()) {
                self.getActiveStep().complete();
            }
        });
    })))).addValidator(nameTextBox::validate).addStateChangeListener((oldState, step, stepper1) -> {
        if (step.isActive()) {
            nameTextBox.focus();
        }
    })).appendChild(Step.create("Contact emailTextBox", "Contact emailTextBox step").disable().appendChild(Row.create().appendChild(span6().appendChild(emailTextBox.apply(emailBox -> {
        KeyboardEvents.listenOnKeyDown(emailBox.getInputElement()).onEnter(evt -> {
            if (self.getActiveStep().validate().isValid()) {
                self.getActiveStep().complete();
            }
        });
    })))).addValidator(emailTextBox::validate).addStateChangeListener((oldState, step, stepper1) -> {
        if (step.isActive()) {
            emailTextBox.focus();
        }
    })).appendChild(Step.create("Contact phone", "Contact phone step").appendChild(Row.create().appendChild(span6().appendChild(phone.apply(phoneBox -> {
        KeyboardEvents.listenOnKeyDown(phoneBox.getInputElement()).onEnter(evt -> {
            if (self.getActiveStep().validate().isValid()) {
                self.getActiveStep().complete();
                self.complete(completeContent);
            }
        });
    })))).addValidator(phone::validate).addStateChangeListener((oldState, step, stepper1) -> {
        if (step.isActive()) {
            phone.focus();
        }
    })).setStepFooter(FlexLayout.create().setJustifyContent(FlexJustifyContent.SPACE_AROUND).appendChild(FlexItem.create().css(Styles.align_center).appendChild(prevButton.hide().addClickListener(evt -> {
        self.previous();
    }))).appendChild(FlexItem.create().css(Styles.align_center).appendChild(finishButton.hide().addClickListener(evt -> {
        if (self.getActiveStep().validate().isValid()) {
            self.getActiveStep().complete();
            self.complete(completeContent);
        }
    }))).appendChild(FlexItem.create().css(Styles.align_center).appendChild(nextButton.addClickListener(evt -> {
        if (self.getActiveStep().validate().isValid()) {
            self.getActiveStep().complete();
        }
    })))).addStateChangeListener((oldState, step, thisStepper) -> {
        prevButton.toggleDisplay(!step.isFirstStep());
        nextButton.toggleDisplay(!step.isLastStep());
        finishButton.toggleDisplay(step.isLastStep());
    }).addCompleteListener(thisStepper -> Notification.create("All steps completed").show()));
    element.appendChild(Card.create("CUSTOM COLORS STEPPER").appendChild(Row.create().addColumn(span12().appendChild(stepper))).element());
}
Also used : Icons(org.dominokit.domino.ui.icons.Icons) SampleClass(org.dominokit.domino.SampleClass) FlexItem(org.dominokit.domino.ui.grid.flex.FlexItem) SampleMethod(org.dominokit.domino.SampleMethod) UiView(org.dominokit.domino.api.client.annotations.UiView) ElementUtil(org.dominokit.domino.ui.utils.ElementUtil) CodeCard(org.dominokit.domino.componentcase.client.ui.views.CodeCard) Column.span6(org.dominokit.domino.ui.grid.Column.span6) Elements.h(org.jboss.elemento.Elements.h) SteppersProxy(org.dominokit.domino.steppers.client.presenters.SteppersProxy) Function(java.util.function.Function) Notification(org.dominokit.domino.ui.notifications.Notification) BlockHeader(org.dominokit.domino.ui.header.BlockHeader) LinkToSourceCode(org.dominokit.domino.componentcase.client.ui.views.LinkToSourceCode) Styles(org.dominokit.domino.ui.style.Styles) HTMLElement(elemental2.dom.HTMLElement) KeyboardEvents(org.dominokit.domino.ui.keyboard.KeyboardEvents) Elements.div(org.jboss.elemento.Elements.div) FlexLayout(org.dominokit.domino.ui.grid.flex.FlexLayout) Row(org.dominokit.domino.ui.grid.Row) Card(org.dominokit.domino.ui.cards.Card) TextBox(org.dominokit.domino.ui.forms.TextBox) BaseDemoView(org.dominokit.domino.componentcase.client.ui.views.BaseDemoView) SteppersView(org.dominokit.domino.steppers.client.views.SteppersView) Step(org.dominokit.domino.ui.stepper.Step) DomGlobal(elemental2.dom.DomGlobal) FlexJustifyContent(org.dominokit.domino.ui.grid.flex.FlexJustifyContent) DominoElement(org.dominokit.domino.ui.utils.DominoElement) Elements.span(org.jboss.elemento.Elements.span) Stepper(org.dominokit.domino.ui.stepper.Stepper) Column.span12(org.dominokit.domino.ui.grid.Column.span12) Color(org.dominokit.domino.ui.style.Color) HTMLDivElement(elemental2.dom.HTMLDivElement) Node(elemental2.dom.Node) Button(org.dominokit.domino.ui.button.Button) Button(org.dominokit.domino.ui.button.Button) HTMLDivElement(elemental2.dom.HTMLDivElement) Stepper(org.dominokit.domino.ui.stepper.Stepper) TextBox(org.dominokit.domino.ui.forms.TextBox) SampleMethod(org.dominokit.domino.SampleMethod)

Example 4 with DominoElement

use of org.dominokit.domino.ui.utils.DominoElement in project domino-ui-demo by DominoKit.

the class SteppersViewImpl method verticalStepper.

@SampleMethod
private void verticalStepper() {
    TextBox nameTextBox = TextBox.create("Name").setRequired(true).setAutoValidation(true).setFixErrorsPosition(true).addLeftAddOn(Icons.ALL.label());
    TextBox emailTextBox = TextBox.create("Email").setRequired(true).setAutoValidation(true).setFixErrorsPosition(true).addLeftAddOn(Icons.ALL.email());
    TextBox phone = ElementUtil.numbersOnly(TextBox.create("Phone")).setRequired(true).setAutoValidation(true).setFixErrorsPosition(true).addLeftAddOn(Icons.ALL.phone());
    Button nextButton = Button.createDefault("Next").linkify().styler(style -> style.setMinWidth("120px").addCss(Styles.m_l_5, Styles.m_r_5));
    Button prevButton = Button.createDefault("Previous").linkify().styler(style -> style.setMinWidth("120px").addCss(Styles.m_l_5, Styles.m_r_5));
    Button finishButton = Button.createDefault("Finish").linkify().styler(style -> style.setMinWidth("120px").addCss(Styles.m_l_5, Styles.m_r_5));
    DominoElement<HTMLDivElement> completeContent = DominoElement.div().css(Styles.align_center).appendChild(h(3).textContent("Setup completed!")).appendChild(Icons.ALL.checkbox_multiple_marked_circle_outline_mdi().size48().setColor(Color.GREEN));
    Stepper stepper = Stepper.create().addStateChangeListener((oldState, step, stepper1) -> {
        DomGlobal.console.info("Step state changed : from STEPPER. for STEP : " + step.getIndex() + " old State : " + oldState.name());
    }).setDirection(Stepper.StepperDirection.VERTICAL).apply(self -> self.appendChild(Step.create("Contact name", "Contact name step").appendChild(Row.create().appendChild(span6().appendChild(nameTextBox.apply(nameBox -> {
        KeyboardEvents.listenOnKeyDown(nameBox.getInputElement()).onEnter(evt -> {
            if (self.getActiveStep().validate().isValid()) {
                self.getActiveStep().complete();
            }
        });
    })))).addValidator(nameTextBox::validate).addStateChangeListener((oldState, step, stepper1) -> {
        if (step.isActive()) {
            nameTextBox.focus();
        }
    })).appendChild(Step.create("Contact emailTextBox", "Contact emailTextBox step").addStateChangeListener((oldState, step, stepper1) -> {
        if (step.isActive() && oldState == Stepper.StepState.INACTIVE) {
            DomGlobal.console.info("Step state changed : STEP - 2 : for step " + step.getIndex() + " old state : " + oldState.name());
        }
    }).appendChild(Row.create().appendChild(span6().appendChild(emailTextBox.apply(emailBox -> {
        KeyboardEvents.listenOnKeyDown(emailBox.getInputElement()).onEnter(evt -> {
            if (self.getActiveStep().validate().isValid()) {
                self.getActiveStep().complete();
            }
        });
    })))).addValidator(emailTextBox::validate).addStateChangeListener((oldState, step, stepper1) -> {
        if (step.isActive()) {
            emailTextBox.focus();
        }
    })).appendChild(Step.create("Contact phone", "Contact phone step").appendChild(Row.create().appendChild(span6().appendChild(phone.apply(phoneBox -> {
        KeyboardEvents.listenOnKeyDown(phoneBox.getInputElement()).onEnter(evt -> {
            if (self.getActiveStep().validate().isValid()) {
                self.getActiveStep().complete();
                self.complete(completeContent);
            }
        });
    })))).addValidator(phone::validate).addStateChangeListener((oldState, step, stepper1) -> {
        if (step.isActive()) {
            phone.focus();
        }
    })).setStepFooter(FlexLayout.create().setJustifyContent(FlexJustifyContent.SPACE_AROUND).appendChild(FlexItem.create().css(Styles.align_center).appendChild(prevButton.hide().addClickListener(evt -> {
        self.previous();
    }))).appendChild(FlexItem.create().css(Styles.align_center).appendChild(finishButton.hide().addClickListener(evt -> {
        if (self.getActiveStep().validate().isValid()) {
            self.getActiveStep().complete();
            self.complete(completeContent);
        }
    }))).appendChild(FlexItem.create().css(Styles.align_center).appendChild(nextButton.addClickListener(evt -> {
        if (self.getActiveStep().validate().isValid()) {
            self.getActiveStep().complete();
        }
    })))).addStateChangeListener((oldState, step, thisStepper) -> {
        prevButton.toggleDisplay(!step.isFirstStep());
        nextButton.toggleDisplay(!step.isLastStep());
        finishButton.toggleDisplay(step.isLastStep());
    }).addCompleteListener(thisStepper -> Notification.create("All steps completed").show()));
    element.appendChild(Card.create("VERTICAL STEPPER").appendChild(Row.create().appendChild(span12().appendChild(stepper))).element());
}
Also used : Icons(org.dominokit.domino.ui.icons.Icons) SampleClass(org.dominokit.domino.SampleClass) FlexItem(org.dominokit.domino.ui.grid.flex.FlexItem) SampleMethod(org.dominokit.domino.SampleMethod) UiView(org.dominokit.domino.api.client.annotations.UiView) ElementUtil(org.dominokit.domino.ui.utils.ElementUtil) CodeCard(org.dominokit.domino.componentcase.client.ui.views.CodeCard) Column.span6(org.dominokit.domino.ui.grid.Column.span6) Elements.h(org.jboss.elemento.Elements.h) SteppersProxy(org.dominokit.domino.steppers.client.presenters.SteppersProxy) Function(java.util.function.Function) Notification(org.dominokit.domino.ui.notifications.Notification) BlockHeader(org.dominokit.domino.ui.header.BlockHeader) LinkToSourceCode(org.dominokit.domino.componentcase.client.ui.views.LinkToSourceCode) Styles(org.dominokit.domino.ui.style.Styles) HTMLElement(elemental2.dom.HTMLElement) KeyboardEvents(org.dominokit.domino.ui.keyboard.KeyboardEvents) Elements.div(org.jboss.elemento.Elements.div) FlexLayout(org.dominokit.domino.ui.grid.flex.FlexLayout) Row(org.dominokit.domino.ui.grid.Row) Card(org.dominokit.domino.ui.cards.Card) TextBox(org.dominokit.domino.ui.forms.TextBox) BaseDemoView(org.dominokit.domino.componentcase.client.ui.views.BaseDemoView) SteppersView(org.dominokit.domino.steppers.client.views.SteppersView) Step(org.dominokit.domino.ui.stepper.Step) DomGlobal(elemental2.dom.DomGlobal) FlexJustifyContent(org.dominokit.domino.ui.grid.flex.FlexJustifyContent) DominoElement(org.dominokit.domino.ui.utils.DominoElement) Elements.span(org.jboss.elemento.Elements.span) Stepper(org.dominokit.domino.ui.stepper.Stepper) Column.span12(org.dominokit.domino.ui.grid.Column.span12) Color(org.dominokit.domino.ui.style.Color) HTMLDivElement(elemental2.dom.HTMLDivElement) Node(elemental2.dom.Node) Button(org.dominokit.domino.ui.button.Button) Button(org.dominokit.domino.ui.button.Button) HTMLDivElement(elemental2.dom.HTMLDivElement) Stepper(org.dominokit.domino.ui.stepper.Stepper) TextBox(org.dominokit.domino.ui.forms.TextBox) SampleMethod(org.dominokit.domino.SampleMethod)

Example 5 with DominoElement

use of org.dominokit.domino.ui.utils.DominoElement in project domino-ui-demo by DominoKit.

the class SteppersViewImpl method customIcons.

@SampleMethod
private void customIcons() {
    TextBox nameTextBox = TextBox.create("Name").setRequired(true).setAutoValidation(true).setFixErrorsPosition(true).addLeftAddOn(Icons.ALL.label());
    TextBox emailTextBox = TextBox.create("Email").setRequired(true).setAutoValidation(true).setFixErrorsPosition(true).addLeftAddOn(Icons.ALL.email());
    TextBox phone = ElementUtil.numbersOnly(TextBox.create("Phone")).setRequired(true).setAutoValidation(true).setFixErrorsPosition(true).addLeftAddOn(Icons.ALL.phone());
    Button nextButton = Button.createDefault("Next").linkify().styler(style -> style.setMinWidth("120px").addCss(Styles.m_l_5, Styles.m_r_5));
    Button prevButton = Button.createDefault("Previous").linkify().styler(style -> style.setMinWidth("120px").addCss(Styles.m_l_5, Styles.m_r_5));
    Button finishButton = Button.createDefault("Finish").linkify().styler(style -> style.setMinWidth("120px").addCss(Styles.m_l_5, Styles.m_r_5));
    DominoElement<HTMLDivElement> completeContent = DominoElement.div().css(Styles.align_center).appendChild(h(3).textContent("Setup completed!")).appendChild(Icons.ALL.checkbox_multiple_marked_circle_outline_mdi().size48().setColor(Color.GREEN));
    Function<Step, DominoElement<HTMLElement>> stepIconSupplier = (step) -> DominoElement.of(span()).apply(self -> {
        if (step.getIndex() == 0) {
            self.appendChild(Icons.ALL.account_mdi().size18());
        } else if (step.getIndex() == 1) {
            self.appendChild(Icons.ALL.contact_mail_mdi().size18());
        } else {
            self.appendChild(Icons.ALL.contact_phone_mdi().size18());
        }
    });
    Stepper stepper = Stepper.create().setStepNumberRenderer(new Stepper.StepNumberRenderer() {

        @Override
        public Node inactiveElement(Step step, Stepper.StepStateColors stepStateColors) {
            return stepIconSupplier.apply(step).css(stepStateColors.inactive().getBackground()).element();
        }

        @Override
        public Node activeElement(Step step, Stepper.StepStateColors stepStateColors) {
            return stepIconSupplier.apply(step).css(stepStateColors.active().getBackground()).element();
        }

        @Override
        public Node errorElement(Step step, Stepper.StepStateColors stepStateColors) {
            return stepIconSupplier.apply(step).css(stepStateColors.error().getBackground()).element();
        }

        @Override
        public Node completedElement(Step step, Stepper.StepStateColors stepStateColors) {
            return stepIconSupplier.apply(step).css(stepStateColors.completed().getBackground()).element();
        }

        @Override
        public Node disabledElement(Step step, Stepper.StepStateColors stepStateColors) {
            return stepIconSupplier.apply(step).css(stepStateColors.disabled().getBackground()).element();
        }
    }).apply(self -> self.appendChild(Step.create("Contact name", "Contact name step").appendChild(Row.create().appendChild(span6().appendChild(nameTextBox.apply(nameBox -> {
        KeyboardEvents.listenOnKeyDown(nameBox.getInputElement()).onEnter(evt -> {
            if (self.getActiveStep().validate().isValid()) {
                self.getActiveStep().complete();
            }
        });
    })))).addValidator(nameTextBox::validate).addStateChangeListener((oldState, step, stepper1) -> {
        if (step.isActive()) {
            nameTextBox.focus();
        }
    })).appendChild(Step.create("Contact emailTextBox", "Contact emailTextBox step").appendChild(Row.create().appendChild(span6().appendChild(emailTextBox.apply(emailBox -> {
        KeyboardEvents.listenOnKeyDown(emailBox.getInputElement()).onEnter(evt -> {
            if (self.getActiveStep().validate().isValid()) {
                self.getActiveStep().complete();
            }
        });
    })))).addValidator(emailTextBox::validate).addStateChangeListener((oldState, step, stepper1) -> {
        if (step.isActive()) {
            emailTextBox.focus();
        }
    })).appendChild(Step.create("Contact phone", "Contact phone step").appendChild(Row.create().appendChild(span6().appendChild(phone.apply(phoneBox -> {
        KeyboardEvents.listenOnKeyDown(phoneBox.getInputElement()).onEnter(evt -> {
            if (self.getActiveStep().validate().isValid()) {
                self.getActiveStep().complete();
                self.complete(completeContent);
            }
        });
    })))).addValidator(phone::validate).addStateChangeListener((oldState, step, stepper1) -> {
        if (step.isActive()) {
            phone.focus();
        }
    })).setStepFooter(FlexLayout.create().setJustifyContent(FlexJustifyContent.SPACE_AROUND).appendChild(FlexItem.create().css(Styles.align_center).appendChild(prevButton.hide().addClickListener(evt -> {
        self.previous();
    }))).appendChild(FlexItem.create().css(Styles.align_center).appendChild(finishButton.hide().addClickListener(evt -> {
        if (self.getActiveStep().validate().isValid()) {
            self.getActiveStep().complete();
            self.complete(completeContent);
        }
    }))).appendChild(FlexItem.create().css(Styles.align_center).appendChild(nextButton.addClickListener(evt -> {
        if (self.getActiveStep().validate().isValid()) {
            self.getActiveStep().complete();
        }
    })))).addStateChangeListener((oldState, step, thisStepper) -> {
        prevButton.toggleDisplay(!step.isFirstStep());
        nextButton.toggleDisplay(!step.isLastStep());
        finishButton.toggleDisplay(step.isLastStep());
    }).addCompleteListener(thisStepper -> Notification.create("All steps completed").show()));
    element.appendChild(Card.create("CUSTOM ICONS STEPPER").appendChild(Row.create().addColumn(span12().appendChild(stepper))).element());
}
Also used : Icons(org.dominokit.domino.ui.icons.Icons) SampleClass(org.dominokit.domino.SampleClass) FlexItem(org.dominokit.domino.ui.grid.flex.FlexItem) SampleMethod(org.dominokit.domino.SampleMethod) UiView(org.dominokit.domino.api.client.annotations.UiView) ElementUtil(org.dominokit.domino.ui.utils.ElementUtil) CodeCard(org.dominokit.domino.componentcase.client.ui.views.CodeCard) Column.span6(org.dominokit.domino.ui.grid.Column.span6) Elements.h(org.jboss.elemento.Elements.h) SteppersProxy(org.dominokit.domino.steppers.client.presenters.SteppersProxy) Function(java.util.function.Function) Notification(org.dominokit.domino.ui.notifications.Notification) BlockHeader(org.dominokit.domino.ui.header.BlockHeader) LinkToSourceCode(org.dominokit.domino.componentcase.client.ui.views.LinkToSourceCode) Styles(org.dominokit.domino.ui.style.Styles) HTMLElement(elemental2.dom.HTMLElement) KeyboardEvents(org.dominokit.domino.ui.keyboard.KeyboardEvents) Elements.div(org.jboss.elemento.Elements.div) FlexLayout(org.dominokit.domino.ui.grid.flex.FlexLayout) Row(org.dominokit.domino.ui.grid.Row) Card(org.dominokit.domino.ui.cards.Card) TextBox(org.dominokit.domino.ui.forms.TextBox) BaseDemoView(org.dominokit.domino.componentcase.client.ui.views.BaseDemoView) SteppersView(org.dominokit.domino.steppers.client.views.SteppersView) Step(org.dominokit.domino.ui.stepper.Step) DomGlobal(elemental2.dom.DomGlobal) FlexJustifyContent(org.dominokit.domino.ui.grid.flex.FlexJustifyContent) DominoElement(org.dominokit.domino.ui.utils.DominoElement) Elements.span(org.jboss.elemento.Elements.span) Stepper(org.dominokit.domino.ui.stepper.Stepper) Column.span12(org.dominokit.domino.ui.grid.Column.span12) Color(org.dominokit.domino.ui.style.Color) HTMLDivElement(elemental2.dom.HTMLDivElement) Node(elemental2.dom.Node) Button(org.dominokit.domino.ui.button.Button) Stepper(org.dominokit.domino.ui.stepper.Stepper) TextBox(org.dominokit.domino.ui.forms.TextBox) Step(org.dominokit.domino.ui.stepper.Step) DominoElement(org.dominokit.domino.ui.utils.DominoElement) Button(org.dominokit.domino.ui.button.Button) HTMLDivElement(elemental2.dom.HTMLDivElement) SampleMethod(org.dominokit.domino.SampleMethod)

Aggregations

HTMLDivElement (elemental2.dom.HTMLDivElement)10 Button (org.dominokit.domino.ui.button.Button)10 FlexItem (org.dominokit.domino.ui.grid.flex.FlexItem)10 FlexLayout (org.dominokit.domino.ui.grid.flex.FlexLayout)10 DominoElement (org.dominokit.domino.ui.utils.DominoElement)10 AbstractErrorPopUpComponent (com.github.nalukit.nalu.client.component.AbstractErrorPopUpComponent)6 Image (elemental2.dom.Image)6 Map (java.util.Map)6 FlexAlign (org.dominokit.domino.ui.grid.flex.FlexAlign)6 FlexDirection (org.dominokit.domino.ui.grid.flex.FlexDirection)6 ModalDialog (org.dominokit.domino.ui.modals.ModalDialog)6 DomGlobal (elemental2.dom.DomGlobal)4 HTMLElement (elemental2.dom.HTMLElement)4 Node (elemental2.dom.Node)4 Function (java.util.function.Function)4 SampleClass (org.dominokit.domino.SampleClass)4 SampleMethod (org.dominokit.domino.SampleMethod)4 UiView (org.dominokit.domino.api.client.annotations.UiView)4 BaseDemoView (org.dominokit.domino.componentcase.client.ui.views.BaseDemoView)4 CodeCard (org.dominokit.domino.componentcase.client.ui.views.CodeCard)4