diff --git a/Item.txt b/Item.txt index c2ebea3..8c71d0f 100644 --- a/Item.txt +++ b/Item.txt @@ -4,11 +4,23 @@ -2;cipolla;50;0.4;null;null;vegetables -3;penna;100;0.5;null;null;diary -1;tofu;18;3.2;null;null;bio -4;vino rosso;46;8.6;null;null;beverage -5;mayo veg;73;3.2;null;null;sauce \ No newline at end of file + + +1;tofu;17;3.2;null;null;bio + + + +5;mayo veg;72;3.2;null;null;sauce + +7;sedano;38;0.15;null;null;vegetables + +2;cipolla;0;0.4;null;null;vegetables + +3;penna;93;0.5;null;null;diary + +6;carota;33;0.1;null;null;vegetables + +4;vino rosso;41;8.6;null;null;beverage \ No newline at end of file diff --git a/Shop.txt b/Shop.txt index 0ac18bc..e5e2799 100644 --- a/Shop.txt +++ b/Shop.txt @@ -1,3 +1,7 @@ -2022-01-15 22:29:56 11 simonetta cornacchia 74.7 -2022-01-16 13:20:51 11 simonetta cornacchia 58.2 -2022-01-16 13:30:09 1 penny briccoli 63.2 +2022-01-15 22:29:56 15 simonetta cornacchia 74.7 +2022-01-16 13:20:51 15 simonetta cornacchia 58.2 +2022-01-16 13:30:09 1 penny briccoli 63.2 +2022-01-16 23:29:33 2 matteo cico 25.9 +2022-01-16 23:30:57 4 sara white 20.0 +2022-01-16 23:32:38 10 lorenzo briccoli 1.7 +2022-01-16 23:36:31 11 mirko viroli 25.8 diff --git a/User.txt b/User.txt index 25402ca..7033014 100644 --- a/User.txt +++ b/User.txt @@ -1,8 +1,15 @@ -1;penny;briccoli;;manager;faenza -2;phebe;buffay;;customer;newyork;end -11;simonetta;cornacchia;la donna delle ceramiche;manager;faenza;end -3;matteo;cicognani;l'amor stronzo della mia vita;manager;san louis obispo;end -0;el duko;pistolero;we mejo der coroseo;customer;roma;end \ No newline at end of file +1;matteo;cico;;cashier;san louis obispo;aka + +2;joseph;tribbiani;;customer;newyork;j1 + + + + + + +10;lorenzo;briccoli;how u doin;customer;liguria;ll + +11;mirko;viroli;;customer;;mk1 diff --git a/bin/main/java/application/MainSBS.class b/bin/main/java/application/MainSBS.class index 9121c64..f2910e2 100644 Binary files a/bin/main/java/application/MainSBS.class and b/bin/main/java/application/MainSBS.class differ diff --git a/bin/main/java/controller/InvoiceControllerImpl.class b/bin/main/java/controller/InvoiceControllerImpl.class index 9fe8c42..5bab87e 100644 Binary files a/bin/main/java/controller/InvoiceControllerImpl.class and b/bin/main/java/controller/InvoiceControllerImpl.class differ diff --git a/bin/main/java/controller/ItemControllerImpl.class b/bin/main/java/controller/ItemControllerImpl.class index 2d91245..9ee01cc 100644 Binary files a/bin/main/java/controller/ItemControllerImpl.class and b/bin/main/java/controller/ItemControllerImpl.class differ diff --git a/bin/main/java/controller/ShopControllerImpl.class b/bin/main/java/controller/ShopControllerImpl.class index b69ed4d..6add1b3 100644 Binary files a/bin/main/java/controller/ShopControllerImpl.class and b/bin/main/java/controller/ShopControllerImpl.class differ diff --git a/bin/main/java/controller/UserController.class b/bin/main/java/controller/UserController.class index 48417f8..4513aec 100644 Binary files a/bin/main/java/controller/UserController.class and b/bin/main/java/controller/UserController.class differ diff --git a/bin/main/java/controller/UserControllerImpl.class b/bin/main/java/controller/UserControllerImpl.class index ae37f1a..c4846a9 100644 Binary files a/bin/main/java/controller/UserControllerImpl.class and b/bin/main/java/controller/UserControllerImpl.class differ diff --git a/bin/main/java/model/ItemCategory.class b/bin/main/java/model/ItemCategory.class index 7a3ed1e..e149458 100644 Binary files a/bin/main/java/model/ItemCategory.class and b/bin/main/java/model/ItemCategory.class differ diff --git a/bin/main/java/model/ItemImpl.class b/bin/main/java/model/ItemImpl.class index 7e4c305..7d96316 100644 Binary files a/bin/main/java/model/ItemImpl.class and b/bin/main/java/model/ItemImpl.class differ diff --git a/bin/main/java/model/Model.class b/bin/main/java/model/Model.class deleted file mode 100644 index 8f931a0..0000000 Binary files a/bin/main/java/model/Model.class and /dev/null differ diff --git a/bin/main/java/model/ModelImpl.class b/bin/main/java/model/ModelImpl.class deleted file mode 100644 index 1404128..0000000 Binary files a/bin/main/java/model/ModelImpl.class and /dev/null differ diff --git a/bin/main/java/model/ShoppingCart.class b/bin/main/java/model/ShoppingCart.class index fcc36ff..0ce666e 100644 Binary files a/bin/main/java/model/ShoppingCart.class and b/bin/main/java/model/ShoppingCart.class differ diff --git a/bin/main/java/model/ShoppingCartImpl.class b/bin/main/java/model/ShoppingCartImpl.class index f529e22..1338649 100644 Binary files a/bin/main/java/model/ShoppingCartImpl.class and b/bin/main/java/model/ShoppingCartImpl.class differ diff --git a/bin/main/java/model/User.class b/bin/main/java/model/User.class index 2f751bd..fa466c8 100644 Binary files a/bin/main/java/model/User.class and b/bin/main/java/model/User.class differ diff --git a/bin/main/java/model/UserImpl$UserBuilder.class b/bin/main/java/model/UserImpl$UserBuilder.class index c6e05c8..fb188ac 100644 Binary files a/bin/main/java/model/UserImpl$UserBuilder.class and b/bin/main/java/model/UserImpl$UserBuilder.class differ diff --git a/bin/main/java/model/UserImpl.class b/bin/main/java/model/UserImpl.class index e239ea8..5c6fdeb 100644 Binary files a/bin/main/java/model/UserImpl.class and b/bin/main/java/model/UserImpl.class differ diff --git a/bin/main/java/model/UserRole.class b/bin/main/java/model/UserRole.class index c7d9df5..fd19057 100644 Binary files a/bin/main/java/model/UserRole.class and b/bin/main/java/model/UserRole.class differ diff --git a/bin/main/java/view/AccountingView$1.class b/bin/main/java/view/AccountingView$1.class index d18e714..50f9674 100644 Binary files a/bin/main/java/view/AccountingView$1.class and b/bin/main/java/view/AccountingView$1.class differ diff --git a/bin/main/java/view/AccountingView$2.class b/bin/main/java/view/AccountingView$2.class index af0eaa8..5e9e4de 100644 Binary files a/bin/main/java/view/AccountingView$2.class and b/bin/main/java/view/AccountingView$2.class differ diff --git a/bin/main/java/view/AccountingView$3.class b/bin/main/java/view/AccountingView$3.class index 725f79d..b14a0b7 100644 Binary files a/bin/main/java/view/AccountingView$3.class and b/bin/main/java/view/AccountingView$3.class differ diff --git a/bin/main/java/view/AccountingView.class b/bin/main/java/view/AccountingView.class index 87d1150..17b338b 100644 Binary files a/bin/main/java/view/AccountingView.class and b/bin/main/java/view/AccountingView.class differ diff --git a/bin/main/java/view/AddCustomerView$1.class b/bin/main/java/view/AddCustomerView$1.class index 260d1fc..fdeedf8 100644 Binary files a/bin/main/java/view/AddCustomerView$1.class and b/bin/main/java/view/AddCustomerView$1.class differ diff --git a/bin/main/java/view/AddCustomerView$2.class b/bin/main/java/view/AddCustomerView$2.class index 3b83c02..318c124 100644 Binary files a/bin/main/java/view/AddCustomerView$2.class and b/bin/main/java/view/AddCustomerView$2.class differ diff --git a/bin/main/java/view/AddCustomerView.class b/bin/main/java/view/AddCustomerView.class index 29dab22..111e02a 100644 Binary files a/bin/main/java/view/AddCustomerView.class and b/bin/main/java/view/AddCustomerView.class differ diff --git a/bin/main/java/view/AddItemView$1.class b/bin/main/java/view/AddItemView$1.class index a97c646..3017cb2 100644 Binary files a/bin/main/java/view/AddItemView$1.class and b/bin/main/java/view/AddItemView$1.class differ diff --git a/bin/main/java/view/AddItemView$2.class b/bin/main/java/view/AddItemView$2.class index 6895fa9..7da34d3 100644 Binary files a/bin/main/java/view/AddItemView$2.class and b/bin/main/java/view/AddItemView$2.class differ diff --git a/bin/main/java/view/AddItemView.class b/bin/main/java/view/AddItemView.class index 0fc7135..592c4e8 100644 Binary files a/bin/main/java/view/AddItemView.class and b/bin/main/java/view/AddItemView.class differ diff --git a/bin/main/java/view/AddUserView$1.class b/bin/main/java/view/AddUserView$1.class index e54a206..d5cf91b 100644 Binary files a/bin/main/java/view/AddUserView$1.class and b/bin/main/java/view/AddUserView$1.class differ diff --git a/bin/main/java/view/AddUserView$2.class b/bin/main/java/view/AddUserView$2.class index 3ecef87..aa66a02 100644 Binary files a/bin/main/java/view/AddUserView$2.class and b/bin/main/java/view/AddUserView$2.class differ diff --git a/bin/main/java/view/AddUserView.class b/bin/main/java/view/AddUserView.class index 6efb73c..97b1476 100644 Binary files a/bin/main/java/view/AddUserView.class and b/bin/main/java/view/AddUserView.class differ diff --git a/bin/main/java/view/CashierView$1.class b/bin/main/java/view/CashierView$1.class index 3bd0d1a..4e0b97c 100644 Binary files a/bin/main/java/view/CashierView$1.class and b/bin/main/java/view/CashierView$1.class differ diff --git a/bin/main/java/view/CashierView$2.class b/bin/main/java/view/CashierView$2.class index e2561cc..3a62a4e 100644 Binary files a/bin/main/java/view/CashierView$2.class and b/bin/main/java/view/CashierView$2.class differ diff --git a/bin/main/java/view/CashierView.class b/bin/main/java/view/CashierView.class index fb28578..11ad37c 100644 Binary files a/bin/main/java/view/CashierView.class and b/bin/main/java/view/CashierView.class differ diff --git a/bin/main/java/view/CustomerView$1.class b/bin/main/java/view/CustomerView$1.class index 57a42da..46fad1e 100644 Binary files a/bin/main/java/view/CustomerView$1.class and b/bin/main/java/view/CustomerView$1.class differ diff --git a/bin/main/java/view/CustomerView$2.class b/bin/main/java/view/CustomerView$2.class index 1c848dd..80def71 100644 Binary files a/bin/main/java/view/CustomerView$2.class and b/bin/main/java/view/CustomerView$2.class differ diff --git a/bin/main/java/view/CustomerView$3.class b/bin/main/java/view/CustomerView$3.class index b0b782f..a08eeea 100644 Binary files a/bin/main/java/view/CustomerView$3.class and b/bin/main/java/view/CustomerView$3.class differ diff --git a/bin/main/java/view/CustomerView.class b/bin/main/java/view/CustomerView.class index 175d99a..b293af4 100644 Binary files a/bin/main/java/view/CustomerView.class and b/bin/main/java/view/CustomerView.class differ diff --git a/bin/main/java/view/EditCustomerView$1.class b/bin/main/java/view/EditCustomerView$1.class index c23d93b..951f560 100644 Binary files a/bin/main/java/view/EditCustomerView$1.class and b/bin/main/java/view/EditCustomerView$1.class differ diff --git a/bin/main/java/view/EditCustomerView$2.class b/bin/main/java/view/EditCustomerView$2.class index 1eb4a0d..7d5360e 100644 Binary files a/bin/main/java/view/EditCustomerView$2.class and b/bin/main/java/view/EditCustomerView$2.class differ diff --git a/bin/main/java/view/EditCustomerView$3.class b/bin/main/java/view/EditCustomerView$3.class index d1e0bec..06c36ba 100644 Binary files a/bin/main/java/view/EditCustomerView$3.class and b/bin/main/java/view/EditCustomerView$3.class differ diff --git a/bin/main/java/view/EditCustomerView$4.class b/bin/main/java/view/EditCustomerView$4.class index e3c83e4..25061d4 100644 Binary files a/bin/main/java/view/EditCustomerView$4.class and b/bin/main/java/view/EditCustomerView$4.class differ diff --git a/bin/main/java/view/EditCustomerView$5.class b/bin/main/java/view/EditCustomerView$5.class index 36bf06b..53366bb 100644 Binary files a/bin/main/java/view/EditCustomerView$5.class and b/bin/main/java/view/EditCustomerView$5.class differ diff --git a/bin/main/java/view/EditCustomerView.class b/bin/main/java/view/EditCustomerView.class index 59c0b08..13086ca 100644 Binary files a/bin/main/java/view/EditCustomerView.class and b/bin/main/java/view/EditCustomerView.class differ diff --git a/bin/main/java/view/EditItemView$1.class b/bin/main/java/view/EditItemView$1.class index bb597f3..44601b6 100644 Binary files a/bin/main/java/view/EditItemView$1.class and b/bin/main/java/view/EditItemView$1.class differ diff --git a/bin/main/java/view/EditItemView$2.class b/bin/main/java/view/EditItemView$2.class index d88c8cb..03ce4f7 100644 Binary files a/bin/main/java/view/EditItemView$2.class and b/bin/main/java/view/EditItemView$2.class differ diff --git a/bin/main/java/view/EditItemView$3.class b/bin/main/java/view/EditItemView$3.class index 1c5cc61..f306a0a 100644 Binary files a/bin/main/java/view/EditItemView$3.class and b/bin/main/java/view/EditItemView$3.class differ diff --git a/bin/main/java/view/EditItemView$4.class b/bin/main/java/view/EditItemView$4.class index 09b5a3b..f7f0d5c 100644 Binary files a/bin/main/java/view/EditItemView$4.class and b/bin/main/java/view/EditItemView$4.class differ diff --git a/bin/main/java/view/EditItemView$5.class b/bin/main/java/view/EditItemView$5.class index eb4b432..3894d9f 100644 Binary files a/bin/main/java/view/EditItemView$5.class and b/bin/main/java/view/EditItemView$5.class differ diff --git a/bin/main/java/view/EditItemView.class b/bin/main/java/view/EditItemView.class index c501ab4..1e5bacf 100644 Binary files a/bin/main/java/view/EditItemView.class and b/bin/main/java/view/EditItemView.class differ diff --git a/bin/main/java/view/EditUserView$1.class b/bin/main/java/view/EditUserView$1.class index 7b9a25e..9a6161b 100644 Binary files a/bin/main/java/view/EditUserView$1.class and b/bin/main/java/view/EditUserView$1.class differ diff --git a/bin/main/java/view/EditUserView$2.class b/bin/main/java/view/EditUserView$2.class index 590f1cd..1186d27 100644 Binary files a/bin/main/java/view/EditUserView$2.class and b/bin/main/java/view/EditUserView$2.class differ diff --git a/bin/main/java/view/EditUserView$3.class b/bin/main/java/view/EditUserView$3.class index 99e6561..1c8fd2d 100644 Binary files a/bin/main/java/view/EditUserView$3.class and b/bin/main/java/view/EditUserView$3.class differ diff --git a/bin/main/java/view/EditUserView$4.class b/bin/main/java/view/EditUserView$4.class index 5ebe598..a74bd48 100644 Binary files a/bin/main/java/view/EditUserView$4.class and b/bin/main/java/view/EditUserView$4.class differ diff --git a/bin/main/java/view/EditUserView$5.class b/bin/main/java/view/EditUserView$5.class index dc53532..9ea0114 100644 Binary files a/bin/main/java/view/EditUserView$5.class and b/bin/main/java/view/EditUserView$5.class differ diff --git a/bin/main/java/view/EditUserView.class b/bin/main/java/view/EditUserView.class index 676c5cf..734f0f3 100644 Binary files a/bin/main/java/view/EditUserView.class and b/bin/main/java/view/EditUserView.class differ diff --git a/bin/main/java/view/HomeView$1.class b/bin/main/java/view/HomeView$1.class index 02f8380..fa97f2d 100644 Binary files a/bin/main/java/view/HomeView$1.class and b/bin/main/java/view/HomeView$1.class differ diff --git a/bin/main/java/view/HomeView$2.class b/bin/main/java/view/HomeView$2.class index b3d583a..50a1c37 100644 Binary files a/bin/main/java/view/HomeView$2.class and b/bin/main/java/view/HomeView$2.class differ diff --git a/bin/main/java/view/HomeView$3.class b/bin/main/java/view/HomeView$3.class index 9df58a5..9911b8a 100644 Binary files a/bin/main/java/view/HomeView$3.class and b/bin/main/java/view/HomeView$3.class differ diff --git a/bin/main/java/view/HomeView$4.class b/bin/main/java/view/HomeView$4.class index 141f6e2..acb0a1b 100644 Binary files a/bin/main/java/view/HomeView$4.class and b/bin/main/java/view/HomeView$4.class differ diff --git a/bin/main/java/view/HomeView$5.class b/bin/main/java/view/HomeView$5.class index 90952dd..13966a4 100644 Binary files a/bin/main/java/view/HomeView$5.class and b/bin/main/java/view/HomeView$5.class differ diff --git a/bin/main/java/view/HomeView.class b/bin/main/java/view/HomeView.class index 19a28ac..1141bd4 100644 Binary files a/bin/main/java/view/HomeView.class and b/bin/main/java/view/HomeView.class differ diff --git a/bin/main/java/view/InvoiceView$1.class b/bin/main/java/view/InvoiceView$1.class index d929ec2..ebc3266 100644 Binary files a/bin/main/java/view/InvoiceView$1.class and b/bin/main/java/view/InvoiceView$1.class differ diff --git a/bin/main/java/view/InvoiceView$2.class b/bin/main/java/view/InvoiceView$2.class index 54ae7d6..a2cc1d2 100644 Binary files a/bin/main/java/view/InvoiceView$2.class and b/bin/main/java/view/InvoiceView$2.class differ diff --git a/bin/main/java/view/InvoiceView$3.class b/bin/main/java/view/InvoiceView$3.class index 7ea2bfc..77a1727 100644 Binary files a/bin/main/java/view/InvoiceView$3.class and b/bin/main/java/view/InvoiceView$3.class differ diff --git a/bin/main/java/view/InvoiceView$4.class b/bin/main/java/view/InvoiceView$4.class index ae878d2..64ffe13 100644 Binary files a/bin/main/java/view/InvoiceView$4.class and b/bin/main/java/view/InvoiceView$4.class differ diff --git a/bin/main/java/view/InvoiceView$5.class b/bin/main/java/view/InvoiceView$5.class index 5589c5c..965e294 100644 Binary files a/bin/main/java/view/InvoiceView$5.class and b/bin/main/java/view/InvoiceView$5.class differ diff --git a/bin/main/java/view/InvoiceView$6.class b/bin/main/java/view/InvoiceView$6.class index 10c9ab9..7f09904 100644 Binary files a/bin/main/java/view/InvoiceView$6.class and b/bin/main/java/view/InvoiceView$6.class differ diff --git a/bin/main/java/view/InvoiceView$7.class b/bin/main/java/view/InvoiceView$7.class index 74842dc..1d6216c 100644 Binary files a/bin/main/java/view/InvoiceView$7.class and b/bin/main/java/view/InvoiceView$7.class differ diff --git a/bin/main/java/view/InvoiceView$8.class b/bin/main/java/view/InvoiceView$8.class index a0dba72..db1dcf7 100644 Binary files a/bin/main/java/view/InvoiceView$8.class and b/bin/main/java/view/InvoiceView$8.class differ diff --git a/bin/main/java/view/InvoiceView.class b/bin/main/java/view/InvoiceView.class index e58872e..86b4106 100644 Binary files a/bin/main/java/view/InvoiceView.class and b/bin/main/java/view/InvoiceView.class differ diff --git a/bin/main/java/view/ItemReportView$1.class b/bin/main/java/view/ItemReportView$1.class index 1e7873e..6a45ed7 100644 Binary files a/bin/main/java/view/ItemReportView$1.class and b/bin/main/java/view/ItemReportView$1.class differ diff --git a/bin/main/java/view/ItemReportView$2.class b/bin/main/java/view/ItemReportView$2.class index 5240c38..6ec82f7 100644 Binary files a/bin/main/java/view/ItemReportView$2.class and b/bin/main/java/view/ItemReportView$2.class differ diff --git a/bin/main/java/view/ItemReportView$3.class b/bin/main/java/view/ItemReportView$3.class index cfcd988..33457fd 100644 Binary files a/bin/main/java/view/ItemReportView$3.class and b/bin/main/java/view/ItemReportView$3.class differ diff --git a/bin/main/java/view/ItemReportView.class b/bin/main/java/view/ItemReportView.class index 65d415b..9cbb69f 100644 Binary files a/bin/main/java/view/ItemReportView.class and b/bin/main/java/view/ItemReportView.class differ diff --git a/bin/main/java/view/ItemView$1.class b/bin/main/java/view/ItemView$1.class index 958d8c6..2d64ba6 100644 Binary files a/bin/main/java/view/ItemView$1.class and b/bin/main/java/view/ItemView$1.class differ diff --git a/bin/main/java/view/ItemView$2.class b/bin/main/java/view/ItemView$2.class index 3ad5b52..a254744 100644 Binary files a/bin/main/java/view/ItemView$2.class and b/bin/main/java/view/ItemView$2.class differ diff --git a/bin/main/java/view/ItemView$3.class b/bin/main/java/view/ItemView$3.class index 2567213..f924f39 100644 Binary files a/bin/main/java/view/ItemView$3.class and b/bin/main/java/view/ItemView$3.class differ diff --git a/bin/main/java/view/ItemView.class b/bin/main/java/view/ItemView.class index 46f9620..01de3de 100644 Binary files a/bin/main/java/view/ItemView.class and b/bin/main/java/view/ItemView.class differ diff --git a/bin/main/java/view/LoginView$1.class b/bin/main/java/view/LoginView$1.class index 1ad04f5..f7a08b6 100644 Binary files a/bin/main/java/view/LoginView$1.class and b/bin/main/java/view/LoginView$1.class differ diff --git a/bin/main/java/view/LoginView$2.class b/bin/main/java/view/LoginView$2.class index 6e2e269..290d852 100644 Binary files a/bin/main/java/view/LoginView$2.class and b/bin/main/java/view/LoginView$2.class differ diff --git a/bin/main/java/view/LoginView$3.class b/bin/main/java/view/LoginView$3.class index ab6b9b8..23b759a 100644 Binary files a/bin/main/java/view/LoginView$3.class and b/bin/main/java/view/LoginView$3.class differ diff --git a/bin/main/java/view/LoginView$4.class b/bin/main/java/view/LoginView$4.class index 5c1f7c0..ea25d26 100644 Binary files a/bin/main/java/view/LoginView$4.class and b/bin/main/java/view/LoginView$4.class differ diff --git a/bin/main/java/view/LoginView.class b/bin/main/java/view/LoginView.class index 3af0d7d..73e2000 100644 Binary files a/bin/main/java/view/LoginView.class and b/bin/main/java/view/LoginView.class differ diff --git a/bin/main/java/view/ManagementView$1.class b/bin/main/java/view/ManagementView$1.class index ab83c60..f113aaf 100644 Binary files a/bin/main/java/view/ManagementView$1.class and b/bin/main/java/view/ManagementView$1.class differ diff --git a/bin/main/java/view/ManagementView$2.class b/bin/main/java/view/ManagementView$2.class index b3c828b..6f7d7bc 100644 Binary files a/bin/main/java/view/ManagementView$2.class and b/bin/main/java/view/ManagementView$2.class differ diff --git a/bin/main/java/view/ManagementView$3.class b/bin/main/java/view/ManagementView$3.class index 1ea5fe1..5b89bec 100644 Binary files a/bin/main/java/view/ManagementView$3.class and b/bin/main/java/view/ManagementView$3.class differ diff --git a/bin/main/java/view/ManagementView$4.class b/bin/main/java/view/ManagementView$4.class index abed5ea..3eb0cd0 100644 Binary files a/bin/main/java/view/ManagementView$4.class and b/bin/main/java/view/ManagementView$4.class differ diff --git a/bin/main/java/view/ManagementView$5.class b/bin/main/java/view/ManagementView$5.class index 1395aab..9d14079 100644 Binary files a/bin/main/java/view/ManagementView$5.class and b/bin/main/java/view/ManagementView$5.class differ diff --git a/bin/main/java/view/ManagementView.class b/bin/main/java/view/ManagementView.class index 9dc13af..e4d68cf 100644 Binary files a/bin/main/java/view/ManagementView.class and b/bin/main/java/view/ManagementView.class differ diff --git a/bin/main/java/view/PurchaseReportView$1.class b/bin/main/java/view/PurchaseReportView$1.class index dde5e5c..e694344 100644 Binary files a/bin/main/java/view/PurchaseReportView$1.class and b/bin/main/java/view/PurchaseReportView$1.class differ diff --git a/bin/main/java/view/PurchaseReportView$2.class b/bin/main/java/view/PurchaseReportView$2.class index 83a8a30..2095833 100644 Binary files a/bin/main/java/view/PurchaseReportView$2.class and b/bin/main/java/view/PurchaseReportView$2.class differ diff --git a/bin/main/java/view/PurchaseReportView$3.class b/bin/main/java/view/PurchaseReportView$3.class index 79a3332..670aa48 100644 Binary files a/bin/main/java/view/PurchaseReportView$3.class and b/bin/main/java/view/PurchaseReportView$3.class differ diff --git a/bin/main/java/view/PurchaseReportView.class b/bin/main/java/view/PurchaseReportView.class index 905ed46..0b5d85c 100644 Binary files a/bin/main/java/view/PurchaseReportView.class and b/bin/main/java/view/PurchaseReportView.class differ diff --git a/bin/main/java/view/ReportView$1.class b/bin/main/java/view/ReportView$1.class index 4b10797..cf18633 100644 Binary files a/bin/main/java/view/ReportView$1.class and b/bin/main/java/view/ReportView$1.class differ diff --git a/bin/main/java/view/ReportView$2.class b/bin/main/java/view/ReportView$2.class index 022c229..c7b7c2b 100644 Binary files a/bin/main/java/view/ReportView$2.class and b/bin/main/java/view/ReportView$2.class differ diff --git a/bin/main/java/view/ReportView$3.class b/bin/main/java/view/ReportView$3.class index 355408d..518e7c2 100644 Binary files a/bin/main/java/view/ReportView$3.class and b/bin/main/java/view/ReportView$3.class differ diff --git a/bin/main/java/view/ReportView$4.class b/bin/main/java/view/ReportView$4.class index 869790b..35b7ad8 100644 Binary files a/bin/main/java/view/ReportView$4.class and b/bin/main/java/view/ReportView$4.class differ diff --git a/bin/main/java/view/ReportView.class b/bin/main/java/view/ReportView.class index a223f77..20bee3f 100644 Binary files a/bin/main/java/view/ReportView.class and b/bin/main/java/view/ReportView.class differ diff --git a/bin/main/java/view/UserView$1.class b/bin/main/java/view/UserView$1.class index 483427a..72124bc 100644 Binary files a/bin/main/java/view/UserView$1.class and b/bin/main/java/view/UserView$1.class differ diff --git a/bin/main/java/view/UserView$2.class b/bin/main/java/view/UserView$2.class index 57e42f8..cf046d8 100644 Binary files a/bin/main/java/view/UserView$2.class and b/bin/main/java/view/UserView$2.class differ diff --git a/bin/main/java/view/UserView$3.class b/bin/main/java/view/UserView$3.class index 9001dc6..4e40964 100644 Binary files a/bin/main/java/view/UserView$3.class and b/bin/main/java/view/UserView$3.class differ diff --git a/bin/main/java/view/UserView.class b/bin/main/java/view/UserView.class index 9157608..f59be45 100644 Binary files a/bin/main/java/view/UserView.class and b/bin/main/java/view/UserView.class differ diff --git a/bin/main/resources/mainView.jpg b/bin/main/resources/mainView.jpg deleted file mode 100644 index a9de7fb..0000000 Binary files a/bin/main/resources/mainView.jpg and /dev/null differ diff --git a/bin/test/java/model/FileTest.class b/bin/test/java/model/FileTest.class index 54f9956..9579a1e 100644 Binary files a/bin/test/java/model/FileTest.class and b/bin/test/java/model/FileTest.class differ diff --git a/bin/test/java/model/ItemTest.class b/bin/test/java/model/ItemTest.class index cd97bfc..b790e93 100644 Binary files a/bin/test/java/model/ItemTest.class and b/bin/test/java/model/ItemTest.class differ diff --git a/bin/test/java/model/UserTest.class b/bin/test/java/model/UserTest.class index 9490a9c..208b927 100644 Binary files a/bin/test/java/model/UserTest.class and b/bin/test/java/model/UserTest.class differ diff --git a/doc/allclasses-index.html b/doc/allclasses-index.html new file mode 100644 index 0000000..3b1894e --- /dev/null +++ b/doc/allclasses-index.html @@ -0,0 +1,66 @@ + + + + +All Classes and Interfaces + + + + + + + + + + + + + + + +
+ +
+
+
+

All Classes and Interfaces

+
+
+
Interfaces
+
+
Class
+
Description
+ +
 
+
+
+
+
+
+ + diff --git a/doc/allpackages-index.html b/doc/allpackages-index.html new file mode 100644 index 0000000..0e550c5 --- /dev/null +++ b/doc/allpackages-index.html @@ -0,0 +1,64 @@ + + + + +All Packages + + + + + + + + + + + + + + + +
+ +
+
+
+

All Packages

+
+
Package Summary
+
+
Package
+
Description
+ +
 
+
+
+
+
+ + diff --git a/doc/element-list b/doc/element-list new file mode 100644 index 0000000..c5e9df7 --- /dev/null +++ b/doc/element-list @@ -0,0 +1 @@ +main.java.model.file diff --git a/doc/help-doc.html b/doc/help-doc.html new file mode 100644 index 0000000..92d769e --- /dev/null +++ b/doc/help-doc.html @@ -0,0 +1,176 @@ + + + + +API Help + + + + + + + + + + + + + + + +
+ +
+
+

JavaDoc Help

+ +
+
+

Navigation

+Starting from the Overview page, you can browse the documentation using the links in each page, and in the navigation bar at the top of each page. The Index and Search box allow you to navigate to specific declarations and summary pages, including: All Packages, All Classes and Interfaces + +
+
+
+

Kinds of Pages

+The following sections describe the different kinds of pages in this collection. +
+

Package

+

Each package has a page that contains a list of its classes and interfaces, with a summary for each. These pages may contain the following categories:

+
    +
  • Interfaces
  • +
  • Classes
  • +
  • Enum Classes
  • +
  • Exceptions
  • +
  • Errors
  • +
  • Annotation Interfaces
  • +
+
+
+

Class or Interface

+

Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a declaration and description, member summary tables, and detailed member descriptions. Entries in each of these sections are omitted if they are empty or not applicable.

+
    +
  • Class Inheritance Diagram
  • +
  • Direct Subclasses
  • +
  • All Known Subinterfaces
  • +
  • All Known Implementing Classes
  • +
  • Class or Interface Declaration
  • +
  • Class or Interface Description
  • +
+
+
    +
  • Nested Class Summary
  • +
  • Enum Constant Summary
  • +
  • Field Summary
  • +
  • Property Summary
  • +
  • Constructor Summary
  • +
  • Method Summary
  • +
  • Required Element Summary
  • +
  • Optional Element Summary
  • +
+
+
    +
  • Enum Constant Details
  • +
  • Field Details
  • +
  • Property Details
  • +
  • Constructor Details
  • +
  • Method Details
  • +
  • Element Details
  • +
+

Note: Annotation interfaces have required and optional elements, but not methods. Only enum classes have enum constants. The components of a record class are displayed as part of the declaration of the record class. Properties are a feature of JavaFX.

+

The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.

+
+
+

Other Files

+

Packages and modules may contain pages with additional information related to the declarations nearby.

+
+
+

Use

+

Each documented package, class and interface has its own Use page. This page describes what packages, classes, methods, constructors and fields use any part of the given class or package. Given a class or interface A, its Use page includes subclasses of A, fields declared as A, methods that return A, and methods and constructors with parameters of type A. You can access this page by first going to the package, class or interface, then clicking on the USE link in the navigation bar.

+
+
+

Tree (Class Hierarchy)

+

There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. Classes are organized by inheritance structure starting with java.lang.Object. Interfaces do not inherit from java.lang.Object.

+
    +
  • When viewing the Overview page, clicking on TREE displays the hierarchy for all packages.
  • +
  • When viewing a particular package, class or interface page, clicking on TREE displays the hierarchy for only that package.
  • +
+
+
+

All Packages

+

The All Packages page contains an alphabetic index of all packages contained in the documentation.

+
+
+

All Classes and Interfaces

+

The All Classes and Interfaces page contains an alphabetic index of all classes and interfaces contained in the documentation, including annotation interfaces, enum classes, and record classes.

+
+
+

Index

+

The Index contains an alphabetic index of all classes, interfaces, constructors, methods, and fields in the documentation, as well as summary pages such as All Packages, All Classes and Interfaces.

+
+
+
+This help file applies to API documentation generated by the standard doclet.
+
+
+ + diff --git a/doc/index-files/index-1.html b/doc/index-files/index-1.html new file mode 100644 index 0000000..c331c18 --- /dev/null +++ b/doc/index-files/index-1.html @@ -0,0 +1,65 @@ + + + + +D-Index + + + + + + + + + + + + + + + +
+ +
+
+
+

Index

+
+D E F G M S W 
All Classes and Interfaces|All Packages +

D

+
+
deleteLine(String) - Method in interface main.java.model.file.FileStrategy
+
+
It deletes the line that contain as the first data the target setted as parameter.
+
+
+D E F G M S W 
All Classes and Interfaces|All Packages
+
+
+ + diff --git a/doc/index-files/index-2.html b/doc/index-files/index-2.html new file mode 100644 index 0000000..0f3ac0f --- /dev/null +++ b/doc/index-files/index-2.html @@ -0,0 +1,65 @@ + + + + +E-Index + + + + + + + + + + + + + + + +
+ +
+
+
+

Index

+
+D E F G M S W 
All Classes and Interfaces|All Packages +

E

+
+
emptyFile() - Method in interface main.java.model.file.FileStrategy
+
+
It cleans the file.
+
+
+D E F G M S W 
All Classes and Interfaces|All Packages
+
+
+ + diff --git a/doc/index-files/index-3.html b/doc/index-files/index-3.html new file mode 100644 index 0000000..9f1679e --- /dev/null +++ b/doc/index-files/index-3.html @@ -0,0 +1,67 @@ + + + + +F-Index + + + + + + + + + + + + + + + +
+ +
+
+
+

Index

+
+D E F G M S W 
All Classes and Interfaces|All Packages +

F

+
+
fileReader() - Method in interface main.java.model.file.FileStrategy
+
+
Uses a buffer to read each line from file.
+
+
FileStrategy - Interface in main.java.model.file
+
 
+
+D E F G M S W 
All Classes and Interfaces|All Packages
+
+
+ + diff --git a/doc/index-files/index-4.html b/doc/index-files/index-4.html new file mode 100644 index 0000000..b58be70 --- /dev/null +++ b/doc/index-files/index-4.html @@ -0,0 +1,65 @@ + + + + +G-Index + + + + + + + + + + + + + + + +
+ +
+
+
+

Index

+
+D E F G M S W 
All Classes and Interfaces|All Packages +

G

+
+
getAllId() - Method in interface main.java.model.file.FileStrategy
+
+
Calls fileReader() method and from its output it takes all the IDs.
+
+
+D E F G M S W 
All Classes and Interfaces|All Packages
+
+
+ + diff --git a/doc/index-files/index-5.html b/doc/index-files/index-5.html new file mode 100644 index 0000000..f174276 --- /dev/null +++ b/doc/index-files/index-5.html @@ -0,0 +1,63 @@ + + + + +M-Index + + + + + + + + + + + + + + + +
+ +
+
+
+

Index

+
+D E F G M S W 
All Classes and Interfaces|All Packages +

M

+
+
main.java.model.file - package main.java.model.file
+
 
+
+D E F G M S W 
All Classes and Interfaces|All Packages
+
+
+ + diff --git a/doc/index-files/index-6.html b/doc/index-files/index-6.html new file mode 100644 index 0000000..82d340a --- /dev/null +++ b/doc/index-files/index-6.html @@ -0,0 +1,65 @@ + + + + +S-Index + + + + + + + + + + + + + + + +
+ +
+
+
+

Index

+
+D E F G M S W 
All Classes and Interfaces|All Packages +

S

+
+
searchInFile(String) - Method in interface main.java.model.file.FileStrategy
+
+
Search a String target on the first data in each line of the file.
+
+
+D E F G M S W 
All Classes and Interfaces|All Packages
+
+
+ + diff --git a/doc/index-files/index-7.html b/doc/index-files/index-7.html new file mode 100644 index 0000000..72ac635 --- /dev/null +++ b/doc/index-files/index-7.html @@ -0,0 +1,65 @@ + + + + +W-Index + + + + + + + + + + + + + + + +
+ +
+
+
+

Index

+
+D E F G M S W 
All Classes and Interfaces|All Packages +

W

+
+
writeInFile(String) - Method in interface main.java.model.file.FileStrategy
+
+
Uses a buffer to write a new line on file.
+
+
+D E F G M S W 
All Classes and Interfaces|All Packages
+
+
+ + diff --git a/doc/index.html b/doc/index.html new file mode 100644 index 0000000..f046b57 --- /dev/null +++ b/doc/index.html @@ -0,0 +1,26 @@ + + + + +Generated Documentation (Untitled) + + + + + + + + + + + +
+ +

main/java/model/file/package-summary.html

+
+ + diff --git a/doc/jquery-ui.overrides.css b/doc/jquery-ui.overrides.css new file mode 100644 index 0000000..f89acb6 --- /dev/null +++ b/doc/jquery-ui.overrides.css @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +.ui-state-active, +.ui-widget-content .ui-state-active, +.ui-widget-header .ui-state-active, +a.ui-button:active, +.ui-button:active, +.ui-button.ui-state-active:hover { + /* Overrides the color of selection used in jQuery UI */ + background: #F8981D; +} diff --git a/doc/legal/ADDITIONAL_LICENSE_INFO b/doc/legal/ADDITIONAL_LICENSE_INFO new file mode 100644 index 0000000..b62cc3e --- /dev/null +++ b/doc/legal/ADDITIONAL_LICENSE_INFO @@ -0,0 +1 @@ +Please see ..\java.base\ADDITIONAL_LICENSE_INFO diff --git a/doc/legal/ASSEMBLY_EXCEPTION b/doc/legal/ASSEMBLY_EXCEPTION new file mode 100644 index 0000000..0d4cfb4 --- /dev/null +++ b/doc/legal/ASSEMBLY_EXCEPTION @@ -0,0 +1 @@ +Please see ..\java.base\ASSEMBLY_EXCEPTION diff --git a/doc/legal/LICENSE b/doc/legal/LICENSE new file mode 100644 index 0000000..4ad9fe4 --- /dev/null +++ b/doc/legal/LICENSE @@ -0,0 +1 @@ +Please see ..\java.base\LICENSE diff --git a/doc/legal/jquery.md b/doc/legal/jquery.md new file mode 100644 index 0000000..8054a34 --- /dev/null +++ b/doc/legal/jquery.md @@ -0,0 +1,72 @@ +## jQuery v3.5.1 + +### jQuery License +``` +jQuery v 3.5.1 +Copyright JS Foundation and other contributors, https://js.foundation/ + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +****************************************** + +The jQuery JavaScript Library v3.5.1 also includes Sizzle.js + +Sizzle.js includes the following license: + +Copyright JS Foundation and other contributors, https://js.foundation/ + +This software consists of voluntary contributions made by many +individuals. For exact contribution history, see the revision history +available at https://github.com/jquery/sizzle + +The following license applies to all parts of this software except as +documented below: + +==== + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +==== + +All files located in the node_modules and external directories are +externally maintained libraries used by this software which have their +own licenses; we recommend you read them, as their terms may differ from +the terms above. + +********************* + +``` diff --git a/doc/legal/jqueryUI.md b/doc/legal/jqueryUI.md new file mode 100644 index 0000000..8031bdb --- /dev/null +++ b/doc/legal/jqueryUI.md @@ -0,0 +1,49 @@ +## jQuery UI v1.12.1 + +### jQuery UI License +``` +Copyright jQuery Foundation and other contributors, https://jquery.org/ + +This software consists of voluntary contributions made by many +individuals. For exact contribution history, see the revision history +available at https://github.com/jquery/jquery-ui + +The following license applies to all parts of this software except as +documented below: + +==== + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +==== + +Copyright and related rights for sample code are waived via CC0. Sample +code is defined as all source code contained within the demos directory. + +CC0: http://creativecommons.org/publicdomain/zero/1.0/ + +==== + +All files located in the node_modules and external directories are +externally maintained libraries used by this software which have their +own licenses; we recommend you read them, as their terms may differ from +the terms above. + +``` diff --git a/doc/main/java/model/file/FileInvoiceImpl.html b/doc/main/java/model/file/FileInvoiceImpl.html new file mode 100644 index 0000000..9924ccb --- /dev/null +++ b/doc/main/java/model/file/FileInvoiceImpl.html @@ -0,0 +1,266 @@ + + + + +FileInvoiceImpl + + + + + + + + + + + + + + + +
+ +
+
+ +
+ +

Class FileInvoiceImpl

+
+
java.lang.Object +
main.java.model.file.FileInvoiceImpl
+
+
+
+
All Implemented Interfaces:
+
main.java.model.file.FileStrategy
+
+
+
public class FileInvoiceImpl +extends Object +implements main.java.model.file.FileStrategy
+
+
+
    + +
  • +
    +

    Constructor Summary

    +
    Constructors
    +
    +
    Constructor
    +
    Description
    + +
     
    +
    +
    +
  • + +
  • +
    +

    Method Summary

    +
    +
    +
    +
    +
    Modifier and Type
    +
    Method
    +
    Description
    +
    boolean
    + +
    +
    It deletes the line that contain as the first data the target setted as parameter.
    +
    +
    boolean
    + +
    +
    It cleans the file.
    +
    + + +
    +
    Uses a buffer to read each line from file and return them as a Set of String.
    +
    + + +
    +
    Calls fileReader() method and from its output it takes all the IDs.
    +
    + + +
    +
    Search a String target on the first data in each line of the file.
    +
    +
    boolean
    +
    writeInFile(String objectToString)
    +
    +
    Uses a buffer to write a new line on file.
    +
    +
    +
    +
    +
    +

    Methods inherited from class java.lang.Object

    +equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    +
    +
  • +
+
+
+
    + +
  • +
    +

    Constructor Details

    +
      +
    • +
      +

      FileInvoiceImpl

      +
      public FileInvoiceImpl()
      +
      +
    • +
    +
    +
  • + +
  • +
    +

    Method Details

    +
      +
    • +
      +

      fileReader

      +
      public Set<String> fileReader()
      +
      Description copied from interface: main.java.model.file.FileStrategy
      +
      Uses a buffer to read each line from file and return them as a Set of String.
      +
      +
      Specified by:
      +
      fileReader in interface main.java.model.file.FileStrategy
      +
      Returns:
      +
      +
      +
    • +
    • +
      +

      writeInFile

      +
      public boolean writeInFile(String objectToString)
      +
      Description copied from interface: main.java.model.file.FileStrategy
      +
      Uses a buffer to write a new line on file.
      +
      +
      Specified by:
      +
      writeInFile in interface main.java.model.file.FileStrategy
      +
      Returns:
      +
      false is something went wrong
      +
      +
      +
    • +
    • +
      +

      searchInFile

      +
      public String searchInFile(String target)
      +
      Description copied from interface: main.java.model.file.FileStrategy
      +
      Search a String target on the first data in each line of the file.
      +
      +
      Specified by:
      +
      searchInFile in interface main.java.model.file.FileStrategy
      +
      Returns:
      +
      the complete line who contains the target inside the first information.
      +
      +
      +
    • +
    • +
      +

      deleteLine

      +
      public boolean deleteLine(String target)
      +
      Description copied from interface: main.java.model.file.FileStrategy
      +
      It deletes the line that contain as the first data the target setted as parameter.
      +
      +
      Specified by:
      +
      deleteLine in interface main.java.model.file.FileStrategy
      +
      Returns:
      +
      false if something went wrong
      +
      +
      +
    • +
    • +
      +

      emptyFile

      +
      public boolean emptyFile()
      +
      Description copied from interface: main.java.model.file.FileStrategy
      +
      It cleans the file.
      +
      +
      Specified by:
      +
      emptyFile in interface main.java.model.file.FileStrategy
      +
      Returns:
      +
      +
      +
    • +
    • +
      +

      getAllId

      +
      public Set<String> getAllId()
      +
      Description copied from interface: main.java.model.file.FileStrategy
      +
      Calls fileReader() method and from its output it takes all the IDs.
      +
      +
      Specified by:
      +
      getAllId in interface main.java.model.file.FileStrategy
      +
      Returns:
      +
      a Set of String containing the IDs
      +
      +
      +
    • +
    +
    +
  • +
+
+ +
+
+
+ + diff --git a/doc/main/java/model/file/FileItemImpl.html b/doc/main/java/model/file/FileItemImpl.html new file mode 100644 index 0000000..7008eab --- /dev/null +++ b/doc/main/java/model/file/FileItemImpl.html @@ -0,0 +1,274 @@ + + + + +FileItemImpl + + + + + + + + + + + + + + + +
+ +
+
+ +
+ +

Class FileItemImpl

+
+
java.lang.Object +
main.java.model.file.FileItemImpl
+
+
+
+
All Implemented Interfaces:
+
main.java.model.file.FileStrategy
+
+
+
public class FileItemImpl +extends Object +implements main.java.model.file.FileStrategy
+
+
+
    + +
  • +
    +

    Constructor Summary

    +
    Constructors
    +
    +
    Constructor
    +
    Description
    + +
     
    +
    +
    +
  • + +
  • +
    +

    Method Summary

    +
    +
    +
    +
    +
    Modifier and Type
    +
    Method
    +
    Description
    +
    boolean
    + +
    +
    It deletes the line that contain as the first data the target setted as parameter.
    +
    +
    boolean
    + +
    +
    It cleans the file.
    +
    + + +
    +
    Uses a buffer to read each line from file.
    +
    + + +
    +
    Calls fileReader() method and from its output it takes all the IDs.
    +
    + + +
    +
    Search a String target on the first data in each line of the file.
    +
    +
    boolean
    +
    writeInFile(String objectToString)
    +
    +
    Uses a buffer to write a new line on file.
    +
    +
    +
    +
    +
    +

    Methods inherited from class java.lang.Object

    +equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    +
    +
  • +
+
+
+
    + +
  • +
    +

    Constructor Details

    +
      +
    • +
      +

      FileItemImpl

      +
      public FileItemImpl()
      +
      +
    • +
    +
    +
  • + +
  • +
    +

    Method Details

    +
      +
    • +
      +

      fileReader

      +
      public Set<String> fileReader()
      +
      Description copied from interface: main.java.model.file.FileStrategy
      +
      Uses a buffer to read each line from file.
      +
      +
      Specified by:
      +
      fileReader in interface main.java.model.file.FileStrategy
      +
      Returns:
      +
      return each line read as a Set of String
      +
      +
      +
    • +
    • +
      +

      writeInFile

      +
      public boolean writeInFile(String objectToString)
      +
      Description copied from interface: main.java.model.file.FileStrategy
      +
      Uses a buffer to write a new line on file.
      +
      +
      Specified by:
      +
      writeInFile in interface main.java.model.file.FileStrategy
      +
      Parameters:
      +
      objectToString - to write
      +
      Returns:
      +
      false is something went wrong
      +
      +
      +
    • +
    • +
      +

      searchInFile

      +
      public String searchInFile(String target)
      +
      Description copied from interface: main.java.model.file.FileStrategy
      +
      Search a String target on the first data in each line of the file.
      +
      +
      Specified by:
      +
      searchInFile in interface main.java.model.file.FileStrategy
      +
      Parameters:
      +
      target - to look for
      +
      Returns:
      +
      the complete line who contains the target inside the first information.
      +
      +
      +
    • +
    • +
      +

      deleteLine

      +
      public boolean deleteLine(String target)
      +
      Description copied from interface: main.java.model.file.FileStrategy
      +
      It deletes the line that contain as the first data the target setted as parameter.
      +
      +
      Specified by:
      +
      deleteLine in interface main.java.model.file.FileStrategy
      +
      Parameters:
      +
      target - to delete
      +
      Returns:
      +
      false if something went wrong
      +
      +
      +
    • +
    • +
      +

      emptyFile

      +
      public boolean emptyFile()
      +
      Description copied from interface: main.java.model.file.FileStrategy
      +
      It cleans the file.
      +
      +
      Specified by:
      +
      emptyFile in interface main.java.model.file.FileStrategy
      +
      Returns:
      +
      false if something went wrong
      +
      +
      +
    • +
    • +
      +

      getAllId

      +
      public Set<String> getAllId()
      +
      Description copied from interface: main.java.model.file.FileStrategy
      +
      Calls fileReader() method and from its output it takes all the IDs.
      +
      +
      Specified by:
      +
      getAllId in interface main.java.model.file.FileStrategy
      +
      Returns:
      +
      a Set of String containing the IDs
      +
      +
      +
    • +
    +
    +
  • +
+
+ +
+
+
+ + diff --git a/doc/main/java/model/file/FileStrategy.html b/doc/main/java/model/file/FileStrategy.html new file mode 100644 index 0000000..903236e --- /dev/null +++ b/doc/main/java/model/file/FileStrategy.html @@ -0,0 +1,218 @@ + + + + +FileStrategy + + + + + + + + + + + + + + + +
+ +
+
+ +
+ +

Interface FileStrategy

+
+
+
+
public interface FileStrategy
+
+
+
    + +
  • +
    +

    Method Summary

    +
    +
    +
    +
    +
    Modifier and Type
    +
    Method
    +
    Description
    +
    boolean
    + +
    +
    It deletes the line that contain as the first data the target setted as parameter.
    +
    +
    boolean
    + +
    +
    It cleans the file.
    +
    + + +
    +
    Uses a buffer to read each line from file.
    +
    + + +
    +
    Calls fileReader() method and from its output it takes all the IDs.
    +
    + + +
    +
    Search a String target on the first data in each line of the file.
    +
    +
    boolean
    +
    writeInFile(String objectToString)
    +
    +
    Uses a buffer to write a new line on file.
    +
    +
    +
    +
    +
    +
  • +
+
+
+
    + +
  • +
    +

    Method Details

    +
      +
    • +
      +

      fileReader

      +
      Set<String> fileReader()
      +
      Uses a buffer to read each line from file.
      +
      +
      Returns:
      +
      return each line read as a Set of String
      +
      +
      +
    • +
    • +
      +

      writeInFile

      +
      boolean writeInFile(String objectToString)
      +
      Uses a buffer to write a new line on file.
      +
      +
      Parameters:
      +
      objectToString - to write
      +
      Returns:
      +
      false is something went wrong
      +
      +
      +
    • +
    • +
      +

      searchInFile

      +
      String searchInFile(String target)
      +
      Search a String target on the first data in each line of the file.
      +
      +
      Parameters:
      +
      target - to look for
      +
      Returns:
      +
      the complete line who contains the target inside the first information.
      +
      +
      +
    • +
    • +
      +

      deleteLine

      +
      boolean deleteLine(String target)
      +
      It deletes the line that contain as the first data the target setted as parameter.
      +
      +
      Parameters:
      +
      target - to delete
      +
      Returns:
      +
      false if something went wrong
      +
      +
      +
    • +
    • +
      +

      emptyFile

      +
      boolean emptyFile()
      +
      It cleans the file.
      +
      +
      Returns:
      +
      false if something went wrong
      +
      +
      +
    • +
    • +
      +

      getAllId

      +
      Set<String> getAllId()
      +
      Calls fileReader() method and from its output it takes all the IDs. + fileReader()
      +
      +
      Returns:
      +
      a Set of String containing the IDs
      +
      +
      +
    • +
    +
    +
  • +
+
+ +
+
+
+ + diff --git a/doc/main/java/model/file/class-use/FileInvoiceImpl.html b/doc/main/java/model/file/class-use/FileInvoiceImpl.html new file mode 100644 index 0000000..05a9341 --- /dev/null +++ b/doc/main/java/model/file/class-use/FileInvoiceImpl.html @@ -0,0 +1,57 @@ + + + + +Uses of Class main.java.model.file.FileInvoiceImpl + + + + + + + + + + + + + + + +
+ +
+
+
+

Uses of Class
main.java.model.file.FileInvoiceImpl

+
+No usage of main.java.model.file.FileInvoiceImpl
+
+
+ + diff --git a/doc/main/java/model/file/class-use/FileItemImpl.html b/doc/main/java/model/file/class-use/FileItemImpl.html new file mode 100644 index 0000000..d3e0db3 --- /dev/null +++ b/doc/main/java/model/file/class-use/FileItemImpl.html @@ -0,0 +1,57 @@ + + + + +Uses of Class main.java.model.file.FileItemImpl + + + + + + + + + + + + + + + +
+ +
+
+
+

Uses of Class
main.java.model.file.FileItemImpl

+
+No usage of main.java.model.file.FileItemImpl
+
+
+ + diff --git a/doc/main/java/model/file/class-use/FileStrategy.html b/doc/main/java/model/file/class-use/FileStrategy.html new file mode 100644 index 0000000..17d6466 --- /dev/null +++ b/doc/main/java/model/file/class-use/FileStrategy.html @@ -0,0 +1,57 @@ + + + + +Uses of Interface main.java.model.file.FileStrategy + + + + + + + + + + + + + + + +
+ +
+
+
+

Uses of Interface
main.java.model.file.FileStrategy

+
+No usage of main.java.model.file.FileStrategy
+
+
+ + diff --git a/doc/main/java/model/file/package-summary.html b/doc/main/java/model/file/package-summary.html new file mode 100644 index 0000000..9bf78bb --- /dev/null +++ b/doc/main/java/model/file/package-summary.html @@ -0,0 +1,82 @@ + + + + +main.java.model.file + + + + + + + + + + + + + + + +
+ +
+
+
+

Package main.java.model.file

+
+
+
package main.java.model.file
+
+
    +
  • +
    +
    Interfaces
    +
    +
    Class
    +
    Description
    + +
     
    +
    +
    +
  • +
+
+
+
+
+ + diff --git a/doc/main/java/model/file/package-tree.html b/doc/main/java/model/file/package-tree.html new file mode 100644 index 0000000..53c6817 --- /dev/null +++ b/doc/main/java/model/file/package-tree.html @@ -0,0 +1,63 @@ + + + + +main.java.model.file Class Hierarchy + + + + + + + + + + + + + + + +
+ +
+
+
+

Hierarchy For Package main.java.model.file

+
+
+

Interface Hierarchy

+ +
+
+
+
+ + diff --git a/doc/main/java/model/file/package-use.html b/doc/main/java/model/file/package-use.html new file mode 100644 index 0000000..fd650fa --- /dev/null +++ b/doc/main/java/model/file/package-use.html @@ -0,0 +1,57 @@ + + + + +Uses of Package main.java.model.file + + + + + + + + + + + + + + + +
+ +
+
+
+

Uses of Package
main.java.model.file

+
+No usage of main.java.model.file
+
+
+ + diff --git a/doc/member-search-index.js b/doc/member-search-index.js new file mode 100644 index 0000000..7c5f179 --- /dev/null +++ b/doc/member-search-index.js @@ -0,0 +1 @@ +memberSearchIndex = [{"p":"main.java.model.file","c":"FileStrategy","l":"deleteLine(String)","u":"deleteLine(java.lang.String)"},{"p":"main.java.model.file","c":"FileStrategy","l":"emptyFile()"},{"p":"main.java.model.file","c":"FileStrategy","l":"fileReader()"},{"p":"main.java.model.file","c":"FileStrategy","l":"getAllId()"},{"p":"main.java.model.file","c":"FileStrategy","l":"searchInFile(String)","u":"searchInFile(java.lang.String)"},{"p":"main.java.model.file","c":"FileStrategy","l":"writeInFile(String)","u":"writeInFile(java.lang.String)"}];updateSearchResults(); \ No newline at end of file diff --git a/doc/module-search-index.js b/doc/module-search-index.js new file mode 100644 index 0000000..0d59754 --- /dev/null +++ b/doc/module-search-index.js @@ -0,0 +1 @@ +moduleSearchIndex = [];updateSearchResults(); \ No newline at end of file diff --git a/doc/overview-tree.html b/doc/overview-tree.html new file mode 100644 index 0000000..c4f3aec --- /dev/null +++ b/doc/overview-tree.html @@ -0,0 +1,67 @@ + + + + +Class Hierarchy + + + + + + + + + + + + + + + +
+ +
+
+
+

Hierarchy For All Packages

+Package Hierarchies: + +
+
+

Interface Hierarchy

+ +
+
+
+
+ + diff --git a/doc/package-search-index.js b/doc/package-search-index.js new file mode 100644 index 0000000..59fba7e --- /dev/null +++ b/doc/package-search-index.js @@ -0,0 +1 @@ +packageSearchIndex = [{"l":"All Packages","u":"allpackages-index.html"},{"l":"main.java.model.file"}];updateSearchResults(); \ No newline at end of file diff --git a/doc/resources/glass.png b/doc/resources/glass.png new file mode 100644 index 0000000..a7f591f Binary files /dev/null and b/doc/resources/glass.png differ diff --git a/doc/resources/x.png b/doc/resources/x.png new file mode 100644 index 0000000..30548a7 Binary files /dev/null and b/doc/resources/x.png differ diff --git a/doc/script-dir/images/ui-bg_glass_55_fbf9ee_1x400.png b/doc/script-dir/images/ui-bg_glass_55_fbf9ee_1x400.png new file mode 100644 index 0000000..34abd18 Binary files /dev/null and b/doc/script-dir/images/ui-bg_glass_55_fbf9ee_1x400.png differ diff --git a/doc/script-dir/images/ui-bg_glass_65_dadada_1x400.png b/doc/script-dir/images/ui-bg_glass_65_dadada_1x400.png new file mode 100644 index 0000000..f058a93 Binary files /dev/null and b/doc/script-dir/images/ui-bg_glass_65_dadada_1x400.png differ diff --git a/doc/script-dir/images/ui-bg_glass_75_dadada_1x400.png b/doc/script-dir/images/ui-bg_glass_75_dadada_1x400.png new file mode 100644 index 0000000..2ce04c1 Binary files /dev/null and b/doc/script-dir/images/ui-bg_glass_75_dadada_1x400.png differ diff --git a/doc/script-dir/images/ui-bg_glass_75_e6e6e6_1x400.png b/doc/script-dir/images/ui-bg_glass_75_e6e6e6_1x400.png new file mode 100644 index 0000000..a90afb8 Binary files /dev/null and b/doc/script-dir/images/ui-bg_glass_75_e6e6e6_1x400.png differ diff --git a/doc/script-dir/images/ui-bg_glass_95_fef1ec_1x400.png b/doc/script-dir/images/ui-bg_glass_95_fef1ec_1x400.png new file mode 100644 index 0000000..dbe091f Binary files /dev/null and b/doc/script-dir/images/ui-bg_glass_95_fef1ec_1x400.png differ diff --git a/doc/script-dir/images/ui-bg_highlight-soft_75_cccccc_1x100.png b/doc/script-dir/images/ui-bg_highlight-soft_75_cccccc_1x100.png new file mode 100644 index 0000000..5dc3593 Binary files /dev/null and b/doc/script-dir/images/ui-bg_highlight-soft_75_cccccc_1x100.png differ diff --git a/doc/script-dir/images/ui-icons_222222_256x240.png b/doc/script-dir/images/ui-icons_222222_256x240.png new file mode 100644 index 0000000..e723e17 Binary files /dev/null and b/doc/script-dir/images/ui-icons_222222_256x240.png differ diff --git a/doc/script-dir/images/ui-icons_2e83ff_256x240.png b/doc/script-dir/images/ui-icons_2e83ff_256x240.png new file mode 100644 index 0000000..1f5f497 Binary files /dev/null and b/doc/script-dir/images/ui-icons_2e83ff_256x240.png differ diff --git a/doc/script-dir/images/ui-icons_454545_256x240.png b/doc/script-dir/images/ui-icons_454545_256x240.png new file mode 100644 index 0000000..618f5b0 Binary files /dev/null and b/doc/script-dir/images/ui-icons_454545_256x240.png differ diff --git a/doc/script-dir/images/ui-icons_888888_256x240.png b/doc/script-dir/images/ui-icons_888888_256x240.png new file mode 100644 index 0000000..ee5e33f Binary files /dev/null and b/doc/script-dir/images/ui-icons_888888_256x240.png differ diff --git a/doc/script-dir/images/ui-icons_cd0a0a_256x240.png b/doc/script-dir/images/ui-icons_cd0a0a_256x240.png new file mode 100644 index 0000000..7e8ebc1 Binary files /dev/null and b/doc/script-dir/images/ui-icons_cd0a0a_256x240.png differ diff --git a/doc/script-dir/jquery-3.5.1.min.js b/doc/script-dir/jquery-3.5.1.min.js new file mode 100644 index 0000000..b061403 --- /dev/null +++ b/doc/script-dir/jquery-3.5.1.min.js @@ -0,0 +1,2 @@ +/*! jQuery v3.5.1 | (c) JS Foundation and other contributors | jquery.org/license */ +!function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(C,e){"use strict";var t=[],r=Object.getPrototypeOf,s=t.slice,g=t.flat?function(e){return t.flat.call(e)}:function(e){return t.concat.apply([],e)},u=t.push,i=t.indexOf,n={},o=n.toString,v=n.hasOwnProperty,a=v.toString,l=a.call(Object),y={},m=function(e){return"function"==typeof e&&"number"!=typeof e.nodeType},x=function(e){return null!=e&&e===e.window},E=C.document,c={type:!0,src:!0,nonce:!0,noModule:!0};function b(e,t,n){var r,i,o=(n=n||E).createElement("script");if(o.text=e,t)for(r in c)(i=t[r]||t.getAttribute&&t.getAttribute(r))&&o.setAttribute(r,i);n.head.appendChild(o).parentNode.removeChild(o)}function w(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?n[o.call(e)]||"object":typeof e}var f="3.5.1",S=function(e,t){return new S.fn.init(e,t)};function p(e){var t=!!e&&"length"in e&&e.length,n=w(e);return!m(e)&&!x(e)&&("array"===n||0===t||"number"==typeof t&&0+~]|"+M+")"+M+"*"),U=new RegExp(M+"|>"),X=new RegExp(F),V=new RegExp("^"+I+"$"),G={ID:new RegExp("^#("+I+")"),CLASS:new RegExp("^\\.("+I+")"),TAG:new RegExp("^("+I+"|[*])"),ATTR:new RegExp("^"+W),PSEUDO:new RegExp("^"+F),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+R+")$","i"),needsContext:new RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},Y=/HTML$/i,Q=/^(?:input|select|textarea|button)$/i,J=/^h\d$/i,K=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ee=/[+~]/,te=new RegExp("\\\\[\\da-fA-F]{1,6}"+M+"?|\\\\([^\\r\\n\\f])","g"),ne=function(e,t){var n="0x"+e.slice(1)-65536;return t||(n<0?String.fromCharCode(n+65536):String.fromCharCode(n>>10|55296,1023&n|56320))},re=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,ie=function(e,t){return t?"\0"===e?"\ufffd":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e},oe=function(){T()},ae=be(function(e){return!0===e.disabled&&"fieldset"===e.nodeName.toLowerCase()},{dir:"parentNode",next:"legend"});try{H.apply(t=O.call(p.childNodes),p.childNodes),t[p.childNodes.length].nodeType}catch(e){H={apply:t.length?function(e,t){L.apply(e,O.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1}}}function se(t,e,n,r){var i,o,a,s,u,l,c,f=e&&e.ownerDocument,p=e?e.nodeType:9;if(n=n||[],"string"!=typeof t||!t||1!==p&&9!==p&&11!==p)return n;if(!r&&(T(e),e=e||C,E)){if(11!==p&&(u=Z.exec(t)))if(i=u[1]){if(9===p){if(!(a=e.getElementById(i)))return n;if(a.id===i)return n.push(a),n}else if(f&&(a=f.getElementById(i))&&y(e,a)&&a.id===i)return n.push(a),n}else{if(u[2])return H.apply(n,e.getElementsByTagName(t)),n;if((i=u[3])&&d.getElementsByClassName&&e.getElementsByClassName)return H.apply(n,e.getElementsByClassName(i)),n}if(d.qsa&&!N[t+" "]&&(!v||!v.test(t))&&(1!==p||"object"!==e.nodeName.toLowerCase())){if(c=t,f=e,1===p&&(U.test(t)||z.test(t))){(f=ee.test(t)&&ye(e.parentNode)||e)===e&&d.scope||((s=e.getAttribute("id"))?s=s.replace(re,ie):e.setAttribute("id",s=S)),o=(l=h(t)).length;while(o--)l[o]=(s?"#"+s:":scope")+" "+xe(l[o]);c=l.join(",")}try{return H.apply(n,f.querySelectorAll(c)),n}catch(e){N(t,!0)}finally{s===S&&e.removeAttribute("id")}}}return g(t.replace($,"$1"),e,n,r)}function ue(){var r=[];return function e(t,n){return r.push(t+" ")>b.cacheLength&&delete e[r.shift()],e[t+" "]=n}}function le(e){return e[S]=!0,e}function ce(e){var t=C.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function fe(e,t){var n=e.split("|"),r=n.length;while(r--)b.attrHandle[n[r]]=t}function pe(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&e.sourceIndex-t.sourceIndex;if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function de(t){return function(e){return"input"===e.nodeName.toLowerCase()&&e.type===t}}function he(n){return function(e){var t=e.nodeName.toLowerCase();return("input"===t||"button"===t)&&e.type===n}}function ge(t){return function(e){return"form"in e?e.parentNode&&!1===e.disabled?"label"in e?"label"in e.parentNode?e.parentNode.disabled===t:e.disabled===t:e.isDisabled===t||e.isDisabled!==!t&&ae(e)===t:e.disabled===t:"label"in e&&e.disabled===t}}function ve(a){return le(function(o){return o=+o,le(function(e,t){var n,r=a([],e.length,o),i=r.length;while(i--)e[n=r[i]]&&(e[n]=!(t[n]=e[n]))})})}function ye(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}for(e in d=se.support={},i=se.isXML=function(e){var t=e.namespaceURI,n=(e.ownerDocument||e).documentElement;return!Y.test(t||n&&n.nodeName||"HTML")},T=se.setDocument=function(e){var t,n,r=e?e.ownerDocument||e:p;return r!=C&&9===r.nodeType&&r.documentElement&&(a=(C=r).documentElement,E=!i(C),p!=C&&(n=C.defaultView)&&n.top!==n&&(n.addEventListener?n.addEventListener("unload",oe,!1):n.attachEvent&&n.attachEvent("onunload",oe)),d.scope=ce(function(e){return a.appendChild(e).appendChild(C.createElement("div")),"undefined"!=typeof e.querySelectorAll&&!e.querySelectorAll(":scope fieldset div").length}),d.attributes=ce(function(e){return e.className="i",!e.getAttribute("className")}),d.getElementsByTagName=ce(function(e){return e.appendChild(C.createComment("")),!e.getElementsByTagName("*").length}),d.getElementsByClassName=K.test(C.getElementsByClassName),d.getById=ce(function(e){return a.appendChild(e).id=S,!C.getElementsByName||!C.getElementsByName(S).length}),d.getById?(b.filter.ID=function(e){var t=e.replace(te,ne);return function(e){return e.getAttribute("id")===t}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&E){var n=t.getElementById(e);return n?[n]:[]}}):(b.filter.ID=function(e){var n=e.replace(te,ne);return function(e){var t="undefined"!=typeof e.getAttributeNode&&e.getAttributeNode("id");return t&&t.value===n}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&E){var n,r,i,o=t.getElementById(e);if(o){if((n=o.getAttributeNode("id"))&&n.value===e)return[o];i=t.getElementsByName(e),r=0;while(o=i[r++])if((n=o.getAttributeNode("id"))&&n.value===e)return[o]}return[]}}),b.find.TAG=d.getElementsByTagName?function(e,t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):d.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},b.find.CLASS=d.getElementsByClassName&&function(e,t){if("undefined"!=typeof t.getElementsByClassName&&E)return t.getElementsByClassName(e)},s=[],v=[],(d.qsa=K.test(C.querySelectorAll))&&(ce(function(e){var t;a.appendChild(e).innerHTML="",e.querySelectorAll("[msallowcapture^='']").length&&v.push("[*^$]="+M+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||v.push("\\["+M+"*(?:value|"+R+")"),e.querySelectorAll("[id~="+S+"-]").length||v.push("~="),(t=C.createElement("input")).setAttribute("name",""),e.appendChild(t),e.querySelectorAll("[name='']").length||v.push("\\["+M+"*name"+M+"*="+M+"*(?:''|\"\")"),e.querySelectorAll(":checked").length||v.push(":checked"),e.querySelectorAll("a#"+S+"+*").length||v.push(".#.+[+~]"),e.querySelectorAll("\\\f"),v.push("[\\r\\n\\f]")}),ce(function(e){e.innerHTML="";var t=C.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&v.push("name"+M+"*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&v.push(":enabled",":disabled"),a.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&v.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),v.push(",.*:")})),(d.matchesSelector=K.test(c=a.matches||a.webkitMatchesSelector||a.mozMatchesSelector||a.oMatchesSelector||a.msMatchesSelector))&&ce(function(e){d.disconnectedMatch=c.call(e,"*"),c.call(e,"[s!='']:x"),s.push("!=",F)}),v=v.length&&new RegExp(v.join("|")),s=s.length&&new RegExp(s.join("|")),t=K.test(a.compareDocumentPosition),y=t||K.test(a.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},D=t?function(e,t){if(e===t)return l=!0,0;var n=!e.compareDocumentPosition-!t.compareDocumentPosition;return n||(1&(n=(e.ownerDocument||e)==(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!d.sortDetached&&t.compareDocumentPosition(e)===n?e==C||e.ownerDocument==p&&y(p,e)?-1:t==C||t.ownerDocument==p&&y(p,t)?1:u?P(u,e)-P(u,t):0:4&n?-1:1)}:function(e,t){if(e===t)return l=!0,0;var n,r=0,i=e.parentNode,o=t.parentNode,a=[e],s=[t];if(!i||!o)return e==C?-1:t==C?1:i?-1:o?1:u?P(u,e)-P(u,t):0;if(i===o)return pe(e,t);n=e;while(n=n.parentNode)a.unshift(n);n=t;while(n=n.parentNode)s.unshift(n);while(a[r]===s[r])r++;return r?pe(a[r],s[r]):a[r]==p?-1:s[r]==p?1:0}),C},se.matches=function(e,t){return se(e,null,null,t)},se.matchesSelector=function(e,t){if(T(e),d.matchesSelector&&E&&!N[t+" "]&&(!s||!s.test(t))&&(!v||!v.test(t)))try{var n=c.call(e,t);if(n||d.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(e){N(t,!0)}return 0":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(te,ne),e[3]=(e[3]||e[4]||e[5]||"").replace(te,ne),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||se.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&se.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return G.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&X.test(n)&&(t=h(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(te,ne).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=m[e+" "];return t||(t=new RegExp("(^|"+M+")"+e+"("+M+"|$)"))&&m(e,function(e){return t.test("string"==typeof e.className&&e.className||"undefined"!=typeof e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(n,r,i){return function(e){var t=se.attr(e,n);return null==t?"!="===r:!r||(t+="","="===r?t===i:"!="===r?t!==i:"^="===r?i&&0===t.indexOf(i):"*="===r?i&&-1:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function D(e,n,r){return m(n)?S.grep(e,function(e,t){return!!n.call(e,t,e)!==r}):n.nodeType?S.grep(e,function(e){return e===n!==r}):"string"!=typeof n?S.grep(e,function(e){return-1)[^>]*|#([\w-]+))$/;(S.fn.init=function(e,t,n){var r,i;if(!e)return this;if(n=n||j,"string"==typeof e){if(!(r="<"===e[0]&&">"===e[e.length-1]&&3<=e.length?[null,e,null]:q.exec(e))||!r[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(r[1]){if(t=t instanceof S?t[0]:t,S.merge(this,S.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:E,!0)),N.test(r[1])&&S.isPlainObject(t))for(r in t)m(this[r])?this[r](t[r]):this.attr(r,t[r]);return this}return(i=E.getElementById(r[2]))&&(this[0]=i,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):m(e)?void 0!==n.ready?n.ready(e):e(S):S.makeArray(e,this)}).prototype=S.fn,j=S(E);var L=/^(?:parents|prev(?:Until|All))/,H={children:!0,contents:!0,next:!0,prev:!0};function O(e,t){while((e=e[t])&&1!==e.nodeType);return e}S.fn.extend({has:function(e){var t=S(e,this),n=t.length;return this.filter(function(){for(var e=0;e\x20\t\r\n\f]*)/i,he=/^$|^module$|\/(?:java|ecma)script/i;ce=E.createDocumentFragment().appendChild(E.createElement("div")),(fe=E.createElement("input")).setAttribute("type","radio"),fe.setAttribute("checked","checked"),fe.setAttribute("name","t"),ce.appendChild(fe),y.checkClone=ce.cloneNode(!0).cloneNode(!0).lastChild.checked,ce.innerHTML="",y.noCloneChecked=!!ce.cloneNode(!0).lastChild.defaultValue,ce.innerHTML="",y.option=!!ce.lastChild;var ge={thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};function ve(e,t){var n;return n="undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName(t||"*"):"undefined"!=typeof e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&A(e,t)?S.merge([e],n):n}function ye(e,t){for(var n=0,r=e.length;n",""]);var me=/<|&#?\w+;/;function xe(e,t,n,r,i){for(var o,a,s,u,l,c,f=t.createDocumentFragment(),p=[],d=0,h=e.length;d\s*$/g;function qe(e,t){return A(e,"table")&&A(11!==t.nodeType?t:t.firstChild,"tr")&&S(e).children("tbody")[0]||e}function Le(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function He(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function Oe(e,t){var n,r,i,o,a,s;if(1===t.nodeType){if(Y.hasData(e)&&(s=Y.get(e).events))for(i in Y.remove(t,"handle events"),s)for(n=0,r=s[i].length;n").attr(n.scriptAttrs||{}).prop({charset:n.scriptCharset,src:n.url}).on("load error",i=function(e){r.remove(),i=null,e&&t("error"===e.type?404:200,e.type)}),E.head.appendChild(r[0])},abort:function(){i&&i()}}});var Ut,Xt=[],Vt=/(=)\?(?=&|$)|\?\?/;S.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Xt.pop()||S.expando+"_"+Ct.guid++;return this[e]=!0,e}}),S.ajaxPrefilter("json jsonp",function(e,t,n){var r,i,o,a=!1!==e.jsonp&&(Vt.test(e.url)?"url":"string"==typeof e.data&&0===(e.contentType||"").indexOf("application/x-www-form-urlencoded")&&Vt.test(e.data)&&"data");if(a||"jsonp"===e.dataTypes[0])return r=e.jsonpCallback=m(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,a?e[a]=e[a].replace(Vt,"$1"+r):!1!==e.jsonp&&(e.url+=(Et.test(e.url)?"&":"?")+e.jsonp+"="+r),e.converters["script json"]=function(){return o||S.error(r+" was not called"),o[0]},e.dataTypes[0]="json",i=C[r],C[r]=function(){o=arguments},n.always(function(){void 0===i?S(C).removeProp(r):C[r]=i,e[r]&&(e.jsonpCallback=t.jsonpCallback,Xt.push(r)),o&&m(i)&&i(o[0]),o=i=void 0}),"script"}),y.createHTMLDocument=((Ut=E.implementation.createHTMLDocument("").body).innerHTML="
",2===Ut.childNodes.length),S.parseHTML=function(e,t,n){return"string"!=typeof e?[]:("boolean"==typeof t&&(n=t,t=!1),t||(y.createHTMLDocument?((r=(t=E.implementation.createHTMLDocument("")).createElement("base")).href=E.location.href,t.head.appendChild(r)):t=E),o=!n&&[],(i=N.exec(e))?[t.createElement(i[1])]:(i=xe([e],t,o),o&&o.length&&S(o).remove(),S.merge([],i.childNodes)));var r,i,o},S.fn.load=function(e,t,n){var r,i,o,a=this,s=e.indexOf(" ");return-1").append(S.parseHTML(e)).find(r):e)}).always(n&&function(e,t){a.each(function(){n.apply(this,o||[e.responseText,t,e])})}),this},S.expr.pseudos.animated=function(t){return S.grep(S.timers,function(e){return t===e.elem}).length},S.offset={setOffset:function(e,t,n){var r,i,o,a,s,u,l=S.css(e,"position"),c=S(e),f={};"static"===l&&(e.style.position="relative"),s=c.offset(),o=S.css(e,"top"),u=S.css(e,"left"),("absolute"===l||"fixed"===l)&&-1<(o+u).indexOf("auto")?(a=(r=c.position()).top,i=r.left):(a=parseFloat(o)||0,i=parseFloat(u)||0),m(t)&&(t=t.call(e,n,S.extend({},s))),null!=t.top&&(f.top=t.top-s.top+a),null!=t.left&&(f.left=t.left-s.left+i),"using"in t?t.using.call(e,f):("number"==typeof f.top&&(f.top+="px"),"number"==typeof f.left&&(f.left+="px"),c.css(f))}},S.fn.extend({offset:function(t){if(arguments.length)return void 0===t?this:this.each(function(e){S.offset.setOffset(this,t,e)});var e,n,r=this[0];return r?r.getClientRects().length?(e=r.getBoundingClientRect(),n=r.ownerDocument.defaultView,{top:e.top+n.pageYOffset,left:e.left+n.pageXOffset}):{top:0,left:0}:void 0},position:function(){if(this[0]){var e,t,n,r=this[0],i={top:0,left:0};if("fixed"===S.css(r,"position"))t=r.getBoundingClientRect();else{t=this.offset(),n=r.ownerDocument,e=r.offsetParent||n.documentElement;while(e&&(e===n.body||e===n.documentElement)&&"static"===S.css(e,"position"))e=e.parentNode;e&&e!==r&&1===e.nodeType&&((i=S(e).offset()).top+=S.css(e,"borderTopWidth",!0),i.left+=S.css(e,"borderLeftWidth",!0))}return{top:t.top-i.top-S.css(r,"marginTop",!0),left:t.left-i.left-S.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent;while(e&&"static"===S.css(e,"position"))e=e.offsetParent;return e||re})}}),S.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(t,i){var o="pageYOffset"===i;S.fn[t]=function(e){return $(this,function(e,t,n){var r;if(x(e)?r=e:9===e.nodeType&&(r=e.defaultView),void 0===n)return r?r[i]:e[t];r?r.scrollTo(o?r.pageXOffset:n,o?n:r.pageYOffset):e[t]=n},t,e,arguments.length)}}),S.each(["top","left"],function(e,n){S.cssHooks[n]=$e(y.pixelPosition,function(e,t){if(t)return t=Be(e,n),Me.test(t)?S(e).position()[n]+"px":t})}),S.each({Height:"height",Width:"width"},function(a,s){S.each({padding:"inner"+a,content:s,"":"outer"+a},function(r,o){S.fn[o]=function(e,t){var n=arguments.length&&(r||"boolean"!=typeof e),i=r||(!0===e||!0===t?"margin":"border");return $(this,function(e,t,n){var r;return x(e)?0===o.indexOf("outer")?e["inner"+a]:e.document.documentElement["client"+a]:9===e.nodeType?(r=e.documentElement,Math.max(e.body["scroll"+a],r["scroll"+a],e.body["offset"+a],r["offset"+a],r["client"+a])):void 0===n?S.css(e,t,i):S.style(e,t,n,i)},s,n?e:void 0,n)}})}),S.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){S.fn[t]=function(e){return this.on(t,e)}}),S.fn.extend({bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)},hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}}),S.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(e,n){S.fn[n]=function(e,t){return 0a;a++)for(s in o[a])n=o[a][s],o[a].hasOwnProperty(s)&&void 0!==n&&(e[s]=t.isPlainObject(n)?t.isPlainObject(e[s])?t.widget.extend({},e[s],n):t.widget.extend({},n):n);return e},t.widget.bridge=function(e,s){var n=s.prototype.widgetFullName||e;t.fn[e]=function(o){var a="string"==typeof o,r=i.call(arguments,1),l=this;return a?this.length||"instance"!==o?this.each(function(){var i,s=t.data(this,n);return"instance"===o?(l=s,!1):s?t.isFunction(s[o])&&"_"!==o.charAt(0)?(i=s[o].apply(s,r),i!==s&&void 0!==i?(l=i&&i.jquery?l.pushStack(i.get()):i,!1):void 0):t.error("no such method '"+o+"' for "+e+" widget instance"):t.error("cannot call methods on "+e+" prior to initialization; "+"attempted to call method '"+o+"'")}):l=void 0:(r.length&&(o=t.widget.extend.apply(null,[o].concat(r))),this.each(function(){var e=t.data(this,n);e?(e.option(o||{}),e._init&&e._init()):t.data(this,n,new s(o,this))})),l}},t.Widget=function(){},t.Widget._childConstructors=[],t.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"
",options:{classes:{},disabled:!1,create:null},_createWidget:function(i,s){s=t(s||this.defaultElement||this)[0],this.element=t(s),this.uuid=e++,this.eventNamespace="."+this.widgetName+this.uuid,this.bindings=t(),this.hoverable=t(),this.focusable=t(),this.classesElementLookup={},s!==this&&(t.data(s,this.widgetFullName,this),this._on(!0,this.element,{remove:function(t){t.target===s&&this.destroy()}}),this.document=t(s.style?s.ownerDocument:s.document||s),this.window=t(this.document[0].defaultView||this.document[0].parentWindow)),this.options=t.widget.extend({},this.options,this._getCreateOptions(),i),this._create(),this.options.disabled&&this._setOptionDisabled(this.options.disabled),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:function(){return{}},_getCreateEventData:t.noop,_create:t.noop,_init:t.noop,destroy:function(){var e=this;this._destroy(),t.each(this.classesElementLookup,function(t,i){e._removeClass(i,t)}),this.element.off(this.eventNamespace).removeData(this.widgetFullName),this.widget().off(this.eventNamespace).removeAttr("aria-disabled"),this.bindings.off(this.eventNamespace)},_destroy:t.noop,widget:function(){return this.element},option:function(e,i){var s,n,o,a=e;if(0===arguments.length)return t.widget.extend({},this.options);if("string"==typeof e)if(a={},s=e.split("."),e=s.shift(),s.length){for(n=a[e]=t.widget.extend({},this.options[e]),o=0;s.length-1>o;o++)n[s[o]]=n[s[o]]||{},n=n[s[o]];if(e=s.pop(),1===arguments.length)return void 0===n[e]?null:n[e];n[e]=i}else{if(1===arguments.length)return void 0===this.options[e]?null:this.options[e];a[e]=i}return this._setOptions(a),this},_setOptions:function(t){var e;for(e in t)this._setOption(e,t[e]);return this},_setOption:function(t,e){return"classes"===t&&this._setOptionClasses(e),this.options[t]=e,"disabled"===t&&this._setOptionDisabled(e),this},_setOptionClasses:function(e){var i,s,n;for(i in e)n=this.classesElementLookup[i],e[i]!==this.options.classes[i]&&n&&n.length&&(s=t(n.get()),this._removeClass(n,i),s.addClass(this._classes({element:s,keys:i,classes:e,add:!0})))},_setOptionDisabled:function(t){this._toggleClass(this.widget(),this.widgetFullName+"-disabled",null,!!t),t&&(this._removeClass(this.hoverable,null,"ui-state-hover"),this._removeClass(this.focusable,null,"ui-state-focus"))},enable:function(){return this._setOptions({disabled:!1})},disable:function(){return this._setOptions({disabled:!0})},_classes:function(e){function i(i,o){var a,r;for(r=0;i.length>r;r++)a=n.classesElementLookup[i[r]]||t(),a=e.add?t(t.unique(a.get().concat(e.element.get()))):t(a.not(e.element).get()),n.classesElementLookup[i[r]]=a,s.push(i[r]),o&&e.classes[i[r]]&&s.push(e.classes[i[r]])}var s=[],n=this;return e=t.extend({element:this.element,classes:this.options.classes||{}},e),this._on(e.element,{remove:"_untrackClassesElement"}),e.keys&&i(e.keys.match(/\S+/g)||[],!0),e.extra&&i(e.extra.match(/\S+/g)||[]),s.join(" ")},_untrackClassesElement:function(e){var i=this;t.each(i.classesElementLookup,function(s,n){-1!==t.inArray(e.target,n)&&(i.classesElementLookup[s]=t(n.not(e.target).get()))})},_removeClass:function(t,e,i){return this._toggleClass(t,e,i,!1)},_addClass:function(t,e,i){return this._toggleClass(t,e,i,!0)},_toggleClass:function(t,e,i,s){s="boolean"==typeof s?s:i;var n="string"==typeof t||null===t,o={extra:n?e:i,keys:n?t:e,element:n?this.element:t,add:s};return o.element.toggleClass(this._classes(o),s),this},_on:function(e,i,s){var n,o=this;"boolean"!=typeof e&&(s=i,i=e,e=!1),s?(i=n=t(i),this.bindings=this.bindings.add(i)):(s=i,i=this.element,n=this.widget()),t.each(s,function(s,a){function r(){return e||o.options.disabled!==!0&&!t(this).hasClass("ui-state-disabled")?("string"==typeof a?o[a]:a).apply(o,arguments):void 0}"string"!=typeof a&&(r.guid=a.guid=a.guid||r.guid||t.guid++);var l=s.match(/^([\w:-]*)\s*(.*)$/),h=l[1]+o.eventNamespace,c=l[2];c?n.on(h,c,r):i.on(h,r)})},_off:function(e,i){i=(i||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace,e.off(i).off(i),this.bindings=t(this.bindings.not(e).get()),this.focusable=t(this.focusable.not(e).get()),this.hoverable=t(this.hoverable.not(e).get())},_delay:function(t,e){function i(){return("string"==typeof t?s[t]:t).apply(s,arguments)}var s=this;return setTimeout(i,e||0)},_hoverable:function(e){this.hoverable=this.hoverable.add(e),this._on(e,{mouseenter:function(e){this._addClass(t(e.currentTarget),null,"ui-state-hover")},mouseleave:function(e){this._removeClass(t(e.currentTarget),null,"ui-state-hover")}})},_focusable:function(e){this.focusable=this.focusable.add(e),this._on(e,{focusin:function(e){this._addClass(t(e.currentTarget),null,"ui-state-focus")},focusout:function(e){this._removeClass(t(e.currentTarget),null,"ui-state-focus")}})},_trigger:function(e,i,s){var n,o,a=this.options[e];if(s=s||{},i=t.Event(i),i.type=(e===this.widgetEventPrefix?e:this.widgetEventPrefix+e).toLowerCase(),i.target=this.element[0],o=i.originalEvent)for(n in o)n in i||(i[n]=o[n]);return this.element.trigger(i,s),!(t.isFunction(a)&&a.apply(this.element[0],[i].concat(s))===!1||i.isDefaultPrevented())}},t.each({show:"fadeIn",hide:"fadeOut"},function(e,i){t.Widget.prototype["_"+e]=function(s,n,o){"string"==typeof n&&(n={effect:n});var a,r=n?n===!0||"number"==typeof n?i:n.effect||i:e;n=n||{},"number"==typeof n&&(n={duration:n}),a=!t.isEmptyObject(n),n.complete=o,n.delay&&s.delay(n.delay),a&&t.effects&&t.effects.effect[r]?s[e](n):r!==e&&s[r]?s[r](n.duration,n.easing,o):s.queue(function(i){t(this)[e](),o&&o.call(s[0]),i()})}}),t.widget,function(){function e(t,e,i){return[parseFloat(t[0])*(u.test(t[0])?e/100:1),parseFloat(t[1])*(u.test(t[1])?i/100:1)]}function i(e,i){return parseInt(t.css(e,i),10)||0}function s(e){var i=e[0];return 9===i.nodeType?{width:e.width(),height:e.height(),offset:{top:0,left:0}}:t.isWindow(i)?{width:e.width(),height:e.height(),offset:{top:e.scrollTop(),left:e.scrollLeft()}}:i.preventDefault?{width:0,height:0,offset:{top:i.pageY,left:i.pageX}}:{width:e.outerWidth(),height:e.outerHeight(),offset:e.offset()}}var n,o=Math.max,a=Math.abs,r=/left|center|right/,l=/top|center|bottom/,h=/[\+\-]\d+(\.[\d]+)?%?/,c=/^\w+/,u=/%$/,d=t.fn.position;t.position={scrollbarWidth:function(){if(void 0!==n)return n;var e,i,s=t("
"),o=s.children()[0];return t("body").append(s),e=o.offsetWidth,s.css("overflow","scroll"),i=o.offsetWidth,e===i&&(i=s[0].clientWidth),s.remove(),n=e-i},getScrollInfo:function(e){var i=e.isWindow||e.isDocument?"":e.element.css("overflow-x"),s=e.isWindow||e.isDocument?"":e.element.css("overflow-y"),n="scroll"===i||"auto"===i&&e.widthi?"left":e>0?"right":"center",vertical:0>r?"top":s>0?"bottom":"middle"};h>p&&p>a(e+i)&&(u.horizontal="center"),c>f&&f>a(s+r)&&(u.vertical="middle"),u.important=o(a(e),a(i))>o(a(s),a(r))?"horizontal":"vertical",n.using.call(this,t,u)}),l.offset(t.extend(D,{using:r}))})},t.ui.position={fit:{left:function(t,e){var i,s=e.within,n=s.isWindow?s.scrollLeft:s.offset.left,a=s.width,r=t.left-e.collisionPosition.marginLeft,l=n-r,h=r+e.collisionWidth-a-n;e.collisionWidth>a?l>0&&0>=h?(i=t.left+l+e.collisionWidth-a-n,t.left+=l-i):t.left=h>0&&0>=l?n:l>h?n+a-e.collisionWidth:n:l>0?t.left+=l:h>0?t.left-=h:t.left=o(t.left-r,t.left)},top:function(t,e){var i,s=e.within,n=s.isWindow?s.scrollTop:s.offset.top,a=e.within.height,r=t.top-e.collisionPosition.marginTop,l=n-r,h=r+e.collisionHeight-a-n;e.collisionHeight>a?l>0&&0>=h?(i=t.top+l+e.collisionHeight-a-n,t.top+=l-i):t.top=h>0&&0>=l?n:l>h?n+a-e.collisionHeight:n:l>0?t.top+=l:h>0?t.top-=h:t.top=o(t.top-r,t.top)}},flip:{left:function(t,e){var i,s,n=e.within,o=n.offset.left+n.scrollLeft,r=n.width,l=n.isWindow?n.scrollLeft:n.offset.left,h=t.left-e.collisionPosition.marginLeft,c=h-l,u=h+e.collisionWidth-r-l,d="left"===e.my[0]?-e.elemWidth:"right"===e.my[0]?e.elemWidth:0,p="left"===e.at[0]?e.targetWidth:"right"===e.at[0]?-e.targetWidth:0,f=-2*e.offset[0];0>c?(i=t.left+d+p+f+e.collisionWidth-r-o,(0>i||a(c)>i)&&(t.left+=d+p+f)):u>0&&(s=t.left-e.collisionPosition.marginLeft+d+p+f-l,(s>0||u>a(s))&&(t.left+=d+p+f))},top:function(t,e){var i,s,n=e.within,o=n.offset.top+n.scrollTop,r=n.height,l=n.isWindow?n.scrollTop:n.offset.top,h=t.top-e.collisionPosition.marginTop,c=h-l,u=h+e.collisionHeight-r-l,d="top"===e.my[1],p=d?-e.elemHeight:"bottom"===e.my[1]?e.elemHeight:0,f="top"===e.at[1]?e.targetHeight:"bottom"===e.at[1]?-e.targetHeight:0,g=-2*e.offset[1];0>c?(s=t.top+p+f+g+e.collisionHeight-r-o,(0>s||a(c)>s)&&(t.top+=p+f+g)):u>0&&(i=t.top-e.collisionPosition.marginTop+p+f+g-l,(i>0||u>a(i))&&(t.top+=p+f+g))}},flipfit:{left:function(){t.ui.position.flip.left.apply(this,arguments),t.ui.position.fit.left.apply(this,arguments)},top:function(){t.ui.position.flip.top.apply(this,arguments),t.ui.position.fit.top.apply(this,arguments)}}}}(),t.ui.position,t.ui.keyCode={BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38},t.fn.extend({uniqueId:function(){var t=0;return function(){return this.each(function(){this.id||(this.id="ui-id-"+ ++t)})}}(),removeUniqueId:function(){return this.each(function(){/^ui-id-\d+$/.test(this.id)&&t(this).removeAttr("id")})}}),t.ui.safeActiveElement=function(t){var e;try{e=t.activeElement}catch(i){e=t.body}return e||(e=t.body),e.nodeName||(e=t.body),e},t.widget("ui.menu",{version:"1.12.1",defaultElement:"
    ",delay:300,options:{icons:{submenu:"ui-icon-caret-1-e"},items:"> *",menus:"ul",position:{my:"left top",at:"right top"},role:"menu",blur:null,focus:null,select:null},_create:function(){this.activeMenu=this.element,this.mouseHandled=!1,this.element.uniqueId().attr({role:this.options.role,tabIndex:0}),this._addClass("ui-menu","ui-widget ui-widget-content"),this._on({"mousedown .ui-menu-item":function(t){t.preventDefault()},"click .ui-menu-item":function(e){var i=t(e.target),s=t(t.ui.safeActiveElement(this.document[0]));!this.mouseHandled&&i.not(".ui-state-disabled").length&&(this.select(e),e.isPropagationStopped()||(this.mouseHandled=!0),i.has(".ui-menu").length?this.expand(e):!this.element.is(":focus")&&s.closest(".ui-menu").length&&(this.element.trigger("focus",[!0]),this.active&&1===this.active.parents(".ui-menu").length&&clearTimeout(this.timer)))},"mouseenter .ui-menu-item":function(e){if(!this.previousFilter){var i=t(e.target).closest(".ui-menu-item"),s=t(e.currentTarget);i[0]===s[0]&&(this._removeClass(s.siblings().children(".ui-state-active"),null,"ui-state-active"),this.focus(e,s))}},mouseleave:"collapseAll","mouseleave .ui-menu":"collapseAll",focus:function(t,e){var i=this.active||this.element.find(this.options.items).eq(0);e||this.focus(t,i)},blur:function(e){this._delay(function(){var i=!t.contains(this.element[0],t.ui.safeActiveElement(this.document[0]));i&&this.collapseAll(e)})},keydown:"_keydown"}),this.refresh(),this._on(this.document,{click:function(t){this._closeOnDocumentClick(t)&&this.collapseAll(t),this.mouseHandled=!1}})},_destroy:function(){var e=this.element.find(".ui-menu-item").removeAttr("role aria-disabled"),i=e.children(".ui-menu-item-wrapper").removeUniqueId().removeAttr("tabIndex role aria-haspopup");this.element.removeAttr("aria-activedescendant").find(".ui-menu").addBack().removeAttr("role aria-labelledby aria-expanded aria-hidden aria-disabled tabIndex").removeUniqueId().show(),i.children().each(function(){var e=t(this);e.data("ui-menu-submenu-caret")&&e.remove()})},_keydown:function(e){var i,s,n,o,a=!0;switch(e.keyCode){case t.ui.keyCode.PAGE_UP:this.previousPage(e);break;case t.ui.keyCode.PAGE_DOWN:this.nextPage(e);break;case t.ui.keyCode.HOME:this._move("first","first",e);break;case t.ui.keyCode.END:this._move("last","last",e);break;case t.ui.keyCode.UP:this.previous(e);break;case t.ui.keyCode.DOWN:this.next(e);break;case t.ui.keyCode.LEFT:this.collapse(e);break;case t.ui.keyCode.RIGHT:this.active&&!this.active.is(".ui-state-disabled")&&this.expand(e);break;case t.ui.keyCode.ENTER:case t.ui.keyCode.SPACE:this._activate(e);break;case t.ui.keyCode.ESCAPE:this.collapse(e);break;default:a=!1,s=this.previousFilter||"",o=!1,n=e.keyCode>=96&&105>=e.keyCode?""+(e.keyCode-96):String.fromCharCode(e.keyCode),clearTimeout(this.filterTimer),n===s?o=!0:n=s+n,i=this._filterMenuItems(n),i=o&&-1!==i.index(this.active.next())?this.active.nextAll(".ui-menu-item"):i,i.length||(n=String.fromCharCode(e.keyCode),i=this._filterMenuItems(n)),i.length?(this.focus(e,i),this.previousFilter=n,this.filterTimer=this._delay(function(){delete this.previousFilter},1e3)):delete this.previousFilter}a&&e.preventDefault()},_activate:function(t){this.active&&!this.active.is(".ui-state-disabled")&&(this.active.children("[aria-haspopup='true']").length?this.expand(t):this.select(t))},refresh:function(){var e,i,s,n,o,a=this,r=this.options.icons.submenu,l=this.element.find(this.options.menus);this._toggleClass("ui-menu-icons",null,!!this.element.find(".ui-icon").length),s=l.filter(":not(.ui-menu)").hide().attr({role:this.options.role,"aria-hidden":"true","aria-expanded":"false"}).each(function(){var e=t(this),i=e.prev(),s=t("").data("ui-menu-submenu-caret",!0);a._addClass(s,"ui-menu-icon","ui-icon "+r),i.attr("aria-haspopup","true").prepend(s),e.attr("aria-labelledby",i.attr("id"))}),this._addClass(s,"ui-menu","ui-widget ui-widget-content ui-front"),e=l.add(this.element),i=e.find(this.options.items),i.not(".ui-menu-item").each(function(){var e=t(this);a._isDivider(e)&&a._addClass(e,"ui-menu-divider","ui-widget-content")}),n=i.not(".ui-menu-item, .ui-menu-divider"),o=n.children().not(".ui-menu").uniqueId().attr({tabIndex:-1,role:this._itemRole()}),this._addClass(n,"ui-menu-item")._addClass(o,"ui-menu-item-wrapper"),i.filter(".ui-state-disabled").attr("aria-disabled","true"),this.active&&!t.contains(this.element[0],this.active[0])&&this.blur()},_itemRole:function(){return{menu:"menuitem",listbox:"option"}[this.options.role]},_setOption:function(t,e){if("icons"===t){var i=this.element.find(".ui-menu-icon");this._removeClass(i,null,this.options.icons.submenu)._addClass(i,null,e.submenu)}this._super(t,e)},_setOptionDisabled:function(t){this._super(t),this.element.attr("aria-disabled",t+""),this._toggleClass(null,"ui-state-disabled",!!t)},focus:function(t,e){var i,s,n;this.blur(t,t&&"focus"===t.type),this._scrollIntoView(e),this.active=e.first(),s=this.active.children(".ui-menu-item-wrapper"),this._addClass(s,null,"ui-state-active"),this.options.role&&this.element.attr("aria-activedescendant",s.attr("id")),n=this.active.parent().closest(".ui-menu-item").children(".ui-menu-item-wrapper"),this._addClass(n,null,"ui-state-active"),t&&"keydown"===t.type?this._close():this.timer=this._delay(function(){this._close()},this.delay),i=e.children(".ui-menu"),i.length&&t&&/^mouse/.test(t.type)&&this._startOpening(i),this.activeMenu=e.parent(),this._trigger("focus",t,{item:e})},_scrollIntoView:function(e){var i,s,n,o,a,r;this._hasScroll()&&(i=parseFloat(t.css(this.activeMenu[0],"borderTopWidth"))||0,s=parseFloat(t.css(this.activeMenu[0],"paddingTop"))||0,n=e.offset().top-this.activeMenu.offset().top-i-s,o=this.activeMenu.scrollTop(),a=this.activeMenu.height(),r=e.outerHeight(),0>n?this.activeMenu.scrollTop(o+n):n+r>a&&this.activeMenu.scrollTop(o+n-a+r))},blur:function(t,e){e||clearTimeout(this.timer),this.active&&(this._removeClass(this.active.children(".ui-menu-item-wrapper"),null,"ui-state-active"),this._trigger("blur",t,{item:this.active}),this.active=null)},_startOpening:function(t){clearTimeout(this.timer),"true"===t.attr("aria-hidden")&&(this.timer=this._delay(function(){this._close(),this._open(t)},this.delay))},_open:function(e){var i=t.extend({of:this.active},this.options.position);clearTimeout(this.timer),this.element.find(".ui-menu").not(e.parents(".ui-menu")).hide().attr("aria-hidden","true"),e.show().removeAttr("aria-hidden").attr("aria-expanded","true").position(i)},collapseAll:function(e,i){clearTimeout(this.timer),this.timer=this._delay(function(){var s=i?this.element:t(e&&e.target).closest(this.element.find(".ui-menu"));s.length||(s=this.element),this._close(s),this.blur(e),this._removeClass(s.find(".ui-state-active"),null,"ui-state-active"),this.activeMenu=s},this.delay)},_close:function(t){t||(t=this.active?this.active.parent():this.element),t.find(".ui-menu").hide().attr("aria-hidden","true").attr("aria-expanded","false")},_closeOnDocumentClick:function(e){return!t(e.target).closest(".ui-menu").length},_isDivider:function(t){return!/[^\-\u2014\u2013\s]/.test(t.text())},collapse:function(t){var e=this.active&&this.active.parent().closest(".ui-menu-item",this.element);e&&e.length&&(this._close(),this.focus(t,e))},expand:function(t){var e=this.active&&this.active.children(".ui-menu ").find(this.options.items).first();e&&e.length&&(this._open(e.parent()),this._delay(function(){this.focus(t,e)}))},next:function(t){this._move("next","first",t)},previous:function(t){this._move("prev","last",t)},isFirstItem:function(){return this.active&&!this.active.prevAll(".ui-menu-item").length},isLastItem:function(){return this.active&&!this.active.nextAll(".ui-menu-item").length},_move:function(t,e,i){var s;this.active&&(s="first"===t||"last"===t?this.active["first"===t?"prevAll":"nextAll"](".ui-menu-item").eq(-1):this.active[t+"All"](".ui-menu-item").eq(0)),s&&s.length&&this.active||(s=this.activeMenu.find(this.options.items)[e]()),this.focus(i,s)},nextPage:function(e){var i,s,n;return this.active?(this.isLastItem()||(this._hasScroll()?(s=this.active.offset().top,n=this.element.height(),this.active.nextAll(".ui-menu-item").each(function(){return i=t(this),0>i.offset().top-s-n}),this.focus(e,i)):this.focus(e,this.activeMenu.find(this.options.items)[this.active?"last":"first"]())),void 0):(this.next(e),void 0)},previousPage:function(e){var i,s,n;return this.active?(this.isFirstItem()||(this._hasScroll()?(s=this.active.offset().top,n=this.element.height(),this.active.prevAll(".ui-menu-item").each(function(){return i=t(this),i.offset().top-s+n>0}),this.focus(e,i)):this.focus(e,this.activeMenu.find(this.options.items).first())),void 0):(this.next(e),void 0)},_hasScroll:function(){return this.element.outerHeight()",options:{appendTo:null,autoFocus:!1,delay:300,minLength:1,position:{my:"left top",at:"left bottom",collision:"none"},source:null,change:null,close:null,focus:null,open:null,response:null,search:null,select:null},requestIndex:0,pending:0,_create:function(){var e,i,s,n=this.element[0].nodeName.toLowerCase(),o="textarea"===n,a="input"===n;this.isMultiLine=o||!a&&this._isContentEditable(this.element),this.valueMethod=this.element[o||a?"val":"text"],this.isNewMenu=!0,this._addClass("ui-autocomplete-input"),this.element.attr("autocomplete","off"),this._on(this.element,{keydown:function(n){if(this.element.prop("readOnly"))return e=!0,s=!0,i=!0,void 0;e=!1,s=!1,i=!1;var o=t.ui.keyCode;switch(n.keyCode){case o.PAGE_UP:e=!0,this._move("previousPage",n);break;case o.PAGE_DOWN:e=!0,this._move("nextPage",n);break;case o.UP:e=!0,this._keyEvent("previous",n);break;case o.DOWN:e=!0,this._keyEvent("next",n);break;case o.ENTER:this.menu.active&&(e=!0,n.preventDefault(),this.menu.select(n));break;case o.TAB:this.menu.active&&this.menu.select(n);break;case o.ESCAPE:this.menu.element.is(":visible")&&(this.isMultiLine||this._value(this.term),this.close(n),n.preventDefault());break;default:i=!0,this._searchTimeout(n)}},keypress:function(s){if(e)return e=!1,(!this.isMultiLine||this.menu.element.is(":visible"))&&s.preventDefault(),void 0;if(!i){var n=t.ui.keyCode;switch(s.keyCode){case n.PAGE_UP:this._move("previousPage",s);break;case n.PAGE_DOWN:this._move("nextPage",s);break;case n.UP:this._keyEvent("previous",s);break;case n.DOWN:this._keyEvent("next",s)}}},input:function(t){return s?(s=!1,t.preventDefault(),void 0):(this._searchTimeout(t),void 0)},focus:function(){this.selectedItem=null,this.previous=this._value()},blur:function(t){return this.cancelBlur?(delete this.cancelBlur,void 0):(clearTimeout(this.searching),this.close(t),this._change(t),void 0)}}),this._initSource(),this.menu=t("
      ").appendTo(this._appendTo()).menu({role:null}).hide().menu("instance"),this._addClass(this.menu.element,"ui-autocomplete","ui-front"),this._on(this.menu.element,{mousedown:function(e){e.preventDefault(),this.cancelBlur=!0,this._delay(function(){delete this.cancelBlur,this.element[0]!==t.ui.safeActiveElement(this.document[0])&&this.element.trigger("focus")})},menufocus:function(e,i){var s,n;return this.isNewMenu&&(this.isNewMenu=!1,e.originalEvent&&/^mouse/.test(e.originalEvent.type))?(this.menu.blur(),this.document.one("mousemove",function(){t(e.target).trigger(e.originalEvent)}),void 0):(n=i.item.data("ui-autocomplete-item"),!1!==this._trigger("focus",e,{item:n})&&e.originalEvent&&/^key/.test(e.originalEvent.type)&&this._value(n.value),s=i.item.attr("aria-label")||n.value,s&&t.trim(s).length&&(this.liveRegion.children().hide(),t("
      ").text(s).appendTo(this.liveRegion)),void 0)},menuselect:function(e,i){var s=i.item.data("ui-autocomplete-item"),n=this.previous;this.element[0]!==t.ui.safeActiveElement(this.document[0])&&(this.element.trigger("focus"),this.previous=n,this._delay(function(){this.previous=n,this.selectedItem=s})),!1!==this._trigger("select",e,{item:s})&&this._value(s.value),this.term=this._value(),this.close(e),this.selectedItem=s}}),this.liveRegion=t("
      ",{role:"status","aria-live":"assertive","aria-relevant":"additions"}).appendTo(this.document[0].body),this._addClass(this.liveRegion,null,"ui-helper-hidden-accessible"),this._on(this.window,{beforeunload:function(){this.element.removeAttr("autocomplete")}})},_destroy:function(){clearTimeout(this.searching),this.element.removeAttr("autocomplete"),this.menu.element.remove(),this.liveRegion.remove()},_setOption:function(t,e){this._super(t,e),"source"===t&&this._initSource(),"appendTo"===t&&this.menu.element.appendTo(this._appendTo()),"disabled"===t&&e&&this.xhr&&this.xhr.abort()},_isEventTargetInWidget:function(e){var i=this.menu.element[0];return e.target===this.element[0]||e.target===i||t.contains(i,e.target)},_closeOnClickOutside:function(t){this._isEventTargetInWidget(t)||this.close()},_appendTo:function(){var e=this.options.appendTo;return e&&(e=e.jquery||e.nodeType?t(e):this.document.find(e).eq(0)),e&&e[0]||(e=this.element.closest(".ui-front, dialog")),e.length||(e=this.document[0].body),e},_initSource:function(){var e,i,s=this;t.isArray(this.options.source)?(e=this.options.source,this.source=function(i,s){s(t.ui.autocomplete.filter(e,i.term))}):"string"==typeof this.options.source?(i=this.options.source,this.source=function(e,n){s.xhr&&s.xhr.abort(),s.xhr=t.ajax({url:i,data:e,dataType:"json",success:function(t){n(t)},error:function(){n([])}})}):this.source=this.options.source},_searchTimeout:function(t){clearTimeout(this.searching),this.searching=this._delay(function(){var e=this.term===this._value(),i=this.menu.element.is(":visible"),s=t.altKey||t.ctrlKey||t.metaKey||t.shiftKey;(!e||e&&!i&&!s)&&(this.selectedItem=null,this.search(null,t))},this.options.delay)},search:function(t,e){return t=null!=t?t:this._value(),this.term=this._value(),t.length").append(t("
      ").text(i.label)).appendTo(e)},_move:function(t,e){return this.menu.element.is(":visible")?this.menu.isFirstItem()&&/^previous/.test(t)||this.menu.isLastItem()&&/^next/.test(t)?(this.isMultiLine||this._value(this.term),this.menu.blur(),void 0):(this.menu[t](e),void 0):(this.search(null,e),void 0)},widget:function(){return this.menu.element},_value:function(){return this.valueMethod.apply(this.element,arguments)},_keyEvent:function(t,e){(!this.isMultiLine||this.menu.element.is(":visible"))&&(this._move(t,e),e.preventDefault())},_isContentEditable:function(t){if(!t.length)return!1;var e=t.prop("contentEditable");return"inherit"===e?this._isContentEditable(t.parent()):"true"===e}}),t.extend(t.ui.autocomplete,{escapeRegex:function(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")},filter:function(e,i){var s=RegExp(t.ui.autocomplete.escapeRegex(i),"i");return t.grep(e,function(t){return s.test(t.label||t.value||t)})}}),t.widget("ui.autocomplete",t.ui.autocomplete,{options:{messages:{noResults:"No search results.",results:function(t){return t+(t>1?" results are":" result is")+" available, use up and down arrow keys to navigate."}}},__response:function(e){var i;this._superApply(arguments),this.options.disabled||this.cancelSearch||(i=e&&e.length?this.options.messages.results(e.length):this.options.messages.noResults,this.liveRegion.children().hide(),t("
      ").text(i).appendTo(this.liveRegion))}}),t.ui.autocomplete}); \ No newline at end of file diff --git a/doc/script-dir/jquery-ui.structure.min.css b/doc/script-dir/jquery-ui.structure.min.css new file mode 100644 index 0000000..e880892 --- /dev/null +++ b/doc/script-dir/jquery-ui.structure.min.css @@ -0,0 +1,5 @@ +/*! jQuery UI - v1.12.1 - 2018-12-06 +* http://jqueryui.com +* Copyright jQuery Foundation and other contributors; Licensed MIT */ + +.ui-helper-hidden{display:none}.ui-helper-hidden-accessible{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.ui-helper-reset{margin:0;padding:0;border:0;outline:0;line-height:1.3;text-decoration:none;font-size:100%;list-style:none}.ui-helper-clearfix:before,.ui-helper-clearfix:after{content:"";display:table;border-collapse:collapse}.ui-helper-clearfix:after{clear:both}.ui-helper-zfix{width:100%;height:100%;top:0;left:0;position:absolute;opacity:0;filter:Alpha(Opacity=0)}.ui-front{z-index:100}.ui-state-disabled{cursor:default!important;pointer-events:none}.ui-icon{display:inline-block;vertical-align:middle;margin-top:-.25em;position:relative;text-indent:-99999px;overflow:hidden;background-repeat:no-repeat}.ui-widget-icon-block{left:50%;margin-left:-8px;display:block}.ui-widget-overlay{position:fixed;top:0;left:0;width:100%;height:100%}.ui-autocomplete{position:absolute;top:0;left:0;cursor:default}.ui-menu{list-style:none;padding:0;margin:0;display:block;outline:0}.ui-menu .ui-menu{position:absolute}.ui-menu .ui-menu-item{margin:0;cursor:pointer;list-style-image:url("data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7")}.ui-menu .ui-menu-item-wrapper{position:relative;padding:3px 1em 3px .4em}.ui-menu .ui-menu-divider{margin:5px 0;height:0;font-size:0;line-height:0;border-width:1px 0 0 0}.ui-menu .ui-state-focus,.ui-menu .ui-state-active{margin:-1px}.ui-menu-icons{position:relative}.ui-menu-icons .ui-menu-item-wrapper{padding-left:2em}.ui-menu .ui-icon{position:absolute;top:0;bottom:0;left:.2em;margin:auto 0}.ui-menu .ui-menu-icon{left:auto;right:0} \ No newline at end of file diff --git a/doc/script.js b/doc/script.js new file mode 100644 index 0000000..864989c --- /dev/null +++ b/doc/script.js @@ -0,0 +1,132 @@ +/* + * Copyright (c) 2013, 2020, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +var moduleSearchIndex; +var packageSearchIndex; +var typeSearchIndex; +var memberSearchIndex; +var tagSearchIndex; +function loadScripts(doc, tag) { + createElem(doc, tag, 'search.js'); + + createElem(doc, tag, 'module-search-index.js'); + createElem(doc, tag, 'package-search-index.js'); + createElem(doc, tag, 'type-search-index.js'); + createElem(doc, tag, 'member-search-index.js'); + createElem(doc, tag, 'tag-search-index.js'); +} + +function createElem(doc, tag, path) { + var script = doc.createElement(tag); + var scriptElement = doc.getElementsByTagName(tag)[0]; + script.src = pathtoroot + path; + scriptElement.parentNode.insertBefore(script, scriptElement); +} + +function show(tableId, selected, columns) { + if (tableId !== selected) { + document.querySelectorAll('div.' + tableId + ':not(.' + selected + ')') + .forEach(function(elem) { + elem.style.display = 'none'; + }); + } + document.querySelectorAll('div.' + selected) + .forEach(function(elem, index) { + elem.style.display = ''; + var isEvenRow = index % (columns * 2) < columns; + elem.classList.remove(isEvenRow ? oddRowColor : evenRowColor); + elem.classList.add(isEvenRow ? evenRowColor : oddRowColor); + }); + updateTabs(tableId, selected); +} + +function updateTabs(tableId, selected) { + document.querySelector('div#' + tableId +' .summary-table') + .setAttribute('aria-labelledby', selected); + document.querySelectorAll('button[id^="' + tableId + '"]') + .forEach(function(tab, index) { + if (selected === tab.id || (tableId === selected && index === 0)) { + tab.className = activeTableTab; + tab.setAttribute('aria-selected', true); + tab.setAttribute('tabindex',0); + } else { + tab.className = tableTab; + tab.setAttribute('aria-selected', false); + tab.setAttribute('tabindex',-1); + } + }); +} + +function switchTab(e) { + var selected = document.querySelector('[aria-selected=true]'); + if (selected) { + if ((e.keyCode === 37 || e.keyCode === 38) && selected.previousSibling) { + // left or up arrow key pressed: move focus to previous tab + selected.previousSibling.click(); + selected.previousSibling.focus(); + e.preventDefault(); + } else if ((e.keyCode === 39 || e.keyCode === 40) && selected.nextSibling) { + // right or down arrow key pressed: move focus to next tab + selected.nextSibling.click(); + selected.nextSibling.focus(); + e.preventDefault(); + } + } +} + +var updateSearchResults = function() {}; + +function indexFilesLoaded() { + return moduleSearchIndex + && packageSearchIndex + && typeSearchIndex + && memberSearchIndex + && tagSearchIndex; +} + +// Workaround for scroll position not being included in browser history (8249133) +document.addEventListener("DOMContentLoaded", function(e) { + var contentDiv = document.querySelector("div.flex-content"); + window.addEventListener("popstate", function(e) { + if (e.state !== null) { + contentDiv.scrollTop = e.state; + } + }); + window.addEventListener("hashchange", function(e) { + history.replaceState(contentDiv.scrollTop, document.title); + }); + contentDiv.addEventListener("scroll", function(e) { + var timeoutID; + if (!timeoutID) { + timeoutID = setTimeout(function() { + history.replaceState(contentDiv.scrollTop, document.title); + timeoutID = null; + }, 100); + } + }); + if (!location.hash) { + history.replaceState(contentDiv.scrollTop, document.title); + } +}); diff --git a/doc/search.js b/doc/search.js new file mode 100644 index 0000000..db3b2f4 --- /dev/null +++ b/doc/search.js @@ -0,0 +1,354 @@ +/* + * Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +var noResult = {l: "No results found"}; +var loading = {l: "Loading search index..."}; +var catModules = "Modules"; +var catPackages = "Packages"; +var catTypes = "Classes and Interfaces"; +var catMembers = "Members"; +var catSearchTags = "Search Tags"; +var highlight = "$&"; +var searchPattern = ""; +var fallbackPattern = ""; +var RANKING_THRESHOLD = 2; +var NO_MATCH = 0xffff; +var MIN_RESULTS = 3; +var MAX_RESULTS = 500; +var UNNAMED = ""; +function escapeHtml(str) { + return str.replace(//g, ">"); +} +function getHighlightedText(item, matcher, fallbackMatcher) { + var escapedItem = escapeHtml(item); + var highlighted = escapedItem.replace(matcher, highlight); + if (highlighted === escapedItem) { + highlighted = escapedItem.replace(fallbackMatcher, highlight) + } + return highlighted; +} +function getURLPrefix(ui) { + var urlPrefix=""; + var slash = "/"; + if (ui.item.category === catModules) { + return ui.item.l + slash; + } else if (ui.item.category === catPackages && ui.item.m) { + return ui.item.m + slash; + } else if (ui.item.category === catTypes || ui.item.category === catMembers) { + if (ui.item.m) { + urlPrefix = ui.item.m + slash; + } else { + $.each(packageSearchIndex, function(index, item) { + if (item.m && ui.item.p === item.l) { + urlPrefix = item.m + slash; + } + }); + } + } + return urlPrefix; +} +function createSearchPattern(term) { + var pattern = ""; + var isWordToken = false; + term.replace(/,\s*/g, ", ").trim().split(/\s+/).forEach(function(w, index) { + if (index > 0) { + // whitespace between identifiers is significant + pattern += (isWordToken && /^\w/.test(w)) ? "\\s+" : "\\s*"; + } + var tokens = w.split(/(?=[A-Z,.()<>[\/])/); + for (var i = 0; i < tokens.length; i++) { + var s = tokens[i]; + if (s === "") { + continue; + } + pattern += $.ui.autocomplete.escapeRegex(s); + isWordToken = /\w$/.test(s); + if (isWordToken) { + pattern += "([a-z0-9_$<>\\[\\]]*?)"; + } + } + }); + return pattern; +} +function createMatcher(pattern, flags) { + var isCamelCase = /[A-Z]/.test(pattern); + return new RegExp(pattern, flags + (isCamelCase ? "" : "i")); +} +var watermark = 'Search'; +$(function() { + var search = $("#search-input"); + var reset = $("#reset-button"); + search.val(''); + search.prop("disabled", false); + reset.prop("disabled", false); + search.val(watermark).addClass('watermark'); + search.blur(function() { + if ($(this).val().length === 0) { + $(this).val(watermark).addClass('watermark'); + } + }); + search.on('click keydown paste', function() { + if ($(this).val() === watermark) { + $(this).val('').removeClass('watermark'); + } + }); + reset.click(function() { + search.val('').focus(); + }); + search.focus()[0].setSelectionRange(0, 0); +}); +$.widget("custom.catcomplete", $.ui.autocomplete, { + _create: function() { + this._super(); + this.widget().menu("option", "items", "> :not(.ui-autocomplete-category)"); + }, + _renderMenu: function(ul, items) { + var rMenu = this; + var currentCategory = ""; + rMenu.menu.bindings = $(); + $.each(items, function(index, item) { + var li; + if (item.category && item.category !== currentCategory) { + ul.append("
    • " + item.category + "
    • "); + currentCategory = item.category; + } + li = rMenu._renderItemData(ul, item); + if (item.category) { + li.attr("aria-label", item.category + " : " + item.l); + li.attr("class", "result-item"); + } else { + li.attr("aria-label", item.l); + li.attr("class", "result-item"); + } + }); + }, + _renderItem: function(ul, item) { + var label = ""; + var matcher = createMatcher(escapeHtml(searchPattern), "g"); + var fallbackMatcher = new RegExp(fallbackPattern, "gi") + if (item.category === catModules) { + label = getHighlightedText(item.l, matcher, fallbackMatcher); + } else if (item.category === catPackages) { + label = getHighlightedText(item.l, matcher, fallbackMatcher); + } else if (item.category === catTypes) { + label = (item.p && item.p !== UNNAMED) + ? getHighlightedText(item.p + "." + item.l, matcher, fallbackMatcher) + : getHighlightedText(item.l, matcher, fallbackMatcher); + } else if (item.category === catMembers) { + label = (item.p && item.p !== UNNAMED) + ? getHighlightedText(item.p + "." + item.c + "." + item.l, matcher, fallbackMatcher) + : getHighlightedText(item.c + "." + item.l, matcher, fallbackMatcher); + } else if (item.category === catSearchTags) { + label = getHighlightedText(item.l, matcher, fallbackMatcher); + } else { + label = item.l; + } + var li = $("
    • ").appendTo(ul); + var div = $("
      ").appendTo(li); + if (item.category === catSearchTags && item.h) { + if (item.d) { + div.html(label + " (" + item.h + ")
      " + + item.d + "
      "); + } else { + div.html(label + " (" + item.h + ")"); + } + } else { + if (item.m) { + div.html(item.m + "/" + label); + } else { + div.html(label); + } + } + return li; + } +}); +function rankMatch(match, category) { + if (!match) { + return NO_MATCH; + } + var index = match.index; + var input = match.input; + var leftBoundaryMatch = 2; + var periferalMatch = 0; + // make sure match is anchored on a left word boundary + if (index === 0 || /\W/.test(input[index - 1]) || "_" === input[index]) { + leftBoundaryMatch = 0; + } else if ("_" === input[index - 1] || (input[index] === input[index].toUpperCase() && !/^[A-Z0-9_$]+$/.test(input))) { + leftBoundaryMatch = 1; + } + var matchEnd = index + match[0].length; + var leftParen = input.indexOf("("); + var endOfName = leftParen > -1 ? leftParen : input.length; + // exclude peripheral matches + if (category !== catModules && category !== catSearchTags) { + var delim = category === catPackages ? "/" : "."; + if (leftParen > -1 && leftParen < index) { + periferalMatch += 2; + } else if (input.lastIndexOf(delim, endOfName) >= matchEnd) { + periferalMatch += 2; + } + } + var delta = match[0].length === endOfName ? 0 : 1; // rank full match higher than partial match + for (var i = 1; i < match.length; i++) { + // lower ranking if parts of the name are missing + if (match[i]) + delta += match[i].length; + } + if (category === catTypes) { + // lower ranking if a type name contains unmatched camel-case parts + if (/[A-Z]/.test(input.substring(matchEnd))) + delta += 5; + if (/[A-Z]/.test(input.substring(0, index))) + delta += 5; + } + return leftBoundaryMatch + periferalMatch + (delta / 200); + +} +function doSearch(request, response) { + var result = []; + searchPattern = createSearchPattern(request.term); + fallbackPattern = createSearchPattern(request.term.toLowerCase()); + if (searchPattern === "") { + return this.close(); + } + var camelCaseMatcher = createMatcher(searchPattern, ""); + var fallbackMatcher = new RegExp(fallbackPattern, "i"); + + function searchIndexWithMatcher(indexArray, matcher, category, nameFunc) { + if (indexArray) { + var newResults = []; + $.each(indexArray, function (i, item) { + item.category = category; + var ranking = rankMatch(matcher.exec(nameFunc(item)), category); + if (ranking < RANKING_THRESHOLD) { + newResults.push({ranking: ranking, item: item}); + } + return newResults.length <= MAX_RESULTS; + }); + return newResults.sort(function(e1, e2) { + return e1.ranking - e2.ranking; + }).map(function(e) { + return e.item; + }); + } + return []; + } + function searchIndex(indexArray, category, nameFunc) { + var primaryResults = searchIndexWithMatcher(indexArray, camelCaseMatcher, category, nameFunc); + result = result.concat(primaryResults); + if (primaryResults.length <= MIN_RESULTS && !camelCaseMatcher.ignoreCase) { + var secondaryResults = searchIndexWithMatcher(indexArray, fallbackMatcher, category, nameFunc); + result = result.concat(secondaryResults.filter(function (item) { + return primaryResults.indexOf(item) === -1; + })); + } + } + + searchIndex(moduleSearchIndex, catModules, function(item) { return item.l; }); + searchIndex(packageSearchIndex, catPackages, function(item) { + return (item.m && request.term.indexOf("/") > -1) + ? (item.m + "/" + item.l) : item.l; + }); + searchIndex(typeSearchIndex, catTypes, function(item) { + return request.term.indexOf(".") > -1 ? item.p + "." + item.l : item.l; + }); + searchIndex(memberSearchIndex, catMembers, function(item) { + return request.term.indexOf(".") > -1 + ? item.p + "." + item.c + "." + item.l : item.l; + }); + searchIndex(tagSearchIndex, catSearchTags, function(item) { return item.l; }); + + if (!indexFilesLoaded()) { + updateSearchResults = function() { + doSearch(request, response); + } + result.unshift(loading); + } else { + updateSearchResults = function() {}; + } + response(result); +} +$(function() { + $("#search-input").catcomplete({ + minLength: 1, + delay: 300, + source: doSearch, + response: function(event, ui) { + if (!ui.content.length) { + ui.content.push(noResult); + } else { + $("#search-input").empty(); + } + }, + autoFocus: true, + focus: function(event, ui) { + return false; + }, + position: { + collision: "flip" + }, + select: function(event, ui) { + if (ui.item.category) { + var url = getURLPrefix(ui); + if (ui.item.category === catModules) { + url += "module-summary.html"; + } else if (ui.item.category === catPackages) { + if (ui.item.u) { + url = ui.item.u; + } else { + url += ui.item.l.replace(/\./g, '/') + "/package-summary.html"; + } + } else if (ui.item.category === catTypes) { + if (ui.item.u) { + url = ui.item.u; + } else if (ui.item.p === UNNAMED) { + url += ui.item.l + ".html"; + } else { + url += ui.item.p.replace(/\./g, '/') + "/" + ui.item.l + ".html"; + } + } else if (ui.item.category === catMembers) { + if (ui.item.p === UNNAMED) { + url += ui.item.c + ".html" + "#"; + } else { + url += ui.item.p.replace(/\./g, '/') + "/" + ui.item.c + ".html" + "#"; + } + if (ui.item.u) { + url += ui.item.u; + } else { + url += ui.item.l; + } + } else if (ui.item.category === catSearchTags) { + url += ui.item.u; + } + if (top !== window) { + parent.classFrame.location = pathtoroot + url; + } else { + window.location.href = pathtoroot + url; + } + $("#search-input").focus(); + } + } + }); +}); diff --git a/doc/stylesheet.css b/doc/stylesheet.css new file mode 100644 index 0000000..836c62d --- /dev/null +++ b/doc/stylesheet.css @@ -0,0 +1,865 @@ +/* + * Javadoc style sheet + */ + +@import url('resources/fonts/dejavu.css'); + +/* + * Styles for individual HTML elements. + * + * These are styles that are specific to individual HTML elements. Changing them affects the style of a particular + * HTML element throughout the page. + */ + +body { + background-color:#ffffff; + color:#353833; + font-family:'DejaVu Sans', Arial, Helvetica, sans-serif; + font-size:14px; + margin:0; + padding:0; + height:100%; + width:100%; +} +iframe { + margin:0; + padding:0; + height:100%; + width:100%; + overflow-y:scroll; + border:none; +} +a:link, a:visited { + text-decoration:none; + color:#4A6782; +} +a[href]:hover, a[href]:focus { + text-decoration:none; + color:#bb7a2a; +} +a[name] { + color:#353833; +} +pre { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; +} +h1 { + font-size:20px; +} +h2 { + font-size:18px; +} +h3 { + font-size:16px; +} +h4 { + font-size:15px; +} +h5 { + font-size:14px; +} +h6 { + font-size:13px; +} +ul { + list-style-type:disc; +} +code, tt { + font-family:'DejaVu Sans Mono', monospace; +} +:not(h1, h2, h3, h4, h5, h6) > code, +:not(h1, h2, h3, h4, h5, h6) > tt { + font-size:14px; + padding-top:4px; + margin-top:8px; + line-height:1.4em; +} +dt code { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + padding-top:4px; +} +.summary-table dt code { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + vertical-align:top; + padding-top:4px; +} +sup { + font-size:8px; +} +button { + font-family: 'DejaVu Sans', Arial, Helvetica, sans-serif; + font-size: 14px; +} +/* + * Styles for HTML generated by javadoc. + * + * These are style classes that are used by the standard doclet to generate HTML documentation. + */ + +/* + * Styles for document title and copyright. + */ +.clear { + clear:both; + height:0; + overflow:hidden; +} +.about-language { + float:right; + padding:0 21px 8px 8px; + font-size:11px; + margin-top:-9px; + height:2.9em; +} +.legal-copy { + margin-left:.5em; +} +.tab { + background-color:#0066FF; + color:#ffffff; + padding:8px; + width:5em; + font-weight:bold; +} +/* + * Styles for navigation bar. + */ +@media screen { + .flex-box { + position:fixed; + display:flex; + flex-direction:column; + height: 100%; + width: 100%; + } + .flex-header { + flex: 0 0 auto; + } + .flex-content { + flex: 1 1 auto; + overflow-y: auto; + } +} +.top-nav { + background-color:#4D7A97; + color:#FFFFFF; + float:left; + padding:0; + width:100%; + clear:right; + min-height:2.8em; + padding-top:10px; + overflow:hidden; + font-size:12px; +} +.sub-nav { + background-color:#dee3e9; + float:left; + width:100%; + overflow:hidden; + font-size:12px; +} +.sub-nav div { + clear:left; + float:left; + padding:0 0 5px 6px; + text-transform:uppercase; +} +.sub-nav .nav-list { + padding-top:5px; +} +ul.nav-list { + display:block; + margin:0 25px 0 0; + padding:0; +} +ul.sub-nav-list { + float:left; + margin:0 25px 0 0; + padding:0; +} +ul.nav-list li { + list-style:none; + float:left; + padding: 5px 6px; + text-transform:uppercase; +} +.sub-nav .nav-list-search { + float:right; + margin:0 0 0 0; + padding:5px 6px; + clear:none; +} +.nav-list-search label { + position:relative; + right:-16px; +} +ul.sub-nav-list li { + list-style:none; + float:left; + padding-top:10px; +} +.top-nav a:link, .top-nav a:active, .top-nav a:visited { + color:#FFFFFF; + text-decoration:none; + text-transform:uppercase; +} +.top-nav a:hover { + text-decoration:none; + color:#bb7a2a; + text-transform:uppercase; +} +.nav-bar-cell1-rev { + background-color:#F8981D; + color:#253441; + margin: auto 5px; +} +.skip-nav { + position:absolute; + top:auto; + left:-9999px; + overflow:hidden; +} +/* + * Hide navigation links and search box in print layout + */ +@media print { + ul.nav-list, div.sub-nav { + display:none; + } +} +/* + * Styles for page header and footer. + */ +.title { + color:#2c4557; + margin:10px 0; +} +.sub-title { + margin:5px 0 0 0; +} +.header ul { + margin:0 0 15px 0; + padding:0; +} +.header ul li, .footer ul li { + list-style:none; + font-size:13px; +} +/* + * Styles for headings. + */ +body.class-declaration-page .summary h2, +body.class-declaration-page .details h2, +body.class-use-page h2, +body.module-declaration-page .block-list h2 { + font-style: italic; + padding:0; + margin:15px 0; +} +body.class-declaration-page .summary h3, +body.class-declaration-page .details h3, +body.class-declaration-page .summary .inherited-list h2 { + background-color:#dee3e9; + border:1px solid #d0d9e0; + margin:0 0 6px -8px; + padding:7px 5px; +} +/* + * Styles for page layout containers. + */ +main { + clear:both; + padding:10px 20px; + position:relative; +} +dl.notes > dt { + font-family: 'DejaVu Sans', Arial, Helvetica, sans-serif; + font-size:12px; + font-weight:bold; + margin:10px 0 0 0; + color:#4E4E4E; +} +dl.notes > dd { + margin:5px 10px 10px 0; + font-size:14px; + font-family:'DejaVu Serif', Georgia, "Times New Roman", Times, serif; +} +dl.name-value > dt { + margin-left:1px; + font-size:1.1em; + display:inline; + font-weight:bold; +} +dl.name-value > dd { + margin:0 0 0 1px; + font-size:1.1em; + display:inline; +} +/* + * Styles for lists. + */ +li.circle { + list-style:circle; +} +ul.horizontal li { + display:inline; + font-size:0.9em; +} +div.inheritance { + margin:0; + padding:0; +} +div.inheritance div.inheritance { + margin-left:2em; +} +ul.block-list, +ul.details-list, +ul.member-list, +ul.summary-list { + margin:10px 0 10px 0; + padding:0; +} +ul.block-list > li, +ul.details-list > li, +ul.member-list > li, +ul.summary-list > li { + list-style:none; + margin-bottom:15px; + line-height:1.4; +} +.summary-table dl, .summary-table dl dt, .summary-table dl dd { + margin-top:0; + margin-bottom:1px; +} +ul.see-list, ul.see-list-long { + padding-left: 0; + list-style: none; +} +ul.see-list li { + display: inline; +} +ul.see-list li:not(:last-child):after, +ul.see-list-long li:not(:last-child):after { + content: ", "; + white-space: pre-wrap; +} +/* + * Styles for tables. + */ +.summary-table, .details-table { + width:100%; + border-spacing:0; + border-left:1px solid #EEE; + border-right:1px solid #EEE; + border-bottom:1px solid #EEE; + padding:0; +} +.caption { + position:relative; + text-align:left; + background-repeat:no-repeat; + color:#253441; + font-weight:bold; + clear:none; + overflow:hidden; + padding:0; + padding-top:10px; + padding-left:1px; + margin:0; + white-space:pre; +} +.caption a:link, .caption a:visited { + color:#1f389c; +} +.caption a:hover, +.caption a:active { + color:#FFFFFF; +} +.caption span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + padding-bottom:7px; + display:inline-block; + float:left; + background-color:#F8981D; + border: none; + height:16px; +} +div.table-tabs { + padding:10px 0 0 1px; + margin:0; +} +div.table-tabs > button { + border: none; + cursor: pointer; + padding: 5px 12px 7px 12px; + font-weight: bold; + margin-right: 3px; +} +div.table-tabs > button.active-table-tab { + background: #F8981D; + color: #253441; +} +div.table-tabs > button.table-tab { + background: #4D7A97; + color: #FFFFFF; +} +.two-column-summary { + display: grid; + grid-template-columns: minmax(15%, max-content) minmax(15%, auto); +} +.three-column-summary { + display: grid; + grid-template-columns: minmax(10%, max-content) minmax(15%, max-content) minmax(15%, auto); +} +.four-column-summary { + display: grid; + grid-template-columns: minmax(10%, max-content) minmax(10%, max-content) minmax(10%, max-content) minmax(10%, auto); +} +@media screen and (max-width: 600px) { + .two-column-summary { + display: grid; + grid-template-columns: 1fr; + } +} +@media screen and (max-width: 800px) { + .three-column-summary { + display: grid; + grid-template-columns: minmax(10%, max-content) minmax(25%, auto); + } + .three-column-summary .col-last { + grid-column-end: span 2; + } +} +@media screen and (max-width: 1000px) { + .four-column-summary { + display: grid; + grid-template-columns: minmax(15%, max-content) minmax(15%, auto); + } +} +.summary-table > div, .details-table > div { + text-align:left; + padding: 8px 3px 3px 7px; +} +.col-first, .col-second, .col-last, .col-constructor-name, .col-summary-item-name { + vertical-align:top; + padding-right:0; + padding-top:8px; + padding-bottom:3px; +} +.table-header { + background:#dee3e9; + font-weight: bold; +} +.col-first, .col-first { + font-size:13px; +} +.col-second, .col-second, .col-last, .col-constructor-name, .col-summary-item-name, .col-last { + font-size:13px; +} +.col-first, .col-second, .col-constructor-name { + vertical-align:top; + overflow: auto; +} +.col-last { + white-space:normal; +} +.col-first a:link, .col-first a:visited, +.col-second a:link, .col-second a:visited, +.col-first a:link, .col-first a:visited, +.col-second a:link, .col-second a:visited, +.col-constructor-name a:link, .col-constructor-name a:visited, +.col-summary-item-name a:link, .col-summary-item-name a:visited, +.constant-values-container a:link, .constant-values-container a:visited, +.all-classes-container a:link, .all-classes-container a:visited, +.all-packages-container a:link, .all-packages-container a:visited { + font-weight:bold; +} +.table-sub-heading-color { + background-color:#EEEEFF; +} +.even-row-color, .even-row-color .table-header { + background-color:#FFFFFF; +} +.odd-row-color, .odd-row-color .table-header { + background-color:#EEEEEF; +} +/* + * Styles for contents. + */ +.deprecated-content { + margin:0; + padding:10px 0; +} +div.block { + font-size:14px; + font-family:'DejaVu Serif', Georgia, "Times New Roman", Times, serif; +} +.col-last div { + padding-top:0; +} +.col-last a { + padding-bottom:3px; +} +.module-signature, +.package-signature, +.type-signature, +.member-signature { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + margin:14px 0; + white-space: pre-wrap; +} +.module-signature, +.package-signature, +.type-signature { + margin-top: 0; +} +.member-signature .type-parameters-long, +.member-signature .parameters, +.member-signature .exceptions { + display: inline-block; + vertical-align: top; + white-space: pre; +} +.member-signature .type-parameters { + white-space: normal; +} +/* + * Styles for formatting effect. + */ +.source-line-no { + color:green; + padding:0 30px 0 0; +} +h1.hidden { + visibility:hidden; + overflow:hidden; + font-size:10px; +} +.block { + display:block; + margin:0 10px 5px 0; + color:#474747; +} +.deprecated-label, .descfrm-type-label, .implementation-label, .member-name-label, .member-name-link, +.module-label-in-package, .module-label-in-type, .override-specify-label, .package-label-in-type, +.package-hierarchy-label, .type-name-label, .type-name-link, .search-tag-link, .preview-label { + font-weight:bold; +} +.deprecation-comment, .help-footnote, .preview-comment { + font-style:italic; +} +.deprecation-block { + font-size:14px; + font-family:'DejaVu Serif', Georgia, "Times New Roman", Times, serif; + border-style:solid; + border-width:thin; + border-radius:10px; + padding:10px; + margin-bottom:10px; + margin-right:10px; + display:inline-block; +} +.preview-block { + font-size:14px; + font-family:'DejaVu Serif', Georgia, "Times New Roman", Times, serif; + border-style:solid; + border-width:thin; + border-radius:10px; + padding:10px; + margin-bottom:10px; + margin-right:10px; + display:inline-block; +} +div.block div.deprecation-comment { + font-style:normal; +} +/* + * Styles specific to HTML5 elements. + */ +main, nav, header, footer, section { + display:block; +} +/* + * Styles for javadoc search. + */ +.ui-autocomplete-category { + font-weight:bold; + font-size:15px; + padding:7px 0 7px 3px; + background-color:#4D7A97; + color:#FFFFFF; +} +.result-item { + font-size:13px; +} +.ui-autocomplete { + max-height:85%; + max-width:65%; + overflow-y:scroll; + overflow-x:scroll; + white-space:nowrap; + box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23); +} +ul.ui-autocomplete { + position:fixed; + z-index:999999; +} +ul.ui-autocomplete li { + float:left; + clear:both; + width:100%; +} +.result-highlight { + font-weight:bold; +} +#search-input { + background-image:url('resources/glass.png'); + background-size:13px; + background-repeat:no-repeat; + background-position:2px 3px; + padding-left:20px; + position:relative; + right:-18px; + width:400px; +} +#reset-button { + background-color: rgb(255,255,255); + background-image:url('resources/x.png'); + background-position:center; + background-repeat:no-repeat; + background-size:12px; + border:0 none; + width:16px; + height:16px; + position:relative; + left:-4px; + top:-4px; + font-size:0px; +} +.watermark { + color:#545454; +} +.search-tag-desc-result { + font-style:italic; + font-size:11px; +} +.search-tag-holder-result { + font-style:italic; + font-size:12px; +} +.search-tag-result:target { + background-color:yellow; +} +.module-graph span { + display:none; + position:absolute; +} +.module-graph:hover span { + display:block; + margin: -100px 0 0 100px; + z-index: 1; +} +.inherited-list { + margin: 10px 0 10px 0; +} +section.class-description { + line-height: 1.4; +} +.summary section[class$="-summary"], .details section[class$="-details"], +.class-uses .detail, .serialized-class-details { + padding: 0px 20px 5px 10px; + border: 1px solid #ededed; + background-color: #f8f8f8; +} +.inherited-list, section[class$="-details"] .detail { + padding:0 0 5px 8px; + background-color:#ffffff; + border:none; +} +.vertical-separator { + padding: 0 5px; +} +ul.help-section-list { + margin: 0; +} +ul.help-subtoc > li { + display: inline-block; + padding-right: 5px; + font-size: smaller; +} +ul.help-subtoc > li::before { + content: "\2022" ; + padding-right:2px; +} +span.help-note { + font-style: italic; +} +/* + * Indicator icon for external links. + */ +main a[href*="://"]::after { + content:""; + display:inline-block; + background-image:url('data:image/svg+xml; utf8, \ + \ + \ + '); + background-size:100% 100%; + width:7px; + height:7px; + margin-left:2px; + margin-bottom:4px; +} +main a[href*="://"]:hover::after, +main a[href*="://"]:focus::after { + background-image:url('data:image/svg+xml; utf8, \ + \ + \ + '); +} + +/* + * Styles for user-provided tables. + * + * borderless: + * No borders, vertical margins, styled caption. + * This style is provided for use with existing doc comments. + * In general, borderless tables should not be used for layout purposes. + * + * plain: + * Plain borders around table and cells, vertical margins, styled caption. + * Best for small tables or for complex tables for tables with cells that span + * rows and columns, when the "striped" style does not work well. + * + * striped: + * Borders around the table and vertical borders between cells, striped rows, + * vertical margins, styled caption. + * Best for tables that have a header row, and a body containing a series of simple rows. + */ + +table.borderless, +table.plain, +table.striped { + margin-top: 10px; + margin-bottom: 10px; +} +table.borderless > caption, +table.plain > caption, +table.striped > caption { + font-weight: bold; + font-size: smaller; +} +table.borderless th, table.borderless td, +table.plain th, table.plain td, +table.striped th, table.striped td { + padding: 2px 5px; +} +table.borderless, +table.borderless > thead > tr > th, table.borderless > tbody > tr > th, table.borderless > tr > th, +table.borderless > thead > tr > td, table.borderless > tbody > tr > td, table.borderless > tr > td { + border: none; +} +table.borderless > thead > tr, table.borderless > tbody > tr, table.borderless > tr { + background-color: transparent; +} +table.plain { + border-collapse: collapse; + border: 1px solid black; +} +table.plain > thead > tr, table.plain > tbody tr, table.plain > tr { + background-color: transparent; +} +table.plain > thead > tr > th, table.plain > tbody > tr > th, table.plain > tr > th, +table.plain > thead > tr > td, table.plain > tbody > tr > td, table.plain > tr > td { + border: 1px solid black; +} +table.striped { + border-collapse: collapse; + border: 1px solid black; +} +table.striped > thead { + background-color: #E3E3E3; +} +table.striped > thead > tr > th, table.striped > thead > tr > td { + border: 1px solid black; +} +table.striped > tbody > tr:nth-child(even) { + background-color: #EEE +} +table.striped > tbody > tr:nth-child(odd) { + background-color: #FFF +} +table.striped > tbody > tr > th, table.striped > tbody > tr > td { + border-left: 1px solid black; + border-right: 1px solid black; +} +table.striped > tbody > tr > th { + font-weight: normal; +} +/** + * Tweak font sizes and paddings for small screens. + */ +@media screen and (max-width: 1050px) { + #search-input { + width: 300px; + } +} +@media screen and (max-width: 800px) { + #search-input { + width: 200px; + } + .top-nav, + .bottom-nav { + font-size: 11px; + padding-top: 6px; + } + .sub-nav { + font-size: 11px; + } + .about-language { + padding-right: 16px; + } + ul.nav-list li, + .sub-nav .nav-list-search { + padding: 6px; + } + ul.sub-nav-list li { + padding-top: 5px; + } + main { + padding: 10px; + } + .summary section[class$="-summary"], .details section[class$="-details"], + .class-uses .detail, .serialized-class-details { + padding: 0 8px 5px 8px; + } + body { + -webkit-text-size-adjust: none; + } +} +@media screen and (max-width: 500px) { + #search-input { + width: 150px; + } + .top-nav, + .bottom-nav { + font-size: 10px; + } + .sub-nav { + font-size: 10px; + } + .about-language { + font-size: 10px; + padding-right: 12px; + } +} diff --git a/doc/tag-search-index.js b/doc/tag-search-index.js new file mode 100644 index 0000000..0367dae --- /dev/null +++ b/doc/tag-search-index.js @@ -0,0 +1 @@ +tagSearchIndex = [];updateSearchResults(); \ No newline at end of file diff --git a/doc/type-search-index.js b/doc/type-search-index.js new file mode 100644 index 0000000..ad9d7fa --- /dev/null +++ b/doc/type-search-index.js @@ -0,0 +1 @@ +typeSearchIndex = [{"l":"All Classes and Interfaces","u":"allclasses-index.html"},{"p":"main.java.model.file","l":"FileStrategy"}];updateSearchResults(); \ No newline at end of file diff --git a/src/main/java/application/MainSBS.java b/src/main/java/application/MainSBS.java index 99839c9..e2eca4f 100644 --- a/src/main/java/application/MainSBS.java +++ b/src/main/java/application/MainSBS.java @@ -7,7 +7,7 @@ public class MainSBS { public static void main(String[] args) { try { - HomeView home = new HomeView(false); + HomeView home = new HomeView(0); home.display(); } catch (Exception e) { e.printStackTrace(); diff --git a/src/main/java/controller/InvoiceController.java b/src/main/java/controller/InvoiceController.java index 3f14ce1..0d25360 100644 --- a/src/main/java/controller/InvoiceController.java +++ b/src/main/java/controller/InvoiceController.java @@ -2,13 +2,37 @@ public interface InvoiceController { + /** + * Create new item line for the shop cart. + * @param itemId + * @param qty + * @return the line created + */ String createInvoiceItem(String itemId, String qty); + /** + * Once the cart is ready to checkout, it calculate the total price. + * @return The total price + */ Double calculateTotal(); + /** + * Add the new invoice line to the cart. + * @param cartLine + * @return false if something went wrong + */ boolean addToCart(String cartLine); + /** + * Removes all the data from the cart. + * @return false if something went wrong + */ boolean newInvoice(); + /** + * For each item in cart, it recalculate the unsold stock. + * After that, it cleans the cart. + * @return false if something went wrong + */ boolean checkout(); } diff --git a/src/main/java/controller/InvoiceControllerImpl.java b/src/main/java/controller/InvoiceControllerImpl.java index bf143b1..f65dc15 100644 --- a/src/main/java/controller/InvoiceControllerImpl.java +++ b/src/main/java/controller/InvoiceControllerImpl.java @@ -11,6 +11,9 @@ public class InvoiceControllerImpl implements InvoiceController{ private FileStrategy fileInvoice = new FileInvoiceImpl(); ItemController itemController = new ItemControllerImpl(); + /** + * {@inheritDoc} + */ @Override public String createInvoiceItem(String itemId, String qty) { Item item = itemController.searchItem(itemId); @@ -20,6 +23,9 @@ public String createInvoiceItem(String itemId, String qty) { return invoiceLine; } + /** + * {@inheritDoc} + */ @Override public Double calculateTotal() { Double cartTotal = 0.0; @@ -40,16 +46,25 @@ public Double calculateTotal() { return cartTotal; } + /** + * {@inheritDoc} + */ @Override public boolean addToCart(String cartLine) { return fileInvoice.writeInFile(cartLine); } + /** + * {@inheritDoc} + */ @Override public boolean newInvoice() { return fileInvoice.emptyFile(); } + /** + * {@inheritDoc} + */ @Override public boolean checkout() { try { diff --git a/src/main/java/controller/ItemControllerImpl.java b/src/main/java/controller/ItemControllerImpl.java index 69f5dc2..4124430 100644 --- a/src/main/java/controller/ItemControllerImpl.java +++ b/src/main/java/controller/ItemControllerImpl.java @@ -29,6 +29,9 @@ public static ItemControllerImpl getInstance() { return single_instance; } + /** + * {@inheritDoc} + */ @Override public boolean addItem(Item newItem) { if (!exists(newItem.getBarcode())) { @@ -39,6 +42,9 @@ public boolean addItem(Item newItem) { } } + /** + * {@inheritDoc} + */ @Override public Item searchItem(String barcode) { String itemLine = file.searchInFile(barcode.toLowerCase()); @@ -50,6 +56,9 @@ public Item searchItem(String barcode) { } } + /** + * {@inheritDoc} + */ @Override public void updateItem(Item updatedItem) { var id = updatedItem.getBarcode(); @@ -59,6 +68,9 @@ public void updateItem(Item updatedItem) { addItem(updatedItem); } + /** + * {@inheritDoc} + */ @Override public boolean deleteItem(String barcode) { if (exists(barcode)) { @@ -68,6 +80,11 @@ public boolean deleteItem(String barcode) { return false; } + /** + * {@inheritDoc} + * @param itemLine + * @return + */ private Item composeItem(String itemLine) { String[] data = itemLine.split(";"); @@ -82,6 +99,11 @@ private Item composeItem(String itemLine) { return item; } + /** + * {@inheritDoc} + * @param barcode + * @return + */ private boolean exists(String barcode) { try { String itemLine = file.searchInFile(barcode.toLowerCase()); @@ -96,12 +118,18 @@ private boolean exists(String barcode) { } } + /** + * {@inheritDoc} + */ @Override public Set getAllId() { Set ls = file.getAllId(); return ls; } + /** + * {@inheritDoc} + */ @Override public Set fromOneToQuantity(Item item) { Set qtys = new HashSet<>(); @@ -112,6 +140,9 @@ public Set fromOneToQuantity(Item item) { return qtys; } + /** + * {@inheritDoc} + */ @Override public void recalculateQuantity(String barcode, int nSold) { Item i = searchItem(barcode); @@ -122,6 +153,9 @@ public void recalculateQuantity(String barcode, int nSold) { updateItem(itemToUpdate); } + /** + * {@inheritDoc} + */ @Override public Set showUnsold() { Set ides = getAllId(); diff --git a/src/main/java/controller/ShopController.java b/src/main/java/controller/ShopController.java index 19689b0..4622f20 100644 --- a/src/main/java/controller/ShopController.java +++ b/src/main/java/controller/ShopController.java @@ -4,7 +4,17 @@ public interface ShopController { + /** + * Create and Add a new purchase line to the file. + * @param userId + * @param tot + * @return false if something went wrong + */ boolean addPayment(int userId, Double tot); + /** + * Shows all purchases. + * @return a Set with every purchase line. + */ Set showPayments(); } diff --git a/src/main/java/controller/ShopControllerImpl.java b/src/main/java/controller/ShopControllerImpl.java index 6501b9e..489c312 100644 --- a/src/main/java/controller/ShopControllerImpl.java +++ b/src/main/java/controller/ShopControllerImpl.java @@ -15,6 +15,9 @@ public class ShopControllerImpl implements ShopController { private FileStrategy fileShop = new FileShopImpl(); private UserController userController = new UserControllerImpl(); + /** + * {@inheritDoc} + */ @Override public boolean addPayment(int userId, Double tot) { DateTimeFormatter formatter = DateTimeFormatter @@ -22,10 +25,13 @@ public boolean addPayment(int userId, Double tot) { .withZone(ZoneId.from(ZoneOffset.UTC)); String time = formatter.format(Instant.now()); User u = userController.searchUser(userId); - String paymentLine = time + "\t" + userId + "\t" + u.getName() + " " + u.getLastname() + "\t" + tot + "\n"; + String paymentLine = time + "\t" + userId + "\t" + u.getName() + " " + u.getLastname() + "\t\t" + tot + "\n"; return fileShop.writeInFile(paymentLine); } + /** + * {@inheritDoc} + */ @Override public Set showPayments() { Set payments = fileShop.fileReader(); diff --git a/src/main/java/controller/UserController.java b/src/main/java/controller/UserController.java index 6a8382c..f931065 100644 --- a/src/main/java/controller/UserController.java +++ b/src/main/java/controller/UserController.java @@ -40,4 +40,16 @@ public interface UserController { */ Set getAllId(); + /** + * Get the Id of logged user + * @return the id as int + */ + int getIdUserLogged(); + + /** + * Set the Id of logged user + * @param idLogged as int + */ + public boolean setUserLogged(int idLogged); + } diff --git a/src/main/java/controller/UserControllerImpl.java b/src/main/java/controller/UserControllerImpl.java index 7f8c0f7..6836b14 100644 --- a/src/main/java/controller/UserControllerImpl.java +++ b/src/main/java/controller/UserControllerImpl.java @@ -13,9 +13,9 @@ public class UserControllerImpl implements UserController{ private User user; - private String name, lastname, description, city; + private String password, name, lastname, description, city; private UserRole role; - private int id; + private int id, loggedId; protected boolean isAdmin, isCustomer; private FileStrategy file = new FileUserImpl(); @@ -28,8 +28,11 @@ public static UserControllerImpl getInstance() { return single_instance; } + /** + * {@inheritDoc} + */ @Override - public boolean addUser(User newUser) { + public boolean addUser(final User newUser) { if (!exists(newUser.getId())) { file.writeInFile(newUser.toString()); return true; @@ -38,8 +41,11 @@ public boolean addUser(User newUser) { } } + /** + * {@inheritDoc} + */ @Override - public User searchUser(int userId) { + public User searchUser(final int userId) { String userLine = file.searchInFile(String.valueOf(userId)); if (!StringUtils.isBlank(userLine)) { User u = composeUser(userLine); @@ -49,8 +55,11 @@ public User searchUser(int userId) { } } + /** + * {@inheritDoc} + */ @Override - public void updateUser(User updatedUser) { + public void updateUser(final User updatedUser) { var id = updatedUser.getId(); if (exists(id)) { deleteUser(id); @@ -58,8 +67,11 @@ public void updateUser(User updatedUser) { addUser(updatedUser); } + /** + * {@inheritDoc} + */ @Override - public boolean deleteUser(int userId) { + public boolean deleteUser(final int userId) { if (exists(userId)) { file.deleteLine(String.valueOf(userId)); return true; @@ -67,17 +79,23 @@ public boolean deleteUser(int userId) { return false; } - private User composeUser(String userLine) { + /** + * {@inheritDoc} + * @param userLine + * @return + */ + private User composeUser(final String userLine) { String[] data = userLine.split(";"); id = Integer.parseInt(data[0]); + password = data[6]; name = data[1]; lastname = data[2]; description = data[3]; role = UserRole.valueOf(data[4].toUpperCase()); city = data[5]; - user = new UserImpl.UserBuilder(id) + user = new UserImpl.UserBuilder(id, password) .name(name) .lastname(lastname) .city(city) @@ -88,7 +106,12 @@ private User composeUser(String userLine) { return user; } - private boolean exists(int id) { + /** + * {@inheritDoc} + * @param id + * @return + */ + private boolean exists(final int id) { try { String strId = String.valueOf(id); String userLine = file.searchInFile(strId); @@ -103,10 +126,30 @@ private boolean exists(int id) { } } + /** + * {@inheritDoc} + */ @Override public Set getAllId() { Set ls = file.getAllId(); return ls; } + + /** + * {@inheritDoc} + */ + @Override + public int getIdUserLogged() { + return this.loggedId; + } + + /** + * {@inheritDoc} + */ + @Override + public boolean setUserLogged(final int idLogged) { + this.loggedId = idLogged; + return true; + } } diff --git a/src/main/java/model/Item.java b/src/main/java/model/Item.java index c17dade..01d974c 100644 --- a/src/main/java/model/Item.java +++ b/src/main/java/model/Item.java @@ -6,25 +6,25 @@ public interface Item { * Get name of selected interface object. * @return a string with the name. */ - public String getName(); + String getName(); /** * Get barcode of selected item. * @return a string with the barcode. */ - public String getBarcode(); + String getBarcode(); /** * Get quantity of selected item. * @return an int with the quantity. */ - public int getQuantity(); + int getQuantity(); /** * Get unit price of selected item. * @return a double with price per unit. */ - public double getUnitPrice(); + double getUnitPrice(); /** * Get category of selected item. diff --git a/src/main/java/model/ItemCategory.java b/src/main/java/model/ItemCategory.java index c7962fd..e62f9d2 100644 --- a/src/main/java/model/ItemCategory.java +++ b/src/main/java/model/ItemCategory.java @@ -1,7 +1,6 @@ package main.java.model; public enum ItemCategory { - SELECT, BIO, VEGETABLES, FRUITS, diff --git a/src/main/java/model/ItemImpl.java b/src/main/java/model/ItemImpl.java index c205901..6d89b24 100644 --- a/src/main/java/model/ItemImpl.java +++ b/src/main/java/model/ItemImpl.java @@ -15,17 +15,8 @@ public class ItemImpl implements Item{ private Date receivedDate, expirationDate; private ItemCategory category; -// public ItemImpl(ItemBuilder builder) { -// this.barcode = builder.barcode; -// this.productName = builder.productName; -// this.quantity = builder.quantity; -// this.unitPrice = builder.unitPrice; -// this.receivedDate = stringToDate(builder.receivedDate); -// } - public ItemImpl(String barcode, String productName, int quantity, double unitPrice, Date receivedDate, Date expirationDate, ItemCategory category) { -// this.barcode = UUID.randomUUID().toString(); this.barcode = barcode; this.productName = productName; this.quantity = quantity; @@ -35,6 +26,9 @@ public ItemImpl(String barcode, String productName, int quantity, double unitPri this.category = category; } + /** + * {@inheritDoc} + */ @Override public String toString() { String s = barcode + ATTR_SEP + productName + ATTR_SEP + quantity @@ -43,36 +37,61 @@ public String toString() { return s.toLowerCase(); } + /** + * {@inheritDoc} + */ @Override public String getBarcode() { return this.barcode; } + /** + * {@inheritDoc} + */ @Override public String getName() { return this.productName; } + /** + * {@inheritDoc} + */ @Override public int getQuantity() { return this.quantity; } + /** + * {@inheritDoc} + */ @Override public double getUnitPrice() { return this.unitPrice; } + /** + * {@inheritDoc} + */ @Override public ItemCategory getCategory() { return category; } + /** + * {@inheritDoc} + * @param date + * @return + */ protected static String dateToString(Date date) { String ds = date.toString(); return ds; } + /** + * {@inheritDoc} + * @param receivedDate + * @return + */ protected static Date stringToDate(String receivedDate) { Date date = null; try { @@ -82,59 +101,5 @@ protected static Date stringToDate(String receivedDate) { e.printStackTrace(); } return date; - } - -// public static class ItemBuilder { -// private String barcode; -// private String productName; -// private int quantity; -// private double unitPrice; -// private Optional receivedDate = Optional.empty(); -// private Optional expirationDate = Optional.empty(); -// private ItemCategory category; -// -// public ItemBuilder barcode(String barcode) { -// this.barcode = UUID.randomUUID().toString(); -// return this; -// } -// -// public ItemBuilder productName(String name) { -// this.productName = name; -// return this; -// } -// -// public ItemBuilder quantity(int quantity) { -// this.quantity = quantity; -// return this; -// } -// -// public ItemBuilder unitPrice(double unitPrice) { -// this.unitPrice = unitPrice; -// return this; -// } -// -// public ItemBuilder receivedDate(Date receivedDate) { -// this.receivedDate = Optional.ofNullable(dateToString(receivedDate)); -// return this; -// } -// -// public ItemBuilder expirationDate(Date expirationDate) { -// this.expirationDate = Optional.ofNullable(dateToString(expirationDate)); -// return this; -// } -// -// public ItemBuilder category(ItemCategory category) { -// this.category = category; -// return this; -// } -// -// public Item build() throws IllegalStateException{ -//// if (this.firstname == null || this.lastname == null){ -//// throw new IllegalStateException(""); -//// } -// return new ItemImpl(this); -// } -// -// } - + } } diff --git a/src/main/java/model/Model.java b/src/main/java/model/Model.java deleted file mode 100644 index dfe46b2..0000000 --- a/src/main/java/model/Model.java +++ /dev/null @@ -1,25 +0,0 @@ -package main.java.model; - -import java.util.Optional; - - -public interface Model { - - /** - * - * @return an optional which is full only if a user is logged - */ - Optional getLoggedUser(); - - /** - * - * @param user the user to be set as current user - */ - void setCurrentUser(User user); - - /** - * Un-sets the current user. - */ - void unsetCurrentUser(); - -} diff --git a/src/main/java/model/ModelImpl.java b/src/main/java/model/ModelImpl.java deleted file mode 100644 index d68194b..0000000 --- a/src/main/java/model/ModelImpl.java +++ /dev/null @@ -1,25 +0,0 @@ -package main.java.model; - -import java.util.Optional; - - -public class ModelImpl implements Model { - - private Optional currentUser = Optional.empty(); - - @Override - public Optional getLoggedUser() { - return this.currentUser; - } - - @Override - public void setCurrentUser(User user) { - this.currentUser = Optional.of(user); - } - - @Override - public void unsetCurrentUser() { - this.currentUser = Optional.empty(); - } - -} diff --git a/src/main/java/model/ShoppingCart.java b/src/main/java/model/ShoppingCart.java index 1dfbb36..a048d9e 100644 --- a/src/main/java/model/ShoppingCart.java +++ b/src/main/java/model/ShoppingCart.java @@ -2,18 +2,22 @@ public interface ShoppingCart { + /** + * Add to the shop cart a new Item. + * @param item + */ void addToCart(Item item); - void showCart(); - + /** + * Remove the passed Item from shop cart. + * @param item + */ void removeFromCart(Item item); + /** + * Calculate the total price by iterating all the Cart Items. + * @return a double value + */ double getTotalAmount(); - public double getDiscountedAmount(); - - void addDiscount(double discount); - - void printInvoice(); - } diff --git a/src/main/java/model/ShoppingCartImpl.java b/src/main/java/model/ShoppingCartImpl.java index afc6428..eedc22d 100644 --- a/src/main/java/model/ShoppingCartImpl.java +++ b/src/main/java/model/ShoppingCartImpl.java @@ -19,20 +19,17 @@ public ShoppingCartImpl() { this.tax = 0.22; } + /** + * {@inheritDoc} + */ @Override public void addToCart(Item item) { this.items.add(item); } - @Override - public void showCart() { - ListIterator iterator = items.listIterator(); - while(iterator.hasNext()) { - Item item1 = iterator.next(); - System.out.println(item1); - } - } - + /** + * {@inheritDoc} + */ @Override public void removeFromCart(Item itemToDelete) { ListIterator iterator = items.listIterator(); @@ -45,6 +42,9 @@ public void removeFromCart(Item itemToDelete) { } } + /** + * {@inheritDoc} + */ @Override public double getTotalAmount() { ListIterator iterator = items.listIterator(); @@ -53,42 +53,8 @@ public double getTotalAmount() { Item item = iterator.next(); this.totalAmount = this.totalAmount + (item.getUnitPrice() * item.getQuantity()); } - if (this.discount > 0){ - getDiscountedAmount(); - } return this.totalAmount; } - - @Override - public double getDiscountedAmount() { - this.toDiscount = this.totalAmount * this.discount; - this.discountedAmount = this.totalAmount - this.toDiscount; - return this.discountedAmount; - } - - @Override - public void addDiscount(double discount) { - this.discount = discount; - } - - @Override - public void printInvoice() { - ListIterator iterator = items.listIterator(); - while(iterator.hasNext()) { - Item item = iterator.next(); - System.out.print(item.getName() + "\t"); - System.out.print(item.getQuantity() + "\t"); - System.out.print(item.getUnitPrice() + "\t"); - System.out.println(item.getUnitPrice() * item.getQuantity()); - } - this.addDiscount(this.discount); - this.getTotalAmount(); - System.out.println("\t\t\t" + "Ammount : " + this.totalAmount); - System.out.println("\t\t\t" + "Discount : -" + this.toDiscount); - System.out.println("\t\t\t" + "Tax : " + this.tax); - System.out.println("\t\t\t" + "Total : " + this.discountedAmount); - } - } diff --git a/src/main/java/model/User.java b/src/main/java/model/User.java index e3179c9..7e8d5ce 100644 --- a/src/main/java/model/User.java +++ b/src/main/java/model/User.java @@ -5,24 +5,50 @@ public interface User { /** - * Get id of selected user. + * Returns id of calling user. * @return a string with the id. */ - public int getId(); + int getId(); /** - * Get name of selected interface object. + * Returns password of calling user. + * @return + */ + String getPassword(); + + /** + * Returns the name of calling user. * @return a string with the name. */ - public String getName(); + String getName(); - public String getLastname(); + /** + * Returns lastname of calling user. + * @return + */ + String getLastname(); - public Optional getCity(); + /** + * Returns the city where the calling user lives. + * @return + */ + Optional getCity(); - public UserRole getRole(); + /** + * Returns the role of calling User. + * @return a value from enum UserRole + */ + UserRole getRole(); - public Optional getDescription(); + /** + * Returns the description of calling user. + * @return + */ + Optional getDescription(); - public String toString(); + /** + * Return the user as string. This is the format that will be used to print on db files. + * @return + */ + String toString(); } diff --git a/src/main/java/model/UserImpl.java b/src/main/java/model/UserImpl.java index 23c618d..8dbea04 100644 --- a/src/main/java/model/UserImpl.java +++ b/src/main/java/model/UserImpl.java @@ -7,7 +7,7 @@ public class UserImpl implements User{ private static final char ATTR_SEP = File.pathSeparatorChar; - private final String firstname, lastname; + private final String firstname, lastname, password; Optional description; Optional city; private int id; @@ -20,13 +20,18 @@ private UserImpl(UserBuilder builder) { this.city = builder.city; this.role = builder.role; this.description = builder.description; + this.password = builder.password; } @Override public String getName() { return this.firstname; } - + + public String getPassword() { + return this.password; + } + @Override public String getLastname() { return this.lastname; @@ -55,20 +60,21 @@ public int getId() { @Override public String toString() { String s = String.valueOf(id) + ATTR_SEP + firstname + ATTR_SEP + lastname + ATTR_SEP - + description.get() + ATTR_SEP + role + ATTR_SEP + city.get() + ATTR_SEP + "end"; + + description.get() + ATTR_SEP + role + ATTR_SEP + city.get() + ATTR_SEP + password; return s.toLowerCase(); } public static class UserBuilder { - private String firstname, lastname; + private String firstname, lastname, password; private Optional city = Optional.empty(); private UserRole role; private Optional description = Optional.empty(); private int id; - public UserBuilder(int id) { + public UserBuilder(int id, String password) { this.id = id; + this.password = password; } public UserBuilder name(String firstname) { @@ -96,10 +102,7 @@ public UserBuilder description(String description) { return this; } - public User build() throws IllegalStateException{ -// if (this.firstname == null || this.lastname == null){ -// throw new IllegalStateException(""); -// } + public User build() { return new UserImpl(this); } diff --git a/src/main/java/model/UserRole.java b/src/main/java/model/UserRole.java index 7b24f2a..f184342 100644 --- a/src/main/java/model/UserRole.java +++ b/src/main/java/model/UserRole.java @@ -1,7 +1,6 @@ package main.java.model; public enum UserRole { - SELECT, MANAGER, CASHIER, CUSTOMER diff --git a/src/main/java/model/file/FileStrategy.java b/src/main/java/model/file/FileStrategy.java index ff5519e..5b35984 100644 --- a/src/main/java/model/file/FileStrategy.java +++ b/src/main/java/model/file/FileStrategy.java @@ -4,15 +4,43 @@ public interface FileStrategy { + /** + * Uses a buffer to read each line from file. + * @return return each line read as a Set of String + */ Set fileReader(); + /** + * Uses a buffer to write a new line on file. + * @param objectToString to write + * @return false is something went wrong + */ boolean writeInFile(final String objectToString); + /** + * Search a String target on the first data in each line of the file. + * @param target to look for + * @return the complete line who contains the target inside the first information. + */ String searchInFile(String target); + /** + * It deletes the line that contain as the first data the target setted as parameter. + * @param target to delete + * @return false if something went wrong + */ boolean deleteLine(String target); + /** + * It cleans the file. + * @return false if something went wrong + */ boolean emptyFile(); + /** + * Calls fileReader() method and from its output it takes all the IDs. + * {@link fileReader()} + * @return a Set of String containing the IDs + */ Set getAllId(); } diff --git a/src/main/java/view/AccountingView.java b/src/main/java/view/AccountingView.java index 4607349..cc9b4a1 100644 --- a/src/main/java/view/AccountingView.java +++ b/src/main/java/view/AccountingView.java @@ -11,15 +11,20 @@ import javax.swing.JPanel; import javax.swing.border.EmptyBorder; +import main.java.controller.UserController; +import main.java.controller.UserControllerImpl; + public class AccountingView extends JFrame{ private static final long serialVersionUID = 8308931027188591302L; private JPanel contentPane; - + private UserController userController = new UserControllerImpl(); + /** * Create the frame. */ - public AccountingView() { + public AccountingView(final int loggedId) { + userController.setUserLogged(loggedId); setTitle("Accounting"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(620, 280, 744, 611); @@ -33,7 +38,7 @@ public AccountingView() { btnCancel.setBounds(610, 520, 117, 25); btnCancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { - ManagementView screen = new ManagementView(); + ManagementView screen = new ManagementView(loggedId); setVisible(false); screen.display(); } @@ -46,7 +51,7 @@ public void actionPerformed(ActionEvent arg0) { btnSalaries.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { setVisible(false); - PurchaseReportView screen= new PurchaseReportView(); + PurchaseReportView screen= new PurchaseReportView(loggedId); screen.display(); } }); @@ -58,7 +63,7 @@ public void actionPerformed(ActionEvent e) { btnPaymentMethood.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { setVisible(false); - ItemReportView screen= new ItemReportView(); + ItemReportView screen= new ItemReportView(loggedId); screen.display(); } }); diff --git a/src/main/java/view/AddCustomerView.java b/src/main/java/view/AddCustomerView.java index 7a2cf2d..4ec6dfc 100644 --- a/src/main/java/view/AddCustomerView.java +++ b/src/main/java/view/AddCustomerView.java @@ -30,19 +30,21 @@ public class AddCustomerView extends JFrame{ private static final long serialVersionUID = 2826400392768057297L; private JPanel contentPane; private JTextField textField_Id; + private JTextField textField_Psw; private JTextField textField_Name; private JTextField textField_LastName; private JTextField textField_City; private JTextField textField_Description; - private JComboBox comboBox_Role; + private JComboBox comboBox_Role = new JComboBox<>(); - UserController controller = new UserControllerImpl(); + private UserController userController = new UserControllerImpl(); - private String name, lastname, city, description; + private String password, name, lastname, city, description; private UserRole role; private int id; - public AddCustomerView() { + public AddCustomerView(final int loggedId) { + userController.setUserLogged(loggedId); setTitle("Add Customer"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(620, 280, 550, 450); @@ -57,29 +59,34 @@ public AddCustomerView() { lblId.setBounds(12, 13, 79, 22); contentPane.add(lblId); + JLabel lblPwd = new JLabel("Password: *"); + lblPwd.setFont(new Font("Tahoma", Font.BOLD, 13)); + lblPwd.setBounds(12, 46, 100, 22); + contentPane.add(lblPwd); + JLabel lblFirstName = new JLabel("Name: *"); lblFirstName.setFont(new Font("Tahoma", Font.BOLD, 13)); - lblFirstName.setBounds(12, 48, 79, 22); + lblFirstName.setBounds(12, 79, 79, 22); contentPane.add(lblFirstName); JLabel lblLastName = new JLabel("LastName:"); lblLastName.setFont(new Font("Tahoma", Font.BOLD, 13)); - lblLastName.setBounds(12, 81, 100, 22); + lblLastName.setBounds(12, 112, 100, 22); contentPane.add(lblLastName); JLabel lblCity = new JLabel("City:"); lblCity.setFont(new Font("Tahoma", Font.BOLD, 13)); - lblCity.setBounds(12, 116, 80, 22); + lblCity.setBounds(12, 145, 80, 22); contentPane.add(lblCity); JLabel lblRole = new JLabel("Role:"); lblRole.setFont(new Font("Tahoma", Font.BOLD, 13)); - lblRole.setBounds(12, 151, 80, 22); + lblRole.setBounds(12, 178, 80, 22); contentPane.add(lblRole); JLabel lblDescription = new JLabel("Description:"); lblDescription.setFont(new Font("Tahoma", Font.BOLD, 13)); - lblDescription.setBounds(12, 186, 100, 22); + lblDescription.setBounds(12, 212, 100, 22); contentPane.add(lblDescription); JButton btnBack = new JButton("Back"); @@ -87,7 +94,7 @@ public AddCustomerView() { btnBack.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { setVisible(false); - CustomerView screen = new CustomerView(); + CustomerView screen = new CustomerView(loggedId); screen.display(); } }); @@ -105,36 +112,41 @@ public void actionPerformed(ActionEvent e) { textField_Id.setBounds(143, 12, 144, 22); contentPane.add(textField_Id); + textField_Psw = new JTextField(); + textField_Psw.setFont(new Font("Tahoma", Font.BOLD, 14)); + textField_Psw.setColumns(10); + textField_Psw.setBounds(143, 46, 144, 22); + contentPane.add(textField_Psw); + textField_Name = new JTextField(); textField_Name.setFont(new Font("Tahoma", Font.BOLD, 14)); textField_Name.setColumns(10); - textField_Name.setBounds(143, 47, 144, 22); + textField_Name.setBounds(143, 80, 144, 22); contentPane.add(textField_Name); textField_LastName = new JTextField(); textField_LastName.setFont(new Font("Tahoma", Font.BOLD, 14)); textField_LastName.setColumns(10); - textField_LastName.setBounds(143, 80, 144, 22); + textField_LastName.setBounds(143, 115, 144, 22); contentPane.add(textField_LastName); textField_City = new JTextField(); textField_City.setFont(new Font("Tahoma", Font.BOLD, 14)); textField_City.setColumns(10); - textField_City.setBounds(143, 115, 144, 22); + textField_City.setBounds(143, 149, 144, 22); contentPane.add(textField_City); - - comboBox_Role = new JComboBox<>(); + comboBox_Role.setFont(new Font("Tahoma", Font.BOLD, 14)); comboBox_Role.setModel(new DefaultComboBoxModel(UserRole.values())); comboBox_Role.setSelectedItem(UserRole.CUSTOMER); - comboBox_Role.enable(false); - comboBox_Role.setBounds(143, 151, 144, 22); + comboBox_Role.setEnabled(false); + comboBox_Role.setBounds(143, 184, 144, 22); contentPane.add(comboBox_Role); textField_Description = new JTextField(); textField_Description.setFont(new Font("Tahoma", Font.BOLD, 14)); textField_Description.setColumns(10); - textField_Description.setBounds(143, 186, 144, 50); + textField_Description.setBounds(143, 219, 144, 50); contentPane.add(textField_Description); JButton btnAdd = new JButton("Add"); @@ -143,37 +155,42 @@ public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent arg0) { try { String strId = textField_Id.getText(); + password = textField_Psw.getText(); name = textField_Name.getText(); - lastname = textField_LastName.getText(); - city = textField_City.getText(); - role = UserRole.valueOf(String.valueOf(comboBox_Role.getSelectedItem()).toUpperCase()); - description = textField_Description.getText(); - if (!strId.isBlank() && !name.isBlank()) { + if ((!strId.isBlank()) && (!password.isBlank()) && (!name.isBlank())) { id = Integer.parseInt(strId); - - User user = new UserImpl.UserBuilder(id) - .name(name) - .lastname(lastname) - .city(city) - .role(role) - .description(description) - .build(); - - if (controller.addUser(user)) { - JOptionPane.showMessageDialog(null, "The Customer was added to the database"); - textField_Id.setText("0"); - textField_Name.setText(""); - textField_LastName.setText(""); - textField_City.setText(""); - comboBox_Role.setSelectedIndex(0); - textField_Description.setText(""); - } else { - JOptionPane.showMessageDialog(null, "The ID is already in the database"); + if(id>0) { + lastname = textField_LastName.getText(); + city = textField_City.getText(); + role = UserRole.valueOf(String.valueOf(comboBox_Role.getSelectedItem()).toUpperCase()); + description = textField_Description.getText(); + + User user = new UserImpl.UserBuilder(id, password) + .name(name) + .lastname(lastname) + .city(city) + .role(role) + .description(description) + .build(); + + if (userController.addUser(user)) { + JOptionPane.showMessageDialog(null, "The Customer was added to the database"); + textField_Psw.setText(""); + textField_Name.setText(""); + textField_LastName.setText(""); + textField_City.setText(""); + textField_Description.setText(""); + } else { + JOptionPane.showMessageDialog(null, "The ID is already in the database"); + } + } else { + JOptionPane.showMessageDialog(null, "User Id mus be greater than zero."); } + textField_Id.setText("0"); } else { - JOptionPane.showMessageDialog(null, "User Id and Name must be filled to complete the operation."); - } + JOptionPane.showMessageDialog(null, "User Id, Password and Name must be filled to complete the operation."); + } } catch (Exception e) { e.printStackTrace(); } diff --git a/src/main/java/view/AddItemView.java b/src/main/java/view/AddItemView.java index c076616..6b0f0b5 100644 --- a/src/main/java/view/AddItemView.java +++ b/src/main/java/view/AddItemView.java @@ -25,6 +25,8 @@ import main.java.controller.ItemController; import main.java.controller.ItemControllerImpl; +import main.java.controller.UserController; +import main.java.controller.UserControllerImpl; import main.java.model.Item; import main.java.model.ItemCategory; import main.java.model.ItemImpl; @@ -33,7 +35,8 @@ public class AddItemView extends JFrame{ private static final long serialVersionUID = -4391439102930446102L; - ItemController controller = new ItemControllerImpl(); + private ItemController controller = new ItemControllerImpl(); + private UserController userController = new UserControllerImpl(); private JPanel contentPane; private JTextField textField_ID; @@ -48,7 +51,8 @@ public class AddItemView extends JFrame{ /** * Create the frame. */ - public AddItemView() { + public AddItemView(final int loggedId) { + userController.setUserLogged(loggedId); setTitle("Add Product"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(620, 280, 550, 450); @@ -171,7 +175,7 @@ public void actionPerformed(ActionEvent a) { btnBack.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { setVisible(false); - ItemView screen = new ItemView(); + ItemView screen = new ItemView(loggedId); screen.display(); } }); diff --git a/src/main/java/view/AddUserView.java b/src/main/java/view/AddUserView.java index c4573b1..7195751 100644 --- a/src/main/java/view/AddUserView.java +++ b/src/main/java/view/AddUserView.java @@ -31,19 +31,21 @@ public class AddUserView extends JFrame{ private JPanel contentPane; private JTextField textField_Id; + private JTextField textField_Psw; private JTextField textField_Name; private JTextField textField_LastName; private JTextField textField_City; private JTextField textField_Description; private JComboBox comboBox_Role = new JComboBox<>(); - UserController controller = new UserControllerImpl(); + UserController userController = new UserControllerImpl(); - private String name, lastname, city, description; + private String password, name, lastname, city, description; private UserRole role; private int id; - public AddUserView() { + public AddUserView(final int loggedId) { + userController.setUserLogged(loggedId); setTitle("Add User"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(620, 280, 550, 450); @@ -58,29 +60,34 @@ public AddUserView() { lblId.setBounds(12, 13, 79, 22); contentPane.add(lblId); + JLabel lblPwd = new JLabel("Password: *"); + lblPwd.setFont(new Font("Tahoma", Font.BOLD, 13)); + lblPwd.setBounds(12, 46, 100, 22); + contentPane.add(lblPwd); + JLabel lblFirstName = new JLabel("Name: *"); lblFirstName.setFont(new Font("Tahoma", Font.BOLD, 13)); - lblFirstName.setBounds(12, 48, 79, 22); + lblFirstName.setBounds(12, 79, 79, 22); contentPane.add(lblFirstName); JLabel lblLastName = new JLabel("LastName:"); lblLastName.setFont(new Font("Tahoma", Font.BOLD, 13)); - lblLastName.setBounds(12, 81, 100, 22); + lblLastName.setBounds(12, 112, 100, 22); contentPane.add(lblLastName); JLabel lblCity = new JLabel("City:"); lblCity.setFont(new Font("Tahoma", Font.BOLD, 13)); - lblCity.setBounds(12, 116, 80, 22); + lblCity.setBounds(12, 145, 80, 22); contentPane.add(lblCity); JLabel lblRole = new JLabel("Role:"); lblRole.setFont(new Font("Tahoma", Font.BOLD, 13)); - lblRole.setBounds(12, 151, 80, 22); + lblRole.setBounds(12, 178, 80, 22); contentPane.add(lblRole); JLabel lblDescription = new JLabel("Description:"); lblDescription.setFont(new Font("Tahoma", Font.BOLD, 13)); - lblDescription.setBounds(12, 186, 100, 22); + lblDescription.setBounds(12, 212, 100, 22); contentPane.add(lblDescription); JButton btnBack = new JButton("Back"); @@ -88,7 +95,7 @@ public AddUserView() { btnBack.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { setVisible(false); - UserView screen = new UserView(); + UserView screen = new UserView(loggedId); screen.display(); } }); @@ -106,33 +113,40 @@ public void actionPerformed(ActionEvent e) { textField_Id.setBounds(143, 12, 144, 22); contentPane.add(textField_Id); + textField_Psw = new JTextField(); + textField_Psw.setFont(new Font("Tahoma", Font.BOLD, 14)); + textField_Psw.setColumns(10); + textField_Psw.setBounds(143, 46, 144, 22); + contentPane.add(textField_Psw); + textField_Name = new JTextField(); textField_Name.setFont(new Font("Tahoma", Font.BOLD, 14)); textField_Name.setColumns(10); - textField_Name.setBounds(143, 47, 144, 22); + textField_Name.setBounds(143, 80, 144, 22); contentPane.add(textField_Name); textField_LastName = new JTextField(); textField_LastName.setFont(new Font("Tahoma", Font.BOLD, 14)); textField_LastName.setColumns(10); - textField_LastName.setBounds(143, 80, 144, 22); + textField_LastName.setBounds(143, 115, 144, 22); contentPane.add(textField_LastName); textField_City = new JTextField(); textField_City.setFont(new Font("Tahoma", Font.BOLD, 14)); textField_City.setColumns(10); - textField_City.setBounds(143, 115, 144, 22); + textField_City.setBounds(143, 149, 144, 22); contentPane.add(textField_City); comboBox_Role.setFont(new Font("Tahoma", Font.BOLD, 14)); comboBox_Role.setModel(new DefaultComboBoxModel(UserRole.values())); - comboBox_Role.setBounds(143, 151, 144, 22); + comboBox_Role.setSelectedItem(UserRole.CUSTOMER); + comboBox_Role.setBounds(143, 184, 144, 22); contentPane.add(comboBox_Role); textField_Description = new JTextField(); textField_Description.setFont(new Font("Tahoma", Font.BOLD, 14)); textField_Description.setColumns(10); - textField_Description.setBounds(143, 186, 144, 50); + textField_Description.setBounds(143, 219, 144, 50); contentPane.add(textField_Description); JButton btnAdd = new JButton("Add"); @@ -141,36 +155,42 @@ public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent arg0) { try { String strId = textField_Id.getText(); + password = textField_Psw.getText(); name = textField_Name.getText(); - if (!strId.isBlank() && !name.isBlank()) { + if ((!strId.isBlank()) && (!password.isBlank()) && (!name.isBlank())) { id = Integer.parseInt(strId); - lastname = textField_LastName.getText(); - city = textField_City.getText(); - role = UserRole.valueOf(String.valueOf(comboBox_Role.getSelectedItem()).toUpperCase()); - description = textField_Description.getText(); - - User user = new UserImpl.UserBuilder(id) - .name(name) - .lastname(lastname) - .city(city) - .role(role) - .description(description) - .build(); - - if (controller.addUser(user)) { - JOptionPane.showMessageDialog(null, "The User was added to the database"); - textField_Id.setText("0"); - textField_Name.setText(""); - textField_LastName.setText(""); - textField_City.setText(""); - comboBox_Role.setSelectedIndex(0); - textField_Description.setText(""); - } else { - JOptionPane.showMessageDialog(null, "The ID is already in the database"); - } + if(id>0) { + lastname = textField_LastName.getText(); + city = textField_City.getText(); + role = UserRole.valueOf(String.valueOf(comboBox_Role.getSelectedItem()).toUpperCase()); + description = textField_Description.getText(); + + User user = new UserImpl.UserBuilder(id, password) + .name(name) + .lastname(lastname) + .city(city) + .role(role) + .description(description) + .build(); + + if (userController.addUser(user)) { + JOptionPane.showMessageDialog(null, "The User was added to the database."); + textField_Id.setText("0"); + textField_Psw.setText(""); + textField_Name.setText(""); + textField_LastName.setText(""); + textField_City.setText(""); + comboBox_Role.setSelectedIndex(0); + textField_Description.setText(""); + } else { + JOptionPane.showMessageDialog(null, "The ID is already in the database."); + } + } else { + JOptionPane.showMessageDialog(null, "User Id mus be greater than zero."); + } } else { - JOptionPane.showMessageDialog(null, "User Id and Name must be filled to complete the operation."); + JOptionPane.showMessageDialog(null, "User Id, Password and Name must be filled to complete the operation."); } } catch (Exception e) { e.printStackTrace(); diff --git a/src/main/java/view/CashierView.java b/src/main/java/view/CashierView.java index 9303948..f243fb9 100644 --- a/src/main/java/view/CashierView.java +++ b/src/main/java/view/CashierView.java @@ -11,15 +11,20 @@ import javax.swing.JPanel; import javax.swing.border.EmptyBorder; +import main.java.controller.UserController; +import main.java.controller.UserControllerImpl; + public class CashierView extends JFrame{ private static final long serialVersionUID = -392773556724218338L; private JPanel contentPane; - + private UserController userController = new UserControllerImpl(); + /** * Create the frame. */ - public CashierView() { + public CashierView(int loggedId) { + userController.setUserLogged(loggedId); setTitle("Cashier register"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(620, 280, 458, 461); @@ -32,7 +37,7 @@ public CashierView() { JButton btnInvoiceScreen = new JButton("Invoice Screen"); btnInvoiceScreen.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { - InvoiceView screen = new InvoiceView(); + InvoiceView screen = new InvoiceView(loggedId); setVisible(false); screen.display(); } @@ -45,7 +50,7 @@ public void actionPerformed(ActionEvent e) { btnBack.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { setVisible(false); - HomeView screen = new HomeView(true); + HomeView screen = new HomeView(loggedId); screen.display(); } }); diff --git a/src/main/java/view/CustomerView.java b/src/main/java/view/CustomerView.java index 4461752..3e9fd14 100644 --- a/src/main/java/view/CustomerView.java +++ b/src/main/java/view/CustomerView.java @@ -11,18 +11,20 @@ import javax.swing.JPanel; import javax.swing.border.EmptyBorder; +import main.java.controller.UserController; +import main.java.controller.UserControllerImpl; + public class CustomerView extends JFrame{ private static final long serialVersionUID = 206562391366914947L; private JPanel contentPane; - + private UserController userController = new UserControllerImpl(); + /** * Create the frame. */ - public CustomerView() { -// File logoImage = new File("CustomerScreen.jpg"); -// String imagePath = logoImage.getPath(); -// setIconImage(Toolkit.getDefaultToolkit().getImage(imagePath)); + public CustomerView (final int loggedId) { + userController.setUserLogged(loggedId); setTitle("Customer Screen"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(0, 0, 400, 350); @@ -36,7 +38,7 @@ public CustomerView() { btnAddUser.setFont(new Font("Tahoma", Font.BOLD, 13)); btnAddUser.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { - AddCustomerView screen = new AddCustomerView(); + AddCustomerView screen = new AddCustomerView(loggedId); setVisible(false); screen.display(); } @@ -48,7 +50,7 @@ public void actionPerformed(ActionEvent arg0) { btnCancel.setFont(new Font("Tahoma", Font.BOLD, 13)); btnCancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { - ManagementView screen = new ManagementView(); + ManagementView screen = new ManagementView(loggedId); setVisible(false); screen.display(); } @@ -60,7 +62,7 @@ public void actionPerformed(ActionEvent arg0) { btnEditUser.setFont(new Font("Tahoma", Font.BOLD, 13)); btnEditUser.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { - EditCustomerView screen = new EditCustomerView(); + EditCustomerView screen = new EditCustomerView(loggedId); setVisible(false); screen.display(); } diff --git a/src/main/java/view/EditCustomerView.java b/src/main/java/view/EditCustomerView.java index 0a09844..0a0174a 100644 --- a/src/main/java/view/EditCustomerView.java +++ b/src/main/java/view/EditCustomerView.java @@ -30,25 +30,24 @@ public class EditCustomerView extends JFrame{ private static final long serialVersionUID = -5302446014220983539L; private JPanel contentPane; private JTextField textField_Id; + private JTextField textField_Psw; private JTextField textField_Name; private JTextField textField_LastName; private JTextField textField_City; private JTextField textField_Description; private JComboBox comboBox_Role = new JComboBox<>(); - UserController controller = new UserControllerImpl(); + private UserController userController = new UserControllerImpl(); - private String name, lastname, city, description; + private String password, name, lastname, city, description; private UserRole role; private int id; /** * Create the frame. */ - public EditCustomerView() { -// File logoImage = new File("EditUserView.png"); -// String imagePath = logoImage.getPath(); -// setIconImage(Toolkit.getDefaultToolkit().getImage(imagePath)); + public EditCustomerView(final int loggedId) { + userController.setUserLogged(loggedId); setTitle("Edit Customer"); getContentPane().setBackground(Color.ORANGE); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); @@ -59,35 +58,39 @@ public EditCustomerView() { setContentPane(contentPane); contentPane.setLayout(null); - JLabel lblUserid = new JLabel("ID: *"); lblUserid.setFont(new Font("Tahoma", Font.BOLD, 13)); lblUserid.setBounds(10, 43, 80, 22); contentPane.add(lblUserid); + JLabel lblPassword = new JLabel("Password:"); + lblPassword.setFont(new Font("Tahoma", Font.BOLD, 13)); + lblPassword.setBounds(10, 82, 100, 22); + contentPane.add(lblPassword); + JLabel lblFirstName = new JLabel("Name:"); lblFirstName.setFont(new Font("Tahoma", Font.BOLD, 13)); - lblFirstName.setBounds(10, 82, 80, 22); + lblFirstName.setBounds(10, 115, 80, 22); contentPane.add(lblFirstName); JLabel lblLastName = new JLabel("Last Name:"); lblLastName.setFont(new Font("Tahoma", Font.BOLD, 13)); - lblLastName.setBounds(10, 115, 120, 22); + lblLastName.setBounds(10, 148, 120, 22); contentPane.add(lblLastName); JLabel lblCity = new JLabel("City:"); lblCity.setFont(new Font("Tahoma", Font.BOLD, 13)); - lblCity.setBounds(10, 148, 80, 22); + lblCity.setBounds(10, 185, 80, 22); contentPane.add(lblCity); JLabel lblRole = new JLabel("Role:"); lblRole.setFont(new Font("Tahoma", Font.BOLD, 13)); - lblRole.setBounds(10, 185, 80, 22); + lblRole.setBounds(10, 224, 80, 22); contentPane.add(lblRole); JLabel lblDescription = new JLabel("Description:"); lblDescription.setFont(new Font("Tahoma", Font.BOLD, 13)); - lblDescription.setBounds(10, 224, 100, 22); + lblDescription.setBounds(10, 257, 100, 22); contentPane.add(lblDescription); JButton btnBack = new JButton("Back"); @@ -95,7 +98,7 @@ public EditCustomerView() { btnBack.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { setVisible(false); - CustomerView screen = new CustomerView(); + CustomerView screen = new CustomerView(loggedId); screen.display(); } }); @@ -118,35 +121,42 @@ public void actionPerformed(ActionEvent arg0) { textField_Id.setBounds(131, 43, 161, 22); contentPane.add(textField_Id); + textField_Psw = new JTextField(); + textField_Psw.setFont(new Font("Tahoma", Font.BOLD, 14)); + textField_Psw.setEditable(false); + textField_Psw.setColumns(10); + textField_Psw.setBounds(131, 80, 161, 22); + contentPane.add(textField_Psw); + textField_Name = new JTextField(); textField_Name.setFont(new Font("Tahoma", Font.BOLD, 14)); textField_Name.setColumns(10); - textField_Name.setBounds(131, 80, 161, 22); + textField_Name.setBounds(131, 111, 161, 22); contentPane.add(textField_Name); textField_LastName = new JTextField(); textField_LastName.setFont(new Font("Tahoma", Font.BOLD, 14)); textField_LastName.setColumns(10); - textField_LastName.setBounds(131, 113, 161, 22); + textField_LastName.setBounds(131, 145, 161, 22); contentPane.add(textField_LastName); textField_City = new JTextField(); textField_City.setFont(new Font("Tahoma", Font.BOLD, 14)); textField_City.setColumns(10); - textField_City.setBounds(131, 147, 161, 22); + textField_City.setBounds(131, 180, 161, 22); contentPane.add(textField_City); comboBox_Role.setFont(new Font("Tahoma", Font.BOLD, 14)); comboBox_Role.setModel(new DefaultComboBoxModel(UserRole.values())); comboBox_Role.setSelectedItem(UserRole.CUSTOMER); - comboBox_Role.enable(false); - comboBox_Role.setBounds(131, 181, 161, 22); + comboBox_Role.setEnabled(false); + comboBox_Role.setBounds(131, 217, 161, 22); contentPane.add(comboBox_Role); textField_Description = new JTextField(); textField_Description.setFont(new Font("Tahoma", Font.BOLD, 14)); textField_Description.setColumns(10); - textField_Description.setBounds(131, 223, 161, 50); + textField_Description.setBounds(131, 250, 161, 50); contentPane.add(textField_Description); JButton btnUpdate = new JButton("Update"); @@ -158,15 +168,16 @@ public void actionPerformed(ActionEvent e) { if (!strId.isBlank()) { id = Integer.parseInt(strId); - var foundUser = controller.searchUser(id); + var foundUser = userController.searchUser(id); if ((foundUser != null) && (foundUser.getRole().equals(UserRole.CUSTOMER))) { + password = textField_Psw.getText(); name = textField_Name.getText(); lastname = textField_LastName.getText(); city = textField_City.getText(); role = UserRole.valueOf(String.valueOf(comboBox_Role.getSelectedItem()).toUpperCase()); description = textField_Description.getText(); - User user = new UserImpl.UserBuilder(id) + User user = new UserImpl.UserBuilder(id, password) .name(name) .lastname(lastname) .city(city) @@ -174,7 +185,7 @@ public void actionPerformed(ActionEvent e) { .description(description) .build(); - controller.updateUser(user); + userController.updateUser(user); JOptionPane.showMessageDialog(null, "The Customer was updated"); } else { @@ -184,9 +195,9 @@ public void actionPerformed(ActionEvent e) { JOptionPane.showMessageDialog(null, "The Customer Id must be filled"); } textField_Id.setText("0"); + textField_Psw.setText(""); textField_Name.setText(""); textField_LastName.setText(""); - comboBox_Role.setSelectedIndex(0); textField_City.setText(""); textField_Description.setText(""); } catch (Exception e1) { @@ -203,9 +214,9 @@ public void actionPerformed(ActionEvent e) { try { id = Integer.parseInt(textField_Id.getText()); - var foundUser = controller.searchUser(id); + var foundUser = userController.searchUser(id); if ((foundUser != null) && (foundUser.getRole().equals(UserRole.CUSTOMER))) { - boolean check = controller.deleteUser(id); + boolean check = userController.deleteUser(id); if(check) { JOptionPane.showMessageDialog(null, "The Customer was successfully deleted"); } @@ -213,9 +224,9 @@ public void actionPerformed(ActionEvent e) { JOptionPane.showMessageDialog(null, "The Customer was not found"); } textField_Id.setText("0"); + textField_Psw.setText(""); textField_Name.setText(""); textField_LastName.setText(""); - comboBox_Role.setSelectedIndex(0); textField_City.setText(""); textField_Description.setText(""); } catch (Exception ex) { @@ -234,10 +245,11 @@ public void actionPerformed(ActionEvent e) { try { id = Integer.parseInt(textField_Id.getText()); - User foundUser = controller.searchUser(id); + User foundUser = userController.searchUser(id); if ((foundUser != null) && (foundUser.getRole().equals(UserRole.CUSTOMER))) { textField_Id.setText(String.valueOf(foundUser.getId())); + textField_Psw.setText(foundUser.getPassword()); textField_Name.setText(foundUser.getName()); textField_LastName.setText(foundUser.getLastname()); textField_City.setText(foundUser.getCity().get()); @@ -245,9 +257,9 @@ public void actionPerformed(ActionEvent e) { comboBox_Role.setSelectedItem(UserRole.CUSTOMER); } else { textField_Id.setText("0"); + textField_Psw.setText(""); textField_Name.setText(""); textField_LastName.setText(""); - comboBox_Role.setSelectedIndex(0); textField_City.setText(""); textField_Description.setText(""); JOptionPane.showMessageDialog(null, "The Customer was not found"); @@ -265,22 +277,15 @@ public void actionPerformed(ActionEvent e) { btnClear.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { textField_Id.setText("0"); + textField_Psw.setText(""); textField_Name.setText(""); textField_LastName.setText(""); - comboBox_Role.setSelectedIndex(0); textField_City.setText(""); textField_Description.setText(""); } }); btnClear.setBounds(400, 115, 89, 23); - contentPane.add(btnClear); - - JLabel lblPicture = new JLabel(""); -// File UsersEdit = new File("EditUserView.png"); -// String UserEditPath = UsersEdit.getPath(); -// lblPicture.setIcon(new ImageIcon(UserEditPath)); - lblPicture.setBounds(299, -3, 551, 465); - contentPane.add(lblPicture); + contentPane.add(btnClear); } public void display() { diff --git a/src/main/java/view/EditItemView.java b/src/main/java/view/EditItemView.java index 3b22388..a18bea4 100644 --- a/src/main/java/view/EditItemView.java +++ b/src/main/java/view/EditItemView.java @@ -24,6 +24,8 @@ import main.java.controller.ItemController; import main.java.controller.ItemControllerImpl; +import main.java.controller.UserController; +import main.java.controller.UserControllerImpl; import main.java.model.Item; import main.java.model.ItemCategory; import main.java.model.ItemImpl; @@ -39,18 +41,18 @@ public class EditItemView extends JFrame{ private double price; private ItemCategory category; - ItemController controller = new ItemControllerImpl(); - Object[] idArray; + private ItemController controller = new ItemControllerImpl(); + private UserController userController = new UserControllerImpl(); - JComboBox comboBox_ItemId; - JComboBox comboBox_Category; + private Object[] idArray; + + private JComboBox comboBox_ItemId; + private JComboBox comboBox_Category; /** * Create the frame. */ - public EditItemView() { -// File logoImage = new File("EditItemView.png"); -// String imagePath = logoImage.getPath(); -// setIconImage(Toolkit.getDefaultToolkit().getImage(imagePath)); + public EditItemView(final int loggedId) { + userController.setUserLogged(loggedId); setTitle("Edit Product"); setResizable(false); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); @@ -133,7 +135,7 @@ public EditItemView() { btnBack.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { setVisible(false); - ItemView screen = new ItemView(); + ItemView screen = new ItemView(loggedId); screen.display(); } }); diff --git a/src/main/java/view/EditUserView.java b/src/main/java/view/EditUserView.java index d1a0211..63e990c 100644 --- a/src/main/java/view/EditUserView.java +++ b/src/main/java/view/EditUserView.java @@ -27,25 +27,26 @@ public class EditUserView extends JFrame{ private static final long serialVersionUID = 7857713318260675481L; private JPanel contentPane; private JTextField textField_Name; + private JTextField textField_Psw; private JTextField textField_LastName; private JTextField textField_City; private JTextField textField_Description; private JComboBox comboBox_Role; private JComboBox comboBox_UserId; - UserController controller = new UserControllerImpl(); + private UserController controller = new UserControllerImpl(); + private UserController userController = new UserControllerImpl(); - private String name, lastname, city, description; + + private String name, password, lastname, city, description; private UserRole role; private int id; /** * Create the frame. */ - public EditUserView() { -// File logoImage = new File("EditUserView.png"); -// String imagePath = logoImage.getPath(); -// setIconImage(Toolkit.getDefaultToolkit().getImage(imagePath)); + public EditUserView(final int loggedId) { + userController.setUserLogged(loggedId); setTitle("Edit Users"); getContentPane().setBackground(Color.ORANGE); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); @@ -62,29 +63,34 @@ public EditUserView() { lblUserid.setBounds(10, 43, 80, 22); contentPane.add(lblUserid); + JLabel lblPassword = new JLabel("Password:"); + lblPassword.setFont(new Font("Tahoma", Font.BOLD, 13)); + lblPassword.setBounds(10, 82, 100, 22); + contentPane.add(lblPassword); + JLabel lblFirstName = new JLabel("Name:"); lblFirstName.setFont(new Font("Tahoma", Font.BOLD, 13)); - lblFirstName.setBounds(10, 82, 80, 22); + lblFirstName.setBounds(10, 115, 80, 22); contentPane.add(lblFirstName); JLabel lblLastName = new JLabel("Last Name:"); lblLastName.setFont(new Font("Tahoma", Font.BOLD, 13)); - lblLastName.setBounds(10, 115, 120, 22); + lblLastName.setBounds(10, 148, 120, 22); contentPane.add(lblLastName); JLabel lblCity = new JLabel("City:"); lblCity.setFont(new Font("Tahoma", Font.BOLD, 13)); - lblCity.setBounds(10, 148, 80, 22); + lblCity.setBounds(10, 185, 80, 22); contentPane.add(lblCity); JLabel lblRole = new JLabel("Role:"); lblRole.setFont(new Font("Tahoma", Font.BOLD, 13)); - lblRole.setBounds(10, 185, 80, 22); + lblRole.setBounds(10, 224, 80, 22); contentPane.add(lblRole); JLabel lblDescription = new JLabel("Description:"); lblDescription.setFont(new Font("Tahoma", Font.BOLD, 13)); - lblDescription.setBounds(10, 224, 100, 22); + lblDescription.setBounds(10, 257, 100, 22); contentPane.add(lblDescription); JButton btnBack = new JButton("Back"); @@ -92,7 +98,7 @@ public EditUserView() { btnBack.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { setVisible(false); - UserView screen = new UserView(); + UserView screen = new UserView(loggedId); screen.display(); } }); @@ -110,34 +116,41 @@ public void actionPerformed(ActionEvent arg0) { comboBox_UserId.setBounds(131, 43, 161, 22); contentPane.add(comboBox_UserId); + textField_Psw = new JTextField(); + textField_Psw.setFont(new Font("Tahoma", Font.BOLD, 14)); + textField_Psw.setEditable(false); + textField_Psw.setColumns(10); + textField_Psw.setBounds(131, 77, 161, 22); + contentPane.add(textField_Psw); + textField_Name = new JTextField(); textField_Name.setFont(new Font("Tahoma", Font.BOLD, 14)); textField_Name.setColumns(10); - textField_Name.setBounds(131, 80, 161, 22); + textField_Name.setBounds(131, 111, 161, 22); contentPane.add(textField_Name); textField_LastName = new JTextField(); textField_LastName.setFont(new Font("Tahoma", Font.BOLD, 14)); textField_LastName.setColumns(10); - textField_LastName.setBounds(131, 113, 161, 22); + textField_LastName.setBounds(131, 145, 161, 22); contentPane.add(textField_LastName); textField_City = new JTextField(); textField_City.setFont(new Font("Tahoma", Font.BOLD, 14)); textField_City.setColumns(10); - textField_City.setBounds(131, 147, 161, 22); + textField_City.setBounds(131, 179, 161, 22); contentPane.add(textField_City); comboBox_Role = new JComboBox<>(); comboBox_Role.setFont(new Font("Tahoma", Font.BOLD, 14)); comboBox_Role.setModel(new DefaultComboBoxModel(UserRole.values())); - comboBox_Role.setBounds(131, 181, 161, 22); + comboBox_Role.setBounds(131, 213, 161, 22); contentPane.add(comboBox_Role); textField_Description = new JTextField(); textField_Description.setFont(new Font("Tahoma", Font.BOLD, 14)); textField_Description.setColumns(10); - textField_Description.setBounds(131, 223, 161, 50); + textField_Description.setBounds(131, 247, 161, 50); contentPane.add(textField_Description); JButton btnUpdate = new JButton("Update"); @@ -151,13 +164,14 @@ public void actionPerformed(ActionEvent e) { comboBox_UserId.setSelectedIndex(0); JOptionPane.showMessageDialog(null, "The User was not found"); } else { + password = textField_Psw.getText(); name = textField_Name.getText(); lastname = textField_LastName.getText(); city = textField_City.getText(); role = UserRole.valueOf(String.valueOf(comboBox_Role.getSelectedItem()).toUpperCase()); description = textField_Description.getText(); - User user = new UserImpl.UserBuilder(id) + User user = new UserImpl.UserBuilder(id, password) .name(name) .lastname(lastname) .city(city) @@ -168,6 +182,7 @@ public void actionPerformed(ActionEvent e) { controller.updateUser(user); comboBox_UserId.setSelectedIndex(0); + textField_Psw.setText(""); textField_Name.setText(""); textField_LastName.setText(""); comboBox_Role.setSelectedIndex(0); @@ -199,6 +214,7 @@ public void actionPerformed(ActionEvent e) { comboBox_UserId.setModel(new DefaultComboBoxModel(idArray)); } comboBox_UserId.setSelectedIndex(0); + textField_Psw.setText(""); textField_Name.setText(""); textField_LastName.setText(""); comboBox_Role.setSelectedIndex(0); @@ -226,6 +242,7 @@ public void actionPerformed(ActionEvent e) { comboBox_UserId.setSelectedIndex(0); JOptionPane.showMessageDialog(null, "The User was not found"); } else { + textField_Psw.setText(foundUser.getPassword()); textField_Name.setText(foundUser.getName()); textField_LastName.setText(foundUser.getLastname()); textField_City.setText(foundUser.getCity().get()); @@ -250,6 +267,7 @@ public void actionPerformed(ActionEvent e) { btnClear.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { comboBox_UserId.setSelectedIndex(0); + textField_Psw.setText(""); textField_Name.setText(""); textField_LastName.setText(""); comboBox_Role.setSelectedIndex(0); @@ -258,14 +276,7 @@ public void actionPerformed(ActionEvent arg0) { } }); btnClear.setBounds(400, 115, 89, 23); - contentPane.add(btnClear); - - JLabel lblPicture = new JLabel(""); -// File UsersEdit = new File("EditUserView.png"); -// String UserEditPath = UsersEdit.getPath(); -// lblPicture.setIcon(new ImageIcon(UserEditPath)); - lblPicture.setBounds(299, -3, 551, 465); - contentPane.add(lblPicture); + contentPane.add(btnClear); } public void display() { diff --git a/src/main/java/view/HomeView.java b/src/main/java/view/HomeView.java index a80299a..e3538e2 100644 --- a/src/main/java/view/HomeView.java +++ b/src/main/java/view/HomeView.java @@ -9,20 +9,28 @@ import javax.swing.JButton; import javax.swing.JFrame; +import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.border.EmptyBorder; +import main.java.controller.UserController; +import main.java.controller.UserControllerImpl; +import main.java.model.User; +import main.java.model.UserRole; + public class HomeView extends JFrame{ private static final long serialVersionUID = 6847662332522983305L; private static final double PERCENT = 0.6; private JPanel contentPane; + private UserController userController = new UserControllerImpl(); /** * Create the frame. */ - public HomeView(boolean faded) { + public HomeView(int loggedId) { + userController.setUserLogged(loggedId); setFont(new Font("Dialog", Font.PLAIN, 6)); setTitle("Main Menu"); setBackground(Color.WHITE); @@ -36,28 +44,35 @@ public HomeView(boolean faded) { contentPane.setLayout(null); JButton btnCashier = new JButton("Cash register"); - btnCashier.setEnabled(faded); + User u = userController.searchUser(loggedId); + boolean isNotCustomer = (u != null) ? !u.getRole().equals(UserRole.CUSTOMER) : false; + btnCashier.setEnabled(isNotCustomer); btnCashier.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { - setVisible(false); - CashierView cash=new CashierView(); - cash.display(); + if (isNotCustomer) { + CashierView cash=new CashierView(loggedId); + cash.display(); + setVisible(false); + } else { + JOptionPane.showMessageDialog(null, "You must be authenticated as MANAGER"); + } } }); btnCashier.setFont(new Font("Serif", Font.BOLD, 15)); btnCashier.setBounds(194, 272, 129, 54); contentPane.add(btnCashier); - JButton btnInfo = new JButton("info"); - btnInfo.setFont(new Font("Tahoma", Font.BOLD, 14)); + JButton btnInfo = new JButton("I"); + btnInfo.setFont(new Font("Tahoma", Font.BOLD, 18)); btnInfo.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { - String right = "Developed by Sara Briccoli"; - JOptionPane.showMessageDialog(null, right); + JLabel resLabel = new JLabel("Developed by Sara Briccoli"); + String info = "INFO"; + JOptionPane.showMessageDialog(null, resLabel, info, JOptionPane.QUESTION_MESSAGE); } }); - btnInfo.setForeground(Color.RED); - btnInfo.setBackground(Color.WHITE); + btnInfo.setForeground(Color.WHITE); + btnInfo.setBackground(Color.GRAY); btnInfo.setBounds(585, 13, 50, 50); contentPane.add(btnInfo); @@ -74,12 +89,22 @@ public void actionPerformed(ActionEvent e) { contentPane.add(btnLogin); JButton btnManagement = new JButton("Management"); - btnManagement.setEnabled(faded); + boolean isManager = (u != null) ? u.getRole().equals(UserRole.MANAGER) : false; + btnManagement.setEnabled(isManager); btnManagement.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { - ManagementView manage = new ManagementView(); - setVisible(false); - manage.display(); + int log = userController.getIdUserLogged(); + var a = userController.searchUser(log); + var b = a.getRole(); + boolean isManagerTEST = b.equals(UserRole.MANAGER); + + if (isManagerTEST) { + ManagementView manage = new ManagementView(loggedId); + setVisible(false); + manage.display(); + } else { + JOptionPane.showMessageDialog(null, "You must be authenticated as MANAGER"); + } } }); btnManagement.setFont(new Font("Serif", Font.BOLD, 15)); diff --git a/src/main/java/view/InvoiceView.java b/src/main/java/view/InvoiceView.java index a32e16e..3f5ef69 100644 --- a/src/main/java/view/InvoiceView.java +++ b/src/main/java/view/InvoiceView.java @@ -35,21 +35,22 @@ public class InvoiceView extends JFrame{ private static final long serialVersionUID = 3240398240332114971L; private JPanel contentPane; private JTextField textField_TotalPrice; - JComboBox comboBox_CustomerId; - JComboBox comboBox_ItemId; - JComboBox comboBox_Quantity; + private JComboBox comboBox_CustomerId; + private JComboBox comboBox_ItemId; + private JComboBox comboBox_Quantity; - UserController userController = new UserControllerImpl(); - ItemController itemController = new ItemControllerImpl(); - ShopController shopController = new ShopControllerImpl(); - InvoiceController invoiceController = new InvoiceControllerImpl(); - Set quantityModel; + private UserController userController = new UserControllerImpl(); + private ItemController itemController = new ItemControllerImpl(); + private ShopController shopController = new ShopControllerImpl(); + private InvoiceController invoiceController = new InvoiceControllerImpl(); + + private Set quantityModel; /** * Create the frame. */ - public InvoiceView() { - + public InvoiceView(final int loggedId) { + userController.setUserLogged(loggedId); setTitle("Invoice Screen"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(620, 280, 1300, 520); @@ -251,7 +252,7 @@ public void actionPerformed(ActionEvent arg0) { @Override public void actionPerformed(ActionEvent arg0) { setVisible(false); - CashierView screen = new CashierView(); + CashierView screen = new CashierView(loggedId); screen.display(); } }); diff --git a/src/main/java/view/ItemReportView.java b/src/main/java/view/ItemReportView.java index 8fa9fe2..196b930 100644 --- a/src/main/java/view/ItemReportView.java +++ b/src/main/java/view/ItemReportView.java @@ -19,6 +19,8 @@ import main.java.controller.ItemController; import main.java.controller.ItemControllerImpl; +import main.java.controller.UserController; +import main.java.controller.UserControllerImpl; public class ItemReportView extends JFrame{ @@ -26,11 +28,13 @@ public class ItemReportView extends JFrame{ private JPanel contentPane; private ItemController itemController = new ItemControllerImpl(); - + private UserController userController = new UserControllerImpl(); + /** * Create the frame. */ - public ItemReportView() { + public ItemReportView(final int loggedId) { + userController.setUserLogged(loggedId); setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); setBounds(620, 280, 850, 650); contentPane = new JPanel(); @@ -89,7 +93,7 @@ public void actionPerformed(ActionEvent e) { btnBack.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { setVisible(false); - AccountingView screen = new AccountingView(); + AccountingView screen = new AccountingView(loggedId); screen.display(); } }); diff --git a/src/main/java/view/ItemView.java b/src/main/java/view/ItemView.java index 49c0d79..88ed4cf 100644 --- a/src/main/java/view/ItemView.java +++ b/src/main/java/view/ItemView.java @@ -11,15 +11,20 @@ import javax.swing.JPanel; import javax.swing.border.EmptyBorder; +import main.java.controller.UserController; +import main.java.controller.UserControllerImpl; + public class ItemView extends JFrame{ private static final long serialVersionUID = -8594745175203264477L; private JPanel contentPane; + private UserController userController = new UserControllerImpl(); /** * Create the frame. */ - public ItemView() { + public ItemView(final int loggedId) { + userController.setUserLogged(loggedId); setTitle("Product Screen"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(620, 280, 905, 566); @@ -33,7 +38,7 @@ public ItemView() { btnAddUser.setFont(new Font("Tahoma", Font.BOLD, 14)); btnAddUser.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { - AddItemView screen = new AddItemView(); + AddItemView screen = new AddItemView(loggedId); setVisible(false); screen.display(); } @@ -45,7 +50,7 @@ public void actionPerformed(ActionEvent arg0) { btnCancel.setFont(new Font("Tahoma", Font.BOLD, 14)); btnCancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { - ManagementView screen = new ManagementView(); + ManagementView screen = new ManagementView(loggedId); setVisible(false); screen.display(); } @@ -56,7 +61,7 @@ public void actionPerformed(ActionEvent arg0) { JButton btnEditUser = new JButton("Edit Product"); btnEditUser.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { - EditItemView screen = new EditItemView(); + EditItemView screen = new EditItemView(loggedId); setVisible(false); screen.display(); } diff --git a/src/main/java/view/LoginView.java b/src/main/java/view/LoginView.java index 4d8d499..80519f5 100644 --- a/src/main/java/view/LoginView.java +++ b/src/main/java/view/LoginView.java @@ -4,13 +4,16 @@ import java.awt.Dimension; import java.awt.Font; import java.awt.event.ActionListener; -import java.io.File; -import java.io.IOException; -import java.util.Scanner; +import java.util.Set; import javax.swing.*; import javax.swing.border.EmptyBorder; +import main.java.controller.UserController; +import main.java.controller.UserControllerImpl; +import main.java.model.User; +import main.java.model.UserRole; + import java.awt.event.*; public class LoginView extends JFrame { @@ -18,8 +21,8 @@ public class LoginView extends JFrame { private static final long serialVersionUID = -72099129895597800L; private JPanel contentPane; private JTextField JTextField_Username; - int attempts = 3; private JPasswordField JPassword; + private UserController userController = new UserControllerImpl(); public LoginView() { setTitle("Login"); @@ -36,7 +39,7 @@ public LoginView() { lblWelcomeToHitpos.setBounds(200, 15, 300, 60); contentPane.add(lblWelcomeToHitpos); - JLabel lblUsername = new JLabel("Username"); + JLabel lblUsername = new JLabel("User ID"); lblUsername.setFont(new Font("Tahoma", Font.BOLD, 13)); lblUsername.setBounds(175, 115, 100, 45); contentPane.add(lblUsername); @@ -51,9 +54,14 @@ public LoginView() { contentPane.add(JTextField_Username); JTextField_Username.setColumns(10); + JPassword = new JPasswordField(); + JPassword.setBounds(250, 150, 120, 25); + contentPane.add(JPassword); + JCheckBox chckbxShowPassword = new JCheckBox("Show Password"); chckbxShowPassword.setFont(new Font("Tahoma", Font.BOLD, 13)); chckbxShowPassword.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { if(chckbxShowPassword.isSelected()) { @@ -71,34 +79,35 @@ public void actionPerformed(ActionEvent e) { JButton btnLogin = new JButton("Login"); btnLogin.setFont(new Font("Tahoma", Font.BOLD, 13)); btnLogin.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent arg0) { - String Username = JTextField_Username.getText(); - String Password = JPassword.getText(); - while(attempts != 0) - { - if (Username.equals ("A") && Password.equals ("A")) - { - HomeView mMenu =new HomeView(true);{ - setVisible(false); - mMenu.repaint(); - mMenu.display(); - } - } - - else - { - attempts--; - JOptionPane.showMessageDialog(null, "Invalid username or password "+ attempts+" attempts remaning"); - if (attempts == 0) - { - JOptionPane.showMessageDialog(null, "Please Contact maintenance"); - System.exit(0); + String userId_input = JTextField_Username.getText(); + String psw_input = String.valueOf(JPassword.getPassword()); + boolean checkIdDb = false; + + Set ides_db = userController.getAllId(); + for(String strId : ides_db) { + if (userId_input.equals(strId)) { + checkIdDb = true; + int id = Integer.parseInt(strId); + User u = userController.searchUser(id); + String psw_db = u.getPassword(); + if (psw_db.equals(psw_input) && (!u.getRole().equals(UserRole.CUSTOMER))) { + userController.setUserLogged(id); + HomeView menu =new HomeView(id); + setVisible(false); + menu.repaint(); + menu.display(); + } else { + JOptionPane.showMessageDialog(null, "No authorization!"); + } } } - return; + if(!checkIdDb) { + JOptionPane.showMessageDialog(null, "User not found!"); } - - }}); + } + }); btnLogin.setBounds(140, 320, 120, 40); contentPane.add(btnLogin); @@ -106,73 +115,28 @@ public void actionPerformed(ActionEvent arg0) { JButton btnCancel = new JButton("Exit"); btnCancel.setFont(new Font("Tahoma", Font.BOLD, 13)); btnCancel.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { System.exit(0);; } }); btnCancel.setBounds(280, 320, 120, 40); contentPane.add(btnCancel); - - JLabel lblPicture = new JLabel(""); -// File logoImage = new File("project_logo.png"); -// String imagePath = logoImage.getPath(); -// lblPicture.setIcon(new ImageIcon(imagePath)); - lblPicture.setBounds(235, 67, 356, 291); - contentPane.add(lblPicture); - - JPassword = new JPasswordField(); - JPassword.setBounds(250, 150, 120, 25); - contentPane.add(JPassword); - - JButton btnNewButton = new JButton(""); - btnNewButton.setForeground(Color.WHITE); - btnNewButton.addActionListener(new ActionListener() { - @SuppressWarnings("static-access") - public void actionPerformed(ActionEvent arg0) { - JOptionPane jopt = new JOptionPane(); - String result; - result = "Please Call Maintenance"; - JLabel resLabel = new JLabel(result); - resLabel.setFont(new Font("Monospaced", Font.BOLD, 18)); - jopt.showMessageDialog( null, resLabel); + JButton btnHelp = new JButton("?"); + btnHelp.setFont(new Font("Tahoma", Font.BOLD, 18)); + btnHelp.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent arg0) { + JLabel resLabel = new JLabel("Please Call Maintenance"); + String help = "HELP"; + JOptionPane.showMessageDialog(null, resLabel, help, JOptionPane.QUESTION_MESSAGE); } }); - btnNewButton.setBackground(Color.WHITE); -// btnNewButton.setIcon(new ImageIcon(LoginView.class.getResource("/com/sun/javafx/scene/control/skin/caspian/dialog-information.png"))); - btnNewButton.setBounds(533, 13, 37, 41); - contentPane.add(btnNewButton); - } - - private static boolean login(String Username,String Password) - { - File file = new File("UsersLogin.txt"); - try - { - Scanner input = new Scanner (file); - String data; - String [] sub_data; - - while(input.hasNext()) - { - data=input.nextLine(); - sub_data = data.split(","); - - if (sub_data[0].equals(Username) && sub_data[1].equals(Password)) - { - return true; - } - else - return false; - } - } - - catch (IOException e) - { - System.out.println("Error" +e); - } - - return false; + btnHelp.setForeground(Color.WHITE); + btnHelp.setBackground(Color.BLUE); + btnHelp.setBounds(533, 13, 50, 50); + contentPane.add(btnHelp); } public void display() { diff --git a/src/main/java/view/ManagementView.java b/src/main/java/view/ManagementView.java index 5c5222b..3825bf6 100644 --- a/src/main/java/view/ManagementView.java +++ b/src/main/java/view/ManagementView.java @@ -11,12 +11,17 @@ import javax.swing.JPanel; import javax.swing.border.EmptyBorder; +import main.java.controller.UserController; +import main.java.controller.UserControllerImpl; + public class ManagementView extends JFrame{ private static final long serialVersionUID = -9170551248090369195L; private JPanel contentPane; - - public ManagementView() { + private UserController userController = new UserControllerImpl(); + + public ManagementView(final int loggedId) { + userController.setUserLogged(loggedId); setFont(new Font("Serif", Font.BOLD, 14)); setTitle("Management Screen"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); @@ -31,7 +36,7 @@ public ManagementView() { btnNewButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { setVisible(false); - UserView screen = new UserView(); + UserView screen = new UserView(loggedId); screen.display(); } }); @@ -44,7 +49,7 @@ public void actionPerformed(ActionEvent e) { btnProducts.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { setVisible(false); - ItemView screen = new ItemView(); + ItemView screen = new ItemView(loggedId); screen.display(); } }); @@ -57,7 +62,7 @@ public void actionPerformed(ActionEvent e) { btnAccounting.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { setVisible(false); - AccountingView screen = new AccountingView(); + AccountingView screen = new AccountingView(loggedId); screen.display(); } }); @@ -70,7 +75,7 @@ public void actionPerformed(ActionEvent e) { btnCustomers.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { setVisible(false); - CustomerView screen = new CustomerView(); + CustomerView screen = new CustomerView(loggedId); screen.display(); } }); @@ -83,7 +88,7 @@ public void actionPerformed(ActionEvent e) { button_6.setFont(new Font("Serif", Font.BOLD, 16)); button_6.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { - HomeView screen =new HomeView(true);{ + HomeView screen =new HomeView(loggedId);{ screen.repaint(); setVisible(false); screen.display(); diff --git a/src/main/java/view/PurchaseReportView.java b/src/main/java/view/PurchaseReportView.java index e323de8..19c76fe 100644 --- a/src/main/java/view/PurchaseReportView.java +++ b/src/main/java/view/PurchaseReportView.java @@ -17,14 +17,18 @@ import main.java.controller.ShopController; import main.java.controller.ShopControllerImpl; +import main.java.controller.UserController; +import main.java.controller.UserControllerImpl; public class PurchaseReportView extends JFrame{ private static final long serialVersionUID = -48307813456949410L; private JPanel contentPane; private ShopController shopController = new ShopControllerImpl(); + private UserController userController = new UserControllerImpl(); - public PurchaseReportView() { + public PurchaseReportView(final int loggedId) { + userController.setUserLogged(loggedId); setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); setBounds(620, 280, 850, 650); setTitle("Salaries Report"); @@ -89,7 +93,7 @@ public void actionPerformed(ActionEvent e) { btnBack.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { setVisible(false); - AccountingView screen = new AccountingView(); + AccountingView screen = new AccountingView(loggedId); screen.display(); } }); diff --git a/src/main/java/view/ReportView.java b/src/main/java/view/ReportView.java index 2a267d5..a926f7f 100644 --- a/src/main/java/view/ReportView.java +++ b/src/main/java/view/ReportView.java @@ -14,15 +14,20 @@ import javax.swing.JTextArea; import javax.swing.border.EmptyBorder; +import main.java.controller.UserController; +import main.java.controller.UserControllerImpl; + public class ReportView extends JFrame{ private static final long serialVersionUID = 1066914862981666048L; private JPanel contentPane; + private UserController userController = new UserControllerImpl(); /** * Create the frame. */ - public ReportView() { + public ReportView(final int loggedId) { + userController.setUserLogged(loggedId); setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); setBounds(500, 500, 850, 650); setTitle("Report Screen"); @@ -92,7 +97,7 @@ public void actionPerformed(ActionEvent e) { btnBack.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { setVisible(false); - AccountingView screen = new AccountingView(); + AccountingView screen = new AccountingView(loggedId); screen.display(); } }); diff --git a/src/main/java/view/UserView.java b/src/main/java/view/UserView.java index 71b25fa..7825cd1 100644 --- a/src/main/java/view/UserView.java +++ b/src/main/java/view/UserView.java @@ -11,13 +11,17 @@ import javax.swing.JPanel; import javax.swing.border.EmptyBorder; +import main.java.controller.UserController; +import main.java.controller.UserControllerImpl; + public class UserView extends JFrame{ private static final long serialVersionUID = 4193666446055665724L; private JPanel contentPane; - + private UserController userController = new UserControllerImpl(); - public UserView() { + public UserView(final int loggedId) { + userController.setUserLogged(loggedId); setTitle("Users"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(620, 280, 788, 512); @@ -31,7 +35,7 @@ public UserView() { btnAddUser.setFont(new Font("Tahoma", Font.BOLD, 13)); btnAddUser.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { - AddUserView screen = new AddUserView(); + AddUserView screen = new AddUserView(loggedId); setVisible(false); screen.display(); } @@ -43,7 +47,7 @@ public void actionPerformed(ActionEvent arg0) { btnCancel.setFont(new Font("Tahoma", Font.BOLD, 13)); btnCancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { - ManagementView screen = new ManagementView(); + ManagementView screen = new ManagementView(loggedId); setVisible(false); screen.display(); } @@ -56,7 +60,7 @@ public void actionPerformed(ActionEvent arg0) { btnEditUser.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { setVisible(false); - EditUserView screen = new EditUserView(); + EditUserView screen = new EditUserView(loggedId); screen.display(); } }); diff --git a/src/main/resources/mainView.jpg b/src/main/resources/mainView.jpg deleted file mode 100644 index a9de7fb..0000000 Binary files a/src/main/resources/mainView.jpg and /dev/null differ diff --git a/src/test/java/model/FileTest.java b/src/test/java/model/FileTest.java index f20d4c5..ec3224e 100644 --- a/src/test/java/model/FileTest.java +++ b/src/test/java/model/FileTest.java @@ -1,7 +1,5 @@ package test.java.model; -import java.io.File; - import org.junit.Test; import org.junit.jupiter.api.DisplayName; @@ -10,51 +8,43 @@ import main.java.model.Item; import main.java.model.ItemCategory; import main.java.model.ItemImpl; -import main.java.model.User; import main.java.model.UserImpl; import main.java.model.file.FileItemImpl; import main.java.model.file.FileStrategy; import main.java.model.file.FileUserImpl; public class FileTest { - -// @Test -// @DisplayName("Set and Get file test.") -// public void setGetFileTest() { -// final FileStrategy fs = new FileItemImpl(); -// fs.setFile("test1"); -// File test = fs.getFile(); -// -// System.out.println(test.getName()); -// } -// @Test -// public void randomTest() { -// Item i = new ItemImpl("0d5kx", "soya", 0, 2.5, null, null, null); -// System.out.println(i.toString()); -// } + /** + * These test were useful when developing the file writing and reading methods. + */ + + @Test + public void toStringTest() { + Item i = new ItemImpl("0d5kx", "soya", 0, 2.5, null, null, null); + System.out.println(i.toString()); + } -// @Test -// @DisplayName("FileStrategy Test on creation and writing.") -// public void createWriteTest() { -// var u = new UserImpl.UserBuilder() -// .name("Sara") -// .city("Salvador") -// .isAdmin(false) -// .build(); -// -// FileStrategy f = new FileUserImpl(); -// f.writeInFile(u.toString()); -// } + @Test + @DisplayName("FileStrategy Test on creation and writing.") + public void createWriteTest() { + var u = new UserImpl.UserBuilder(5, "jko") + .name("Sara") + .city("Salvador") + .build(); + + FileStrategy f = new FileUserImpl(); + f.writeInFile(u.toString()); + } -// @Test -// @DisplayName("FileStrategy Test on reading.") -// public void readTest() { -// FileStrategy f = new FileItemImpl(); -// Item i = new ItemImpl("0d5kx", "soya", 50, 2.5, null, null, ItemCategory.BIO); -// f.writeInFile(i.toString()); -// System.out.println(f.fileReader()); -// } + @Test + @DisplayName("FileStrategy Test on reading.") + public void readTest() { + FileStrategy f = new FileItemImpl(); + Item i = new ItemImpl("0d5kx", "soya", 50, 2.5, null, null, ItemCategory.BIO); + f.writeInFile(i.toString()); + System.out.println(f.fileReader()); + } @Test @DisplayName("Add, Delete, Update and Search Item test.") diff --git a/src/test/java/model/ItemTest.java b/src/test/java/model/ItemTest.java index bafc822..edaa17d 100644 --- a/src/test/java/model/ItemTest.java +++ b/src/test/java/model/ItemTest.java @@ -1,11 +1,6 @@ package test.java.model; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertTrue; - -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.Date; import org.junit.Test; import org.junit.jupiter.api.DisplayName; @@ -18,13 +13,13 @@ public class ItemTest { @Test - @DisplayName("Amount and Discount test.") - public void amountAndDiscountTest() { - Item i1 = new ItemImpl(null, "Olive Oil Brisighello 1l", 3, 100.0, null, null, null); - Item i2 = new ItemImpl(null, "Cheese Slices", 2, 50.0, null, null, null); - Item i3 = new ItemImpl(null, "Bread", 1, 5.0, null, null, null); - Item i4 = new ItemImpl(null, "Eggs", 50, 10.0, null, null, null); - Item i5 = new ItemImpl(null, "Soya Drink", 2, 100.0, null, null, null); + @DisplayName("Total Payment test.") + public void totPayTest() { + Item i1 = new ItemImpl("20", "Olive Oil Brisighello 1l", 3, 100.0, null, null, null); + Item i2 = new ItemImpl("21", "Cheese Slices", 2, 50.0, null, null, null); + Item i3 = new ItemImpl("22", "Bread", 1, 5.0, null, null, null); + Item i4 = new ItemImpl("23", "Eggs", 50, 10.0, null, null, null); + Item i5 = new ItemImpl("24", "Soya Drink", 2, 100.0, null, null, null); ShoppingCart cart = new ShoppingCartImpl(); @@ -33,45 +28,17 @@ public void amountAndDiscountTest() { cart.addToCart(i3); cart.addToCart(i4); cart.addToCart(i5); - - cart.showCart(); - + cart.removeFromCart(i1); cart.removeFromCart(i3); cart.removeFromCart(i4); cart.removeFromCart(i5); - cart.showCart(); - double totalAmount = cart.getTotalAmount(); System.out.println(totalAmount); - cart.addDiscount(0.1); - cart.printInvoice(); - assertEquals(cart.getTotalAmount(), 100.0); - assertEquals(cart.getDiscountedAmount(), 90.0); - } - - @Test - @DisplayName("Dates test") - public void dateTest() throws ParseException { - SimpleDateFormat dateFormatter = new SimpleDateFormat("EEE MMM d HH:mm:ss zzz yyyy"); - - Item i1 = new ItemImpl(null, null, 0, 0, new Date(2015, 8, 17), null, null); - Item i2 = new ItemImpl(null, null, 0, 0, null, new Date(2021, 1, 4), null); - -// System.out.println("method: " + i2.getExpirationDate()); - try { - System.out.println("format: " + dateFormatter.parse("Fri Feb 04 00:00:00 CET 3921")); - } catch (ParseException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } - -// assertEquals(i1.getReceivedDate(), new Date(2015, 8, 17)); -// assertEquals(i2.getExpirationDate(), new Date(2021, 12, 4)); -// assertTrue(i2.getExpirationDate().compareTo(dateFormatter.parse("Fri Feb 04 00:00:00 CET 3921")) == 0); - + + cart.removeFromCart(i3); } } diff --git a/src/test/java/model/UserTest.java b/src/test/java/model/UserTest.java index a78529c..7ae0a9d 100644 --- a/src/test/java/model/UserTest.java +++ b/src/test/java/model/UserTest.java @@ -1,14 +1,15 @@ package test.java.model; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; -import java.util.HashSet; import java.util.Optional; import org.junit.Test; import org.junit.jupiter.api.DisplayName; +import main.java.controller.UserController; +import main.java.controller.UserControllerImpl; import main.java.model.User; import main.java.model.UserImpl; import main.java.model.UserRole; @@ -20,7 +21,7 @@ public class UserTest { @DisplayName("User Builder working correctly.") public void testBuilderFields() { - final User admin = new UserImpl.UserBuilder(2) + final User admin = new UserImpl.UserBuilder(2, "ciao") .name("Sara") .lastname("Briccoli") .city("Faenza") @@ -28,11 +29,9 @@ public void testBuilderFields() { .description(null) .build(); - final User cashier = new UserImpl.UserBuilder(3) + final User cashier = new UserImpl.UserBuilder(3, "promto") .name("Jay") .build(); - - System.out.println(admin.getRole() + " " + admin.getDescription()); assertEquals(admin.getName(), "Sara"); assertEquals(admin.getLastname(), "Briccoli"); @@ -46,13 +45,17 @@ public void testBuilderFields() { @Test @DisplayName("toString test.") public void toStringTest() { - final User sara = new UserImpl.UserBuilder(4) - .name("Sara") - .lastname("Briccoli") - .city("Faenza") - .role(UserRole.MANAGER) + User grace = new UserImpl.UserBuilder(45, "lucky4") + .name("Grace") + .lastname("Lion") + .city("Ravenna") + .role(UserRole.CUSTOMER) .description(null) .build(); - System.out.println(sara.toString()); + + UserController c = new UserControllerImpl(); + +// assertTrue(c.addUser(grace)); +// assertTrue(c.deleteUser(sara.getId())); } }