use of org.jboss.hal.ballroom.form.AbstractFormItem.ExpressionContext in project console by hal.
the class ReadOnlyAppearance method safeApply.
// ------------------------------------------------------ decorations
@Override
protected <C> void safeApply(Decoration decoration, C context) {
switch(decoration) {
case DEFAULT:
defaultValue.textContent = String.valueOf(context);
if (isApplied(HINT)) {
valueContainer.insertBefore(defaultValue, hintElement);
} else {
valueContainer.appendChild(defaultValue);
}
break;
case DEPRECATED:
markAsDeprecated((Deprecation) context);
break;
case EXPRESSION:
ExpressionContext ec = (ExpressionContext) context;
expressionHandler = bind(expressionLink, click, event -> ec.callback.resolveExpression(masked ? backupValue : valueElement.textContent));
if (isApplied(HINT)) {
valueContainer.insertBefore(expressionLink, hintElement);
} else {
valueContainer.appendChild(expressionLink);
}
break;
case HINT:
hintElement.textContent = String.valueOf(context);
valueContainer.appendChild(hintElement);
break;
case RESTRICTED:
valueElement.textContent = "";
Elements.removeChildrenFrom(valueContainer);
valueContainer.appendChild(restrictedMarker);
break;
case SENSITIVE:
if (isApplied(EXPRESSION)) {
valueContainer.insertBefore(peekLink, expressionLink);
} else {
valueContainer.appendChild(peekLink);
}
mask();
break;
// not supported
case ENABLED:
case INVALID:
case REQUIRED:
case SUGGESTIONS:
break;
default:
break;
}
}
Aggregations