Files
TpMazeJava/src/ui/BoxTypeEditionMenu.java
T
regar42 e76db727c7 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
2018-01-14 14:00:07 +01:00

37 lines
1.1 KiB
Java

package ui;
import javax.swing.JPopupMenu;
import javax.swing.JMenuItem;
import maze.Box;
public final class BoxTypeEditionMenu extends JPopupMenu {
JMenuItem setWBox;
JMenuItem setEBox;
JMenuItem setDBox;
JMenuItem setABox;
JMenuItem addRow;
JMenuItem addLine;
JMenuItem delRow;
JMenuItem delLine;
public BoxTypeEditionMenu(MazeApp mazeApp, int boxLine, int boxRow) {
add(setEBox = new SetEBoxMenuItem(mazeApp, boxLine, boxRow));
add(setWBox = new SetWBoxMenuItem(mazeApp, boxLine, boxRow));
add(setDBox = new SetDBoxMenuItem(mazeApp, boxLine, boxRow));
add(setABox = new SetABoxMenuItem(mazeApp, boxLine, boxRow));
Box box = (Box) mazeApp.getModelBox(boxLine, boxRow);
setEBox.setEnabled((box.isWalkable() && (box.isDeparture() ||
box.isArrival())) || ! box.isWalkable());
setWBox.setEnabled(box.isWalkable());
setDBox.setEnabled(! box.isDeparture());
setABox.setEnabled(! box.isArrival());
add(addRow = new AddRowMenuItem(mazeApp, boxRow));
add(addLine = new AddLineMenuItem(mazeApp, boxLine));
add(delRow = new DelRowMenuItem(mazeApp, boxRow));
add(delLine = new DelLineMenuItem(mazeApp, boxLine));
}
}