Add a button to clear path

model:
* Add an attribute to MazeAppModel to keep track of if the path is drawn
  or not. For future use to enable/disable the Clear button depending on
  if the path is drawn or not

ui:
* Add a "Clear shortest path" button to the Maze menu
* Add a method to clear the path in MazeApp (just trigger a repainting
  of the MazeApp, which erase the path, since its not drawn by default)
  and update MazeAppModel accordingly
This commit is contained in:
regar42 committed 2017-12-24 21:27:20 +01:00
1 parent c0afbe104c
commit 7242872b83
4 files changed
+42

No files matched your search

+9
View File
@@ -20,6 +20,7 @@ public class MazeAppModel extends Observable {
private ArrayList<VertexInterface> shortest = previous.getShortestPathTo(arrival);
//private ArrayList<VertexInterface> boxList = maze.getVertexes();
private Boolean modified = false;
private boolean pathDrawn = false;
public void setMaze(Maze maze) {
this.maze = new Maze(maze);
@@ -44,6 +45,14 @@ public class MazeAppModel extends Observable {
return modified;
}
public boolean isPathDrawn() {
return pathDrawn;
}
public void setPathDrawn(boolean pathDrawn) {
this.pathDrawn = pathDrawn;
}
public void saveToFile() {
maze.saveToTextFile("data/labyOutput.txt");
}