private ItemClickListener<Application> applicationOnClick() { return e -> { // Remove previous panel if(details!=null) { this.removeComponent(this.details); } Application app = e.getItem(); // Get application actuator version appService.setActuatorVersion(app, this.envService.getActuatorVersion(app)); // Get application overview info Environment env = this.envService.getEnvironment(app); Optional<Metrics> metrics = this.metricsService.getMetrics(app); // No exception has been thrown : app is up and running ! appService.setUp(app, true); // Add overview panel to page this.details = new ApplicationOverviewPanel(app, env, metrics); this.addComponent(this.details); }; }
@PostConstruct public void init() { roleGrid.setWidth("500px"); roleGrid.setHeightMode(HeightMode.UNDEFINED); roleGrid.addColumn(Role::getId).setCaption("Id").setWidth(50); roleGrid.addColumn(Role::getName).setCaption("Name"); roleGrid.setSelectionMode(Grid.SelectionMode.NONE); roleGrid.addStyleName("kumoHandPointer"); addComponents(roleGrid, btnAddNew); roleGrid.addItemClickListener((ItemClickListener<Role>) itemClick -> navigateTo(RoleEditView.VIEW_NAME + "/" + itemClick.getItem().getId())); btnAddNew.addClickListener((Button.ClickListener) clickEvent -> { handler.addNewRole(this); }); }
@PostConstruct public void init() { badgeGrid.setWidth("800px"); badgeGrid.setHeightMode(HeightMode.ROW); badgeGrid.setSelectionMode(Grid.SelectionMode.NONE); badgeGrid.addStyleName("kumoHandPointer"); addComponent(badgeGrid); addComponent(btnAddNew); badgeGrid.addItemClickListener((ItemClickListener<Badge>) itemClick -> navigateTo(BadgeEditView.VIEW_NAME + "/" + itemClick.getItem().getId())); btnAddNew.addClickListener((Button.ClickListener) clickEvent -> { navigateTo(BadgeEditView.VIEW_NAME + "/"); }); }
/** * Adds an item click listener. The listener is called when an item of this * {@code Grid} is clicked. * * @param listener * the item click listener, not null * @return this for method chaining * @see Grid#addItemClickListener(ItemClickListener) */ @SuppressWarnings("unchecked") public default THIS withItemClickListener(ItemClickListener<? super ITEM> listener) { ((Grid<ITEM>) this).addItemClickListener(listener); return (THIS) this; }