use of javafx.stage.FileChooser in project DistributedFractalNetwork by Budder21.
the class RenderManager method saveFractalAs.
/**
* used when the user wants to save the fractal with a different name, but
* not change the name of the current instance.
*/
public void saveFractalAs() {
FileChooser chooser = new FileChooser();
chooser.setTitle("Save Fractal");
chooser.setInitialDirectory(new File("fractals"));
FileChooser.ExtensionFilter filter = new FileChooser.ExtensionFilter("Fractals (*.fractal)", "*.fractal");
chooser.getExtensionFilters().add(filter);
File f = chooser.showSaveDialog(null);
try {
ObjectOutputStream objOut = new ObjectOutputStream(new FileOutputStream(f));
objOut.writeObject(this);
objOut.close();
} catch (IOException e) {
e.printStackTrace();
}
}
use of javafx.stage.FileChooser in project aic-praise by aic-sri-international.
the class PRAiSEController method initialize.
//
// PRIVATE
//
@FXML
private void initialize() throws IOException {
FXUtil.setDefaultButtonIcon(openMenuButton, FontAwesomeIcons.BARS);
//
FXUtil.setDefaultButtonIcon(newButton, FontAwesomeIcons.FILE_ALT);
FXUtil.setDefaultButtonIcon(openFileButton, FontAwesomeIcons.FOLDER_OPEN);
FXUtil.setDefaultButtonIcon(saveButton, FontAwesomeIcons.SAVE);
//
FXUtil.setDefaultButtonIcon(undoModelEditButton, FontAwesomeIcons.ROTATE_LEFT);
FXUtil.setDefaultButtonIcon(redoModelEditButton, FontAwesomeIcons.ROTATE_RIGHT);
//
FXUtil.setButtonStackedIcons(undoPagesChangeButton, FontAwesomeIcons.ROTATE_LEFT, FontAwesomeIcons.SQUARE_ALT);
FXUtil.setButtonStackedIcons(redoPagesChangeButton, FontAwesomeIcons.ROTATE_RIGHT, FontAwesomeIcons.SQUARE_ALT);
//
FXUtil.setPaginationButtonIcon(removePageButton, FontAwesomeIcons.MINUS);
FXUtil.setPaginationButtonIcon(previousPageButton, FontAwesomeIcons.CARET_LEFT);
FXUtil.setPaginationButtonIcon(nextPageButton, FontAwesomeIcons.CARET_RIGHT);
FXUtil.setPaginationButtonIcon(addPageButton, FontAwesomeIcons.PLUS);
//
FXUtil.setDefaultButtonIcon(configureButton, FontAwesomeIcons.WRENCH);
//
praiseFileChooser = new FileChooser();
praiseFileChooser.getExtensionFilters().addAll(new FileChooser.ExtensionFilter("FactorNetwork Files", "*.praise"));
uaiFileChooser = new FileChooser();
uaiFileChooser.getExtensionFilters().addAll(new FileChooser.ExtensionFilter("UAI Files", "*.uai"));
openMenuPopOver.setArrowLocation(ArrowLocation.LEFT_TOP);
openMenuPopOver.setAutoHide(true);
openMenuPopOver.setDetachedTitle("Menu");
openMenuPopOver.setContentNode(openMenuContent());
configureSettingsPopOver.setArrowLocation(ArrowLocation.RIGHT_TOP);
configureSettingsPopOver.setAutoHide(true);
configureSettingsPopOver.setDetachedTitle("Configure Settings");
configureSettingsPopOver.setContentNode(configureSettingsContent());
//
//
modelPagination.setPageFactory(this::createModelPage);
modelPagination.pageCountProperty().addListener((observable, oldValue, newValue) -> updatePaginationControls(modelPagination.getCurrentPageIndex(), newValue.intValue()));
modelPagination.currentPageIndexProperty().addListener((observable, oldValue, newValue) -> updatePaginationControls(newValue.intValue(), modelPagination.getPageCount()));
examplesComboBox.getSelectionModel().selectedIndexProperty().addListener(this::exampleSelectionChaned);
setPerspective(new HOGMPerspective());
}
use of javafx.stage.FileChooser in project mybatis-generator-gui-extension by spawpaw.
the class FileChooserControl method bindProperties.
@Override
protected void bindProperties() {
label.setMinWidth(MIN_WIDTH_LEFT);
textField.textProperty().bindBidirectional(value);
label.textProperty().bindBidirectional(this.labelTextProperty);
button.setOnMouseClicked((event -> {
FileChooser fileChooser = new FileChooser();
File selectedFile = fileChooser.showOpenDialog(BaseController.primaryStage);
if (selectedFile != null) {
value.setValue(selectedFile.getAbsolutePath());
}
}));
}
use of javafx.stage.FileChooser in project SIMVA-SoS by SESoS.
the class ChartViewer method handleExportToPNG.
/**
* A handler for the export to PNG option in the context menu.
*/
private void handleExportToPNG() {
FileChooser fileChooser = new FileChooser();
fileChooser.setTitle("Export to PNG");
fileChooser.setSelectedExtensionFilter(new FileChooser.ExtensionFilter("Portable Network Graphics (PNG)", "png"));
File file = fileChooser.showSaveDialog(this.getScene().getWindow());
if (file != null) {
try {
ExportUtils.writeAsPNG(this.chart, (int) getWidth(), (int) getHeight(), file);
} catch (IOException ex) {
// FIXME: show a dialog with the error
}
}
}
use of javafx.stage.FileChooser in project BlocklyArduinoIDEPlugin by technologiescollege.
the class BlocklyArduinoServer method IDEsaveXML.
/**
* This method is called from javascript. It lets the user select a location
* where to save the blocks to and saves them.
*
* @param xml The xml structure of the created block program.
*/
public void IDEsaveXML(String xml) {
// System.out.println("saving blocks");
FileChooser fileChooser = new FileChooser();
fileChooser.setInitialDirectory(new File(lastOpenedLocation));
fileChooser.setTitle("Save");
fileChooser.getExtensionFilters().addAll(new FileChooser.ExtensionFilter("Blockly@rduino", "*.B@"));
File selectedFile = fileChooser.showSaveDialog(ownerWindow);
if (selectedFile != null) {
if (selectedFile.getName().matches("^.*\\.B@$")) {
// filename is OK as-is
} else {
// append .B@ if "foo.jpg.xml" is OK
selectedFile = new File(selectedFile.toString() + ".B@");
}
lastOpenedLocation = selectedFile.getParent();
try {
BufferedWriter bWriter = new BufferedWriter(new FileWriter(selectedFile));
bWriter.write(xml);
bWriter.flush();
bWriter.close();
} catch (IOException ex) {
Logger.getLogger(BlocklyArduinoServer.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
Aggregations