/**
   * The following actions are performed:
   *
   * <ul>
   *   <li>Add all option if enabled and control is multi-value
   * </ul>
   *
   * {@inheritDoc}
   */
  @Override
  public void performFinalize(Object model, LifecycleElement parent) {
    super.performFinalize(model, parent);

    // if enabled add option to select all values
    if (addControlSelectAllOption
        && (getControl() != null)
        && getControl() instanceof MultiValueControl) {
      String allOptionText =
          KRADServiceLocatorWeb.getMessageService()
              .getMessageText(UifConstants.MessageKeys.OPTION_ALL);

      MultiValueControl multiValueControl = (MultiValueControl) getControl();
      if (multiValueControl.getOptions() != null) {
        multiValueControl.getOptions().add(0, new ConcreteKeyValue("", allOptionText));
      }

      if (multiValueControl.getRichOptions() != null) {
        Message message = ComponentFactory.getMessage();
        message.setMessageText(allOptionText);
        message.setRenderWrapperTag(false);

        multiValueControl.getRichOptions().add(0, new KeyMessage("", allOptionText, message));
      }
    }
  }
Exemplo n.º 2
0
  /**
   * Sets up rich message content for the label, if any exists
   *
   * <p>{@inheritDoc}
   */
  @Override
  public void performApplyModel(Object model, LifecycleElement parent) {
    super.performApplyModel(model, parent);

    if (richHeaderMessage == null
        && headerText != null
        && headerText.contains(KRADConstants.MessageParsing.LEFT_TOKEN)
        && headerText.contains(KRADConstants.MessageParsing.RIGHT_TOKEN)) {
      Message message = ComponentFactory.getMessage();
      message.setMessageText(headerText);
      message.setInlineComponents(inlineComponents);
      message.setRenderWrapperTag(false);

      this.setRichHeaderMessage(message);
    }
  }