private void handleOkDeleteMetadata(final RendererClickEvent event, final String key) { deleteMetadata(getSelectedEntity(), key); uiNotification.displaySuccess(i18n.getMessage("message.metadata.deleted.successfully", key)); final Object selectedRow = metaDataGrid.getSelectedRow(); metaDataGrid.getContainerDataSource().removeItem(event.getItemId()); // force grid to refresh metaDataGrid.clearSortOrder(); if (!metaDataGrid.getContainerDataSource().getItemIds().isEmpty()) { if (selectedRow != null) { if (selectedRow.equals(event.getItemId())) { metaDataGrid.select(metaDataGrid.getContainerDataSource().getIdByIndex(0)); } else { metaDataGrid.select(selectedRow); } } } else { resetFields(); } }
private void onClickOfRolloutName(final RendererClickEvent event) { rolloutUIState.setRolloutId((long) event.getItemId()); final String rolloutName = (String) getContainerDataSource().getItem(event.getItemId()) .getItemProperty(SPUILabelDefinitions.VAR_NAME).getValue(); rolloutUIState.setRolloutName(rolloutName); final String ds = (String) getContainerDataSource().getItem(event.getItemId()) .getItemProperty(SPUILabelDefinitions.VAR_DIST_NAME_VERSION).getValue(); rolloutUIState.setRolloutDistributionSet(ds); eventBus.publish(this, RolloutEvent.SHOW_ROLLOUT_GROUPS); }
@Override public void click(final RendererClickEvent event) { final Optional<RolloutGroup> group = rolloutGroupManagement .getWithDetailedStatus((Long) event.getItemId()); if (!group.isPresent()) { eventBus.publish(this, RolloutEvent.SHOW_ROLLOUTS); return; } rolloutUIState.setRolloutGroup(group.get()); eventBus.publish(this, RolloutEvent.SHOW_ROLLOUT_GROUP_TARGETS); }
private void onDelete(final RendererClickEvent event) { final Item item = metaDataGrid.getContainerDataSource().getItem(event.getItemId()); final String key = (String) item.getItemProperty(KEY).getValue(); final ConfirmationDialog confirmDialog = new ConfirmationDialog( i18n.getMessage("caption.metadata.delete.action.confirmbox"), i18n.getMessage("message.confirm.delete.metadata", key), i18n.getMessage("button.ok"), i18n.getMessage("button.cancel"), ok -> { if (ok) { handleOkDeleteMetadata(event, key); } }); UI.getCurrent().addWindow(confirmDialog.getWindow()); confirmDialog.getWindow().bringToFront(); }
private void addExpandColumnRenderer(Column column) { final TreeNodeExpandButtonRenderer renderer=new TreeNodeExpandButtonRenderer(CellWrapper.class); renderer.addClickListener(new RendererClickListener() { @Override public void click(RendererClickEvent event) { final Object itemId=event.getItemId(); final List<Object>changedItems=container.toogleCollapse(itemId); for(final Object it:changedItems) { final CellWrapper cw=(CellWrapper) container.getItem(it).getItemProperty(expandColumnPropertyId).getValue(); cw.setIsExpanded(container.isItemExpanded(it)); }; } }); column.setRenderer(renderer); }
@Override public final void click(final RendererClickEvent<T> event) { UI.getCurrent().getNavigator().navigateTo(page + PAGE_SEPARATOR + getPageId(event.getItem())); }