Fix regression on getDimensionX and add finals

* Make all appropriate methods final
* Add new messages to MazeAppModelMessage and handle them to act more
  accurately on observers updates
* Make all buttons from 'File' menu subclasses of FileMenu in order to
  have a cleaner ui folder
* Remove legacy code (for example, the former code used to animate the
  path drawing)
* Improve delegation
This commit is contained in:
regar42 committed 2018-01-14 14:00:07 +01:00
1 parent eaba5b6106
commit e76db727c7
40 files changed
+246 -257

No files matched your search

+4 -7
View File
@@ -3,15 +3,12 @@ package ui;
import javax.swing.JOptionPane;
import java.awt.Component;
import model.MazeAppModel;
public class SaveBox {
public final class SaveBox {
private static String message = "Maze not saved. Save it ?";
public static boolean promptAndContinue(Component parent,
MazeApp mazeApp,
String title) {
MazeAppModel mazeAppModel = mazeApp.getMazeAppModel();
int response = JOptionPane.showOptionDialog(parent,
message,
title,
@@ -22,13 +19,13 @@ public class SaveBox {
case JOptionPane.CANCEL_OPTION:
return false;
case JOptionPane.OK_OPTION:
if (mazeAppModel.getFilename() != null) {
mazeAppModel.saveToFile();
if (mazeApp.getModelFilename() != null) {
mazeApp.saveModelMaze();
}
else {
String filename = FileBox.save(mazeApp);
if (filename != null) {
mazeApp.getMazeAppModel().saveToFile(filename);
mazeApp.saveModelMaze(filename);
}
else {
return promptAndContinue(null, mazeApp, title);