Ejemplo n.º 1
1
  @Override
  protected void onConfigure() {
    super.onConfigure();

    // set all components visible
    Components.show(help, label, feedback);

    // clear feedback message and current state
    stateClassName.setObject("");
    feedback.setDefaultModelObject("");

    final List<FormComponent<?>> formComponents = findFormComponents();
    for (final FormComponent<?> fc : formComponents) {
      final FeedbackMessages messages = fc.getFeedbackMessages();

      if (!messages.isEmpty()) {
        final FeedbackMessage worstMessage = getWorstMessage(messages);
        worstMessage.markRendered();

        stateClassName.setObject(toClassName(worstMessage));
        feedback.setDefaultModelObject(worstMessage.getMessage());

        break; // render worst message of first found child component with feedback message
      }
    }

    Components.hideIfModelIsEmpty(help);
    Components.hideIfModelIsEmpty(label);
    Components.hideIfModelIsEmpty(feedback);
  }
Ejemplo n.º 2
0
 /**
  * Updates the component that is used to show the generated mail body for this example.
  *
  * @param result the component that shows the mail body
  * @param mailBody the text for the mail body
  * @param target the current Ajax request handler
  */
 private void updateResult(
     final Component result, final CharSequence mailBody, final AjaxRequestTarget target) {
   result.setDefaultModelObject(mailBody);
   target.add(result);
 }