1 | package genius.gui.uncertainty;
|
---|
2 |
|
---|
3 | import java.awt.BorderLayout;
|
---|
4 | import java.awt.Dimension;
|
---|
5 | import java.awt.event.MouseEvent;
|
---|
6 | import java.awt.event.MouseListener;
|
---|
7 |
|
---|
8 | import javax.swing.JFrame;
|
---|
9 | import javax.swing.JPanel;
|
---|
10 |
|
---|
11 | import genius.gui.panels.ButtonPanel;
|
---|
12 |
|
---|
13 |
|
---|
14 | public class UncertaintyOptionPanel extends JPanel{
|
---|
15 |
|
---|
16 | private static final long serialVersionUID = -8425326403184043260L;
|
---|
17 |
|
---|
18 | UncertaintyOptionModel model;
|
---|
19 |
|
---|
20 | private ButtonPanel perceivedUtilButton;
|
---|
21 | private ButtonPanel pairwiseCompButton;
|
---|
22 |
|
---|
23 | public UncertaintyOptionPanel (UncertaintyOptionModel model){
|
---|
24 | JFrame frame = new JFrame("Introduce Uncertainty");
|
---|
25 | frame.add(this);
|
---|
26 | this.model = model;
|
---|
27 |
|
---|
28 | perceivedUtilButton = new ButtonPanel("Change Perceived Utility", model.getPerceivedUtilActivationModel());
|
---|
29 | pairwiseCompButton = new ButtonPanel("Add Uncertainty", model.getPairwiseCompActivationModel());
|
---|
30 | perceivedUtilButton.getButton().setPreferredSize(new Dimension(400,100));
|
---|
31 | pairwiseCompButton.getButton().setPreferredSize(new Dimension(400,100));
|
---|
32 |
|
---|
33 | this.add(perceivedUtilButton, BorderLayout.CENTER);
|
---|
34 | this.add(pairwiseCompButton, BorderLayout.CENTER);
|
---|
35 | connect();
|
---|
36 |
|
---|
37 | frame.setSize(600,600);
|
---|
38 | frame.setLocationRelativeTo(null);
|
---|
39 | frame.setVisible(true);
|
---|
40 | }
|
---|
41 |
|
---|
42 | public void connect() {
|
---|
43 |
|
---|
44 | perceivedUtilButton.getButton().addMouseListener(new MouseListener() {
|
---|
45 |
|
---|
46 | @Override
|
---|
47 | public void mouseClicked(MouseEvent arg0) {
|
---|
48 | removeAll();
|
---|
49 | PerceivedUtilityPanel perceivedUtilPanel = new PerceivedUtilityPanel(model.getPerceivedUtilModel());
|
---|
50 | add(perceivedUtilPanel);
|
---|
51 | revalidate();
|
---|
52 | repaint();
|
---|
53 | }
|
---|
54 |
|
---|
55 | @Override
|
---|
56 | public void mouseEntered(MouseEvent arg0) {
|
---|
57 | // TODO Auto-generated method stub
|
---|
58 |
|
---|
59 | }
|
---|
60 |
|
---|
61 | @Override
|
---|
62 | public void mouseExited(MouseEvent arg0) {
|
---|
63 | // TODO Auto-generated method stub
|
---|
64 |
|
---|
65 | }
|
---|
66 |
|
---|
67 | @Override
|
---|
68 | public void mousePressed(MouseEvent arg0) {
|
---|
69 | // TODO Auto-generated method stub
|
---|
70 |
|
---|
71 | }
|
---|
72 |
|
---|
73 | @Override
|
---|
74 | public void mouseReleased(MouseEvent arg0) {
|
---|
75 | // TODO Auto-generated method stub
|
---|
76 |
|
---|
77 | }
|
---|
78 | });
|
---|
79 |
|
---|
80 | pairwiseCompButton.getButton().addMouseListener(new MouseListener() {
|
---|
81 |
|
---|
82 | @Override
|
---|
83 | public void mouseClicked(MouseEvent arg0) {
|
---|
84 | removeAll();
|
---|
85 | PairwiseComparisonPanel pairwiseCompPanel = new PairwiseComparisonPanel(model.getPairwiseCompModel());
|
---|
86 | add(pairwiseCompPanel);
|
---|
87 | revalidate();
|
---|
88 | repaint();
|
---|
89 | }
|
---|
90 |
|
---|
91 | @Override
|
---|
92 | public void mouseEntered(MouseEvent arg0) {
|
---|
93 | // TODO Auto-generated method stub
|
---|
94 |
|
---|
95 | }
|
---|
96 |
|
---|
97 | @Override
|
---|
98 | public void mouseExited(MouseEvent arg0) {
|
---|
99 | // TODO Auto-generated method stub
|
---|
100 |
|
---|
101 | }
|
---|
102 |
|
---|
103 | @Override
|
---|
104 | public void mousePressed(MouseEvent arg0) {
|
---|
105 | // TODO Auto-generated method stub
|
---|
106 |
|
---|
107 | }
|
---|
108 |
|
---|
109 | @Override
|
---|
110 | public void mouseReleased(MouseEvent arg0) {
|
---|
111 | // TODO Auto-generated method stub
|
---|
112 |
|
---|
113 | }
|
---|
114 | });
|
---|
115 |
|
---|
116 |
|
---|
117 | }
|
---|
118 |
|
---|
119 | }
|
---|