use of org.jboss.hal.core.mbui.dialog.NameItem in project console by hal.
the class DestinationPresenter method addJMSQueue.
// ------------------------------------------------------ jms queue
// the custom add resource dialog is necessary because the "durable" and "selector" attributes are read-only
// after created
void addJMSQueue() {
Metadata metadata = metadataRegistry.lookup(JMS_QUEUE_TEMPLATE);
NameItem nameItem = new NameItem();
Form<ModelNode> form = new ModelNodeForm.Builder<>(Ids.build(Ids.MESSAGING_JMS_QUEUE, ADD), metadata).fromRequestProperties().unboundFormItem(nameItem, 0).include(DURABLE, SELECTOR).unsorted().build();
new AddResourceDialog(resources.messages().addResourceTitle(Names.JMS_QUEUE), form, (name, model) -> {
AddressTemplate template = SELECTED_SERVER_TEMPLATE.append("jms-queue=" + nameItem.getValue());
ResourceAddress address = template.resolve(statementContext);
crud.add(Names.JMS_QUEUE, nameItem.getValue(), address, model, (name1, address1) -> reload());
}).show();
}
use of org.jboss.hal.core.mbui.dialog.NameItem in project console by hal.
the class LoggingProfileView method addFileHandlerResource.
private void addFileHandlerResource(String templateSuffix, String id, String type, String... attributes) {
AddressTemplate metadataTemplate = LOGGING_PROFILE_TEMPLATE.append(templateSuffix);
Metadata metadata = mbuiContext.metadataRegistry().lookup(metadataTemplate);
AddressTemplate selectionTemplate = SELECTED_LOGGING_PROFILE_TEMPLATE.append(templateSuffix);
ModelNodeForm.Builder<ModelNode> builder = new ModelNodeForm.Builder<>(id, metadata).fromRequestProperties().unboundFormItem(new NameItem(), 0).customFormItem("file", (attributeDescription) -> new FileFormItem(FILE, true)).unsorted();
if (attributes != null) {
builder.include(asList(attributes));
}
AddResourceDialog dialog = new AddResourceDialog(mbuiContext.resources().messages().addResourceTitle(type), builder.build(), (name, modelNode) -> {
ResourceAddress address = selectionTemplate.resolve(selectionAwareStatementContext, name);
crud().add(type, name, address, modelNode, (n, a) -> presenter.reload());
});
dialog.show();
}
Aggregations