package view.menu;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import view.panels.FreeQueryEntry;
import controller.ActorDecadeController;
import controller.FilmDecadeController;
import controller.ListAllActorsController;
import controller.ListAllFilmsController;
import controller.MainController;
public class MenuLine extends JMenuBar {
private static final long serialVersionUID = -7359511598935127752L;
private JMenu selectiveLists, actorList, filmList;
private JMenuItem listAllFilmsItem, listAllActorsItem, freeQuery;
private DecadeMenu actorDecadeList, filmDecadeList;
private ActorDecadeController actorDecadeController;
private FilmDecadeController filmDecadeController;
public MenuLine() {
super();
actorDecadeController = new ActorDecadeController();
filmDecadeController = new FilmDecadeController();
listAllActorsItem = new JMenuItem("List all actors in database");
listAllActorsItem.addActionListener(new ListAllActorsController());
actorDecadeList = new DecadeMenu(actorDecadeController);
actorList = new JMenu("Select by actor");
actorList.add(listAllActorsItem);
actorList.add(actorDecadeList);
listAllFilmsItem = new JMenuItem("List all film in database");
listAllFilmsItem.addActionListener(new ListAllFilmsController());
filmDecadeList = new DecadeMenu(filmDecadeController);
filmList = new JMenu("Select by film");
filmList.add(listAllFilmsItem);
filmList.add(filmDecadeList);
selectiveLists = new JMenu("Selective Lists");
selectiveLists.add(actorList);
selectiveLists.add(filmList);
freeQuery = new JMenu("Free query entry");
freeQuery.addMouseListener(new MouseListener() {
@Override
public void mouseClicked(MouseEvent arg0) {
new FreeQueryEntry(MainController.getInstance().getWindow());
}
public void mouseReleased(MouseEvent arg0) {}
public void mousePressed(MouseEvent arg0) {}
public void mouseExited(MouseEvent arg0) {}
public void mouseEntered(MouseEvent arg0) {}
});
add(selectiveLists);
add(freeQuery);
}
}