use of org.jboss.hal.processor.mbui.ElementType.Table in project console by hal.
the class MbuiViewProcessor method processMbuiElements.
// ------------------------------------------------------ process @MbuiElement
@SuppressWarnings("HardCodedStringLiteral")
private void processMbuiElements(TypeElement type, Document document, MbuiViewContext context) {
ElementFilter.fieldsIn(type.getEnclosedElements()).stream().filter(field -> MoreElements.isAnnotationPresent(field, MbuiElement.class)).forEach(field -> {
// verify the field
if (field.getModifiers().contains(Modifier.PRIVATE)) {
error(field, "@%s member must not be private", MbuiElement.class.getSimpleName());
}
if (field.getModifiers().contains(Modifier.STATIC)) {
error(field, "@%s member must not be static", MbuiElement.class.getSimpleName());
}
// verify the selector
String selector = getSelector(field);
org.jdom2.Element element = verifySelector(selector, field, document);
// delegate to specific processors based on element type
ElementType elementType = getMbuiElementType(field.asType());
if (elementType == null) {
error(field, "Unsupported type %s. Please choose one of %s", field.asType(), EnumSet.allOf(ElementType.class));
} else {
MbuiElementProcessor elementProcessor = null;
switch(elementType) {
case VerticalNavigation:
elementProcessor = new VerticalNavigationProcessor(this, elementUtils, xPathFactory);
break;
case Table:
elementProcessor = new DataTableProcessor(this, elementUtils, xPathFactory);
break;
case Form:
elementProcessor = new FormProcessor(this, elementUtils, xPathFactory);
break;
default:
break;
}
elementProcessor.process(field, element, selector, context);
}
});
}
Aggregations