/** 批量删除topN报告 */
  public void onClick$delete(Event event) {
    if (topNList.getSelectedCount() <= 0) {
      try {
        Messagebox.show("请选择报告!", "提示", Messagebox.OK, Messagebox.INFORMATION);
      } catch (InterruptedException e) {
      }
      return;
    }
    try {
      int ret =
          Messagebox.show(
              "你确认要删除选中的记录吗?", "询问", Messagebox.OK | Messagebox.CANCEL, Messagebox.QUESTION);
      if (ret == Messagebox.CANCEL) return;
      Set<Listitem> items = topNList.getSelectedItems();
      if (items == null || items.size() == 0) return;
      Iterator itr = items.iterator();
      this.iniFile = new IniFile(INI_FILE);
      if (iniFile == null) return;
      for (; itr.hasNext(); ) {
        Listitem item = (Listitem) itr.next();
        iniFile.deleteSection(item.getId());
        IniFile iniGen = new IniFile("reportTopN." + item.getId() + ".ini");
        try {
          iniGen.load();
        } catch (Exception e) {

        }
        List<String> sections = iniGen.getSectionList();
        for (String section : sections) {
          if (section.equalsIgnoreCase("TempSection(Please_modify_it)")) continue;
          Map<String, String> value = iniGen.getFmap().get(section);
          String fileType = value.get("fileType");
          String filePath = TopNLogListmodel.getfilename(section, fileType);
          File f = new File(filePath);
          if (!f.exists()) continue;
          f.delete();
          if (fileType.equals("html")) {
            f.delete();
            Toolkit.getToolkit().deleteFolder(filePath + "_files");
          }
          iniGen.deleteSection(section);
        }
        iniGen.saveChange();
      }

      iniFile.saveChange(); // 1252396986281
    } catch (Exception e) {
      e.printStackTrace();
    }
    View view = Toolkit.getToolkit().getSvdbView(Executions.getCurrent().getDesktop());
    String loginname = view.getLoginName();
    String minfo =
        loginname + " " + "在" + OpObjectId.topn_report.name + "中进行了  " + OpTypeId.del.name + "操作。";
    AppendOperateLog.addOneLog(loginname, minfo, OpTypeId.del, OpObjectId.topn_report);
    // 刷新页面
    refreshInifile();
    refreshiControl();
    this.topNGenerateTime.getItems().clear();
  }
  /*
   * 批量删除日志
   */
  public void onClick$btnBatchDeleteGen(Event event) throws Exception {
    if (topNGenerateTime.getSelectedCount() == 0) {

      try {
        Messagebox.show("请选择报告!", "提示", Messagebox.OK, Messagebox.INFORMATION);
      } catch (InterruptedException e) {
        e.printStackTrace();
      }
      return;
    }
    try {
      int ret =
          Messagebox.show(
              "你确认要删除选中的记录吗?", "提示", Messagebox.OK | Messagebox.CANCEL, Messagebox.QUESTION);

      if (ret == Messagebox.CANCEL) return;
    } catch (Exception e) {
      e.printStackTrace();
    }
    Listitem topNlist = topNList.getSelectedItem();
    Iterator it = topNGenerateTime.getSelectedItems().iterator();
    try {
      while (it.hasNext()) {
        Listitem item = (Listitem) it.next();
        TopNLogBean logbean = (TopNLogBean) item.getValue();
        String section = logbean.getTitle();
        String filetype = logbean.getFiletype();
        String finame = TopNLogListmodel.getfilename(section, filetype);
        String reportid = topNlist.getId();
        IniFile inifile = new IniFile("reportTopN." + reportid + ".ini");
        inifile.load();
        for (String key : inifile.getSectionList()) {
          if (key.equals(section)) {
            inifile.deleteSection(section);
            inifile.saveChange();
            File file = new File(finame);
            File folder = new File(finame + "_files");
            if (file.exists()) {
              file.delete();
            }
            if (folder.exists()) {
              Toolkit.getToolkit().deleteFolder(finame + "_files");
            }
          }
        }
      }
    } catch (Exception e) {
      throw e;
    }
    // 刷新数据
    onSelecttopNList(event);
  }