Skip to content

Package: ExceptionViewLogic$1

ExceptionViewLogic$1

nameinstructionbranchcomplexitylinemethod
actionPerformed(ActionEvent)
M: 5 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
{...}
M: 9 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%

Coverage

1: /**
2: *
3: */
4: package gui;
5:
6: import gui.view.ExceptionView;
7:
8: import java.awt.event.ActionEvent;
9: import java.awt.event.ActionListener;
10:
11: import model.ModelFacade;
12:
13: /**
14: * @author Phil
15: *
16: */
17: public class ExceptionViewLogic {
18:         /**
19:          * the view to set.
20:          */
21:         private final ExceptionView excView;
22:         /**
23:          * The controller (mvc).
24:          */
25:         private final MainController controller;
26:
27:         /**
28:          * constructor. Creates the view.
29:          *
30:          * @param controller
31:          * the controller to set.
32:          * @param e
33:          * exception to handle.
34:          */
35:         public ExceptionViewLogic(final MainController controller, final Exception e) {
36:                 this.controller = controller;
37:                 this.excView = new ExceptionView(e);
38:                 initLogic();
39:                 this.excView.setVisible(true);
40:         }
41:
42:         /**
43:          * Constructor, creates the exception view. use this if the controller is not necessary.
44:          *
45:          * @param e
46:          * The exception.
47:          */
48:         public ExceptionViewLogic(final Exception e) {
49:                 this.controller = new MainController(new ModelFacade());
50:                 this.excView = new ExceptionView(e);
51:                 initLogic();
52:                 this.excView.setVisible(true);
53:         }
54:
55:         /**
56:          * Initializes the logic.
57:          */
58:         private void initLogic() {
59:                 final ExceptionView tempexcView = this.excView;
60:                 this.excView.getTextArea().setEditable(false);
61:                 this.getExcView().getBtnCancel().addActionListener(new ActionListener() {
62:
63:                         @Override
64:                         public void actionPerformed(final ActionEvent e) {
65:                                 tempexcView.setVisible(false);
66:                         }
67:                 });
68:         }
69:
70:         /**
71:          * @return the excView
72:          */
73:         protected ExceptionView getExcView() {
74:                 return this.excView;
75:         }
76:
77:         /**
78:          * @return the controller
79:          */
80:         protected MainController getController() {
81:                 return this.controller;
82:         }
83: }