-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathController.java
More file actions
782 lines (719 loc) · 33.3 KB
/
Controller.java
File metadata and controls
782 lines (719 loc) · 33.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
package mainPackage;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.control.*;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.BorderPane;
import mainPackage.ADDDialoge.*;
import mainPackage.Data.*;
import mainPackage.FindDialoge.FindEmployController;
import mainPackage.FindDialoge.FindLabAssistentController;
import mainPackage.FindDialoge.FindStudentController;
import mainPackage.FindDialoge.FindTeacherController;
import java.io.IOException;
import java.util.Optional;
public class Controller {
@FXML
private ListView<String> llistview;
@FXML
private BorderPane mainBorderPane;
@FXML
private Label text;
@FXML
private TextArea info;
@FXML
private ImageView imageView;
private boolean flag;
public void initialize() {
Image image=new Image("/mainPackage/UCSTA.jpg");//Create Image Object
imageView.setImage(image);//Set The Image
imageView.getFitWidth();
llistview.getItems().setAll(ListController.getListController().getList1());//Set The Left List
llistview.getSelectionModel().setSelectionMode(SelectionMode.SINGLE);//Seting the Selection Mode Into Single
info.setText("\n\n\n\n\n\n\n" +
"\t\t\t\tThe A.K.Choudhury School of Information Technology is situated in the Technology Campus," +
"University of Calcutta,\n\t and is dedicated to Prof. A.K.Choudhury(1923-1987). Started as a Computer " +
"Centre of the University in 2001,the school emerged as a\n\t full fledged department in 2005. " +
"The department runs MCA ,B.Tech , M.Tech in Information Technology and M.Tech in Computer\n\t Science " +
"and Application (3 year part-time) courses. It has always been an effort of the department impart the " +
"state of the art training\n\t of the students by the way of establishing ultramodern laboratories and latest " +
"hardware and software platforms. Syllabi of the department\n\t are constantly updated to meet the requirements of " +
"the Industry. The department has a strong emphasis on research, lead by the faculties\n\t of the department " +
", which provides the students an excellent opportunity to train up the state of the art system sand related " +
"technologies.\n\t Embedded System Design, VLSI Design , Quantum Computing, Wireless Networks, Network Security ," +
"Computer Vision, Database System,\n\t Data Warehousing and Bio-Medical Image Processing are some Key research " +
"areas of the department. ");
}
@FXML
public void handelclick(){//On Mouse clicked On left List
try {
String item=llistview.getSelectionModel().getSelectedItem();//If Person's Information is selected then Option arrive
if(item.equals(ListController.getListController().getList1().get(0))){
llistview.getItems().setAll(ListController.getListController().getList2());
llistview.getSelectionModel().setSelectionMode(SelectionMode.SINGLE);
}
}catch (Exception e){
text.setText("Select The Correct Item");
}
}
@FXML
public void add() {//Clicking the Add Button
try {
String item = llistview.getSelectionModel().getSelectedItem();//Getting The Selected Item form the Left List
if (item.equals(ListController.getListController().getList1().get(1)))
recorceItemDialog();//If Student is selected
else if (item.equals(ListController.getListController().getList2().get(0)))
studentItemDialog();
else if (item.equals(ListController.getListController().getList2().get(1)))
teacherItemDialog();
else if (item.equals(ListController.getListController().getList2().get(2)))
nonteachingItemDialog();
else if (item.equals(ListController.getListController().getList2().get(3)))
labassistentItemDialog();
else if (item.equals(ListController.getListController().getList2().get(4)))
aluminiItemDialog();
} catch (Exception e) {
text.setText("Select The Currect Item");
}
}
@FXML
public void delete() {//If deleted Button is Pressed
try {
String item = llistview.getSelectionModel().getSelectedItem();
if(item.equals(ListController.getListController().getList1().get(1)))
uprecorceItemDialog();
else if(item.equals(ListController.getListController().getList2().get(0)))
delstudentItemDialog();
else if (item.equals(ListController.getListController().getList2().get(1)))
delteacherItemDialog();
else if (item.equals(ListController.getListController().getList2().get(2)))
delnonteachingItemDialog();
else if (item.equals(ListController.getListController().getList2().get(3)))
dellabassistentItemDialog();
else if (item.equals(ListController.getListController().getList2().get(4)))
findAlumini();
} catch (Exception e) {
text.setText("Select The Currect Item");
}
}
@FXML
public void update() {//If Update Button is Pressed
try {
String item = llistview.getSelectionModel().getSelectedItem();
if (item.equals(ListController.getListController().getList1().get(1)))
uprecorceItemDialog();
else if (item.equals(ListController.getListController().getList2().get(0)))
upstudentItemDialog();
else if (item.equals(ListController.getListController().getList2().get(1)))
upteacherItemDialog();
else if (item.equals(ListController.getListController().getList2().get(2)))
upnonteachingItemDialog();
else if (item.equals(ListController.getListController().getList2().get(3)))
uplabassistentItemDialog();
else if (item.equals(ListController.getListController().getList2().get(4)))
findAlumini();
} catch(Exception e){
text.setText("Select The Currect Item");
}
}
@FXML
public void getInfo(){//If Get Information Button is Pressed
try {
String item=llistview.getSelectionModel().getSelectedItem();
if(item.equals(ListController.getListController().getList1().get(1)))
getResourceInfo();
else if(item.equals(ListController.getListController().getList2().get(0)))
studentInfo();
else if (item.equals(ListController.getListController().getList2().get(1)))
teacheInfo();
else if(item.equals(ListController.getListController().getList2().get(2)))
nonTeachingInfo();
else if (item.equals(ListController.getListController().getList2().get(3)))
labassistantInfo();
else if (item.equals(ListController.getListController().getList2().get(4)))
alumniInfo();
}catch (Exception e){
text.setText("Select The Correct Item");
}
}
private void studentItemDialog() {//Adding A Student Record
Dialog<ButtonType> dialog = new Dialog<>();//Dialog Object For Loading A dialog Box Containing Button
dialog.initOwner(mainBorderPane.getScene().getWindow());//Setting The Dialog Owner
dialog.setTitle("Add New Student Record");//Setting Dialog Title
FXMLLoader fxmlLoader = new FXMLLoader();//FXMLLoader Object To Load FXML File
fxmlLoader.setLocation(getClass().getResource("/mainPackage/ADDDialoge/Student.fxml"));
try {
dialog.getDialogPane().setContent(fxmlLoader.load());//Fxml File Location Setting
} catch (IOException e) {
System.out.println("Couldn't load the dialog");
e.printStackTrace();
return;
}
dialog.getDialogPane().getButtonTypes().add(ButtonType.OK);//Setting Button
dialog.getDialogPane().getButtonTypes().add(ButtonType.CANCEL);
Optional<ButtonType> result = dialog.showAndWait();//Showing the Dialog and Wait for the Event to Happened
if (result.isPresent() && result.get() == ButtonType.OK) {
StudentController controller = fxmlLoader.getController();//Creating StudentController Object
boolean state = controller.processResults();//Getting The result
if (state)
text.setText("Record Added Sucessfully");
else text.setText("Registration Number Must Be Unique or Non-Empty");
}
}
private void teacherItemDialog() {//Adding A Teacher Record Same as Student
Dialog<ButtonType> dialog = new Dialog<>();
dialog.initOwner(mainBorderPane.getScene().getWindow());
dialog.setTitle("Add New Teacher Record");
FXMLLoader fxmlLoader = new FXMLLoader();
fxmlLoader.setLocation(getClass().getResource("/mainPackage/ADDDialoge/Teacher.fxml"));
try {
dialog.getDialogPane().setContent(fxmlLoader.load());
} catch (IOException e) {
System.out.println("Couldn't load the dialog");
e.printStackTrace();
return;
}
dialog.getDialogPane().getButtonTypes().add(ButtonType.OK);
dialog.getDialogPane().getButtonTypes().add(ButtonType.CANCEL);
Optional<ButtonType> result = dialog.showAndWait();
if (result.isPresent() && result.get() == ButtonType.OK) {
TeacherController controller = fxmlLoader.getController();
boolean state = controller.processResults();
if (state)
text.setText("Record Added Sucessfully");
else text.setText("Employ Id Must be Unique or Non Empty");
}
}
private void nonteachingItemDialog() {//Adding A Non-Teaching Stuff Record Same as Student
Dialog<ButtonType> dialog = new Dialog<>();
dialog.initOwner(mainBorderPane.getScene().getWindow());
dialog.setTitle("Add New Stuff Record");
FXMLLoader fxmlLoader = new FXMLLoader();
fxmlLoader.setLocation(getClass().getResource("/mainPackage/ADDDialoge/NonTeaching.fxml"));
try {
dialog.getDialogPane().setContent(fxmlLoader.load());
} catch (IOException e) {
System.out.println("Couldn't load the dialog");
e.printStackTrace();
return;
}
dialog.getDialogPane().getButtonTypes().add(ButtonType.OK);
dialog.getDialogPane().getButtonTypes().add(ButtonType.CANCEL);
Optional<ButtonType> result = dialog.showAndWait();
if (result.isPresent() && result.get() == ButtonType.OK) {
NonTeachingController controller = fxmlLoader.getController();
boolean state = controller.processResults();
if (state)
text.setText("Record Added Sucessfully");
else text.setText("Employ Id Must be Unique ");
}
}
private void labassistentItemDialog() {//Adding A LabAssistant Record Same as Student
Dialog<ButtonType> dialog = new Dialog<>();
dialog.initOwner(mainBorderPane.getScene().getWindow());
dialog.setTitle("Add New Lab Assistent Record");
FXMLLoader fxmlLoader = new FXMLLoader();
fxmlLoader.setLocation(getClass().getResource("/mainPackage/ADDDialoge/LabAssistent.fxml"));
try {
dialog.getDialogPane().setContent(fxmlLoader.load());
} catch (IOException e) {
System.out.println("Couldn't load the dialog");
e.printStackTrace();
return;
}
dialog.getDialogPane().getButtonTypes().add(ButtonType.OK);
dialog.getDialogPane().getButtonTypes().add(ButtonType.CANCEL);
Optional<ButtonType> result = dialog.showAndWait();
if (result.isPresent() && result.get() == ButtonType.OK) {
LabAssistentController controller = fxmlLoader.getController();
boolean state = controller.processResults();
if (state)
text.setText("Record Added Sucessfully");
else text.setText("Employ Id Must be Unique ");
}
}
private void aluminiItemDialog() {//Adding A Alumni Record Same as Student
Dialog<ButtonType> dialog = new Dialog<>();
dialog.initOwner(mainBorderPane.getScene().getWindow());
dialog.setTitle("Add New Alumini Record");
FXMLLoader fxmlLoader = new FXMLLoader();
fxmlLoader.setLocation(getClass().getResource("/mainPackage/ADDDialoge/Alumni.fxml"));
try {
dialog.getDialogPane().setContent(fxmlLoader.load());
} catch (IOException e) {
System.out.println("Couldn't load the dialog");
e.printStackTrace();
return;
}
dialog.getDialogPane().getButtonTypes().add(ButtonType.OK);
dialog.getDialogPane().getButtonTypes().add(ButtonType.CANCEL);
Optional<ButtonType> result = dialog.showAndWait();
if (result.isPresent() && result.get() == ButtonType.OK) {
AlumniController controller = fxmlLoader.getController();
boolean state = controller.processResults();
if (state)
text.setText("Record Added Sucessfully");
}
}
private void recorceItemDialog() {//Adding A Resource Record Same as Student
Dialog<ButtonType> dialog = new Dialog<>();
dialog.initOwner(mainBorderPane.getScene().getWindow());
dialog.setTitle("Add New Resource Record");
FXMLLoader fxmlLoader = new FXMLLoader();
fxmlLoader.setLocation(getClass().getResource("/mainPackage/ADDDialoge/Resource.fxml"));
try {
dialog.getDialogPane().setContent(fxmlLoader.load());
} catch (IOException e) {
System.out.println("Couldn't load the dialog");
e.printStackTrace();
return;
}
dialog.getDialogPane().getButtonTypes().add(ButtonType.OK);
dialog.getDialogPane().getButtonTypes().add(ButtonType.CANCEL);
Optional<ButtonType> result = dialog.showAndWait();
if (result.isPresent() && result.get() == ButtonType.OK) {
ResourceController controller = fxmlLoader.getController();
boolean state = controller.processResults();
if (state)
text.setText("Record Added Sucessfully");
}
}
private void delstudentItemDialog() {//Deleting A Student Record
Student item = findStudent();//Finding The Correct Student Object
if (!flag)
return;
if (item != null) {//If Object is NOn NULL
Alert alert = new Alert(Alert.AlertType.CONFIRMATION);//Alert CONFIRMATION Dialog
alert.setTitle("Delete");
alert.setHeaderText("Are You Sure To Delete");
alert.setContentText(item.getName());
Optional<ButtonType> res = alert.showAndWait();
if (res.isPresent() && (res.get() == ButtonType.OK)) {
PersonData.getInstance().removeStudent(item);
text.setText("Delete Sucessfull");
}
} else {
Alert alert = new Alert(Alert.AlertType.INFORMATION);
alert.setTitle("Delete");
alert.setContentText("Student Not Found");
alert.show();
}
}
private void delteacherItemDialog() {//Deleting A Teacher Record
Teacher item = findTeacher();
if (!flag)
return;
if (item != null) {
Alert alert = new Alert(Alert.AlertType.CONFIRMATION);
alert.setTitle("Delete");
alert.setHeaderText("Are You Sure To Delete");
alert.setContentText(item.getName());
Optional<ButtonType> res = alert.showAndWait();
if (res.isPresent() && (res.get() == ButtonType.OK)) {
PersonData.getInstance().removeTeacher(item);
text.setText("Delete Sucessfull");
}
} else {
Alert alert = new Alert(Alert.AlertType.INFORMATION);
alert.setTitle("Delete");
alert.setContentText("Teacher Not Found");
alert.show();
}
}
private void delnonteachingItemDialog() {//Deleting A Non-Teaching Stuff Record
Employ item = findnonteaching();
if (!flag)
return;
if (item != null) {
Alert alert = new Alert(Alert.AlertType.CONFIRMATION);
alert.setTitle("Delete");
alert.setHeaderText("Are You Sure To Delete");
alert.setContentText(item.getName());
Optional<ButtonType> res = alert.showAndWait();
if (res.isPresent() && (res.get() == ButtonType.OK)) {
PersonData.getInstance().removeEmploy(item);
text.setText("Delete Sucessfull");
}
} else {
Alert alert = new Alert(Alert.AlertType.INFORMATION);
alert.setTitle("Delete");
alert.setContentText("Non Teaching Stuff Not Found");
alert.show();
}
}
private void dellabassistentItemDialog() {//Deleting A Lab Assistant Record
LabAssistent item = findllabAssistant();
if (!flag)
return;
if (item != null) {
Alert alert = new Alert(Alert.AlertType.CONFIRMATION);
alert.setTitle("Delete");
alert.setHeaderText("Are You Sure To Delete");
alert.setContentText(item.getName());
Optional<ButtonType> res = alert.showAndWait();
if (res.isPresent() && (res.get() == ButtonType.OK)) {
PersonData.getInstance().removeLabAssistents(item);
text.setText("Delete Sucessfull");
}
} else {
Alert alert = new Alert(Alert.AlertType.INFORMATION);
alert.setTitle("Delete");
alert.setContentText("Lab Assistent Not Found");
alert.show();
}
}
private void upstudentItemDialog() {//Update a Student
Student item = findStudent();//Finding The Correct Student Object
if (!flag)
return;
if (item != null) {
Dialog<ButtonType> dialog = new Dialog<>();
dialog.initOwner(mainBorderPane.getScene().getWindow());
dialog.setTitle("Update");
FXMLLoader fxmlLoader1 = new FXMLLoader();
fxmlLoader1.setLocation(getClass().getResource("/mainPackage/ADDDialoge/Student.fxml"));
try {
dialog.getDialogPane().setContent(fxmlLoader1.load());
} catch (IOException e) {
e.printStackTrace();
return;
}
StudentController controller = fxmlLoader1.getController();
controller.update(item);
dialog.getDialogPane().getButtonTypes().add(ButtonType.OK);
dialog.getDialogPane().getButtonTypes().add(ButtonType.CANCEL);
Optional<ButtonType> result1 = dialog.showAndWait();
if (result1.isPresent() && (result1.get() == ButtonType.OK)) {
boolean s = controller.updateResult(item);
if (s)
text.setText("Update Sucessfull");
else
text.setText("Registration Number Must Be Unique Or Non Empty");
}
} else {
Alert alert = new Alert(Alert.AlertType.INFORMATION);
alert.setTitle("Delete");
alert.setHeaderText(null);
alert.setContentText("Student Not Found");
alert.show();
}
}
private void upteacherItemDialog() {//Update a Teacher
Teacher item = findTeacher();//Finding The Correct Teacher
if (!flag)
return;
if (item != null) {
Dialog<ButtonType> dialog = new Dialog<>();
dialog.initOwner(mainBorderPane.getScene().getWindow());
dialog.setTitle("Update");
FXMLLoader fxmlLoader = new FXMLLoader();
fxmlLoader.setLocation(getClass().getResource("/mainPackage/ADDDialoge/Teacher.fxml"));
try {
dialog.getDialogPane().setContent(fxmlLoader.load());
} catch (IOException e) {
e.printStackTrace();
return;
}
TeacherController controller = fxmlLoader.getController();
controller.update(item);
dialog.getDialogPane().getButtonTypes().add(ButtonType.OK);
dialog.getDialogPane().getButtonTypes().add(ButtonType.CANCEL);
Optional<ButtonType> result1 = dialog.showAndWait();
if (result1.isPresent() && (result1.get() == ButtonType.OK)) {
boolean s = controller.updateResult(item);
if (s)
text.setText("Update Sucessfull");
else
text.setText("Employ ID Must be Unique Or Non Empty");
}
} else {
Alert alert = new Alert(Alert.AlertType.INFORMATION);
alert.setTitle("Delete");
alert.setHeaderText(null);
alert.setContentText("Teacher Not Found");
alert.show();
}
}
private void upnonteachingItemDialog() {//Update a Non-Teaching Stuff
Employ item = findnonteaching();
if (!flag)
return;
if (item != null) {
Dialog<ButtonType> dialog = new Dialog<>();
dialog.initOwner(mainBorderPane.getScene().getWindow());
dialog.setTitle("Update");
FXMLLoader fxmlLoader = new FXMLLoader();
fxmlLoader.setLocation(getClass().getResource("/mainPackage/ADDDialoge/NonTeaching.fxml"));
try {
dialog.getDialogPane().setContent(fxmlLoader.load());
} catch (IOException e) {
e.printStackTrace();
return;
}
NonTeachingController controller = fxmlLoader.getController();
controller.update(item);
dialog.getDialogPane().getButtonTypes().add(ButtonType.OK);
dialog.getDialogPane().getButtonTypes().add(ButtonType.CANCEL);
Optional<ButtonType> result1 = dialog.showAndWait();
if (result1.isPresent() && (result1.get() == ButtonType.OK)) {
boolean s = controller.updateResult(item);
if (s)
text.setText("Update Sucessfull");
else
text.setText("Employ ID Must be Unique Or Non Empty");
}
} else {
Alert alert = new Alert(Alert.AlertType.INFORMATION);
alert.setTitle("Delete");
alert.setHeaderText(null);
alert.setContentText("Non Teaching Stuff Not Found");
alert.show();
}
}
private void uplabassistentItemDialog() {////Update a LabAssistant
LabAssistent item = findllabAssistant();
if (!flag)
return;
if (item != null) {
Dialog<ButtonType> dialog = new Dialog<>();
dialog.initOwner(mainBorderPane.getScene().getWindow());
dialog.setTitle("Update");
FXMLLoader fxmlLoader = new FXMLLoader();
fxmlLoader.setLocation(getClass().getResource("/mainPackage/ADDDialoge/LabAssistent.fxml"));
try {
dialog.getDialogPane().setContent(fxmlLoader.load());
} catch (IOException e) {
e.printStackTrace();
return;
}
LabAssistentController controller = fxmlLoader.getController();
controller.update(item);
dialog.getDialogPane().getButtonTypes().add(ButtonType.OK);
dialog.getDialogPane().getButtonTypes().add(ButtonType.CANCEL);
Optional<ButtonType> result1 = dialog.showAndWait();
if (result1.isPresent() && (result1.get() == ButtonType.OK)) {
boolean s = controller.updateResult(item);
if (s)
text.setText("Update Sucessfull");
else
text.setText("Employ ID Must be Unique Or Non Empty");
}
} else {
Alert alert = new Alert(Alert.AlertType.INFORMATION);
alert.setTitle("Delete");
alert.setHeaderText(null);
alert.setContentText("Non Teaching Stuff Not Found");
alert.show();
}
}
private Student findStudent() {
flag = true;
Dialog<ButtonType> dialog = new Dialog<>();
dialog.initOwner(mainBorderPane.getScene().getWindow());
dialog.setTitle("Find");
FXMLLoader fxmlLoader = new FXMLLoader();
fxmlLoader.setLocation(getClass().getResource("/mainPackage/FindDialoge/DelStudent.fxml"));
try {
dialog.getDialogPane().setContent(fxmlLoader.load());
} catch (IOException e) {
System.out.println("Couldn't load the dialog");
e.printStackTrace();
}
dialog.getDialogPane().getButtonTypes().add(ButtonType.OK);
dialog.getDialogPane().getButtonTypes().add(ButtonType.CANCEL);
Optional<ButtonType> result = dialog.showAndWait();
if (result.isPresent() && (result.get() == ButtonType.OK)) {
FindStudentController controller = fxmlLoader.getController();
return controller.processResult();
} else {
flag = false;
return null;
}
}
private Teacher findTeacher() {
flag = true;
Dialog<ButtonType> dialog = new Dialog<>();
dialog.initOwner(mainBorderPane.getScene().getWindow());
dialog.setTitle("Delete Teacher Record");
FXMLLoader fxmlLoader = new FXMLLoader();
fxmlLoader.setLocation(getClass().getResource("/mainPackage/FindDialoge/DelTeacher.fxml"));
try {
dialog.getDialogPane().setContent(fxmlLoader.load());
} catch (IOException e) {
System.out.println("Couldn't load the dialog");
e.printStackTrace();
return null;
}
dialog.getDialogPane().getButtonTypes().add(ButtonType.OK);
dialog.getDialogPane().getButtonTypes().add(ButtonType.CANCEL);
Optional<ButtonType> result = dialog.showAndWait();
if (result.isPresent() && (result.get() == ButtonType.OK)) {
FindTeacherController controller = fxmlLoader.getController();
return controller.processResult();
} else {
flag = false;
return null;
}
}
private Employ findnonteaching() {
Dialog<ButtonType> dialog = new Dialog<>();
dialog.initOwner(mainBorderPane.getScene().getWindow());
dialog.setTitle("Find");
FXMLLoader fxmlLoader = new FXMLLoader();
fxmlLoader.setLocation(getClass().getResource("/mainPackage/FindDialoge/DelEmploy.fxml"));
try {
dialog.getDialogPane().setContent(fxmlLoader.load());
} catch (IOException e) {
System.out.println("Couldn't load the dialog");
e.printStackTrace();
return null;
}
dialog.getDialogPane().getButtonTypes().add(ButtonType.OK);
dialog.getDialogPane().getButtonTypes().add(ButtonType.CANCEL);
Optional<ButtonType> result = dialog.showAndWait();
if (result.isPresent() && (result.get() == ButtonType.OK)) {
FindEmployController controller = fxmlLoader.getController();
return controller.processResult();
}else {
flag=false;
return null;
}
}
private LabAssistent findllabAssistant() {
flag = true;
Dialog<ButtonType> dialog = new Dialog<>();
dialog.initOwner(mainBorderPane.getScene().getWindow());
dialog.setTitle("Find");
FXMLLoader fxmlLoader = new FXMLLoader();
fxmlLoader.setLocation(getClass().getResource("/mainPackage/FindDialoge/DelLabAssistent.fxml"));
try {
dialog.getDialogPane().setContent(fxmlLoader.load());
} catch (IOException e) {
System.out.println("Couldn't load the dialog");
e.printStackTrace();
return null;
}
dialog.getDialogPane().getButtonTypes().add(ButtonType.OK);
dialog.getDialogPane().getButtonTypes().add(ButtonType.CANCEL);
Optional<ButtonType> result = dialog.showAndWait();
if (result.isPresent() && (result.get() == ButtonType.OK)) {
FindLabAssistentController controller = fxmlLoader.getController();
return controller.processResult();
}else {
flag=false;
return null;
}
}
private void findAlumini() {
Alert alert=new Alert(Alert.AlertType.INFORMATION);
alert.setTitle("Delete Or Update Alumini");
alert.setHeaderText("You Cannot Update or Delete Alumini From Here");
alert.setContentText("To Update Or Delete Click On Get Informatation");
alert.showAndWait();
}
private void uprecorceItemDialog(){
Alert alert=new Alert(Alert.AlertType.INFORMATION);
alert.setTitle("Delete Or Update Alumini");
alert.setHeaderText("You Cannot Update or Delete Resource Information From Here");
alert.setContentText("To Update Or Delete Click On Get Information");
alert.showAndWait();
}
private void getResourceInfo(){
Dialog<ButtonType> dialog = new Dialog<>();
dialog.initOwner(mainBorderPane.getScene().getWindow());
dialog.setTitle("Resource Informatation");
FXMLLoader fxmlLoader=new FXMLLoader();
fxmlLoader.setLocation(getClass().getResource("/mainPackage/Info/ResourceInfo.fxml"));
try {
dialog.getDialogPane().setContent(fxmlLoader.load());
} catch (IOException e) {
System.out.println("Couldn't load the dialog");
e.printStackTrace();
}
dialog.getDialogPane().getButtonTypes().addAll(ButtonType.OK);
Optional result=dialog.showAndWait();
if(result.isPresent() && result.get()==ButtonType.OK)
dialog.close();
}
private void studentInfo() {
Dialog dialog=new Dialog();
dialog.initOwner(mainBorderPane.getScene().getWindow());
dialog.setTitle("Student Information");
FXMLLoader fxmlLoader=new FXMLLoader();
fxmlLoader.setLocation(getClass().getResource("/mainPackage/Info/StudentInfo.fxml"));
try {
dialog.getDialogPane().setContent(fxmlLoader.load());
}catch (IOException e){
e.printStackTrace();
}
dialog.getDialogPane().getButtonTypes().add(ButtonType.OK);
Optional result=dialog.showAndWait();
if(result.isPresent() && result.get()==ButtonType.OK)
dialog.close();
}
private void teacheInfo(){
Dialog dialog=new Dialog();
dialog.initOwner(mainBorderPane.getScene().getWindow());
dialog.setTitle("Teacher Information");
FXMLLoader fxmlLoader=new FXMLLoader();
fxmlLoader.setLocation(getClass().getResource("/mainPackage/Info/TeacherInfo.fxml"));
try {
dialog.getDialogPane().setContent(fxmlLoader.load());
}catch (IOException e){
e.printStackTrace();
}
dialog.getDialogPane().getButtonTypes().add(ButtonType.OK);
Optional result=dialog.showAndWait();
if(result.isPresent() && result.get()==ButtonType.OK)
dialog.close();
}
private void nonTeachingInfo(){
Dialog dialog=new Dialog();
dialog.initOwner(mainBorderPane.getScene().getWindow());
dialog.setTitle("Non-Teaching Stuff Information");
FXMLLoader fxmlLoader=new FXMLLoader();
fxmlLoader.setLocation(getClass().getResource("/mainPackage/Info/NonTeachingInfo.fxml"));
try {
dialog.getDialogPane().setContent(fxmlLoader.load());
}catch (IOException e){
e.printStackTrace();
}
dialog.getDialogPane().getButtonTypes().add(ButtonType.OK);
Optional result=dialog.showAndWait();
if(result.isPresent() && result.get()==ButtonType.OK)
dialog.close();
}
private void labassistantInfo(){
Dialog dialog=new Dialog();
dialog.initOwner(mainBorderPane.getScene().getWindow());
dialog.setTitle("LabAssistant Information");
FXMLLoader fxmlLoader=new FXMLLoader();
fxmlLoader.setLocation(getClass().getResource("/mainPackage/Info/LabAssistantInfo.fxml"));
try {
dialog.getDialogPane().setContent(fxmlLoader.load());
}catch (IOException e){
e.printStackTrace();
}
dialog.getDialogPane().getButtonTypes().add(ButtonType.OK);
Optional result=dialog.showAndWait();
if(result.isPresent() && result.get()==ButtonType.OK)
dialog.close();
}
private void alumniInfo(){
Dialog dialog=new Dialog();
dialog.initOwner(mainBorderPane.getScene().getWindow());
dialog.setTitle("Alumni Information");
FXMLLoader fxmlLoader=new FXMLLoader();
fxmlLoader.setLocation(getClass().getResource("/mainPackage/Info/AlumniInfo.fxml"));
try {
dialog.getDialogPane().setContent(fxmlLoader.load());
}catch (IOException e){
e.printStackTrace();
}
dialog.getDialogPane().getButtonTypes().add(ButtonType.OK);
Optional result=dialog.showAndWait();
if(result.isPresent() && result.get()==ButtonType.OK)
dialog.close();
}
}