/** * Adds an EditAction that enables controls for editing. */ protected void initBrowseEditAction() { ListComponent<T> table = getTable(); EditAction editAction = (EditAction) table.getActionNN("edit"); editAction.withHandler(actionPerformedEvent -> { if (table.getSelected().size() == 1) { if (lockIfNeeded(table.getSingleSelected())) { refreshOptionsForLookupFields(); enableEditControls(false); } } }); editAction.addEnabledRule(() -> table.getSelected().size() == 1 && getBeanLocator().get(Security.class).isEntityOpPermitted(getEntityClass(), EntityOp.UPDATE)); }
enableEditControls(true); table.setSelected(Collections.emptyList()); });