예제 #1
0
  @Override
  protected void onComponentTag(final ComponentTag tag) {
    super.onComponentTag(tag);

    IValueMap attributes = tag.getAttributes();

    if (minimum != null) {
      attributes.put("min", Objects.stringValue(minimum));
    } else {
      attributes.remove("min");
    }

    if (maximum != null) {
      attributes.put("max", Objects.stringValue(maximum));
    } else {
      attributes.remove("max");
    }

    if (step != null) {
      attributes.put("step", Objects.stringValue(step));
    } else {
      attributes.remove("step");
    }
  }
 public final void replaceAttributeValue(final Component component, final ComponentTag tag) {
   if (this.isEnabled(component)) {
     final IValueMap attributes = tag.getAttributes();
     final Object replacementValue = this.getReplacementOrNull(component);
     if (AttributeModifier.VALUELESS_ATTRIBUTE_ADD == replacementValue) {
       attributes.put((Object) this.attribute, (Object) null);
     } else if (AttributeModifier.VALUELESS_ATTRIBUTE_REMOVE == replacementValue) {
       attributes.remove((Object) this.attribute);
     } else {
       final String value = this.toStringOrNull(attributes.get((Object) this.attribute));
       final String newValue = this.newValue(value, this.toStringOrNull(replacementValue));
       if (newValue != null) {
         attributes.put((Object) this.attribute, (Object) newValue);
       }
     }
   }
 }