Ejemplo n.º 1
0
  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);
  }
Ejemplo n.º 2
0
  private void initData() {

    typeData.clear();
    typeData.addAll(ToolType.allToolTypes());

    List<ToolsTray> bandejaList =
        dao.query(ToolsTray.class, Cnd.where("toolType", "=", C.TOOL_TYPE_TRAY_FOLDER));

    superData.clear();
    ToolsTray bandeja1 = new ToolsTray();
    bandeja1.setId(C.ROOT_PARENT_ID);
    bandeja1.setTrayName("--无父目录--");
    superData.add(bandeja1);
    superData.addAll(bandejaList);

    searchData.clear();
    ToolsTray bandeja = new ToolsTray();
    bandeja.setTrayName("--全部--");
    searchData.add(bandeja);
    searchData.add(bandeja1);
    searchData.addAll(bandejaList);

    tableData.clear();
    tableData.addAll(dao.query(ToolsTray.class, null));
  }
Ejemplo n.º 3
0
  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);
  }
Ejemplo n.º 4
0
  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);
      }
    }
  }
Ejemplo n.º 5
0
 private void modifyPlan(ToolsTray bandeja) {
   tipsLabel.setText("修改任务中:" + bandeja.getTrayName());
   id = bandeja.getId();
   nameField.setText(bandeja.getTrayName());
   commandText.setText(bandeja.getCommand());
 }