예제 #1
0
  /** @see org.apache.wicket.Component#onComponentTag(org.apache.wicket.markup.ComponentTag) */
  @Override
  protected void onComponentTag(ComponentTag tag) {
    super.onComponentTag(tag);

    checkComponentTag(tag, "label");

    LabeledWebMarkupContainer formComponent = getFormComponent();

    tag.put("for", formComponent.getMarkupId());

    if (formComponent instanceof FormComponent<?>) {
      FormComponent<?> fc = (FormComponent<?>) formComponent;

      if (fc.isRequired()) {
        tag.append("class", getString(REQUIRED_CSS_CLASS_KEY), " ");
      }
      if (fc.isValid() == false) {
        tag.append("class", getString(INVALID_CSS_CLASS_KEY), " ");
      }
    }

    if (formComponent.isEnabledInHierarchy() == false) {
      tag.append("class", getString(DISABLED_CSS_CLASS_KEY), " ");
    }

    // always transform the tag to <span></span> so even labels defined as <span/> render
    tag.setType(TagType.OPEN);
  }
예제 #2
0
 @Override
 protected void onComponentTag(ComponentTag tag) {
   super.onComponentTag(tag);
   Prof prof = profOfPanel.getObject();
   if (prof.getWahlModulSelected().isEmpty() && prof.getPflichtModulSelected().isEmpty()) {
     tag.append("style", "display:none", " ");
   }
 }