-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
96 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
137 changes: 72 additions & 65 deletions
137
src/main/view/menubar/MenuBar.java → src/main/view/menubar/MainMenuBar.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,123 +1,130 @@ | ||
package main.view.menubar; | ||
|
||
import javafx.scene.control.Menu; | ||
import javafx.scene.control.MenuItem; | ||
import javafx.scene.control.SeparatorMenuItem; | ||
import javafx.scene.control.*; | ||
import javafx.scene.control.MenuBar; | ||
import javafx.scene.input.KeyCombination; | ||
import main.controller.*; | ||
import main.localization.Loc; | ||
|
||
/** | ||
* MenuBar.java | ||
*/ | ||
public class MenuBar extends javafx.scene.control.MenuBar | ||
public class MainMenuBar extends MenuBar | ||
{ | ||
private Menu fileMenu, statisticsMenu, reportMenu, newMenu, aboutMenu; | ||
|
||
private MenuItem fileSave, closeProject, fileExit, fileRestart, | ||
customerStatistics, insuranceStatistics, claimStatistics, | ||
customerReport, insuranceReport, claimReport, | ||
customer, search, aboutUs; | ||
|
||
/** | ||
* Instantiates a new Menu bar. | ||
*/ | ||
public MenuBar() | ||
public MainMenuBar() | ||
{ | ||
/* Menus */ | ||
fileMenu = new Menu(Loc.c("menu_group_file")); | ||
|
||
statisticsMenu = new Menu(Loc.c("menu_group_statistics")); | ||
|
||
aboutMenu = new Menu(Loc.c("menu_group_about")); | ||
|
||
newMenu = new Menu(Loc.c("new")); | ||
|
||
reportMenu = new Menu(Loc.c("report")); | ||
|
||
/* Menu items */ | ||
setupFile(); | ||
setupNew(); | ||
setupStatistics(); | ||
setupReport(); | ||
setupAbout(); | ||
} | ||
|
||
// about | ||
aboutUs = new MenuItem(Loc.c("menu_about")); | ||
aboutUs.setAccelerator(KeyCombination.keyCombination("SHORTCUT + A")); | ||
aboutUs.setOnAction(e -> Mediator.inst.router(Signal.ABOUT, null)); | ||
private void setupFile() | ||
{ | ||
Menu fileMenu = new Menu(Loc.c("menu_group_file")); | ||
|
||
// file | ||
fileSave = new MenuItem(Loc.c("menu_file_save")); | ||
MenuItem fileSave = new MenuItem(Loc.c("menu_file_save")); | ||
fileSave.setOnAction(e -> Mediator.inst.router(Signal.FILE, | ||
new Payload(main.controller.MenuBar.Type.SAVE))); | ||
|
||
closeProject = new MenuItem(Loc.c("menu_close_project")); | ||
MenuItem closeProject = new MenuItem(Loc.c("menu_close_project")); | ||
closeProject.setOnAction(e -> Mediator.inst.router(Signal.FILE, | ||
new Payload(main.controller.MenuBar.Type.NEW_PROJECT))); | ||
|
||
fileRestart = new MenuItem(Loc.c("restart")); | ||
MenuItem fileRestart = new MenuItem(Loc.c("restart")); | ||
fileRestart.setOnAction(e -> Mediator.inst.router(Signal.FILE, | ||
new Payload(main.controller.MenuBar.Type.RESTART))); | ||
|
||
fileExit = new MenuItem(Loc.c("menu_file_exit")); | ||
MenuItem fileExit = new MenuItem(Loc.c("menu_file_exit")); | ||
fileExit.setAccelerator(KeyCombination.keyCombination("SHORTCUT + X")); | ||
fileExit.setOnAction(e -> Mediator.inst.router(Signal.FILE, | ||
new Payload(main.controller.MenuBar.Type.CLOSE))); | ||
|
||
// statistics | ||
customerStatistics = new MenuItem(Loc.c("menu_customer_statistics")); | ||
fileMenu.getItems().addAll(closeProject, | ||
new SeparatorMenuItem(), | ||
fileSave, | ||
new SeparatorMenuItem(), | ||
fileRestart, fileExit); | ||
|
||
getMenus().add(fileMenu); | ||
} | ||
|
||
private void setupStatistics() | ||
{ | ||
Menu statisticsMenu = new Menu(Loc.c("menu_group_statistics")); | ||
|
||
MenuItem customerStatistics = new MenuItem(Loc.c("menu_customer_statistics")); | ||
customerStatistics.setOnAction(e -> Mediator.inst.router(Signal.STATISTICS, | ||
new Payload(StatisticsController.Type.PERSON))); | ||
|
||
insuranceStatistics = new MenuItem(Loc.c("menu_insurance_statistics")); | ||
MenuItem insuranceStatistics = new MenuItem(Loc.c("menu_insurance_statistics")); | ||
insuranceStatistics.setOnAction(e -> Mediator.inst.router(Signal.STATISTICS, | ||
new Payload(StatisticsController.Type.INSURANCE))); | ||
|
||
claimStatistics = new MenuItem(Loc.c("menu_claim_statistics")); | ||
MenuItem claimStatistics = new MenuItem(Loc.c("menu_claim_statistics")); | ||
claimStatistics.setOnAction(e -> Mediator.inst.router(Signal.STATISTICS, | ||
new Payload(StatisticsController.Type.CLAIM))); | ||
|
||
// reports | ||
customerReport = new MenuItem(Loc.c("menu_customer_report")); | ||
statisticsMenu.getItems().addAll(customerStatistics, | ||
insuranceStatistics, claimStatistics); | ||
|
||
getMenus().add(statisticsMenu); | ||
} | ||
|
||
private void setupAbout() | ||
{ | ||
Menu aboutMenu = new Menu(Loc.c("menu_group_about")); | ||
|
||
MenuItem aboutUs = new MenuItem(Loc.c("menu_about")); | ||
aboutUs.setAccelerator(KeyCombination.keyCombination("SHORTCUT + A")); | ||
aboutUs.setOnAction(e -> Mediator.inst.router(Signal.ABOUT, null)); | ||
|
||
aboutMenu.getItems().addAll(aboutUs); | ||
|
||
getMenus().add(aboutMenu); | ||
} | ||
|
||
private void setupReport() | ||
{ | ||
Menu reportMenu = new Menu(Loc.c("report")); | ||
|
||
MenuItem customerReport = new MenuItem(Loc.c("menu_customer_report")); | ||
customerReport.setOnAction(e -> Mediator.inst.router(Signal.REPORT, | ||
new Payload(ReportController.Type.PERSON))); | ||
|
||
insuranceReport = new MenuItem(Loc.c("menu_insurance_report")); | ||
MenuItem insuranceReport = new MenuItem(Loc.c("menu_insurance_report")); | ||
insuranceReport.setOnAction(e -> Mediator.inst.router(Signal.REPORT, | ||
new Payload(ReportController.Type.INSURANCE))); | ||
|
||
claimReport = new MenuItem(Loc.c("menu_claim_report")); | ||
MenuItem claimReport = new MenuItem(Loc.c("menu_claim_report")); | ||
claimReport.setOnAction(e -> Mediator.inst.router(Signal.REPORT, | ||
new Payload(ReportController.Type.CLAIM))); | ||
|
||
// new | ||
customer = new MenuItem(Loc.c("customer")); | ||
customer.setAccelerator(KeyCombination.keyCombination("SHORTCUT + C")); | ||
reportMenu.getItems().addAll(customerReport, | ||
insuranceReport, claimReport); | ||
|
||
getMenus().add(reportMenu); | ||
} | ||
|
||
private void setupNew() | ||
{ | ||
Menu newMenu = new Menu(Loc.c("new")); | ||
|
||
MenuItem customer = new MenuItem(Loc.c("customer")); | ||
customer.setAccelerator(KeyCombination.keyCombination("SHORTCUT + C")); | ||
customer.setOnAction(e -> Mediator.inst.router(Signal.FILE, | ||
new Payload(main.controller.MenuBar.Type.NEW_CUSTOMER))); | ||
|
||
search = new MenuItem(Loc.c("search")); | ||
MenuItem search = new MenuItem(Loc.c("search")); | ||
search.setAccelerator(KeyCombination.keyCombination("SHORTCUT + S")); | ||
search.setOnAction(e -> Mediator.inst.router(Signal.SEARCH, null)); | ||
|
||
|
||
// Add to menus | ||
fileMenu.getItems().addAll( | ||
closeProject, | ||
new SeparatorMenuItem(), | ||
fileSave, | ||
new SeparatorMenuItem(), | ||
fileRestart, | ||
fileExit); | ||
|
||
newMenu.getItems().addAll(search, customer); | ||
|
||
statisticsMenu.getItems().addAll(customerStatistics, | ||
insuranceStatistics, claimStatistics); | ||
|
||
reportMenu.getItems().addAll(customerReport, | ||
insuranceReport, claimReport); | ||
|
||
aboutMenu.getItems().addAll(aboutUs); | ||
|
||
getMenus().addAll(fileMenu, newMenu, statisticsMenu, | ||
reportMenu, aboutMenu); | ||
getMenus().add(newMenu); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.