public void confirm(ActionEvent event) {
    String name = nameField.getText();
    if (S.isEmpty(name)) {
      tipsLabel.setText("错误:工具名字不能为空!");
      nameField.requestFocus();
      return;
    }
    String command = commandText.getText();
    String order = orderField.getText();
    ToolsTray bandeja = (ToolsTray) parentCombo.getSelectionModel().getSelectedItem();
    Integer parentId = bandeja.getId();
    ToolType toolType = (ToolType) typeCombo.getSelectionModel().getSelectedItem();
    String type = toolType.getToolType();

    ToolsTray toolsTray = new ToolsTray();
    toolsTray.setTrayName(name);
    toolsTray.setCommand(command);
    toolsTray.setParentId(parentId);
    toolsTray.setToolOrder(order);
    toolsTray.setToolType(type);
    if (null == id) {
      dao.insert(toolsTray);
      id = toolsTray.getId();
      tipsLabel.setText("添加成功:" + name);
    } else {
      toolsTray.setId(id);
      dao.update(toolsTray);
      tipsLabel.setText("更新成功:" + name);
    }
    refresh(null);
  }
  public void search(ActionEvent event) {

    ToolsTray bandeja = (ToolsTray) searchCombo.getSelectionModel().getSelectedItem();
    List<ToolsTray> bandejaList;
    if (null == bandeja || null == bandeja.getId()) {
      bandejaList = dao.query(ToolsTray.class, null);
    } else {
      bandejaList = dao.query(ToolsTray.class, Cnd.where("parentId", "=", bandeja.getId()));
    }
    tableData.clear();
    tableData.addAll(bandejaList);
  }
  public void delete(ActionEvent event) {
    ToolsTray bandeja = (ToolsTray) toolTable.getSelectionModel().getSelectedItem();
    if (null != bandeja && null != bandeja.getId()) {
      Alert alert = new Alert(Alert.AlertType.CONFIRMATION);
      alert.setTitle("删除提醒");
      alert.setHeaderText(null);
      alert.setContentText("确定删除:" + bandeja.getTrayName());

      Optional<ButtonType> result = alert.showAndWait();

      if (result.get() == ButtonType.OK) {
        dao.delete(ToolsTray.class, bandeja.getId());
        tipsLabel.setText("删除成功:" + bandeja.getTrayName());
        refresh(null);
      }
    }
  }
 private void modifyPlan(ToolsTray bandeja) {
   tipsLabel.setText("修改任务中:" + bandeja.getTrayName());
   id = bandeja.getId();
   nameField.setText(bandeja.getTrayName());
   commandText.setText(bandeja.getCommand());
 }