Esempio n. 1
0
  /**
   * The following finalization is performed:
   *
   * <ul>
   *   <li>Set render on header group to false if no items are configured
   * </ul>
   *
   * {@inheritDoc}
   */
  @Override
  public void performFinalize(Object model, LifecycleElement parent) {
    super.performFinalize(model, parent);

    // don't render header groups if no items were configured
    if ((getUpperGroup() != null) && (getUpperGroup().getItems().isEmpty())) {
      getUpperGroup().setRender(false);
    }

    if ((getRightGroup() != null) && (getRightGroup().getItems().isEmpty())) {
      getRightGroup().setRender(false);
    }

    if ((getLowerGroup() != null) && (getLowerGroup().getItems().isEmpty())) {
      getLowerGroup().setRender(false);
    }

    // add preset styles to header groups
    if (getUpperGroup() != null) {
      getUpperGroup().addStyleClass("uif-header-upperGroup");
    }

    if (getRightGroup() != null) {
      getRightGroup().addStyleClass("uif-header-rightGroup");
    }

    if (getLowerGroup() != null) {
      getLowerGroup().addStyleClass("uif-header-lowerGroup");
    }
  }
Esempio n. 2
0
  /** {@inheritDoc} */
  @Override
  public void performInitialization(Object model) {
    super.performInitialization(model);

    if (isReadOnly()) {
      if (upperGroup != null) {
        upperGroup.setReadOnly(true);
      }
      if (lowerGroup != null) {
        lowerGroup.setReadOnly(true);
      }
      if (rightGroup != null) {
        rightGroup.setReadOnly(true);
      }
    }
  }
Esempio n. 3
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);
    }
  }
Esempio n. 4
0
  /** {@inheritDoc} */
  @Override
  public void completeValidation(ValidationTrace tracer) {
    tracer.addBean(this);

    // Checks that a correct header level is set
    String headerLevel = getHeaderLevel().toUpperCase();
    boolean correctHeaderLevel = false;
    if (headerLevel.compareTo("H1") == 0) {
      correctHeaderLevel = true;
    } else if (headerLevel.compareTo("H2") == 0) {
      correctHeaderLevel = true;
    } else if (headerLevel.compareTo("H3") == 0) {
      correctHeaderLevel = true;
    } else if (headerLevel.compareTo("H4") == 0) {
      correctHeaderLevel = true;
    } else if (headerLevel.compareTo("H5") == 0) {
      correctHeaderLevel = true;
    } else if (headerLevel.compareTo("H6") == 0) {
      correctHeaderLevel = true;
    } else if (headerLevel.compareTo("LABEL") == 0) {
      correctHeaderLevel = true;
    }
    if (!correctHeaderLevel) {
      String currentValues[] = {"headerLevel =" + getHeaderLevel()};
      tracer.createError(
          "HeaderLevel must be of values h1, h2, h3, h4, h5, h6, or label", currentValues);
    }

    // Checks that header text is set
    if (getHeaderText() == null) {
      if (!Validator.checkExpressions(this, "headerText")) {
        String currentValues[] = {"headertText =" + getHeaderText()};
        tracer.createWarning("HeaderText should be set", currentValues);
      }
    }

    super.completeValidation(tracer.getCopy());
  }