Commit Graph
22 Commits
Author SHA1 Message Date
regar42 8bef42e2a6 Closing the window now does the same as Quit
ui:
* Add a WindowListener catching the event of closing the window to ask
  the user if the maze must be saved or not (if it's not already saved)
  (same behavior as the Quit button) (see #19)
2017-12-26 16:45:47 +01:00
regar42 9b272e5f25 Ask to save before loading a new maze
model:
* Deprecate modified from MazeAppModel, which was misused and
  misunderstood
* Add saved to MazeAppModel to keep track if a maze (or some
  modification) was saved into a file or not

ui:
* Use the new saved attribute to know if the maze was saved or not
* Move the box asking whether to save the maze or not from QuitMenuItem
  to SaveBox and call SaveBox from QuitMenuItem
* SaveBox now checks if the maze has a source file or not, if not it
  prompts a box to ask where to save the maze
* If the maze was modified, the Load Maze button will pop SaveBox before
  erasing the current maze
2017-12-26 15:24:00 +01:00
regar42 78dfe72e01 Open app on empty maze and improve load/save
model:
* Add a filename attribute to MazeAppModel to keep track of the file
  currently being used by the app
* Add saveToFile(filename) to save the maze into a specific file
* Rewrite saveToFile() to use the stored filename attribute to know into
  which file is to be used to save the maze, instead of the
  hardcoded path
* Remove unused models
* MazeAppModel is now initialized with an empty maze, instead of a
  maze read from a hardcoded path (see #13)
* Add a MazeAppModelMessage class to pass proper messages to observers
* Replace setMaze(maze) by loadMaze(filename) for now
* Move paintMaze into ui/MazeApp

ui:
* Add a Save As button (just a new name for the previous Save button)
  and implement an actual Save button (which saves into the file
  currently being used), disabled when no file is currently in use.
  (see #16)
* Create the FileBox class to handle file choices for the load, save,
  save as buttons
* Add keystrokes to trigger Load, Save or Save As actions from the menu

maze:
* Add a method to Maze to perform a deep copy of a matrix of boxes
* Add a static method to generate an empty maze of a fixed size (10*10)
  This behavior might change in the future
* Add a constructor to make a Maze from a matrix of boxes
2017-12-23 20:39:59 +01:00
antograb 16df6a26c6 Fix exception when exiting showDialog 2017-12-21 09:03:55 +01:00
antograb 3cdf425435 Add load maze 2017-12-20 21:05:56 +01:00
regar42 987fb858e4 Use proper dialog type for the "Save Maze" button
Instead of using showOpenDialog(), use showSaveDialog()
2017-12-20 01:18:37 +01:00
regar42 53ee6f1565 Add a button to save the maze from the ui 2017-12-19 23:30:12 +01:00
antograb 213071d3c2 Fix indexes confusion 2017-12-18 16:32:47 +01:00
antograb d9b52c35e2 [WIP] Load maze 2017-12-18 11:47:55 +01:00
antograb 9aa134eb77 Accidentally forgot to save file 2017-12-17 20:30:35 +01:00
antograb 7d5b2938fc Add loading options in JMenuBar
Need to fix bug when loading new maze
with different dimensions
2017-12-17 20:27:55 +01:00
regar42 79ed877d9d Merge branch 'boxTypeEdition' into mvc and cleanup
* Merge branch 'boxTypeEdition' into mvc
* Remove some useless spaces and blank lines
2017-12-16 20:40:27 +01:00
regar42 083962eec5 Merge branch 'menuBar' into mvc 2017-12-16 18:03:56 +01:00
regar42 bac9b54d58 Fixing lines and spaces and restoring labyOutput 2017-12-16 17:41:02 +01:00
antograb a5d0df4b96 Modified LoadMenuItem 2017-12-16 16:21:57 +01:00
antograb a6783e4a0d Add LoadMazeMenuItem (not finished) 2017-12-16 15:47:16 +01:00
antograb d8acf6ebe8 Add ActionListener for QuitMenuItem 2017-12-16 15:15:39 +01:00
antograb f8623fdd7a Add Observer and Observable implementation
Add update method, notifyForUpdates methods
Currently not working
2017-12-16 14:51:39 +01:00
regar42 40c05909e6 Add orange borders to the printed boxes 2017-12-16 13:15:25 +01:00
antograb 892d7e6ff3 Add maze in Model, then modify UI methods using maze. 2017-12-14 09:54:46 +01:00
antograb 94f4ab4e5a Add grid layout for the maze
Still have to add the maze to MazeAppModel and delete reference in ui
classes
2017-12-13 10:11:20 +01:00
antograb 0e398a7b57 Add UI package and JMenuBar 2017-12-11 11:42:01 +01:00