@Override public Action createAction(ListComponent holder) { return ExcludeAction.create(holder); } },
@Override public void actionPerform(Component component) { if (!isEnabled()) return; if (beforeActionPerformedHandler != null) { if (!beforeActionPerformedHandler.beforeActionPerformed()) return; } @SuppressWarnings("unchecked") Set<Entity> selected = target.getSelected(); if (!selected.isEmpty()) { if (confirm) { confirmAndRemove(selected); } else { doRemove(selected, autocommit); afterRemove(selected); if (afterRemoveHandler != null) { afterRemoveHandler.handle(selected); } } } }
@Override public boolean isEnabled() { return super.isEnabled() && isUpdatePermitted(); } });
/** * Creates either Remove or Exclude action depending on property type */ protected RemoveAction createRemoveAction(MetaProperty metaProperty, Table table) { RemoveAction result; switch (metaProperty.getType()) { case COMPOSITION: result = new com.haulmont.cuba.gui.components.actions.RemoveAction(table); break; case ASSOCIATION: result = new com.haulmont.cuba.gui.components.actions.ExcludeAction(table); result.setShortcut(configuration.getConfig(ClientConfig.class).getTableRemoveShortcut()); break; default: throw new IllegalArgumentException("property must contain an entity"); } result.setAutocommit(false); return result; }