Example usage for org.apache.wicket.feedback FeedbackMessage getMessage

List of usage examples for org.apache.wicket.feedback FeedbackMessage getMessage

Introduction

In this page you can find the example usage for org.apache.wicket.feedback FeedbackMessage getMessage.

Prototype

public final Serializable getMessage() 

Source Link

Document

Gets the actual message.

Usage

From source file:$.BootstrapFeedbackPanel.java

License:Apache License

/**
     * Generates a component that is used to display the message inside the
     * feedback panel. This component must handle being attached to
     * <code>span</code> tags.
     * /*from   ww  w  . j  a  v a 2  s  . com*/
     * By default a {@link Label} is used.
     * 
     * Note that the created component is expected to respect feedback panel's
     * {@link #getEscapeModelStrings()} value
     * 
     * @param id
     *            parent id
     * @param message
     *            feedback message
     * @return component used to display the message
     */
    protected Component newMessageDisplayComponent(String id, FeedbackMessage message) {
        Serializable serializable = message.getMessage();
        Label label = new Label(id, (serializable == null) ? "" : serializable.toString());
        label.setEscapeModelStrings(BootstrapFeedbackPanel.this.getEscapeModelStrings());
        return label;
    }

From source file:ca.travelagency.components.decorators.FieldDecorator.java

License:Apache License

@Override
public void afterRender(Component component) {
    Response response = component.getResponse();
    if (component.hasFeedbackMessage()) {
        response.write("<ul class=\"feedbackPanel\">");
        FeedbackMessages feedbackMessages = component.getFeedbackMessages();
        for (FeedbackMessage message : feedbackMessages) {
            response.write("<li class=\"feedbackPanel");
            response.write(message.getLevelAsString().toUpperCase());
            response.write("\">");
            response.write(Strings.escapeMarkup(message.getMessage().toString()));
            response.write("</li>");
            message.markRendered();/*w  w w. j  a  v a 2 s . c  o  m*/
        }
        response.write("</ul>");
    }
    response.write("</span>");

    super.afterRender(component);
}

From source file:com.aipo.mobycket.wicket.markup.html.panel.CssFeedbackPanel.java

License:Apache License

/**
 * Generates a component that is used to display the message inside the
 * feedback panel. This component must handle being attached to
 * <code>span</code> tags./*from ww  w . j a va2  s.c o  m*/
 * 
 * By default a {@link Label} is used.
 * 
 * Note that the created component is expected to respect feedback panel's
 * {@link #getEscapeModelStrings()} value
 * 
 * @param id
 *          parent id
 * @param message
 *          feedback message
 * @return component used to display the message
 */
protected Component newMessageDisplayComponent(String id, FeedbackMessage message) {
    Serializable serializable = message.getMessage();
    Label label = new Label(id, (serializable == null) ? "" : serializable.toString());
    label.setEscapeModelStrings(CssFeedbackPanel.this.getEscapeModelStrings());
    return label;
}

From source file:com.evolveum.midpoint.web.component.message.FeedbackMessagePanel.java

License:Apache License

private boolean isExceptionVisible(final IModel<FeedbackMessage> message) {
    FeedbackMessage fMessage = message.getObject();
    if (!(fMessage.getMessage() instanceof OpResult)) {
        return false;
    }// w w w.  jav a  2s  .c  o  m
    OpResult result = (OpResult) fMessage.getMessage();
    return StringUtils.isNotEmpty(result.getExceptionMessage())
            || StringUtils.isNotEmpty(result.getExceptionsStackTrace());

}

From source file:com.evolveum.midpoint.web.component.message.FeedbackMessagePanel.java

License:Apache License

private IModel<List<OpResult>> createSubresultsModel(final IModel<FeedbackMessage> model) {
    return new LoadableModel<List<OpResult>>(false) {

        @Override//w  ww.ja  v a  2s  . com
        protected List<OpResult> load() {
            FeedbackMessage message = model.getObject();
            Serializable serializable = message.getMessage();
            if (!(serializable instanceof OpResult)) {
                return new ArrayList<OpResult>();
            }

            OpResult result = (OpResult) serializable;
            return result.getSubresults();
        }
    };
}

From source file:com.evolveum.midpoint.web.component.message.FeedbackMessagePanel.java

License:Apache License

private String getTopMessage(final IModel<FeedbackMessage> model) {
    FeedbackMessage message = model.getObject();
    if (!(message.getMessage() instanceof OpResult)) {
        return message.getMessage().toString();
    }/*from   w ww. java  2 s.  c o  m*/

    OpResult result = (OpResult) message.getMessage();

    if (!StringUtils.isEmpty(result.getMessage())) {
        return result.getMessage();
    }

    String resourceKey;
    switch (result.getStatus()) {
    case FATAL_ERROR:
        resourceKey = "feedbackMessagePanel.message.fatalError";
        break;
    case IN_PROGRESS:
        resourceKey = "feedbackMessagePanel.message.inProgress";
        break;
    case NOT_APPLICABLE:
        resourceKey = "feedbackMessagePanel.message.notApplicable";
        break;
    case WARNING:
        resourceKey = "feedbackMessagePanel.message.warn";
        break;
    case PARTIAL_ERROR:
        resourceKey = "feedbackMessagePanel.message.partialError";
        break;
    case SUCCESS:
        resourceKey = "feedbackMessagePanel.message.success";
        break;
    case HANDLED_ERROR:
        resourceKey = "feedbackMessagePanel.message.expectedError";
        break;
    case UNKNOWN:
    default:
        resourceKey = "feedbackMessagePanel.message.unknown";
    }

    return new StringResourceModel(resourceKey, this, null).getString();
}

From source file:com.evolveum.midpoint.web.component.message.TempMessagePanel.java

License:Apache License

private void initExceptionLayout(WebMarkupContainer content, final IModel<FeedbackMessage> message) {
    WebMarkupContainer exception = new WebMarkupContainer("exception") {

        @Override//from   w  w w .j a  v a  2  s  . c  om
        public boolean isVisible() {
            FeedbackMessage fMessage = message.getObject();
            if (!(fMessage.getMessage() instanceof OpResult)) {
                return false;
            }
            OpResult result = (OpResult) fMessage.getMessage();
            return StringUtils.isNotEmpty(result.getExceptionMessage())
                    || StringUtils.isNotEmpty(result.getExceptionsStackTrace());
        }
    };
    content.add(exception);
    exception.add(new MultiLineLabel("exceptionMessage",
            new PropertyModel<String>(message, "message.exceptionMessage")));
}

From source file:com.evolveum.midpoint.web.component.message.TempMessagePanel.java

License:Apache License

private String getTopMessage(final IModel<FeedbackMessage> model) {
    FeedbackMessage message = model.getObject();
    if (!(message.getMessage() instanceof OpResult)) {
        return message.getMessage().toString();
    }//ww w .  j  ava 2  s  . co m

    OpResult result = (OpResult) message.getMessage();

    if (!StringUtils.isEmpty(result.getMessage())) {
        return result.getMessage();
    }

    String resourceKey;
    switch (result.getStatus()) {
    case FATAL_ERROR:
        resourceKey = "tempMessagePanel.message.fatalError";
        break;
    case IN_PROGRESS:
        resourceKey = "tempMessagePanel.message.inProgress";
        break;
    case NOT_APPLICABLE:
        resourceKey = "tempMessagePanel.message.notApplicable";
        break;
    case WARNING:
        resourceKey = "tempMessagePanel.message.warn";
        break;
    case PARTIAL_ERROR:
        resourceKey = "tempMessagePanel.message.partialError";
        break;
    case SUCCESS:
        resourceKey = "tempMessagePanel.message.success";
        break;
    case HANDLED_ERROR:
        resourceKey = "tempMessagePanel.message.expectedError";
        break;
    case UNKNOWN:
    default:
        resourceKey = "tempMessagePanel.message.unknown";
    }

    return new StringResourceModel(resourceKey, this, null).getString();
}

From source file:com.francetelecom.clara.cloud.presentation.tools.FieldFeedbackDecorator.java

License:Apache License

@Override
public void afterRender(Component component) {
    FormComponent<?> fc = (FormComponent<?>) component;
    Response r = component.getResponse();

    r.write("</span>");

    if (fc.hasFeedbackMessage()) {
        r.write("<span class=\"feedbackPanelTextField\">");

        IFeedbackMessageFilter filter = new ComponentFeedbackMessageFilter(component);

        for (FeedbackMessage message : fc.getFeedbackMessages().messages(filter)) {
            r.write("<span class=\"feedbackPanel");
            r.write(message.getLevelAsString().toUpperCase());
            r.write("\">");
            r.write(Strings.escapeMarkup(message.getMessage().toString()));
        }// www  . j a  va  2s.co m

        r.write("</span>");
    }
}

From source file:com.googlecode.wicket.kendo.ui.console.FeedbackConsole.java

License:Apache License

/**
 * Logs a {@link FeedbackMessage}/* w  w w  .  j av  a  2 s .c o m*/
 *
 * @param message the {@link FeedbackMessage}
 */
protected void log(FeedbackMessage message) {
    this.log(message.getMessage(), this.isError(message));

    message.markRendered();
}