/** * Called on request from the UI to delete an event handler. * * @param event Request Invocation Event. */ @SuppressWarnings("unused") public void handleTblSubConfigButtonDeleteRequest(RequestInvocationEvent event) throws ModelControlException { submitCycle = true; CCActionTable tbl = (CCActionTable) getChild(TBL_SUB_CONFIG); tbl.restoreStateData(); CCActionTableModel tblModel = (CCActionTableModel) tbl.getModel(); Integer[] selected = tblModel.getSelectedRows(); SerializedField szCache = (SerializedField) getChild(SZ_CACHE); List list = szCache.getSerializedObj(); Set<String> names = new HashSet<>(selected.length * 2); for (Integer index : selected) { SMSubConfig sc = (SMSubConfig) list.get(index); names.add(sc.getName()); } try { AbstractAuditModel model = (AbstractAuditModel) getModel(); model.deleteEventHandles(names); if (selected.length == 1) { setInlineAlertMessage(TYPE_INFO, INFORMATION_MESSAGE, "event.handler.message.deleted"); } else { setInlineAlertMessage( TYPE_INFO, INFORMATION_MESSAGE, "event.handler.message.deleted.plural"); } } catch (AMConsoleException e) { setInlineAlertMessage(TYPE_ERROR, ERROR_MESSAGE, e.getMessage()); } submitCycle = false; forwardTo(); }
@Override public void beginDisplay(DisplayEvent event) throws ModelControlException { super.beginDisplay(event); AbstractAuditModel model = (AbstractAuditModel) getModel(); if (!submitCycle) { try { populateTableModel(model.getEventHandlerConfigurations()); resetButtonState(TBL_SUB_CONFIG_BUTTON_DELETE); disableButton(TBL_SUB_CONFIG_BUTTON_ADD, false); } catch (AMConsoleException e) { setInlineAlertMessage(TYPE_ERROR, ERROR_MESSAGE, e.getMessage()); } } }