1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
package ca.spaz.cron.summary; |
5 |
|
|
6 |
|
import java.util.*; |
7 |
|
|
8 |
|
import javax.swing.JTabbedPane; |
9 |
|
|
10 |
|
import org.apache.log4j.Logger; |
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
|
22 |
|
public class NutritionSummaryPanel extends JTabbedPane implements Observer { |
23 |
|
|
24 |
|
|
25 |
|
|
26 |
0 |
private static final Logger logger = Logger.getLogger(NutritionSummaryPanel.class); |
27 |
|
|
28 |
|
private TargetSummaryChart targetPanel; |
29 |
|
|
30 |
|
private MacroNutrientSummaryPanel generalPanel; |
31 |
|
|
32 |
|
private MineralSummaryPanel mineralPanel; |
33 |
|
|
34 |
|
private VitaminSummaryPanel vitaminPanel; |
35 |
|
|
36 |
|
private AminoAcidSummaryPanel aminoAcidPanel; |
37 |
|
|
38 |
|
private LipidSummaryPanel lipidsPanel; |
39 |
|
|
40 |
0 |
public NutritionSummaryPanel() { |
41 |
0 |
add("Targets", getTargetSummaryPanel()); |
42 |
0 |
add("General", getGeneralPanel()); |
43 |
0 |
add("Vitamins", getVitaminsPanel()); |
44 |
0 |
add("Minerals", getMineralsPanel()); |
45 |
0 |
add("Amino Acids", getAminoAcidsPanel()); |
46 |
0 |
add("Lipids", getLipidsPanel()); |
47 |
0 |
} |
48 |
|
|
49 |
|
public void update(Observable source, Object message) { |
50 |
0 |
if (!(message instanceof List)) { |
51 |
0 |
return; |
52 |
|
} |
53 |
0 |
List consumed = (List) message; |
54 |
0 |
getTargetSummaryPanel().update(source, message); |
55 |
0 |
getGeneralPanel().update(source, message); |
56 |
0 |
getMineralsPanel().update(source, message); |
57 |
0 |
getVitaminsPanel().update(source, message); |
58 |
0 |
getAminoAcidsPanel().update(source, message); |
59 |
0 |
getLipidsPanel().update(source, message); |
60 |
0 |
} |
61 |
|
|
62 |
|
private TargetSummaryChart getTargetSummaryPanel() { |
63 |
0 |
if (null == targetPanel) { |
64 |
0 |
targetPanel = new TargetSummaryChart(); |
65 |
|
} |
66 |
0 |
return targetPanel; |
67 |
|
} |
68 |
|
|
69 |
|
private MacroNutrientSummaryPanel getGeneralPanel() { |
70 |
0 |
if (null == generalPanel) { |
71 |
0 |
generalPanel = new MacroNutrientSummaryPanel(); |
72 |
|
|
73 |
|
} |
74 |
0 |
return generalPanel; |
75 |
|
} |
76 |
|
|
77 |
|
private VitaminSummaryPanel getVitaminsPanel() { |
78 |
0 |
if (null == vitaminPanel) { |
79 |
0 |
vitaminPanel = new VitaminSummaryPanel(); |
80 |
|
} |
81 |
0 |
return vitaminPanel; |
82 |
|
} |
83 |
|
|
84 |
|
private MineralSummaryPanel getMineralsPanel() { |
85 |
0 |
if (null == mineralPanel) { |
86 |
0 |
mineralPanel = new MineralSummaryPanel(); |
87 |
|
} |
88 |
0 |
return mineralPanel; |
89 |
|
} |
90 |
|
|
91 |
|
private AminoAcidSummaryPanel getAminoAcidsPanel() { |
92 |
0 |
if (null == aminoAcidPanel) { |
93 |
0 |
aminoAcidPanel = new AminoAcidSummaryPanel(); |
94 |
|
} |
95 |
0 |
return aminoAcidPanel; |
96 |
|
} |
97 |
|
|
98 |
|
private LipidSummaryPanel getLipidsPanel() { |
99 |
0 |
if (null == lipidsPanel) { |
100 |
0 |
lipidsPanel = new LipidSummaryPanel(); |
101 |
|
} |
102 |
0 |
return lipidsPanel; |
103 |
|
} |
104 |
|
|
105 |
|
} |