导出文件格式可选

protected void handExportDateAction(ActionEvent event) {
        // ShowDialog.showConfirmDialog(FXRobotHelper.getStages().get(0),
        // "是否导出数据到txt?", "信息");
        FileChooser fileChooser = new FileChooser();
        FileChooser.ExtensionFilter extFilter = new FileChooser.ExtensionFilter("TXT files (*.txt)", "*.txt");
        fileChooser.getExtensionFilters().add(extFilter);
        Stage s = new Stage();
        File file = fileChooser.showSaveDialog(s);
        if (file == null)
            return;
        if(file.exists()){//文件已存在,则删除覆盖文件
            file.delete();
        }
        String exportFilePath = file.getAbsolutePath();
        System.out.println("导出文件的路径" + exportFilePath);

        ObservableList<AmazonProductModel> list = tProduceView.getItems();
        StringBuilder sBuilder=new StringBuilder();
        if (list.size() > 0) {
            for (AmazonProductModel model : list) {
                sBuilder.append(model.getPid()+","+model.getPrice()+","+model.getName()+"\r\n");
            }
        }
        FileWriteUtil.WriteDocument(exportFilePath, sBuilder.toString());
        ShowDialog.showMessageDialog(FXRobotHelper.getStages().get(0), "导出成功!保存路径:\n"+exportFilePath, "提示");
    }