Esempio 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);
  }
Esempio n. 2
0
  @Override
  public void onComponentTag(Component component, ComponentTag tag) {
    super.onComponentTag(component, tag);

    Components.assertTag(component, tag, "code", "pre");
  }