Example usage for org.apache.wicket Component hasErrorMessage

List of usage examples for org.apache.wicket Component hasErrorMessage

Introduction

In this page you can find the example usage for org.apache.wicket Component hasErrorMessage.

Prototype

public final boolean hasErrorMessage() 

Source Link

Usage

From source file:com.chitek.ignition.drivers.generictcp.meta.config.ui.MessageConfigUI.java

License:Apache License

/**
 * Common handler for errors during an Ajax submit
 *///from ww  w  . ja  va  2s.  c o m
private void handleError(final AjaxRequestTarget target) {
    // Update feedback panel and components with errors
    target.addChildren(getPage(), FeedbackPanel.class);
    target.getPage().visitChildren(FormComponent.class, new IVisitor<Component, Void>() {
        @Override
        public void component(Component component, IVisit<Void> arg1) {
            if (component.hasErrorMessage()) {
                target.add(component);
            }
        }
    });
}

From source file:com.locke.library.web.locators.FormErrorMatcher.java

License:Apache License

@Override
protected boolean matches(Component component) {
    return component.hasErrorMessage();
}

From source file:com.locke.library.web.visitors.error.ShowError.java

License:Apache License

public Object component(final Component component) {
    component.add(new AttributeModifier("class", true, new AbstractReadOnlyModel<String>() {

        private static final long serialVersionUID = 5439355914401726391L;

        @Override//from  w w  w  .ja v  a2 s. co m
        public String getObject() {
            return component.hasErrorMessage() ? errorCssClass : "";
        }
    }));
    return CONTINUE_TRAVERSAL;
}

From source file:com.myamamoto.wicket.misc.behavior.AppendErrorClassOnErrorBehavior.java

License:Apache License

@Override
public void onComponentTag(Component arg0, ComponentTag arg1) {
    super.onComponentTag(arg0, arg1);
    String orgClass = arg1.getAttribute(ATTRIBUTE_CLASS);

    if (arg0.hasErrorMessage()) {
        String newClass;/*from  w w  w .j av a2s  .  c  o  m*/
        boolean existsOrgClass = null != orgClass && !orgClass.isEmpty();
        if (existsOrgClass) {
            newClass = orgClass + this.errorClassWithComma;
        } else {
            newClass = this.errorClass;
        }
        arg1.put(ATTRIBUTE_CLASS, newClass);
    } else {
        boolean existsOrgClass = null != orgClass && !orgClass.isEmpty() && !this.errorClass.equals(orgClass);
        if (existsOrgClass) {
            arg1.put(ATTRIBUTE_CLASS, orgClass.replaceAll(this.errorClassWithComma, ""));
        } else {
            arg1.remove(ATTRIBUTE_CLASS);
        }
    }
}

From source file:com.senacor.wbs.web.core.form.AddMarkupFeedbackIndicator.java

License:Apache License

@Override
public void onRendered(Component component) {
    if (component.hasErrorMessage()) {
        Response response = component.getResponse();
        response.write("<span style=\"color:red;\">&nbsp;*</span>");
    }/*  w w  w .  j av  a 2  s. co  m*/
}

From source file:com.senacor.wbs.web.core.form.TooltipFeedbackIndicator.java

License:Apache License

@Override
public void onComponentTag(Component component, ComponentTag tag) {
    super.onComponentTag(component, tag);
    if (component.hasErrorMessage()) {
        tag.put("class", "fieldError");
        tag.put("showtooltip", "true");
        tag.put("title", component.getFeedbackMessage().getMessage().toString());
    } else {/*from w w w  .  j  av a2  s  . c  o m*/
        tag.remove("class");
        tag.remove("showtooltip");
        tag.remove("title");
    }
}

From source file:guru.mmp.application.web.template.util.FeedbackUtil.java

License:Apache License

/**
 * Applies the appropriate CSS class to a component based on the type of feedback message
 * associated with the component using a Wicket <code>AttributeModifier</code>.
 *
 * @param component the component to apply the CSS class to based on the type of feedback message
 *                  associated with the component
 *///from w  w w. j  ava 2 s .  c  o m
public static void applyFeedbackCssClassModifier(Component component) {
    List<? extends Behavior> behaviors = component.getBehaviors();

    if (component.hasErrorMessage()) {
        if (!behaviors.contains(HAS_ERROR_CSS_CLASS_MODIFIER)) {
            component.add(HAS_ERROR_CSS_CLASS_MODIFIER);
        }
    } else {
        if (behaviors.contains(HAS_ERROR_CSS_CLASS_MODIFIER)) {
            component.remove(HAS_ERROR_CSS_CLASS_MODIFIER);
        }
    }
}