private void populateTableModel(List subconfig) {
    CCActionTable tbl = (CCActionTable) getChild(AMPropertySheetModel.TBL_SUB_CONFIG);
    CCActionTableModel tblModel = (CCActionTableModel) tbl.getModel();
    tblModel.clearAll();

    if (subconfig != null) {
      SerializedField szCache = (SerializedField) getChild(SZ_CACHE);
      List cache = new ArrayList(subconfig.size());

      if (!subconfig.isEmpty()) {
        tblModel.clearAll();
        boolean firstEntry = true;

        for (Iterator iter = subconfig.iterator(); iter.hasNext(); ) {
          if (firstEntry) {
            firstEntry = false;
          } else {
            tblModel.appendRow();
          }
          SMSubConfig conf = (SMSubConfig) iter.next();
          tblModel.setValue(AMPropertySheetModel.TBL_SUB_CONFIG_DATA_NAME, conf.getName());
          tblModel.setValue(AMPropertySheetModel.TBL_SUB_CONFIG_HREF_NAME, conf.getName());
          tblModel.setValue(AMPropertySheetModel.TBL_SUB_CONFIG_DATA_TYPE, conf.getType());
          cache.add(conf);
        }
      }
      szCache.setValue((ArrayList) cache);
    }
  }
  /**
   * Deletes sub configuration.
   *
   * @param event Request Invocation Event.
   * @throws ModelControlException if table model cannot be restored.
   */
  public void handleTblSubConfigButtonDeleteRequest(RequestInvocationEvent event)
      throws ModelControlException {
    submitCycle = true;
    CCActionTable tbl = (CCActionTable) getChild(AMPropertySheetModel.TBL_SUB_CONFIG);
    tbl.restoreStateData();
    CCActionTableModel tblModel = (CCActionTableModel) tbl.getModel();
    Integer[] selected = tblModel.getSelectedRows();
    SerializedField szCache = (SerializedField) getChild(SZ_CACHE);
    List list = (List) szCache.getSerializedObj();
    Set names = new HashSet(selected.length * 2);

    for (int i = 0; i < selected.length; i++) {
      SMSubConfig sc = (SMSubConfig) list.get(selected[i].intValue());
      names.add(sc.getName());
    }

    try {
      SubSchemaModel model = (SubSchemaModel) getModel();
      model.deleteSubConfigurations(names);

      if (selected.length == 1) {
        setInlineAlertMessage(
            CCAlert.TYPE_INFO, "message.information", "subconfig.message.deleted");
      } else {
        setInlineAlertMessage(
            CCAlert.TYPE_INFO, "message.information", "subconfig.message.deleted.pural");
      }
    } catch (AMConsoleException e) {
      setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
    }

    submitCycle = false;
    forwardTo();
  }
  /**
   * Handles remove request handlers request.
   *
   * @param event Request Invocation Event.
   */
  public void handleTblRequestHandlerListButtonDeleteRequest(RequestInvocationEvent event)
      throws ModelControlException {
    setSubmitCycle(true);
    CCActionTable table =
        (CCActionTable) getChild(SCSAML2SOAPBindingModelImpl.ATTRIBUTE_NAME_REQUEST_HANDLER_LIST);
    table.restoreStateData();
    CCActionTableModel tblModel =
        (CCActionTableModel)
            propertySheetModel.getModel(
                SCSAML2SOAPBindingModelImpl.ATTRIBUTE_NAME_REQUEST_HANDLER_LIST);
    Integer[] selected = tblModel.getSelectedRows();

    if ((selected != null) && (selected.length > 0)) {
      OrderedSet tblValues =
          (OrderedSet)
              getPageSessionAttribute(
                  SCSAML2SOAPBindingModelImpl.ATTRIBUTE_NAME_REQUEST_HANDLER_LIST);
      tblValues.removeAll(selected);
      setPageSessionAttribute(
          SCSAML2SOAPBindingModelImpl.ATTRIBUTE_NAME_REQUEST_HANDLER_LIST, tblValues);
      populateRequestHandlerListTable(tblValues);
      setInlineAlertMessage(CCAlert.TYPE_INFO, "message.information", "message.profile.modified");
      setPageSessionAttribute(PAGE_MODIFIED, "1");
    }

    forwardTo();
  }
  /**
   * 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();
  }
  private void populateTableModel(List<SMSubConfig> subConfigs) {
    CCActionTable tbl = (CCActionTable) getChild(TBL_SUB_CONFIG);
    CCActionTableModel tblModel = (CCActionTableModel) tbl.getModel();
    tblModel.clearAll();

    if (CollectionUtils.isEmpty(subConfigs)) {
      return;
    }
    SerializedField szCache = (SerializedField) getChild(SZ_CACHE);
    List<SMSubConfig> cache = new ArrayList<>(subConfigs.size());
    boolean firstEntry = true;

    for (SMSubConfig conf : subConfigs) {
      if (firstEntry) {
        firstEntry = false;
      } else {
        tblModel.appendRow();
      }
      tblModel.setValue(TBL_SUB_CONFIG_DATA_NAME, conf.getName());
      tblModel.setValue(TBL_SUB_CONFIG_HREF_NAME, conf.getName());
      tblModel.setValue(TBL_SUB_CONFIG_DATA_TYPE, conf.getType());
      cache.add(conf);
    }
    szCache.setValue(cache);
  }
  /**
   * Instantiate each child view.
   *
   * @param table model
   * @param child component name
   * @param tiled view name
   */
  protected View createChild(CCActionTableModel tableModel, String name, String tiledViewName) {

    // e.g. tileViewName can be "FileSystemSummaryView.CHILD_TILED_VIEW"

    if (name.equals(CHILD_ACTION_TABLE)) {
      // Action table.
      CCActionTable child = new CCActionTable(this, tableModel, name);
      tableModel.setShowSelectionSortIcon(false);
      child.setTiledView((ContainerView) getChild(tiledViewName));
      return child;
    } else if (tableModel.isChildSupported(name)) {
      // Create child from action table model.
      return tableModel.createChild(this, name);
    } else {
      throw new IllegalArgumentException("Invalid child name [" + name + "]");
    }
  }
  /**
   * Handles remove handler request.
   *
   * @param event Request Invocation Event.
   */
  public void handleTblHandlersButtonDeleteRequest(RequestInvocationEvent event)
      throws ModelControlException {
    setSubmitCycle(true);
    CCActionTable table =
        (CCActionTable) getChild(WSAuthNServicesModelImpl.ATTRIBUTE_NAME_HANDLERS);
    table.restoreStateData();
    CCActionTableModel tblModel =
        (CCActionTableModel)
            propertySheetModel.getModel(WSAuthNServicesModelImpl.ATTRIBUTE_NAME_HANDLERS);
    Integer[] selected = tblModel.getSelectedRows();

    if ((selected != null) && (selected.length > 0)) {
      OrderedSet tblValues =
          (OrderedSet) getPageSessionAttribute(WSAuthNServicesModelImpl.ATTRIBUTE_NAME_HANDLERS);
      tblValues.removeAll(selected);
      setPageSessionAttribute(WSAuthNServicesModelImpl.ATTRIBUTE_NAME_HANDLERS, tblValues);
      populateHandlersTable(tblValues);
    }

    forwardTo();
  }