1 package org.whatsitcalled.webflange.webapp;
2
3 import java.util.ArrayList;
4 import java.util.List;
5
6 import org.apache.wicket.PageParameters;
7 import org.apache.wicket.extensions.markup.html.tabs.AbstractTab;
8 import org.apache.wicket.extensions.markup.html.tabs.TabbedPanel;
9 import org.apache.wicket.markup.html.panel.FeedbackPanel;
10 import org.apache.wicket.markup.html.panel.Panel;
11 import org.apache.wicket.model.Model;
12 import org.apache.wicket.security.components.SecureWebPage;
13 import org.whatsitcalled.webflange.WebflangeApplication;
14
15
16
17
18 public class HomePage extends SecureWebPage {
19
20 private static final long serialVersionUID = 1L;
21 private TabbedPanel tabbedPanel = null;
22
23
24
25
26
27
28
29
30 public HomePage(final PageParameters parameters) {
31 ((WebflangeApplication)getApplication()).addHeaders(this);
32
33
34
35 List tabs = new ArrayList();
36 tabs.add(new AbstractTab(new Model("Load Tests"))
37 {
38 public Panel getPanel(String panelId)
39 {
40 return new TestPanel(panelId);
41 }
42 });
43 tabs.add(new AbstractTab(new Model("Projects"))
44 {
45 public Panel getPanel(String panelId)
46 {
47 return new ProjectPanel(panelId);
48 }
49 });
50 tabs.add(new AbstractTab(new Model("Scripts"))
51 {
52 public Panel getPanel(String panelId)
53 {
54 return new ScriptPanel(panelId);
55 }
56 });
57
58 tabs.add(new AbstractTab(new Model("Files"))
59 {
60 public Panel getPanel(String panelId)
61 {
62 return new FilePanel(panelId);
63 }
64 });
65
66 tabs.add(new AbstractTab(new Model("Results"))
67 {
68 public Panel getPanel(String panelId)
69 {
70 return new ReportsPanel(panelId, parameters);
71 }
72 });
73
74 tabs.add(new AbstractTab(new Model("Help"))
75 {
76 public Panel getPanel(String panelId)
77 {
78 return new HelpPanel(panelId);
79 }
80 });
81
82 tabbedPanel = new TabbedPanel("tabs", tabs);
83 add(new FeedbackPanel("feedback")
84 {
85 private static final long serialVersionUID = 1L;
86
87
88
89
90 public boolean isVisible()
91 {
92 return anyMessage();
93 }
94 });
95
96 add(tabbedPanel);
97
98
99 if (!parameters.isEmpty()) {
100 setSelectedTab(4);
101 }
102 }
103
104 public void setSelectedTab(int t) {
105 tabbedPanel.setSelectedTab(t);
106 }
107 }