1 package com.melloware.jukes.gui.view.dialogs;
2
3 import java.awt.BorderLayout;
4 import java.awt.Frame;
5
6 import javax.swing.JButton;
7 import javax.swing.JComponent;
8 import javax.swing.JPanel;
9 import javax.swing.JTabbedPane;
10
11 import com.jgoodies.forms.factories.Borders;
12 import com.jgoodies.forms.factories.ButtonBarFactory;
13 import com.jgoodies.forms.layout.Sizes;
14 import com.jgoodies.uif.AbstractDialog;
15 import com.jgoodies.uif.util.Resizer;
16 import com.jgoodies.uifextras.panel.HeaderPanel;
17 import com.melloware.jukes.gui.tool.Resources;
18
19
20
21
22
23
24
25
26 public final class StatisticsDialog extends AbstractDialog {
27 private JButton buttonClose;
28 private JComponent buttonBar;
29
30
31
32
33
34 public StatisticsDialog(Frame owner) {
35 super(owner);
36 }
37
38
39
40
41
42 protected JComponent buildApplicationTab() {
43
44 final JPanel table = new PropertySheetApplicationStats();
45 int width = Sizes.dialogUnitXAsPixel(300, table);
46 table.setPreferredSize(Resizer.DEFAULT.fromWidth(width));
47 table.setBorder(Borders.DIALOG_BORDER);
48 return table;
49 }
50
51
52
53
54
55 @Override
56 protected JComponent buildContent() {
57 final JPanel content = new JPanel(new BorderLayout());
58 content.add(buildTabbedPane(), BorderLayout.CENTER);
59
60 buttonClose = createCancelButton();
61 buttonClose.setText(Resources.getString("label.Close"));
62 buttonClose.setEnabled(true);
63 buttonBar = ButtonBarFactory.buildRightAlignedBar(buttonClose);
64 content.add(buttonBar, BorderLayout.SOUTH);
65 return content;
66 }
67
68
69
70
71
72 protected JComponent buildDatabaseTab() {
73 final JPanel table = new PropertySheetHibernateStats();
74 int width = Sizes.dialogUnitXAsPixel(220, table);
75 table.setPreferredSize(Resizer.DEFAULT.fromWidth(width));
76 table.setBorder(Borders.DIALOG_BORDER);
77 return table;
78 }
79
80
81
82
83
84 @Override
85 protected JComponent buildHeader() {
86 return new HeaderPanel(Resources.getString("label.Statistics"), Resources.getString("label.StatisticsMessage"),
87 Resources.STATS_LARGE_ICON);
88 }
89
90
91
92
93
94 protected JComponent buildTabbedPane() {
95 final JTabbedPane tabbedPane = new JTabbedPane();
96 tabbedPane.add(Resources.getString("label.Application"), buildApplicationTab());
97 tabbedPane.add(Resources.getString("label.Database"), buildDatabaseTab());
98 return tabbedPane;
99 }
100
101
102
103
104
105 @Override
106 protected void resizeHook(JComponent component) {
107 Resizer.ONE2ONE.resizeDialogContent(component);
108 }
109
110 }