use of org.jboss.hal.ballroom.form.SuggestHandler in project console by hal.
the class DefaultFormItemProvider method checkCapabilityReference.
private void checkCapabilityReference(ModelNode attributeDescription, FormItem<?> formItem) {
SuggestHandler suggestHandler = null;
if (attributeDescription.hasDefined(CAPABILITY_REFERENCE)) {
Dispatcher dispatcher = Core.INSTANCE.dispatcher();
StatementContext statementContext = Core.INSTANCE.statementContext();
String reference = attributeDescription.get(CAPABILITY_REFERENCE).asString();
Capabilities capabilities = metadata.getCapabilities();
if (capabilities.supportsSuggestions()) {
suggestHandler = new SuggestCapabilitiesAutoComplete(dispatcher, statementContext, reference, metadata.getTemplate());
} else if (capabilities.contains(reference)) {
suggestHandler = new ReadChildrenAutoComplete(dispatcher, statementContext, capabilities.lookup(reference));
}
}
if (suggestHandler != null) {
formItem.registerSuggestHandler(suggestHandler);
}
}
use of org.jboss.hal.ballroom.form.SuggestHandler in project console by hal.
the class LoggingView method addRootLogger.
private void addRootLogger() {
Metadata metadata = mbuiContext.metadataRegistry().lookup(ROOT_LOGGER_TEMPLATE);
Form<ModelNode> form = new ModelNodeForm.Builder<>("logging-root-logger-add", metadata).fromRequestProperties().include(LEVEL, HANDLERS).build();
AddResourceDialog dialog = new AddResourceDialog(mbuiContext.resources().messages().addResourceTitle(Names.ROOT_LOGGER), form, (name, model) -> {
Operation operation = new Operation.Builder(ROOT_LOGGER_TEMPLATE.resolve(mbuiContext.statementContext()), ADD).payload(model).build();
mbuiContext.dispatcher().execute(operation, result -> {
MessageEvent.fire(mbuiContext.eventBus(), Message.success(mbuiContext.resources().messages().addSingleResourceSuccess(Names.ROOT_LOGGER)));
presenter.reload();
});
});
SuggestHandler suggestHandler = new ReadChildrenAutoComplete(mbuiContext.dispatcher(), mbuiContext.statementContext(), asList(ASYNC_HANDLER_TEMPLATE, CONSOLE_HANDLER_TEMPLATE, CUSTOM_HANDLER_TEMPLATE, FILE_HANDLER_TEMPLATE, PERIODIC_ROTATING_FILE_HANDLER_TEMPLATE, PERIODIC_SIZE_ROTATING_FILE_HANDLER_TEMPLATE, SIZE_ROTATING_FILE_HANDLER_TEMPLATE, SYSLOG_HANDLER_TEMPLATE));
dialog.getForm().getFormItem(HANDLERS).registerSuggestHandler(suggestHandler);
dialog.show();
}
Aggregations