Package org.aavso.tools.vstar.ui.dialog
Class SaveChooser
java.lang.Object
org.aavso.tools.vstar.ui.dialog.SaveChooser
-
Constructor Summary
ConstructorsConstructorDescriptionSaveChooser(FileNameExtensionFilter[] extensionFilterSave, String defaultExt, String titleSave) Constructor: save file dialogs -
Method Summary
Modifier and TypeMethodDescriptionReturns the selected file and ensures it has a @defaultExt suffix (specified in the constructor)booleanshowDialog(Component parent) Show the file save dialog.booleanwriteStringToFile(Component parent, String content, Charset charset) Invoke Save Dialog (chooser) and write @content to the selected file.voidwriteStringToFile(String path, String content, Charset charset) Write a String to file
-
Constructor Details
-
SaveChooser
public SaveChooser(FileNameExtensionFilter[] extensionFilterSave, String defaultExt, String titleSave) Constructor: save file dialogs- Parameters:
extensionFilterSave- file filters for 'Save' dialogdefaultExt- default file extension for 'Save' dialogtitleSave-
-
-
Method Details
-
showDialog
Show the file save dialog.- Parameters:
parent- The parent component to which the dialog should be positioned relative.- Returns:
- Whether the dialog was "approved".
-
getSaveDialogSelectedFile
Returns the selected file and ensures it has a @defaultExt suffix (specified in the constructor)- Returns:
- The selected file.
-
writeStringToFile
public boolean writeStringToFile(Component parent, String content, Charset charset) throws IOException Invoke Save Dialog (chooser) and write @content to the selected file.- Parameters:
parent- The parent component to which the dialog should be positioned relative.content- String to be writtencharset- Charset, if null, the default charset is used.- Returns:
- true if dialog was approved, false otherwise.
- Throws:
IOException
-
writeStringToFile
Write a String to file- Parameters:
path- Path to a filecontent- String to be writtencharset- Charset, if null, the default charset is used.- Throws:
IOException
-