use of javafx.stage.FileChooser in project Gargoyle by callakrsos.
the class VoEditorController method btnExcelExportOnMouseClick.
/**
* 엑셀 export
*
* @param e
*/
@FXML
public void btnExcelExportOnMouseClick(MouseEvent e) {
File saveFile = DialogUtil.showFileSaveCheckDialog(SharedMemory.getPrimaryStage(), new Consumer<FileChooser>() {
@Override
public void accept(FileChooser choser) {
String fileName = txtClassName.getText();
File dir = SystemUtils.getUserDir();
choser.setInitialFileName(fileName);
choser.setInitialDirectory(dir);
choser.getExtensionFilters().add(new ExtensionFilter(GargoyleExtensionFilters.XLSX_NAME, GargoyleExtensionFilters.XLSX));
}
});
boolean isSuccess = false;
if (saveFile != null) {
try {
File createExcelFile = VoWizardUtil.createExcelFile(saveFile.getParentFile(), saveFile.getName(), tbVoEditor.getItems(), true);
if (createExcelFile != null && createExcelFile.exists()) {
isSuccess = true;
}
} catch (GargoyleFileAlreadyExistException e1) {
ValueUtil.toString(e1);
DialogUtil.showExceptionDailog(e1);
return;
}
}
if (isSuccess) {
if (chkWriteThenOpen.isSelected()) {
if (Desktop.isDesktopSupported()) {
try {
Desktop.getDesktop().open(saveFile);
} catch (IOException e1) {
DialogUtil.showExceptionDailog(e1);
}
}
}
}
}
use of javafx.stage.FileChooser in project jgnash by ccavanaugh.
the class DatabasePathAction method getFileToSave.
public static File getFileToSave() {
final ResourceBundle resources = ResourceUtils.getBundle();
final FileChooser fileChooser = configureFileChooser();
fileChooser.setTitle(resources.getString("Title.NewFile"));
final File file = fileChooser.showSaveDialog(MainView.getPrimaryStage());
if (file != null) {
Preferences pref = Preferences.userNodeForPackage(DatabasePathAction.class);
pref.put(LAST_DIR, file.getParentFile().getAbsolutePath());
}
return file;
}
use of javafx.stage.FileChooser in project jgnash by ccavanaugh.
the class DatabasePathAction method getFileToOpen.
public static File getFileToOpen() {
final ResourceBundle resources = ResourceUtils.getBundle();
final FileChooser fileChooser = configureFileChooser();
fileChooser.setTitle(resources.getString("Title.Open"));
final File file = fileChooser.showOpenDialog(MainView.getPrimaryStage());
if (file != null) {
Preferences pref = Preferences.userNodeForPackage(DatabasePathAction.class);
pref.put(LAST_DIR, file.getParentFile().getAbsolutePath());
}
return file;
}
use of javafx.stage.FileChooser in project jgnash by ccavanaugh.
the class ExecuteJavaScriptAction method configureFileChooser.
private static FileChooser configureFileChooser() {
final Preferences pref = Preferences.userNodeForPackage(ExecuteJavaScriptAction.class);
final FileChooser fileChooser = new FileChooser();
fileChooser.setInitialDirectory(new File(pref.get(LAST_DIR, System.getProperty("user.home"))));
fileChooser.getExtensionFilters().addAll(new FileChooser.ExtensionFilter("JavaScript Files", "*.js"));
fileChooser.getExtensionFilters().addAll(new FileChooser.ExtensionFilter("All Files", "*.*"));
return fileChooser;
}
use of javafx.stage.FileChooser in project jgnash by ccavanaugh.
the class ExportAccountsAction method configureFileChooser.
private static FileChooser configureFileChooser() {
final Preferences pref = Preferences.userNodeForPackage(ExportAccountsAction.class);
final FileChooser fileChooser = new FileChooser();
fileChooser.setInitialDirectory(new File(pref.get(LAST_DIR, System.getProperty("user.home"))));
fileChooser.getExtensionFilters().addAll(new FileChooser.ExtensionFilter(ResourceUtils.getString("Label.XMLFiles") + " (*.xml)", "*.xml", "*.XML"));
return fileChooser;
}
Aggregations