@SuppressWarnings("unchecked") @Override protected void createColumns( DefaultCellTable<ArtifactReference> table, ListDataProvider<ArtifactReference> dataProvider) { final TextColumn<ArtifactReference> nameColumn = new TextColumn<ArtifactReference>() { @Override public String getValue(ArtifactReference reference) { return reference.getName(); } }; nameColumn.setSortable(true); final TextColumn<ArtifactReference> urlColumn = new TextColumn<ArtifactReference>() { @Override public String getValue(ArtifactReference reference) { return reference.getUrl(); } }; urlColumn.setSortable(true); ColumnSortEvent.ListHandler<ArtifactReference> sortHandler = new ColumnSortEvent.ListHandler<ArtifactReference>(dataProvider.getList()); sortHandler.setComparator(nameColumn, createColumnCommparator(nameColumn)); sortHandler.setComparator(urlColumn, createColumnCommparator(urlColumn)); table.addColumn(nameColumn, "Name"); table.addColumn(urlColumn, "URL"); table.addColumnSortHandler(sortHandler); table.addColumnSortHandler(sortHandler); table.getColumnSortList().push(urlColumn); table.getColumnSortList().push(nameColumn); }
@Override protected void createColumns( DefaultCellTable<Transformer> table, ListDataProvider<Transformer> dataProvider) { TextColumn<Transformer> fromColumn = new TextColumn<Transformer>() { @Override public String getValue(Transformer transform) { return transform.getFrom(); } }; fromColumn.setSortable(true); TextColumn<Transformer> toColumn = new TextColumn<Transformer>() { @Override public String getValue(Transformer transform) { return transform.getTo(); } }; toColumn.setSortable(true); TextColumn<Transformer> typeColumn = new TextColumn<Transformer>() { @Override public String getValue(Transformer transform) { return transform.getType(); } }; typeColumn.setSortable(true); ColumnSortEvent.ListHandler<Transformer> sortHandler = new ColumnSortEvent.ListHandler<Transformer>(dataProvider.getList()); sortHandler.setComparator(fromColumn, createColumnCommparator(fromColumn)); sortHandler.setComparator(toColumn, createColumnCommparator(toColumn)); sortHandler.setComparator(typeColumn, createColumnCommparator(typeColumn)); table.addColumn(fromColumn, "From"); table.addColumn(toColumn, "To"); table.addColumn(typeColumn, "Type"); table.addColumnSortHandler(sortHandler); table.getColumnSortList().push(typeColumn); table.getColumnSortList().push(toColumn); table.getColumnSortList().push(fromColumn); table.setWidth("100%", false); table.setColumnWidth(fromColumn, 45, Style.Unit.PCT); table.setColumnWidth(toColumn, 45, Style.Unit.PCT); table.setColumnWidth(typeColumn, 10, Style.Unit.PCT); }
private void setupTable() { table = new DefaultCellTable<>(5); table.setSelectionModel(selectionModel); // columns Column<ModelNode, String> principals = createColumn("principals"); Column<ModelNode, String> roles = createColumn("roles"); principals.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); roles.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); table.addColumn(principals, "Principals"); table.addColumn(roles, "Roles"); table.setColumnWidth(principals, 30, Style.Unit.PCT); table.setColumnWidth(roles, 30, Style.Unit.PCT); }
@Override public void updateFrom(EESubsystem eeSubsystem) { form.edit(eeSubsystem); dataProvider.setList(eeSubsystem.getModules()); moduleList.selectDefaultEntity(); }
public void updateChanges(List<ModelNode> _changes) { dataProvider.setList(_changes); table.selectDefaultEntity(); this.changes.clear(); this.changes.addAll(_changes); detailsConfigurationChange.clearValue(); }
public void setStack(JGroupsStack stack) { this.selectedStack = stack; headline.setText("Protocols: Stack " + stack.getName()); dataProvider.setList(stack.getProtocols()); table.selectDefaultEntity(); }
@Override public void updateDeploymentInfo(List<DeploymentRecord> deployments) { dataProvider.getList().clear(); dataProvider.getList().addAll(deployments); dataProvider.flush(); deploymentTable.selectDefaultEntity(); filter.reset(true); }
public void update(final List<Property> models) { dataProvider.setList(models); if (models.isEmpty()) { selectionModel.clear(); } else { table.selectDefaultEntity(); } SelectionChangeEvent.fire( selectionModel); // updates ModelNodeForm's editedEntity with current value }
@SuppressWarnings("unchecked") protected DefaultCellTable<Property> setupTable() { TextColumn<Property> nameColumn = new TextColumn<Property>() { @Override public String getValue(Property node) { return node.getName(); } }; table.addColumn(nameColumn, "Name"); return table; }
public void setAdapter(ResourceAdapter adapter) { this.currentAdapter = adapter; configProperties.clearValues(); headline.setText("Resource Adapter: " + adapter.getArchive()); List<AdminObject> list = adapter.getAdminObjects(); dataProvider.setList(list); table.selectDefaultEntity(); }
public void update(Property prop) { authContextName = prop.getName(); if (prop.getValue().hasDefined(MATCH_RULES)) { List<ModelNode> models = prop.getValue().get(MATCH_RULES).asList(); table.setRowCount(models.size(), true); List<ModelNode> dataList = dataProvider.getList(); dataList.clear(); dataList.addAll(models); } else { clearValues(); } selectionModel.clear(); }
public void update(Property prop) { permissionMapping = prop.getName(); if (prop.getValue().hasDefined("permissions")) { List<ModelNode> models = prop.getValue().get("permissions").asList(); table.setRowCount(models.size(), true); List<ModelNode> dataList = dataProvider.getList(); dataList.clear(); // cannot call setList() as that breaks the sort handler dataList.addAll(models); } else { clearValues(); } selectionModel.clear(); }
private void setupTable() { table = new DefaultCellTable<>(5); table.setSelectionModel(selectionModel); // columns Column<ModelNode, String> classNameColumn = createColumn("class-name"); Column<ModelNode, String> moduleColumn = createColumn("module"); Column<ModelNode, String> targetNameColumn = createColumn("target-name"); Column<ModelNode, String> actionColumn = createColumn("action"); classNameColumn.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); moduleColumn.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); targetNameColumn.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); actionColumn.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); table.addColumn(classNameColumn, "Class name"); table.addColumn(moduleColumn, "Module"); table.addColumn(targetNameColumn, "Target name"); table.addColumn(actionColumn, "Action"); table.setColumnWidth(classNameColumn, 40, Style.Unit.PCT); table.setColumnWidth(moduleColumn, 20, Style.Unit.PCT); table.setColumnWidth(targetNameColumn, 25, Style.Unit.PCT); table.setColumnWidth(actionColumn, 15, Style.Unit.PCT); }
public void setDiverts(List<ActivemqDivert> diverts) { provider.setList(diverts); serverName.setText("Diverts: Provider " + presenter.getCurrentServer()); table.selectDefaultEntity(); // populate oracle presenter.loadExistingQueueNames( new AsyncCallback<List<String>>() { @Override public void onFailure(Throwable throwable) {} @Override public void onSuccess(List<String> names) { divertForm.setQueueNames(names); } }); }
@SuppressWarnings("unchecked") public IOPanel(AddressTemplate address, IOPresenter presenter) { this.address = address; this.presenter = presenter; this.providesKey = new ProvidesKey<Property>() { @Override public Object getKey(Property item) { return item.getName(); } }; this.table = new DefaultCellTable<>(5, providesKey); this.dataProvider = new ListDataProvider<Property>(providesKey); this.selectionModel = new SingleSelectionModel<Property>(providesKey); dataProvider.addDataDisplay(table); table.setSelectionModel(selectionModel); }
Widget asWidget() { ToolStrip topLevelTools = new ToolStrip(); topLevelTools.addToolButtonRight( new ToolButton( Console.CONSTANTS.common_label_add(), new ClickHandler() { @Override public void onClick(ClickEvent event) { presenter.launchNewAdminWizard(); } })); ClickHandler clickHandler = new ClickHandler() { @Override public void onClick(ClickEvent event) { final AdminObject selection = getCurrentSelection(); if (selection != null) { Feedback.confirm( Console.MESSAGES.deleteTitle("Admin Object"), Console.MESSAGES.deleteConfirm("Admin Object" + selection.getJndiName()), new Feedback.ConfirmationHandler() { @Override public void onConfirmation(boolean isConfirmed) { if (isConfirmed) { presenter.onRemoveAdmin(selection); } } }); } } }; ToolButton deleteBtn = new ToolButton(Console.CONSTANTS.common_label_delete()); deleteBtn.addClickHandler(clickHandler); topLevelTools.addToolButtonRight(deleteBtn); disableBtn = new ToolButton( Console.CONSTANTS.common_label_disable(), new ClickHandler() { @Override public void onClick(ClickEvent event) { final AdminObject selection = getCurrentSelection(); if (selection != null) { selection.setEnabled(!selection.isEnabled()); Feedback.confirm( Console.MESSAGES.modify("Admin Object"), Console.MESSAGES.modifyConfirm("Admin Object " + selection.getJndiName()), new Feedback.ConfirmationHandler() { @Override public void onConfirmation(boolean isConfirmed) { if (isConfirmed) { presenter.enOrDisbaleAdminObject(currentAdapter, selection); } } }); } } }); topLevelTools.addToolButtonRight(disableBtn); // ------- table = new DefaultCellTable<AdminObject>( 10, new ProvidesKey<AdminObject>() { @Override public Object getKey(AdminObject item) { return item.getJndiName(); } }); dataProvider = new ListDataProvider<AdminObject>(); dataProvider.addDataDisplay(table); TextColumn<AdminObject> nameColumn = new TextColumn<AdminObject>() { @Override public String getValue(AdminObject record) { return record.getName(); } }; Column<AdminObject, ImageResource> statusColumn = new Column<AdminObject, ImageResource>(new ImageResourceCell()) { @Override public ImageResource getValue(AdminObject ra) { ImageResource res = null; if (ra.isEnabled()) res = Icons.INSTANCE.status_good(); else res = Icons.INSTANCE.status_bad(); return res; } }; table.addColumn(nameColumn, "Name"); table.addColumn(statusColumn, "Enabled?"); // --- configProperties = new PropertyEditor(this, true); // ---- VerticalPanel formpanel = new VerticalPanel(); formpanel.setStyleName("fill-layout-width"); Form<AdminObject> form = new Form<AdminObject>(AdminObject.class); form.setNumColumns(2); TextItem name = new TextItem("name", "Name"); TextBoxItem jndiItem = new TextBoxItem("jndiName", "JNDI"); TextBoxItem classItem = new TextBoxItem("adminClass", "Class Name"); // CheckBoxItem enabled = new CheckBoxItem("enabled", "Enabled?"); form.setFields(name, jndiItem, classItem); form.setEnabled(false); form.bind(table); FormToolStrip<AdminObject> tools = new FormToolStrip<AdminObject>( form, new FormToolStrip.FormCallback<AdminObject>() { @Override public void onSave(Map<String, Object> changeset) { presenter.onSaveAdmin(getCurrentSelection(), changeset); } @Override public void onDelete(AdminObject entity) { // not possible } }); tools.providesDeleteOp(false); final FormHelpPanel helpPanel = new FormHelpPanel( new FormHelpPanel.AddressCallback() { @Override public ModelNode getAddress() { ModelNode address = Baseadress.get(); address.add("subsystem", "resource-adapters"); address.add("resource-adapter", "*"); address.add("admin-objects", "*"); return address; } }, form); formpanel.add(tools.asWidget()); formpanel.add(helpPanel.asWidget()); formpanel.add(form.asWidget()); table .getSelectionModel() .addSelectionChangeHandler( new SelectionChangeEvent.Handler() { public void onSelectionChange(SelectionChangeEvent event) { AdminObject selection = getCurrentSelection(); configProperties.setProperties("", selection.getProperties()); String nextState = selection.isEnabled() ? Console.CONSTANTS.common_label_disable() : Console.CONSTANTS.common_label_enable(); disableBtn.setText(nextState); } }); // ---- headline = new HTML("HEADLINE"); headline.setStyleName("content-header-label"); MultipleToOneLayout layout = new MultipleToOneLayout() .setPlain(true) .setHeadlineWidget(headline) .setTitle("TITLE") .setDescription(Console.CONSTANTS.subsys_jca_adminobject_desc()) .setMaster(Console.MESSAGES.available("Admin Objects"), table) .setMasterTools(topLevelTools.asWidget()) .addDetail("Attributes", formpanel) .addDetail("Properties", configProperties.asWidget()); configProperties.setAllowEditProps(false); return layout.build(); }
private AdminObject getCurrentSelection() { return ((SingleSelectionModel<AdminObject>) table.getSelectionModel()).getSelectedObject(); }
@Override public Widget createWidget() { form = new Form<EESubsystem>(EESubsystem.class); CheckBoxItem isolation = new CheckBoxItem("isolatedSubdeployments", "Isolated Subdeployments?"); form.setFields(isolation); form.setEnabled(false); FormToolStrip<EESubsystem> formToolStrip = new FormToolStrip<EESubsystem>( form, new FormToolStrip.FormCallback<EESubsystem>() { @Override public void onSave(Map<String, Object> changeset) { presenter.onSave(form.getEditedEntity(), changeset); } @Override public void onDelete(EESubsystem entity) { // cannot be removed } }); formToolStrip.providesDeleteOp(false); FormHelpPanel helpPanel = new FormHelpPanel( new FormHelpPanel.AddressCallback() { @Override public ModelNode getAddress() { ModelNode address = Baseadress.get(); address.add("subsystem", "ee"); return address; } }, form); Widget master = new FormLayout().setForm(form).setHelp(helpPanel).build(); // ----- // module list moduleList = new DefaultCellTable<Module>( 5, new ProvidesKey<Module>() { @Override public Object getKey(Module item) { return item.getName() + "_" + item.getSlot(); } }); dataProvider = new ListDataProvider<Module>(); dataProvider.addDataDisplay(moduleList); moduleList.setSelectionModel(new SingleSelectionModel()); TextColumn<Module> name = new TextColumn<Module>() { @Override public String getValue(Module record) { return record.getName(); } }; TextColumn<Module> slot = new TextColumn<Module>() { @Override public String getValue(Module record) { return record.getSlot(); } }; moduleList.addColumn(name, "Name"); moduleList.addColumn(slot, "Slot"); ToolStrip moduleTools = new ToolStrip(); ToolButton addBtn = new ToolButton( Console.CONSTANTS.common_label_add(), new ClickHandler() { @Override public void onClick(ClickEvent event) { presenter.launchNewModuleDialogue(); } }); addBtn.ensureDebugId(Console.DEBUG_CONSTANTS.debug_label_add_eESubsystemView()); moduleTools.addToolButtonRight(addBtn); ToolButton button = new ToolButton( Console.CONSTANTS.common_label_remove(), new ClickHandler() { @Override public void onClick(ClickEvent event) { final Module module = ((SingleSelectionModel<Module>) moduleList.getSelectionModel()) .getSelectedObject(); if (null == module) return; Feedback.confirm( Console.MESSAGES.deleteTitle("Module"), Console.MESSAGES.deleteConfirm("Module"), new Feedback.ConfirmationHandler() { @Override public void onConfirmation(boolean isConfirmed) { if (isConfirmed) { presenter.onRemoveModule(form.getEditedEntity(), module); } } }); } }); button.ensureDebugId(Console.DEBUG_CONSTANTS.debug_label_remove_eESubsystemView()); moduleTools.addToolButtonRight(button); VerticalPanel modulePanel = new VerticalPanel(); modulePanel.setStyleName("fill-layout-width"); modulePanel.add(moduleTools.asWidget()); modulePanel.add(moduleList.asWidget()); // ---- Widget panel = new OneToOneLayout() .setTitle("EE") .setHeadline("EE Subsystem") .setDescription(Console.CONSTANTS.subsys_ee_desc()) .setMaster("Subsystem Defaults", master) .setMasterTools(formToolStrip.asWidget()) .setDetail("Global Modules", modulePanel) .build(); modulePanel.getElement().setAttribute("style", "padding-top:5px"); return panel; }
@SuppressWarnings("unchecked") public ActivemqDivert getSelectedEntity() { SingleSelectionModel<ActivemqDivert> selectionModel = (SingleSelectionModel<ActivemqDivert>) table.getSelectionModel(); return selectionModel.getSelectedObject(); }
@Override public void setConnectionFactories(List<ConnectionFactory> factories) { factoryTable.setRowCount(factories.size(), true); factoryTable.setRowData(0, factories); }
@SuppressWarnings("unchecked") Widget asWidget() { secTable = new DefaultCellTable<>(8, item -> item.getPattern() + "_" + item.getRole()); secProvider = new ListDataProvider<>(); secProvider.addDataDisplay(secTable); Column<ActivemqSecurityPattern, String> roleColumn = new Column<ActivemqSecurityPattern, String>(new TextCell()) { @Override public String getValue(ActivemqSecurityPattern object) { return object.getRole(); } }; Column<ActivemqSecurityPattern, String> patternColumn = new Column<ActivemqSecurityPattern, String>(new TextCell()) { @Override public String getValue(ActivemqSecurityPattern object) { return object.getPattern(); } }; secTable.addColumn(patternColumn, "Pattern"); secTable.addColumn(roleColumn, "Role"); form = new Form<>(ActivemqSecurityPattern.class); form.setNumColumns(2); form.bind(secTable); CheckBoxItem send = new CheckBoxItem("send", "Send?"); CheckBoxItem consume = new CheckBoxItem("consume", "Consume?"); CheckBoxItem manage = new CheckBoxItem("manage", "Manage?"); CheckBoxItem createDQ = new CheckBoxItem("createDurableQueue", "CreateDurable?"); CheckBoxItem deleteDQ = new CheckBoxItem("deleteDurableQueue", "DeleteDurable?"); CheckBoxItem createNDQ = new CheckBoxItem("createNonDurableQueue", "CreateNonDurable?"); CheckBoxItem deleteNDQ = new CheckBoxItem("deleteNonDurableQueue", "DeleteNonDurable?"); form.setFields(send, consume, manage); form.setFieldsInGroup( Console.CONSTANTS.common_label_advanced(), new DisclosureGroupRenderer(), createDQ, deleteDQ, createNDQ, deleteNDQ); FormHelpPanel helpPanel = new FormHelpPanel( () -> { ModelNode address = Baseadress.get(); address.add("subsystem", "messaging-activemq"); address.add("server", "*"); address.add("security-setting", "*"); address.add("role", "*"); return address; }, form); FormToolStrip<ActivemqSecurityPattern> formTools = new FormToolStrip<>( form, new FormToolStrip.FormCallback<ActivemqSecurityPattern>() { @Override public void onSave(Map<String, Object> changeset) { presenter.onSaveSecDetails(form.getEditedEntity(), changeset); } @Override public void onDelete(ActivemqSecurityPattern entity) {} }); ToolStrip tableTools = new ToolStrip(); ToolButton addBtn = new ToolButton( Console.CONSTANTS.common_label_add(), event -> presenter.launchNewSecDialogue()); addBtn.ensureDebugId(Console.DEBUG_CONSTANTS.debug_label_add_securityDetails()); tableTools.addToolButtonRight(addBtn); ToolButton removeBtn = new ToolButton( Console.CONSTANTS.common_label_delete(), event -> Feedback.confirm( Console.MESSAGES.deleteTitle("Security Config"), Console.MESSAGES.deleteConfirm("Security Config"), isConfirmed -> { if (isConfirmed) { presenter.onDeleteSecDetails(form.getEditedEntity()); } })); tableTools.addToolButtonRight(removeBtn); VerticalPanel formPanel = new VerticalPanel(); formPanel.addStyleName("fill-layout-width"); formPanel.add(helpPanel.asWidget()); formPanel.add(formTools.asWidget()); formPanel.add(form.asWidget()); serverName = new ContentHeaderLabel(); MultipleToOneLayout layout = new MultipleToOneLayout() .setPlain(true) .setHeadlineWidget(serverName) .setDescription( "A security setting allows sets of permissions to be defined against queues based on their address.") .setMaster("Available security settings", secTable) .setMasterTools(tableTools.asWidget()) .setDetail("Details", formPanel); return layout.build(); }
@SuppressWarnings("unchecked") Widget asWidget() { serverName = new ContentHeaderLabel(); table = new DefaultCellTable<>(10, ActivemqDivert::getRoutingName); provider = new ListDataProvider<>(); provider.addDataDisplay(table); Column<ActivemqDivert, String> name = new Column<ActivemqDivert, String>(new TextCell()) { @Override public String getValue(ActivemqDivert object) { return object.getRoutingName(); } }; Column<ActivemqDivert, String> from = new Column<ActivemqDivert, String>(new TextCell()) { @Override public String getValue(ActivemqDivert object) { return object.getDivertAddress(); } }; Column<ActivemqDivert, String> to = new Column<ActivemqDivert, String>(new TextCell()) { @Override public String getValue(ActivemqDivert object) { return object.getForwardingAddress(); } }; table.addColumn(name, "Name"); table.addColumn(from, "From"); table.addColumn(to, "To"); ToolStrip tools = new ToolStrip(); tools.addToolButtonRight( new ToolButton( Console.CONSTANTS.common_label_add(), clickEvent -> presenter.launchNewDivertWizard())); tools.addToolButtonRight( new ToolButton( Console.CONSTANTS.common_label_remove(), clickEvent -> Feedback.confirm( Console.MESSAGES.deleteTitle("Divert"), Console.MESSAGES.deleteConfirm( "Divert " + getSelectedEntity().getRoutingName()), isConfirmed -> { if (isConfirmed) { presenter.onDeleteDivert(getSelectedEntity().getRoutingName()); } }))); divertForm = new DivertForm( presenter, new FormToolStrip.FormCallback<ActivemqDivert>() { @Override public void onSave(Map<String, Object> changeset) { presenter.onSaveDivert(getSelectedEntity().getRoutingName(), changeset); } @Override public void onDelete(ActivemqDivert entity) {} }); MultipleToOneLayout layout = new MultipleToOneLayout() .setPlain(true) .setHeadlineWidget(serverName) .setDescription(Console.CONSTANTS.divertDescription()) .setMaster("Diverts", table) .setMasterTools(tools) .setDetail("Details", divertForm.asWidget()); divertForm.getForm().bind(table); return layout.build(); }
private JGroupsProtocol getCurrentSelection() { SingleSelectionModel<JGroupsProtocol> selectionModel = (SingleSelectionModel<JGroupsProtocol>) table.getSelectionModel(); return selectionModel.getSelectedObject(); }
@SuppressWarnings("unchecked") public Widget asWidget() { ProvidesKey<ModelNode> providesKey = node -> node.get("operation-date").asString(); table = new DefaultCellTable<>(20, providesKey); dataProvider = new ListDataProvider<>(providesKey); dataProvider.addDataDisplay(table); // the date / time column table.addColumn( new TextColumn<ModelNode>() { @Override public String getValue(ModelNode item) { // the operation-date is 2016-07-08T22:39:50.783Z // there is some format to facilitate user experience // by replacing the T with a blank space String opTimestamp = item.get("operation-date").asString(); opTimestamp = opTimestamp.replaceFirst("T", " "); return opTimestamp; } }, "Date and time"); // access-mechanism column TextColumn<ModelNode> accessMechanismColumn = createColumn("access-mechanism"); accessMechanismColumn.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); table.addColumn(accessMechanismColumn, "Access Mechanism"); // remote address column TextColumn<ModelNode> remoteAddressColumn = new TextColumn<ModelNode>() { @Override public String getValue(ModelNode item) { // the remote address is 10.10.10.10/10.10.10.10 // to facilitate user experience we cut at at first slash String clientAddress = item.get("remote-address").asString(); clientAddress = clientAddress.substring(0, clientAddress.indexOf("/")); return clientAddress; } }; remoteAddressColumn.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); table.addColumn(remoteAddressColumn, "Remote address"); // the resource address TextColumn<ModelNode> resourceColumn = new TextColumn<ModelNode>() { @Override public String getValue(ModelNode item) { return StringUtils.shortenStringIfNecessary(extractResourceAddress(item), 63); } }; table.addColumn(resourceColumn, "Resource address"); table.setColumnWidth(resourceColumn, 50, Style.Unit.PCT); // operation column table.addColumn( new TextColumn<ModelNode>() { @Override public String getValue(ModelNode item) { return item.get(OPERATIONS).get(0).get(OP).asString(); } }, "Operation"); // result column table.addColumn(createColumn(OUTCOME), "Result"); table.setTableLayoutFixed(false); // the details panel selectionModel = new SingleSelectionModel<>(providesKey); selectionModel.addSelectionChangeHandler( event -> { ModelNode changeDetails = selectionModel.getSelectedObject(); if (changeDetails != null) { detailsConfigurationChange.setValue(changeDetails.toString()); } }); table.setSelectionModel(selectionModel); detailsConfigurationChange = new TextAreaItem("details", "Details 1", 20); detailsConfigurationChange.setEnabled(false); HorizontalPanel header = new HorizontalPanel(); header.addStyleName("fill-layout-width"); header.add(new HTML("<h3 class='metric-label-embedded'>Configuration change details</h3>")); VerticalPanel detailsPanel = new VerticalPanel(); detailsPanel.addStyleName("metric-container"); detailsPanel.add(header); detailsPanel.add(detailsConfigurationChange.asWidget()); // ====================== DefaultPager pager = new DefaultPager(); pager.setDisplay(table); VerticalPanel tableAndPager = new VerticalPanel(); tableAndPager.setStyleName("fill-layout-width"); tableAndPager.add(table); tableAndPager.add(pager); SimpleLayout layout = new SimpleLayout() .setPlain(true) .setHeadline("Configuration Changes") .setDescription( SafeHtmlUtils.fromString(Console.MESSAGES.configuration_changes_description())) .addContent("", toolstripButtons()) .addContent("", tableAndPager) .addContent("", detailsPanel); return layout.build(); }
public Widget asWidget() { LayoutPanel layout = new LayoutPanel(); VerticalPanel panel = new VerticalPanel(); panel.setStyleName("rhs-content-panel"); ScrollPanel scroll = new ScrollPanel(panel); layout.add(scroll); layout.setWidgetTopHeight(scroll, 0, Style.Unit.PX, 100, Style.Unit.PCT); // --- HorizontalPanel horzPanel = new HorizontalPanel(); horzPanel.getElement().setAttribute("style", "width:100%;"); Image image = new Image(Icons.INSTANCE.messaging()); horzPanel.add(image); horzPanel.add(new ContentHeaderLabel("JMS Subsystem Configuration")); image.getElement().getParentElement().setAttribute("width", "25"); panel.add(horzPanel); // ---- panel.add(new ContentGroupLabel("Connection Factories")); factoryTable = new DefaultCellTable<ConnectionFactory>(10); Column<ConnectionFactory, String> nameColumn = new Column<ConnectionFactory, String>(new TextCell()) { @Override public String getValue(ConnectionFactory object) { return object.getName(); } }; Column<ConnectionFactory, String> jndiColumn = new Column<ConnectionFactory, String>(new TextCell()) { @Override public String getValue(ConnectionFactory object) { return object.getJndiName(); } }; factoryTable.addColumn(nameColumn, "Name"); factoryTable.addColumn(jndiColumn, "JNDI"); StaticHelpPanel helpPanel = new StaticHelpPanel(MessagingDescription.getFactoryDescription()); panel.add(helpPanel.asWidget()); panel.add(factoryTable); // ---- panel.add(new ContentGroupLabel("Subresources")); TabPanel bottomLayout = new TabPanel(); bottomLayout.addStyleName("default-tabpanel"); bottomLayout.getElement().setAttribute("style", "padding-top:20px;"); queueList = new QueueList(presenter); bottomLayout.add(queueList.asWidget(), "Queues"); topicList = new TopicList(presenter); bottomLayout.add(topicList.asWidget(), "Topics"); bottomLayout.selectTab(0); panel.add(bottomLayout); return layout; }
@Override public Widget createWidget() { ProvidesKey<DeploymentRecord> key = new ProvidesKey<DeploymentRecord>() { @Override public Object getKey(DeploymentRecord deploymentRecord) { return deploymentRecord.getName(); } }; deploymentTable = new DefaultCellTable<DeploymentRecord>(8, key); final SingleSelectionModel<DeploymentRecord> selectionModel = new SingleSelectionModel<DeploymentRecord>(); deploymentTable.setSelectionModel(selectionModel); dataProvider = new ListDataProvider<DeploymentRecord>(key); dataProvider.addDataDisplay(deploymentTable); // --- final ToolStrip toolStrip = new ToolStrip(); ToolButton addBtn = new ToolButton( Console.CONSTANTS.common_label_add(), new ClickHandler() { @Override public void onClick(ClickEvent event) { presenter.launchNewDeploymentDialoge(null, false); } }); addBtn.ensureDebugId(Console.DEBUG_CONSTANTS.debug_label_add_deploymentListView()); toolStrip.addToolButtonRight(addBtn); toolStrip.addToolButtonRight( new ToolButton( Console.CONSTANTS.common_label_remove(), new ClickHandler() { @Override public void onClick(ClickEvent clickEvent) { DeploymentRecord selection = selectionModel.getSelectedObject(); if (selection != null) { new DeploymentCommandDelegate( DeploymentListView.this.presenter, DeploymentCommand.REMOVE_FROM_STANDALONE) .execute(selection); } } })); toolStrip.addToolButtonRight( new ToolButton( Console.CONSTANTS.common_label_enOrDisable(), new ClickHandler() { @Override public void onClick(ClickEvent clickEvent) { DeploymentRecord selection = selectionModel.getSelectedObject(); if (selection != null) { new DeploymentCommandDelegate( DeploymentListView.this.presenter, DeploymentCommand.ENABLE_DISABLE) .execute(selection); } } })); toolStrip.addToolButtonRight( new ToolButton( "Update", new ClickHandler() { @Override public void onClick(ClickEvent clickEvent) { DeploymentRecord selection = selectionModel.getSelectedObject(); if (selection != null) { new DeploymentCommandDelegate( DeploymentListView.this.presenter, DeploymentCommand.UPDATE_CONTENT) .execute(selection); } } })); filter = new DeploymentFilter(dataProvider); toolStrip.addToolWidget(filter.asWidget()); TitleColumn dplNameColumn = new TitleColumn() {}; TextColumn<DeploymentRecord> dplRuntimeColumn = new TextColumn<DeploymentRecord>() { @Override public String getValue(DeploymentRecord record) { String title = null; if (record.getRuntimeName().length() > 27) title = record.getRuntimeName().substring(0, 26) + "..."; else title = record.getRuntimeName(); return title; } }; deploymentTable.addColumn(dplNameColumn, Console.CONSTANTS.common_label_name()); deploymentTable.addColumn(dplRuntimeColumn, Console.CONSTANTS.common_label_runtimeName()); deploymentTable.addColumn(makeEnabledColumn(), Console.CONSTANTS.common_label_enabled()); Form<DeploymentRecord> form = new Form<DeploymentRecord>(DeploymentRecord.class); form.setNumColumns(2); form.setEnabled(true); TextAreaItem name = new TextAreaItem("name", "Name"); TextAreaItem runtimeName = new TextAreaItem("runtimeName", "Runtime Name"); // TextBoxItem sha = new TextBoxItem("sha", "SHA"); form.setFields(name, runtimeName); form.bind(deploymentTable); MultipleToOneLayout layout = new MultipleToOneLayout() .setTitle(Console.CONSTANTS.common_label_deployments()) .setHeadline(Console.CONSTANTS.common_label_deployments()) .setDescription( "Currently deployed application components. Deployments that have been added through the filesystem will not be managable through the web interface.") .setMaster(Console.MESSAGES.available("Deployments"), deploymentTable) .setMasterTools(toolStrip) .setDetail(Console.CONSTANTS.common_label_selection(), form.asWidget()); return layout.build(); }
public void setSecurityConfig(List<ActivemqSecurityPattern> patterns) { secProvider.setList(patterns); secTable.selectDefaultEntity(); form.setEnabled(false); serverName.setText("Security Settings: Provider " + presenter.getCurrentServer()); }
Widget asWidget() { table = new DefaultCellTable<JGroupsProtocol>( 6, new ProvidesKey<JGroupsProtocol>() { @Override public Object getKey(JGroupsProtocol item) { return item.getType(); } }); dataProvider = new ListDataProvider<JGroupsProtocol>(); dataProvider.addDataDisplay(table); TextColumn<JGroupsProtocol> type = new TextColumn<JGroupsProtocol>() { @Override public String getValue(JGroupsProtocol record) { return record.getType(); } }; table.addColumn(type, "Type"); ToolStrip toolstrip = new ToolStrip(); ToolButton addBtn = new ToolButton( Console.CONSTANTS.common_label_append(), new ClickHandler() { @Override public void onClick(ClickEvent event) { presenter.launchNewProtocolWizard(); } }); toolstrip.addToolButtonRight(addBtn); ToolButton removeBtn = new ToolButton( Console.CONSTANTS.common_label_remove(), new ClickHandler() { @Override public void onClick(ClickEvent event) { Feedback.confirm( Console.MESSAGES.deleteTitle("Protocol"), Console.MESSAGES.deleteConfirm("Protocol"), new Feedback.ConfirmationHandler() { @Override public void onConfirmation(boolean isConfirmed) { if (isConfirmed) presenter.onDeleteProtocol(form.getEditedEntity()); } }); } }); toolstrip.addToolButtonRight(removeBtn); // ------ this.propertyEditor = new PropertyEditor(presenter, true); // ------ form = new Form<JGroupsProtocol>(JGroupsProtocol.class); form.setNumColumns(2); TextItem typeField = new TextItem("type", "Type"); TextBoxItem socket = new TextBoxItem("socketBinding", "Socket Binding"); form.setFields(typeField, socket); form.setEnabled(false); FormHelpPanel helpPanel = new FormHelpPanel( new FormHelpPanel.AddressCallback() { @Override public ModelNode getAddress() { ModelNode address = Baseadress.get(); address.add("subsystem", "jgroups"); address.add("stack", "*"); address.add("protocol", "*"); return address; } }, form); FormToolStrip<JGroupsProtocol> formToolStrip = new FormToolStrip<JGroupsProtocol>( form, new FormToolStrip.FormCallback<JGroupsProtocol>() { @Override public void onSave(Map<String, Object> changeset) { presenter.onSaveProtocol(form.getEditedEntity(), changeset); } @Override public void onDelete(JGroupsProtocol entity) {} }); formToolStrip.providesDeleteOp(false); Widget detail = new FormLayout().setForm(form).setHelp(helpPanel).setSetTools(formToolStrip).build(); headline = new HTML(); headline.setStyleName("content-header-label"); Widget panel = new MultipleToOneLayout() .setPlain(true) .setTitle("JGroups") .setHeadlineWidget(headline) .setDescription(Console.CONSTANTS.subsys_jgroups_protocol_desc()) .setMaster(Console.MESSAGES.available("Protocols"), table) .setMasterTools(toolstrip.asWidget()) .addDetail("Attributes", detail) .addDetail("Properties", propertyEditor.asWidget()) .build(); form.bind(table); propertyEditor.setAllowEditProps(false); table .getSelectionModel() .addSelectionChangeHandler( new SelectionChangeEvent.Handler() { @Override public void onSelectionChange(SelectionChangeEvent event) { JGroupsProtocol currentSelection = getCurrentSelection(); List<PropertyRecord> properties = currentSelection.getProperties(); if (properties != null) propertyEditor.setProperties( selectedStack.getName() + "_#_" + currentSelection.getType(), properties); else propertyEditor.setProperties( selectedStack.getName() + "_#_" + currentSelection.getType(), Collections.EMPTY_LIST); } }); return panel; }
Widget asWidget() { breadcrumb = new HorizontalPanel(); VerticalPanel panel = new VerticalPanel(); panel.setStyleName("fill-layout-width"); panel.getElement().setAttribute("style", "padding:10px"); // ---- fileSystem = new DefaultCellTable<Entry>(30); fileSystemProvider = new ListDataProvider<Entry>(); fileSystemProvider.addDataDisplay(fileSystem); TextColumn<Entry> entryCol = new TextColumn<Entry>() { @Override public String getValue(Entry entry) { return entry.getName(); } }; fileSystem.addColumn(entryCol); fileSystem.getElement().setAttribute("style", "margin-bottom:10px;"); panel.add(breadcrumb); panel.add(fileSystem); // -- Button visualize = new NavButton( "Visualize", new ClickHandler() { @Override public void onClick(ClickEvent event) { presenter.onVisualize(); } }); panel.add(visualize); Button reify = new NavButton( "Reify", new ClickHandler() { @Override public void onClick(ClickEvent event) { Entry dialog = fsSelection.getSelectedObject(); presenter.onReify(dialog.getName()); } }); panel.add(reify); Button activate = new NavButton( "Activate", new ClickHandler() { @Override public void onClick(ClickEvent event) { presenter.onActivate(); } }); panel.add(activate); Button reset = new NavButton( "Reset", new ClickHandler() { @Override public void onClick(ClickEvent event) { presenter.onResetDialog(); } }); panel.add(reset); Button passivate = new NavButton( "Passivate", new ClickHandler() { @Override public void onClick(ClickEvent event) { presenter.onPassivate(); } }); panel.add(passivate); CheckBox cacheDisabled = new CheckBox("Disable Cache"); cacheDisabled.addValueChangeHandler( new ValueChangeHandler<Boolean>() { @Override public void onValueChange(ValueChangeEvent<Boolean> event) { presenter.setDisableCache(event.getValue()); } }); cacheDisabled.setValue(true); panel.add(cacheDisabled); // ---- fsSelection = new SingleSelectionModel<Entry>(); fileSystem.setSelectionModel(fsSelection); fsSelection.addSelectionChangeHandler( new SelectionChangeEvent.Handler() { @Override public void onSelectionChange(SelectionChangeEvent event) { Entry selection = fsSelection.getSelectedObject(); if (selection != null) { if (Entry.Type.DIR == selection.getType()) { // directories Entry dir = history.peek(); presenter.loadDir( new Entry(dir.getName() + selection.getName(), Entry.Type.DIR), false); } else { // files presenter.loadFile(selection); } } } }); return panel; }
@SuppressWarnings("unchecked") public Widget asWidget() { VerticalPanel panel = new VerticalPanel(); panel.addStyleName("fill-popupLayout-width"); // table table = new DefaultCellTable<>(5); dataProvider = new ListDataProvider<>(); dataProvider.addDataDisplay(table); table.setSelectionModel(selectionModel); // columns Column<ModelNode, String> matchRuleColumn = new TextColumn<ModelNode>() { @Override public String getValue(ModelNode node) { // as the match-rules attribute is a list of attributes // none of them is required, so there is not a unique colum to show, so all defined // attributes are // displayed, there is a "view" button that shows all attributes nicely formatted in a // ModelNodeForm StringBuilder content = new StringBuilder(); for (Property prop : node.asPropertyList()) { content .append(prop.getName()) .append(": ") .append(prop.getValue().asString()) .append(", "); } return StringUtils.shortenStringIfNecessary(content.toString(), 120); } }; Column<ModelNode, ModelNode> linkOpenDetailsColumn = new Column<ModelNode, ModelNode>( new ViewLinkCell<>( Console.CONSTANTS.common_label_view(), (ActionCell.Delegate<ModelNode>) selection -> showDetailModal(selection))) { @Override public ModelNode getValue(ModelNode node) { return node; } }; linkOpenDetailsColumn.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); table.addColumn(matchRuleColumn, ""); table.addColumn(linkOpenDetailsColumn, "Option"); table.setColumnWidth(linkOpenDetailsColumn, 8, Style.Unit.PCT); panel.add(mainTableTools()); panel.add(table); DefaultPager pager = new DefaultPager(); pager.setDisplay(table); panel.add(pager); // ===================== match-rule form popup popupLayout.setStyleName("window-content"); // read-only form to show details of match-rules attribute ModelNodeFormBuilder.FormAssets detailForm = new ModelNodeFormBuilder() .setResourceDescription(resourceDescription) .setCreateMode(false) .unsorted() .setCreateNameAttribute(false) .setSecurityContext(securityContext) .build(); matchRulesForm = detailForm.getForm(); popupDialogOptions.showCancel(false); Widget formWidget = detailForm.getForm().asWidget(); popupLayout.add(formWidget); return panel; }