Open app on empty maze and improve load/save #23

Merged
antograb merged 5 commits from unifyLoadSave into mvc 2017-12-26 16:13:26 +00:00
Collaborator

Open app on empty maze and improve load/save (78dfe72e)

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 (see #13)
  • Remove unused models
  • MazeAppModel is now initialized with an empty maze, instead of a
    maze read from a hardcoded path
  • 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
Open app on empty maze and improve load/save (78dfe72e) ==== 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 (see #13) * Remove unused models * MazeAppModel is now initialized with an empty maze, instead of a maze read from a hardcoded path * 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
antograb was assigned by regar42 2017-12-23 15:36:58 +00:00
Author
Collaborator

(Now THIS is a commit message :D)

(Now THIS is a commit message :D)
Author
Collaborator

Add generic maze generation methods (97f9aa4b)

maze:

  • Change emptySquareMaze() to become emptyMaze(int dimension)
  • emptyMaze now takes 1 or 2 parameteres, and accordingly generate a
    square or a rectangle maze of the given dimension(s)
  • Add wallMaze, which generate a maze full of walls. As emptyMaze, it
    takes one or two parameters
    model:
  • Update mazeAppModel tu use the new emptyMaze method
Add generic maze generation methods (97f9aa4b) ==== maze: * Change emptySquareMaze() to become emptyMaze(int dimension) * emptyMaze now takes 1 or 2 parameteres, and accordingly generate a square or a rectangle maze of the given dimension(s) * Add wallMaze, which generate a maze full of walls. As emptyMaze, it takes one or two parameters model: * Update mazeAppModel tu use the new emptyMaze method
Author
Collaborator

Refresh attributes in MazeAppModel at maze loading (80ffabdd)

model:

  • Add initModelFromMaze() to refresh the model attributes, such as
    arrival, departure, previous, etc, at maze change
Refresh attributes in MazeAppModel at maze loading (80ffabdd) ==== model: * Add initModelFromMaze() to refresh the model attributes, such as arrival, departure, previous, etc, at maze change
regar42 added the enhancement label 2017-12-24 18:28:16 +00:00
Author
Collaborator

Ask to save before loading a new maze (9b272e5f)

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
Ask to save before loading a new maze (9b272e5f) ==== 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
Author
Collaborator

Closing the window now does the same as Quit (80ffabdd)

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)
Closing the window now does the same as Quit (80ffabdd) ==== 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)
antograb closed this pull request 2017-12-26 16:13:26 +00:00
regar42 deleted branch unifyLoadSave 2017-12-26 17:55:31 +00:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
-
Dependencies

No dependencies set.

Reference: antograb/TpMazeJava#23