Example usage for org.apache.wicket.feedback FeedbackMessages isEmpty

List of usage examples for org.apache.wicket.feedback FeedbackMessages isEmpty

Introduction

In this page you can find the example usage for org.apache.wicket.feedback FeedbackMessages isEmpty.

Prototype

public final boolean isEmpty() 

Source Link

Document

Gets whether there are no messages.

Usage

From source file:org.lbogdanov.poker.web.markup.ControlGroup.java

License:Apache License

/**
 * @see Border#Border(String, IModel)/*from   w  w  w .  j  av a 2  s  .  c  om*/
 */
public ControlGroup(String id, IModel<String> model) {
    super(id, model);
    addToBorder(label = new Label("label", getDefaultModel()));
    add(AttributeModifier.append("class", "control-group"));
    add(AttributeModifier.append("class", new AbstractReadOnlyModel<String>() {

        @Override
        public String getObject() {
            FormComponent<?> formComponent = lastFormComponent();
            if (formComponent != null) {
                FeedbackMessages messages = formComponent.getFeedbackMessages();
                if (!messages.isEmpty()) {
                    for (int type : MESSAGE_TYPES) {
                        FeedbackMessage message = messages.first(type);
                        if (message != null) {
                            return messageToCssClass(message);
                        }
                    }
                    return messageToCssClass(messages.first());
                }
            }
            return null;
        }

    }));
}