Example usage for org.apache.wicket.markup.html.panel FeedbackPanel anyErrorMessage

List of usage examples for org.apache.wicket.markup.html.panel FeedbackPanel anyErrorMessage

Introduction

In this page you can find the example usage for org.apache.wicket.markup.html.panel FeedbackPanel anyErrorMessage.

Prototype

public final boolean anyErrorMessage() 

Source Link

Document

Search messages that this panel will render, and see if there is any message of level ERROR or up.

Usage

From source file:org.hippoecm.frontend.dialog.AbstractWizard.java

License:Apache License

protected final boolean hasError() {
    FeedbackPanel feedback = (FeedbackPanel) getForm().get(FEEDBACK_ID);
    return feedback.anyErrorMessage();
}

From source file:org.obiba.onyx.webapp.base.page.BasePage.java

License:Open Source License

public BasePage() {
    super();/*  www.  j a  va 2 s  .  c om*/

    add(reusableConfirmationDialog);

    reusablePrintDialog.addFormValidator(printableReportPanel.getFormValidator());
    reusablePrintDialog.setCloseButtonCallback(new CloseButtonCallback() {
        private static final long serialVersionUID = 1L;

        public boolean onCloseButtonClicked(AjaxRequestTarget target, Status status) {
            if (status == null || status.equals(Status.WINDOW_CLOSED)) {
                return true;
            } else if (status.equals(Status.SUCCESS)) {
                printableReportPanel.printReports();
                FeedbackPanel feedbackPanel = new FeedbackPanel("content");
                if (!feedbackPanel.anyErrorMessage()) {
                    printableReportPanel.getFeedbackWindow().setCloseButtonCallback(new CloseButtonCallback() {

                        private static final long serialVersionUID = 1L;

                        public boolean onCloseButtonClicked(AjaxRequestTarget target1, Status status1) {
                            // Close the print dialog when the user dismisses the success message.
                            reusablePrintDialog.close(target1);
                            return true;
                        }

                    });
                }
                printableReportPanel.getFeedbackWindow().setContent(feedbackPanel);
                printableReportPanel.getFeedbackWindow().show(target);

                return false;
            } else if (status.equals(Status.ERROR)) {
                printableReportPanel.getFeedbackWindow().setContent(new FeedbackPanel("content"));
                printableReportPanel.getFeedbackWindow().show(target);
                return false;
            }
            return true;
        }

    });

    reusablePrintDialog.setWidthUnit("em");
    reusablePrintDialog.setHeightUnit("em");
    reusablePrintDialog.setInitialHeight(34);
    reusablePrintDialog.setInitialWidth(50);
    add(reusablePrintDialog);

    ContextImage img = new ContextImage("logo", new Model<String>("images/logo/logo_on_dark.png"));
    img.setMarkupId("logo");
    img.setOutputMarkupId(true);

    Panel headerPanel = new EmptyPanel("header");

    Panel menuBar = new EmptyPanel("menuBar");
    menuBar.setMarkupId("menuBar");
    setOutputMarkupId(true);

    Label userFullName = new Label("userFullName");
    Label currentTime = new Label("currentTime");
    Panel battery = new EmptyPanel("battery");

    Session session = getSession();
    // Tests the session type for unit testing
    if (session instanceof OnyxAuthenticatedSession) {
        if (((OnyxAuthenticatedSession) getSession()).isSignedIn()) {
            headerPanel = new HeaderPanel("header");
            menuBar = new MenuBar("menuBar");

            userFullName.setDefaultModel(new Model(OnyxAuthenticatedSession.get().getUserName()));
            currentTime.setDefaultModel(DateModelUtils.getDateTimeModel(
                    new Model<DateFormat>(new SimpleDateFormat("yyyy-MM-dd - HH:mm:ss", getLocale())),
                    new Model<Date>(new Date())));
            battery = new BatteryLevelIndicator("battery");
        }
    }

    add(currentTime);
    add(battery);
    add(img);
    add(userFullName);
    add(headerPanel);
    add(menuBar);

    add(new Label("baseAjaxIndicator", new StringResourceModel("Processing", this, null)));
}