1 | public class BarChartGui extends AbstractReportGui {↵ | | 1 | public class LineGraphGui extends AbstractReportGui {↵
|
|
2 | private JLabeledChoice xAxisLabel = new JLabeledChoice();↵ | | 2 | private JLabeledChoice xAxisLabel = new JLabeledChoice();↵
|
3 | ↵ | | |
|
4 | private JLabeledTextField yAxisLabel = ↵ | | 3 | private JLabeledTextField yAxisLabel = ↵
|
5 | new JLabeledTextField(JMeterUtils.getResString("report_chart_y_axis_label"));↵ | | 4 | new JLabeledTextField(JMeterUtils.getResString("report_chart_y_axis_label"));↵
|
6 | ↵ | | 5 | ↵
|
7 | private JLabeledTextField caption = ↵ | | 6 | private JLabeledTextField caption = ↵
|
8 | new JLabeledTextField(JMeterUtils.getResString("report_chart_caption"),↵ | | 7 | new JLabeledTextField(JMeterUtils.getResString("report_chart_caption"),↵
|
9 | Color.white);↵ | | 8 | Color.white);↵
|
|
10 | private JLabeledTextField url = ↵ | | 9 | private JLabeledTextField urls = ↵
|
11 | new JLabeledTextField(JMeterUtils.getResString("report_bar_graph_url"),↵ | | 10 | new JLabeledTextField(JMeterUtils.getResString("report_line_graph_urls"),↵
|
12 | Color.white);↵ | | 11 | Color.white);↵
|
|
13 | private JLabeledChoice yItems = new JLabeledChoice();↵ | | 12 | private JLabeledChoice yItems = new JLabeledChoice();↵
|
14 | private JLabeledChoice xItems = new JLabeledChoice();↵ | | 13 | private JLabeledChoice xItems = new JLabeledChoice();↵
|
|
15 | public BarChartGui() {↵ | | 14 | public LineGraphGui() {↵
|
16 | super();↵ | | 15 | super();↵
|
17 | init();↵ | | 16 | init();↵
|
18 | }↵ | | 17 | }↵
|
19 | ↵ | | 18 | ↵
|
20 | public String getLabelResource() {↵ | | 19 | public String getLabelResource() {↵
|
21 | return "report_bar_chart";↵ | | 20 | return "report_line_graph";↵
|
22 | }↵ | | 21 | }↵
|
23 | ↵ | | 22 | ↵
|
24 | public JPopupMenu createPopupMenu() {↵ | | 23 | public JPopupMenu createPopupMenu() {↵
|
25 | JPopupMenu pop = new JPopupMenu();↵ | | 24 | JPopupMenu pop = new JPopupMenu();↵
|
26 | ReportMenuFactory.addFileMenu(pop);↵ | | 25 | ReportMenuFactory.addFileMenu(pop);↵
|
27 | ReportMenuFactory.addEditMenu(pop,true);↵ | | 26 | ReportMenuFactory.addEditMenu(pop,true);↵
|
28 | return pop;↵ | | 27 | return pop;↵
|
29 | }↵ | | 28 | }↵
|
|
30 | private void init() {// called from ctor, so must not be overridable↵ | | 29 | private void init() {// called from ctor, so must not be overridable↵
|
31 | setLayout(new BorderLayout(10, 10));↵ | | 30 | setLayout(new BorderLayout(10, 10));↵
|
32 | setBorder(makeBorder());↵ | | 31 | setBorder(makeBorder());↵
|
33 | setBackground(Color.white);↵ | | 32 | setBackground(Color.white);↵
|
|
34 | JPanel pane = new JPanel();↵ | | 33 | JPanel pane = new JPanel();↵
|
35 | pane.setLayout(new BorderLayout(10,10));↵ | | 34 | pane.setLayout(new BorderLayout(10,10));↵
|
36 | pane.setBackground(Color.white);↵ | | 35 | pane.setBackground(Color.white);↵
|
37 | pane.add(this.getNamePanel(),BorderLayout.NORTH);↵ | | 36 | pane.add(this.getNamePanel(),BorderLayout.NORTH);↵
|
38 | ↵ | | 37 | ↵
|
39 | VerticalPanel options = new VerticalPanel(Color.white);↵ | | 38 | VerticalPanel options = new VerticalPanel(Color.white);↵
|
40 | xAxisLabel.setBackground(Color.white);↵ | | |
|
41 | yAxisLabel.setBackground(Color.white);↵ | | 39 | yAxisLabel.setBackground(Color.white);↵
|
|
42 | JLabel xLabel = new JLabel(JMeterUtils.getResString("report_chart_x_axis"));↵ | | 40 | JLabel xLabel = new JLabel(JMeterUtils.getResString("report_chart_x_axis"));↵
|
43 | HorizontalPanel xpanel = new HorizontalPanel(Color.white);↵ | | 41 | HorizontalPanel xpanel = new HorizontalPanel(Color.white);↵
|
44 | xLabel.setBorder(new EmptyBorder(5,2,5,2));↵ | | 42 | xLabel.setBorder(new EmptyBorder(5,2,5,2));↵
|
45 | xItems.setBackground(Color.white);↵ | | 43 | xItems.setBackground(Color.white);↵
|
46 | xItems.setValues(AbstractTable.xitems);↵ | | 44 | xItems.setValues(AbstractTable.xitems);↵
|
47 | xpanel.add(xLabel);↵ | | 45 | xpanel.add(xLabel);↵
|
48 | xpanel.add(xItems);↵ | | 46 | xpanel.add(xItems);↵
|
49 | options.add(xpanel);↵ | | 47 | options.add(xpanel);↵
|
|
50 | JLabel xALabel = new JLabel(JMeterUtils.getResString("report_chart_x_axis_label"));↵ | | 48 | JLabel xALabel = new JLabel(JMeterUtils.getResString("report_chart_x_axis_label"));↵
|
51 | HorizontalPanel xApanel = new HorizontalPanel(Color.white);↵ | | 49 | HorizontalPanel xApanel = new HorizontalPanel(Color.white);↵
|
52 | xALabel.setBorder(new EmptyBorder(5,2,5,2));↵ | | 50 | xALabel.setBorder(new EmptyBorder(5,2,5,2));↵
|
53 | xAxisLabel.setBackground(Color.white);↵ | | 51 | xAxisLabel.setBackground(Color.white);↵
|
54 | xAxisLabel.setValues(AbstractChart.X_LABELS);↵ | | 52 | xAxisLabel.setValues(AbstractChart.X_LABELS);↵
|
55 | xApanel.add(xALabel);↵ | | 53 | xApanel.add(xALabel);↵
|
56 | xApanel.add(xAxisLabel);↵ | | 54 | xApanel.add(xAxisLabel);↵
|
57 | options.add(xApanel);↵ | | 55 | options.add(xApanel);↵
|
58 | ↵ | | 56 | ↵
|
59 | JLabel yLabel = new JLabel(JMeterUtils.getResString("report_chart_y_axis"));↵ | | 57 | JLabel yLabel = new JLabel(JMeterUtils.getResString("report_chart_y_axis"));↵
|
60 | HorizontalPanel ypanel = new HorizontalPanel(Color.white);↵ | | 58 | HorizontalPanel ypanel = new HorizontalPanel(Color.white);↵
|
61 | yLabel.setBorder(new EmptyBorder(5,2,5,2));↵ | | 59 | yLabel.setBorder(new EmptyBorder(5,2,5,2));↵
|
62 | yItems.setBackground(Color.white);↵ | | 60 | yItems.setBackground(Color.white);↵
|
63 | yItems.setValues(AbstractTable.items);↵ | | 61 | yItems.setValues(AbstractTable.items);↵
|
64 | ypanel.add(yLabel);↵ | | 62 | ypanel.add(yLabel);↵
|
65 | ypanel.add(yItems);↵ | | 63 | ypanel.add(yItems);↵
|
66 | options.add(ypanel);↵ | | 64 | options.add(ypanel);↵
|
67 | options.add(yAxisLabel);↵ | | 65 | options.add(yAxisLabel);↵
|
68 | options.add(caption);↵ | | 66 | options.add(caption);↵
|
69 | options.add(url);↵ | | 67 | options.add(urls);↵
|
70 | ↵ | | 68 | ↵
|
71 | add(pane,BorderLayout.NORTH);↵ | | 69 | add(pane,BorderLayout.NORTH);↵
|
72 | add(options,BorderLayout.CENTER);↵ | | 70 | add(options,BorderLayout.CENTER);↵
|
73 | }↵ | | 71 | }↵
|
74 | ↵ | | 72 | ↵
|
75 | public TestElement createTestElement() {↵ | | 73 | public TestElement createTestElement() {↵
|
76 | BarChart element = new BarChart();↵ | | 74 | LineChart element = new LineChart();↵
|
77 | modifyTestElement(element);↵ | | 75 | modifyTestElement(element);↵
|
78 | return element;↵ | | 76 | return element;↵
|
79 | }↵ | | 77 | }↵
|
|
80 | public void modifyTestElement(TestElement element) {↵ | | 78 | public void modifyTestElement(TestElement element) {↵
|
81 | this.configureTestElement(element);↵ | | 79 | this.configureTestElement(element);↵
|
82 | BarChart bc = (BarChart)element;↵ | | 80 | LineChart bc = (LineChart)element;↵
|
83 | bc.setXAxis(xItems.getText());↵ | | 81 | bc.setXAxis(xItems.getText());↵
|
84 | bc.setYAxis(yItems.getText());↵ | | 82 | bc.setYAxis(yItems.getText());↵
|
85 | bc.setXLabel(xAxisLabel.getText());↵ | | 83 | bc.setXLabel(xAxisLabel.getText());↵
|
86 | bc.setYLabel(yAxisLabel.getText());↵ | | 84 | bc.setYLabel(yAxisLabel.getText());↵
|
87 | bc.setCaption(caption.getText());↵ | | 85 | bc.setCaption(caption.getText());↵
|
88 | bc.setURL(url.getText());↵ | | 86 | bc.setURLs(urls.getText());↵
|
89 | }↵ | | 87 | }↵
|
90 | ↵ | | 88 | ↵
|
91 | public void configure(TestElement element) {↵ | | 89 | public void configure(TestElement element) {↵
|
92 | super.configure(element);↵ | | 90 | super.configure(element);↵
|
93 | BarChart bc = (BarChart)element;↵ | | 91 | LineChart bc = (LineChart)element;↵
|
94 | xItems.setText(bc.getXAxis());↵ | | 92 | xItems.setText(bc.getXAxis());↵
|
95 | yItems.setText(bc.getYAxis());↵ | | 93 | yItems.setText(bc.getYAxis());↵
|
96 | xAxisLabel.setText(bc.getXLabel());↵ | | 94 | xAxisLabel.setText(bc.getXLabel());↵
|
97 | yAxisLabel.setText(bc.getYLabel());↵ | | 95 | yAxisLabel.setText(bc.getYLabel());↵
|
98 | caption.setText(bc.getCaption());↵ | | 96 | caption.setText(bc.getCaption());↵
|
99 | url.setText(bc.getURL());↵ | | 97 | urls.setText(bc.getURLs());↵
|
100 | | | 98 |
|