}
})
- override def closeOperation {
- if (dirty) {
- val r = JOptionPane.showConfirmDialog(
- peer,
- "The report file \"" + reportSet.file.get.getName + "\" has been modified.\n" +
- "Do you want to save it before closing?",
- "Confirmation",
- JOptionPane.YES_NO_CANCEL_OPTION);
-
- r match {
- case JOptionPane.YES_OPTION => save; dispose
- case JOptionPane.NO_OPTION => dispose
- case _ =>
- }
- }
- else {
- dispose
- }
- }
-
- def dirty : Boolean = {
- return reportSet.dirty
- }
-
- def save {
- if (reportSet.file.isEmpty) {
- val chooser = new FileChooser(Preferences.lastChosenDir())
- val r = chooser.showSaveDialog(null)
- if (r != FileChooser.Result.Approve) {
- return
- }
-
- if (chooser.selectedFile.exists) {
- val r = JOptionPane.showConfirmDialog(
- peer,
- "The chosen file or directory \"" + chooser.selectedFile.getName + "\" already exists.\n" +
- "Do you want to overwrite it?",
- "Confirmation",
- JOptionPane.YES_NO_OPTION)
-
- r match {
- case JOptionPane.YES_OPTION =>
- case JOptionPane.NO_OPTION => return
- }
- }
-
- Preferences.lastChosenDir() = chooser.selectedFile.getParentFile
- reportSet.file = Some(chooser.selectedFile)
- }
-
- reportSet.save
- }
-
menuBar = new MenuBar {
contents += new Menu("File") {
mnemonic = Key.F
}
visible = true
+
+ override def closeOperation {
+ if (dirty) {
+ val r = JOptionPane.showConfirmDialog(
+ peer,
+ "The report file \"" + reportSet.file.get.getName + "\" has been modified.\n" +
+ "Do you want to save it before closing?",
+ "Confirmation",
+ JOptionPane.YES_NO_CANCEL_OPTION);
+
+ r match {
+ case JOptionPane.YES_OPTION => save; dispose
+ case JOptionPane.NO_OPTION => dispose
+ case _ =>
+ }
+ }
+ else {
+ dispose
+ }
+ }
+
+ def dirty : Boolean = {
+ return reportSet.dirty
+ }
+
+ def save {
+ if (reportSet.file.isEmpty) {
+ val chooser = new FileChooser(Preferences.lastChosenDir())
+ val r = chooser.showSaveDialog(null)
+ if (r != FileChooser.Result.Approve) {
+ return
+ }
+
+ if (chooser.selectedFile.exists) {
+ val r = JOptionPane.showConfirmDialog(
+ peer,
+ "The chosen file or directory \"" + chooser.selectedFile.getName + "\" already exists.\n" +
+ "Do you want to overwrite it?",
+ "Confirmation",
+ JOptionPane.YES_NO_OPTION)
+
+ r match {
+ case JOptionPane.YES_OPTION =>
+ case JOptionPane.NO_OPTION => return
+ }
+ }
+
+ Preferences.lastChosenDir() = chooser.selectedFile.getParentFile
+ reportSet.file = Some(chooser.selectedFile)
+ }
+
+ reportSet.save
+ }
}