Add maze edition functionalities #27

Merged
antograb merged 5 commits from editMaze into mvc 2018-01-01 19:28:25 +00:00
5 Commits
Author SHA1 Message Date
regar42 43d58c815b Fix null pointer exception when there is no path
maze:
* Add methods to Box and Maze to reset the neighbor lists of boxes

model:
* If the neighbor list of the arrival box is null, it means that no path
  exist between departure and arrival, and we therefore display the
  pop-up which is already displayed when the user tries to draw the path
  on a maze where there is no departure and/or arrival
2018-01-01 18:32:38 +01:00
regar42 024a4f70c3 Fix add column/line and spinners, cleanup Maintest
* Remove legacy test code in MainTest

maze:
* Add methods to add/del lines and columns
* Add various calls to matrixDeepCopy, allowing to overwrite only a part
  of a matrix

model:
* Better delegation to Maze : let Maze handle column/line
  adds/deletions

ui:
* Add buttons to context menu to add/remove lines and columns
* Add buttons to Maze Menu to delete lines and columns
* Fix the spinners, it used to call a new instance of itself, which made
  impossible to simple get the values from the spinners
2017-12-31 20:25:16 +01:00
antograb 286023c5d8 Add editing functionalities 2017-12-30 00:19:41 +01:00
regar42 81df80e7ea Add a context menu to edit boxes type
model:
* New methods to directly set boxes type instead of only toggling
  (setXBox methods)
* toggleBox now calls setXBox methods

ui:
* Add a context menu, enabled on right click, to directly choose the
  type of a box in the maze
* Defer the calculation of the box coordinates in the matrix to two new
  methods, getBoxRow and getBoxLine
2017-12-29 12:04:15 +01:00
regar42 37def85f5b Add a toggle to dynamically change boxes type
maze:
* Fix EBox, ABox, DBox and WBox, which still used legacy coordinates
  (x for y and y for x). See 213071d3 and #20

model:
* Add a toggle method to MazeAppModel. For a box given by its
  coordinates, it toggles its type (Wall, Empty, Departure or
  Arrival), sends a notification to observers and sets the maze's
  status to 'not saved'.

ui:
* Fix SaveMazeMenuItem, which enabled itself whenever a Maze renewal
  notification was received. It now enables itself only if a filename is
  set (expected behavior).
* Add a MouseListener to MazeDrawing to catch clicks on boxes. The
  selected box is found using the x and y coordinates of where the mouse
  clicked.
* Now print a message when the user tries to draw the shortest path
  whereas the maze doesn't contain an arrival and/or a departure.
2017-12-28 18:26:20 +01:00