Lines 19-25
Link Here
|
19 |
package org.apache.jmeter.visualizers; |
19 |
package org.apache.jmeter.visualizers; |
20 |
|
20 |
|
21 |
import java.awt.BorderLayout; |
21 |
import java.awt.BorderLayout; |
|
|
22 |
import java.awt.Color; |
22 |
import java.awt.Dimension; |
23 |
import java.awt.Dimension; |
|
|
24 |
import java.awt.FlowLayout; |
25 |
import java.awt.Font; |
23 |
import java.awt.event.ActionEvent; |
26 |
import java.awt.event.ActionEvent; |
24 |
import java.awt.event.ActionListener; |
27 |
import java.awt.event.ActionListener; |
25 |
import java.io.FileNotFoundException; |
28 |
import java.io.FileNotFoundException; |
Lines 29-45
Link Here
|
29 |
import java.util.List; |
32 |
import java.util.List; |
30 |
import java.util.Map; |
33 |
import java.util.Map; |
31 |
import java.util.concurrent.ConcurrentHashMap; |
34 |
import java.util.concurrent.ConcurrentHashMap; |
|
|
35 |
import java.util.regex.Matcher; |
36 |
import java.util.regex.Pattern; |
37 |
import java.util.regex.PatternSyntaxException; |
32 |
|
38 |
|
|
|
39 |
import javax.swing.BorderFactory; |
40 |
import javax.swing.Box; |
33 |
import javax.swing.BoxLayout; |
41 |
import javax.swing.BoxLayout; |
34 |
import javax.swing.JButton; |
42 |
import javax.swing.JButton; |
35 |
import javax.swing.JCheckBox; |
43 |
import javax.swing.JCheckBox; |
|
|
44 |
import javax.swing.JColorChooser; |
45 |
import javax.swing.JComboBox; |
36 |
import javax.swing.JComponent; |
46 |
import javax.swing.JComponent; |
37 |
import javax.swing.JFileChooser; |
47 |
import javax.swing.JFileChooser; |
38 |
import javax.swing.JLabel; |
48 |
import javax.swing.JLabel; |
39 |
import javax.swing.JPanel; |
49 |
import javax.swing.JPanel; |
40 |
import javax.swing.JScrollPane; |
50 |
import javax.swing.JScrollPane; |
41 |
import javax.swing.JSplitPane; |
51 |
import javax.swing.JSplitPane; |
|
|
52 |
import javax.swing.JTabbedPane; |
42 |
import javax.swing.JTable; |
53 |
import javax.swing.JTable; |
|
|
54 |
import javax.swing.JTextField; |
43 |
import javax.swing.border.Border; |
55 |
import javax.swing.border.Border; |
44 |
import javax.swing.border.EmptyBorder; |
56 |
import javax.swing.border.EmptyBorder; |
45 |
import javax.swing.table.TableCellRenderer; |
57 |
import javax.swing.table.TableCellRenderer; |
Lines 48-61
Link Here
|
48 |
import org.apache.jmeter.gui.action.ActionRouter; |
60 |
import org.apache.jmeter.gui.action.ActionRouter; |
49 |
import org.apache.jmeter.gui.action.SaveGraphics; |
61 |
import org.apache.jmeter.gui.action.SaveGraphics; |
50 |
import org.apache.jmeter.gui.util.FileDialoger; |
62 |
import org.apache.jmeter.gui.util.FileDialoger; |
51 |
import org.apache.jmeter.gui.util.HorizontalPanel; |
63 |
import org.apache.jmeter.gui.util.FilePanel; |
52 |
import org.apache.jmeter.gui.util.VerticalPanel; |
64 |
import org.apache.jmeter.gui.util.VerticalPanel; |
53 |
import org.apache.jmeter.samplers.Clearable; |
65 |
import org.apache.jmeter.samplers.Clearable; |
54 |
import org.apache.jmeter.samplers.SampleResult; |
66 |
import org.apache.jmeter.samplers.SampleResult; |
55 |
import org.apache.jmeter.save.CSVSaveService; |
67 |
import org.apache.jmeter.save.CSVSaveService; |
56 |
import org.apache.jmeter.util.JMeterUtils; |
68 |
import org.apache.jmeter.util.JMeterUtils; |
57 |
import org.apache.jmeter.visualizers.gui.AbstractVisualizer; |
69 |
import org.apache.jmeter.visualizers.gui.AbstractVisualizer; |
58 |
import org.apache.jorphan.gui.JLabeledChoice; |
|
|
59 |
import org.apache.jorphan.gui.JLabeledTextField; |
70 |
import org.apache.jorphan.gui.JLabeledTextField; |
60 |
import org.apache.jorphan.gui.NumberRenderer; |
71 |
import org.apache.jorphan.gui.NumberRenderer; |
61 |
import org.apache.jorphan.gui.ObjectTableModel; |
72 |
import org.apache.jorphan.gui.ObjectTableModel; |
Lines 97-102
Link Here
|
97 |
|
108 |
|
98 |
private final String TOTAL_ROW_LABEL = |
109 |
private final String TOTAL_ROW_LABEL = |
99 |
JMeterUtils.getResString("aggregate_report_total_label"); //$NON-NLS-1$ |
110 |
JMeterUtils.getResString("aggregate_report_total_label"); //$NON-NLS-1$ |
|
|
111 |
|
112 |
private final Border MARGIN = new EmptyBorder(0, 5, 0, 5); |
100 |
|
113 |
|
101 |
private JTable myJTable; |
114 |
private JTable myJTable; |
102 |
|
115 |
|
Lines 114-130
Link Here
|
114 |
|
127 |
|
115 |
private AxisGraph graphPanel = null; |
128 |
private AxisGraph graphPanel = null; |
116 |
|
129 |
|
117 |
private VerticalPanel graph = null; |
130 |
private JPanel settingsPane = null; |
118 |
|
|
|
119 |
private JScrollPane graphScroll = null; |
120 |
|
131 |
|
121 |
private JSplitPane spane = null; |
132 |
private JSplitPane spane = null; |
122 |
|
133 |
|
123 |
private JLabeledChoice columns = |
|
|
124 |
new JLabeledChoice(JMeterUtils.getResString("aggregate_graph_column"),GRAPH_COLUMNS);//$NON-NLS-1$ |
125 |
|
126 |
//NOT USED protected double[][] data = null; |
134 |
//NOT USED protected double[][] data = null; |
127 |
|
135 |
|
|
|
136 |
private JTabbedPane tabbedGraph = new JTabbedPane(JTabbedPane.TOP); |
137 |
|
128 |
private JButton displayButton = |
138 |
private JButton displayButton = |
129 |
new JButton(JMeterUtils.getResString("aggregate_graph_display")); //$NON-NLS-1$ |
139 |
new JButton(JMeterUtils.getResString("aggregate_graph_display")); //$NON-NLS-1$ |
130 |
|
140 |
|
Lines 134-139
Link Here
|
134 |
private JButton saveTable = |
144 |
private JButton saveTable = |
135 |
new JButton(JMeterUtils.getResString("aggregate_graph_save_table")); //$NON-NLS-1$ |
145 |
new JButton(JMeterUtils.getResString("aggregate_graph_save_table")); //$NON-NLS-1$ |
136 |
|
146 |
|
|
|
147 |
private JButton chooseBarColor = |
148 |
new JButton(JMeterUtils.getResString("aggregate_graph_choose_bar_color")); //$NON-NLS-1$ |
149 |
|
150 |
private JButton chooseForeColor = |
151 |
new JButton(JMeterUtils.getResString("aggregate_graph_choose_foreground_color")); //$NON-NLS-1$ |
152 |
|
153 |
private JButton syncWithName = |
154 |
new JButton(JMeterUtils.getResString("aggregate_graph_sync_with_name")); //$NON-NLS-1$ |
155 |
|
137 |
private JCheckBox saveHeaders = // should header be saved with the data? |
156 |
private JCheckBox saveHeaders = // should header be saved with the data? |
138 |
new JCheckBox(JMeterUtils.getResString("aggregate_graph_save_table_header")); //$NON-NLS-1$ |
157 |
new JCheckBox(JMeterUtils.getResString("aggregate_graph_save_table_header")); //$NON-NLS-1$ |
139 |
|
158 |
|
Lines 143-148
Link Here
|
143 |
private JLabeledTextField maxLengthXAxisLabel = |
162 |
private JLabeledTextField maxLengthXAxisLabel = |
144 |
new JLabeledTextField(JMeterUtils.getResString("aggregate_graph_max_length_xaxis_label"));//$NON-NLS-1$ |
163 |
new JLabeledTextField(JMeterUtils.getResString("aggregate_graph_max_length_xaxis_label"));//$NON-NLS-1$ |
145 |
|
164 |
|
|
|
165 |
/** |
166 |
* checkbox for use dynamic graph size |
167 |
*/ |
168 |
private JCheckBox dynamicGraphSize = new JCheckBox(JMeterUtils.getResString("aggregate_graph_dynamic_size")); // $NON-NLS-1$ |
169 |
|
146 |
private JLabeledTextField graphWidth = |
170 |
private JLabeledTextField graphWidth = |
147 |
new JLabeledTextField(JMeterUtils.getResString("aggregate_graph_width")); //$NON-NLS-1$ |
171 |
new JLabeledTextField(JMeterUtils.getResString("aggregate_graph_width")); //$NON-NLS-1$ |
148 |
private JLabeledTextField graphHeight = |
172 |
private JLabeledTextField graphHeight = |
Lines 158-163
Link Here
|
158 |
|
182 |
|
159 |
private int defaultHeight = 300; |
183 |
private int defaultHeight = 300; |
160 |
|
184 |
|
|
|
185 |
private JLabel currentColor = new JLabel(JMeterUtils.getResString("aggregate_graph_current_colors")); //$NON-NLS-1$ |
186 |
|
187 |
private JComboBox columnsList = new JComboBox(GRAPH_COLUMNS); |
188 |
|
189 |
private JCheckBox columnSelection = new JCheckBox(JMeterUtils.getResString("aggregate_graph_column_selection"), false); //$NON-NLS-1$ |
190 |
|
191 |
private JTextField columnMatchLabel = new JTextField(); |
192 |
|
193 |
private JButton reloadButton = new JButton(JMeterUtils.getResString("aggregate_graph_reload_data")); // $NON-NLS-1$ |
194 |
|
195 |
private JCheckBox caseChkBox = new JCheckBox(JMeterUtils.getResString("search_text_chkbox_case"), false); // $NON-NLS-1$ |
196 |
|
197 |
private JCheckBox regexpChkBox = new JCheckBox(JMeterUtils.getResString("search_text_chkbox_regexp"), true); // $NON-NLS-1$ |
198 |
|
199 |
private JComboBox titleFontNameList = new JComboBox(StatGraphProperties.getFontNameMap().keySet().toArray()); |
200 |
|
201 |
private JComboBox titleFontSizeList = new JComboBox(StatGraphProperties.fontSize); |
202 |
|
203 |
private JComboBox titleFontStyleList = new JComboBox(StatGraphProperties.getFontStyleMap().keySet().toArray()); |
204 |
|
205 |
private JComboBox fontNameList = new JComboBox(StatGraphProperties.getFontNameMap().keySet().toArray()); |
206 |
|
207 |
private JComboBox fontSizeList = new JComboBox(StatGraphProperties.fontSize); |
208 |
|
209 |
private JComboBox fontStyleList = new JComboBox(StatGraphProperties.getFontStyleMap().keySet().toArray()); |
210 |
|
211 |
private JComboBox legendPlacementList = new JComboBox(StatGraphProperties.getPlacementNameMap().keySet().toArray()); |
212 |
|
213 |
private JCheckBox drawOutlinesBar = new JCheckBox(JMeterUtils.getResString("aggregate_graph_draw_outlines"), true); // Default checked // $NON-NLS-1$ |
214 |
|
215 |
private JCheckBox numberShowGrouping = new JCheckBox(JMeterUtils.getResString("aggregate_graph_number_grouping"), true); // Default checked // $NON-NLS-1$ |
216 |
|
217 |
private Color colorBarGraph = Color.YELLOW; |
218 |
|
219 |
private Color colorForeGraph = Color.BLACK; |
220 |
|
161 |
public StatGraphVisualizer() { |
221 |
public StatGraphVisualizer() { |
162 |
super(); |
222 |
super(); |
163 |
model = new ObjectTableModel(COLUMNS, |
223 |
model = new ObjectTableModel(COLUMNS, |
Lines 208-224
Link Here
|
208 |
public void add(SampleResult res) { |
268 |
public void add(SampleResult res) { |
209 |
SamplingStatCalculator row = null; |
269 |
SamplingStatCalculator row = null; |
210 |
final String sampleLabel = res.getSampleLabel(); |
270 |
final String sampleLabel = res.getSampleLabel(); |
211 |
synchronized (lock) { |
271 |
Matcher matcher = null; |
212 |
row = tableRows.get(sampleLabel); |
272 |
if (columnSelection.isSelected() && columnMatchLabel.getText() != null && columnMatchLabel.getText().length() > 0) { |
213 |
if (row == null) { |
273 |
Pattern pattern = createPattern(columnMatchLabel.getText()); |
214 |
row = new SamplingStatCalculator(sampleLabel); |
274 |
matcher = pattern.matcher(sampleLabel); |
215 |
tableRows.put(row.getLabel(), row); |
275 |
} |
216 |
model.insertRow(row, model.getRowCount() - 1); |
276 |
if ((matcher == null) || (matcher.find())) { |
|
|
277 |
synchronized (lock) { |
278 |
row = tableRows.get(sampleLabel); |
279 |
if (row == null) { |
280 |
row = new SamplingStatCalculator(sampleLabel); |
281 |
tableRows.put(row.getLabel(), row); |
282 |
model.insertRow(row, model.getRowCount() - 1); |
283 |
} |
217 |
} |
284 |
} |
|
|
285 |
row.addSample(res); |
286 |
tableRows.get(TOTAL_ROW_LABEL).addSample(res); |
287 |
model.fireTableDataChanged(); |
218 |
} |
288 |
} |
219 |
row.addSample(res); |
|
|
220 |
tableRows.get(TOTAL_ROW_LABEL).addSample(res); |
221 |
model.fireTableDataChanged(); |
222 |
} |
289 |
} |
223 |
|
290 |
|
224 |
/** |
291 |
/** |
Lines 253-334
Link Here
|
253 |
RendererUtils.applyRenderers(myJTable, RENDERERS); |
320 |
RendererUtils.applyRenderers(myJTable, RENDERERS); |
254 |
myScrollPane = new JScrollPane(myJTable); |
321 |
myScrollPane = new JScrollPane(myJTable); |
255 |
|
322 |
|
256 |
graph = new VerticalPanel(); |
323 |
settingsPane = new VerticalPanel(); |
257 |
graph.setBorder(margin2); |
324 |
settingsPane.setBorder(margin2); |
258 |
|
325 |
|
259 |
|
|
|
260 |
JLabel graphLabel = new JLabel(JMeterUtils.getResString("aggregate_graph")); //$NON-NLS-1$ |
261 |
graphPanel = new AxisGraph(); |
326 |
graphPanel = new AxisGraph(); |
262 |
graphPanel.setPreferredSize(new Dimension(defaultWidth,defaultHeight)); |
327 |
graphPanel.setPreferredSize(new Dimension(defaultWidth, defaultHeight)); |
263 |
|
328 |
|
264 |
// horizontal panel for the buttons |
329 |
settingsPane.add(createGraphActionsPane()); |
265 |
HorizontalPanel buttonpanel = new HorizontalPanel(); |
330 |
settingsPane.add(createGraphColumnPane()); |
266 |
buttonpanel.add(columns); |
331 |
settingsPane.add(createGraphTitlePane()); |
267 |
buttonpanel.add(displayButton); |
332 |
settingsPane.add(createGraphDimensionPane()); |
268 |
buttonpanel.add(saveGraph); |
333 |
settingsPane.add(createGraphXAxisPane()); |
269 |
buttonpanel.add(saveTable); |
334 |
settingsPane.add(createLegendPane()); |
270 |
buttonpanel.add(saveHeaders); |
|
|
271 |
|
335 |
|
272 |
graph.add(graphLabel); |
336 |
tabbedGraph.addTab(JMeterUtils.getResString("aggregate_graph_tab_settings"), settingsPane); //$NON-NLS-1$ |
273 |
graph.add(graphTitle); |
337 |
tabbedGraph.addTab(JMeterUtils.getResString("aggregate_graph_tab_graph"), graphPanel); //$NON-NLS-1$ |
274 |
graph.add(maxLengthXAxisLabel); |
|
|
275 |
graph.add(graphWidth); |
276 |
graph.add(graphHeight); |
277 |
graph.add(buttonpanel); |
278 |
graph.add(graphPanel); |
279 |
|
280 |
displayButton.addActionListener(this); |
281 |
saveGraph.addActionListener(this); |
282 |
saveTable.addActionListener(this); |
283 |
graphScroll = new JScrollPane(graph); |
284 |
graphScroll.setAutoscrolls(true); |
285 |
|
338 |
|
286 |
spane = new JSplitPane(JSplitPane.VERTICAL_SPLIT); |
339 |
spane = new JSplitPane(JSplitPane.VERTICAL_SPLIT); |
287 |
spane.setLeftComponent(myScrollPane); |
340 |
spane.setLeftComponent(myScrollPane); |
288 |
spane.setRightComponent(graphScroll); |
341 |
spane.setRightComponent(tabbedGraph); |
289 |
spane.setResizeWeight(.2); |
342 |
spane.setResizeWeight(.2); |
290 |
spane.setContinuousLayout(true); |
343 |
spane.setContinuousLayout(true); |
291 |
|
344 |
|
292 |
this.add(mainPanel, BorderLayout.NORTH); |
345 |
this.add(mainPanel, BorderLayout.NORTH); |
293 |
this.add(spane,BorderLayout.CENTER); |
346 |
this.add(spane, BorderLayout.CENTER); |
294 |
} |
347 |
} |
295 |
|
348 |
|
296 |
public void makeGraph() { |
349 |
public void makeGraph() { |
|
|
350 |
Dimension size = graphPanel.getSize(); |
297 |
String wstr = graphWidth.getText(); |
351 |
String wstr = graphWidth.getText(); |
298 |
String hstr = graphHeight.getText(); |
352 |
String hstr = graphHeight.getText(); |
299 |
String lstr = maxLengthXAxisLabel.getText(); |
353 |
String lstr = maxLengthXAxisLabel.getText(); |
300 |
if (wstr.length() == 0) { |
354 |
int width = (int) size.getWidth(); |
301 |
wstr = "450";//$NON-NLS-1$ |
355 |
if (wstr.length() != 0) { |
|
|
356 |
width = Integer.parseInt(wstr); |
302 |
} |
357 |
} |
303 |
if (hstr.length() == 0) { |
358 |
int height = (int) size.getHeight(); |
304 |
hstr = "250";//$NON-NLS-1$ |
359 |
if (hstr.length() != 0) { |
|
|
360 |
height = Integer.parseInt(hstr); |
305 |
} |
361 |
} |
306 |
if (lstr.length() == 0) { |
362 |
if (lstr.length() == 0) { |
307 |
lstr = "20";//$NON-NLS-1$ |
363 |
lstr = "20";//$NON-NLS-1$ |
308 |
} |
364 |
} |
309 |
int width = Integer.parseInt(wstr); |
|
|
310 |
int height = Integer.parseInt(hstr); |
311 |
int maxLength = Integer.parseInt(lstr); |
365 |
int maxLength = Integer.parseInt(lstr); |
312 |
|
366 |
|
313 |
graphPanel.setData(this.getData()); |
367 |
graphPanel.setData(this.getData()); |
314 |
graphPanel.setHeight(height); |
|
|
315 |
graphPanel.setWidth(width); |
316 |
graphPanel.setTitle(graphTitle.getText()); |
368 |
graphPanel.setTitle(graphTitle.getText()); |
317 |
graphPanel.setMaxLength(maxLength); |
369 |
graphPanel.setMaxLength(maxLength); |
318 |
graphPanel.setXAxisLabels(getAxisLabels()); |
370 |
graphPanel.setXAxisLabels(getAxisLabels()); |
319 |
graphPanel.setXAxisTitle(columns.getText()); |
371 |
graphPanel.setXAxisTitle((String) columnsList.getSelectedItem()); |
320 |
graphPanel.setYAxisLabels(this.yAxisLabel); |
372 |
graphPanel.setYAxisLabels(this.yAxisLabel); |
321 |
graphPanel.setYAxisTitle(this.yAxisTitle); |
373 |
graphPanel.setYAxisTitle(this.yAxisTitle); |
|
|
374 |
graphPanel.setColor(colorBarGraph); |
375 |
graphPanel.setForeColor(colorForeGraph); |
376 |
graphPanel.setOutlinesBarFlag(drawOutlinesBar.isSelected()); |
377 |
graphPanel.setShowGrouping(numberShowGrouping.isSelected()); |
378 |
graphPanel.setLegendPlacement(StatGraphProperties.getPlacementNameMap() |
379 |
.get(legendPlacementList.getSelectedItem())); |
380 |
|
381 |
graphPanel.setTitleFont(new Font(StatGraphProperties.getFontNameMap().get(titleFontNameList.getSelectedItem()), |
382 |
StatGraphProperties.getFontStyleMap().get(titleFontStyleList.getSelectedItem()), |
383 |
Integer.parseInt((String) titleFontSizeList.getSelectedItem()))); |
384 |
graphPanel.setLegendFont(new Font(StatGraphProperties.getFontNameMap().get(fontNameList.getSelectedItem()), |
385 |
StatGraphProperties.getFontStyleMap().get(fontStyleList.getSelectedItem()), |
386 |
Integer.parseInt((String) fontSizeList.getSelectedItem()))); |
322 |
|
387 |
|
323 |
graphPanel.setPreferredSize(new Dimension(width,height)); |
388 |
graphPanel.setHeight(height); |
324 |
graph.setSize(new Dimension(graph.getWidth(), height + 120)); |
389 |
graphPanel.setWidth(width); |
325 |
spane.repaint(); |
390 |
spane.repaint(); |
326 |
} |
391 |
} |
327 |
|
392 |
|
328 |
public double[][] getData() { |
393 |
public double[][] getData() { |
329 |
if (model.getRowCount() > 1) { |
394 |
if (model.getRowCount() > 1) { |
330 |
int count = model.getRowCount() -1; |
395 |
int count = model.getRowCount() -1; |
331 |
int col = model.findColumn(columns.getText()); |
396 |
int col = model.findColumn((String) columnsList.getSelectedItem()); |
332 |
double[][] data = new double[1][count]; |
397 |
double[][] data = new double[1][count]; |
333 |
for (int idx=0; idx < count; idx++) { |
398 |
for (int idx=0; idx < count; idx++) { |
334 |
data[0][idx] = ((Number)model.getValueAt(idx,col)).doubleValue(); |
399 |
data[0][idx] = ((Number)model.getValueAt(idx,col)).doubleValue(); |
Lines 373-381
Link Here
|
373 |
} |
438 |
} |
374 |
|
439 |
|
375 |
public void actionPerformed(ActionEvent event) { |
440 |
public void actionPerformed(ActionEvent event) { |
376 |
if (event.getSource() == displayButton) { |
441 |
final Object eventSource = event.getSource(); |
|
|
442 |
if (eventSource == displayButton) { |
377 |
makeGraph(); |
443 |
makeGraph(); |
378 |
} else if (event.getSource() == saveGraph) { |
444 |
tabbedGraph.setSelectedIndex(1); |
|
|
445 |
} else if (eventSource == saveGraph) { |
379 |
saveGraphToFile = true; |
446 |
saveGraphToFile = true; |
380 |
try { |
447 |
try { |
381 |
ActionRouter.getInstance().getAction( |
448 |
ActionRouter.getInstance().getAction( |
Lines 384-390
Link Here
|
384 |
} catch (Exception e) { |
451 |
} catch (Exception e) { |
385 |
log.error(e.getMessage()); |
452 |
log.error(e.getMessage()); |
386 |
} |
453 |
} |
387 |
} else if (event.getSource() == saveTable) { |
454 |
} else if (eventSource == saveTable) { |
388 |
JFileChooser chooser = FileDialoger.promptToSaveFile("statistics.csv"); //$NON-NLS-1$ |
455 |
JFileChooser chooser = FileDialoger.promptToSaveFile("statistics.csv"); //$NON-NLS-1$ |
389 |
if (chooser == null) { |
456 |
if (chooser == null) { |
390 |
return; |
457 |
return; |
Lines 400-405
Link Here
|
400 |
} finally { |
467 |
} finally { |
401 |
JOrphanUtils.closeQuietly(writer); |
468 |
JOrphanUtils.closeQuietly(writer); |
402 |
} |
469 |
} |
|
|
470 |
} else if (eventSource == chooseBarColor) { |
471 |
colorBarGraph = JColorChooser.showDialog( |
472 |
null, |
473 |
JMeterUtils.getResString("aggregate_graph_choose_color"), //$NON-NLS-1$ |
474 |
colorBarGraph); |
475 |
currentColor.setBackground(colorBarGraph); |
476 |
} else if (eventSource == chooseForeColor) { |
477 |
colorForeGraph = JColorChooser.showDialog( |
478 |
null, |
479 |
JMeterUtils.getResString("aggregate_graph_choose_color"), //$NON-NLS-1$ |
480 |
colorBarGraph); |
481 |
currentColor.setForeground(colorForeGraph); |
482 |
} else if (eventSource == syncWithName) { |
483 |
graphTitle.setText(namePanel.getName()); |
484 |
} else if (eventSource == dynamicGraphSize) { |
485 |
// if use dynamic graph size is checked, we disable the dimension fields |
486 |
if (dynamicGraphSize.isSelected()) { |
487 |
graphWidth.setEnabled(false); |
488 |
graphHeight.setEnabled(false); |
489 |
} else { |
490 |
graphWidth.setEnabled(true); |
491 |
graphHeight.setEnabled(true); |
492 |
} |
493 |
} else if (eventSource == columnSelection) { |
494 |
if (columnSelection.isSelected()) { |
495 |
columnMatchLabel.setEnabled(true); |
496 |
reloadButton.setEnabled(true); |
497 |
caseChkBox.setEnabled(true); |
498 |
regexpChkBox.setEnabled(true); |
499 |
} else { |
500 |
columnMatchLabel.setEnabled(false); |
501 |
reloadButton.setEnabled(false); |
502 |
caseChkBox.setEnabled(false); |
503 |
regexpChkBox.setEnabled(false); |
504 |
} |
505 |
} else if (eventSource == reloadButton) { |
506 |
if (getFile() != null && getFile().length() > 0) { |
507 |
clearData(); |
508 |
FilePanel filePanel = (FilePanel) getFilePanel(); |
509 |
filePanel.actionPerformed(event); |
510 |
} |
403 |
} |
511 |
} |
404 |
} |
512 |
} |
405 |
|
513 |
|
Lines 413-416
Link Here
|
413 |
} |
521 |
} |
414 |
return this; |
522 |
return this; |
415 |
} |
523 |
} |
|
|
524 |
|
525 |
private JPanel createGraphActionsPane() { |
526 |
JPanel buttonPanel = new JPanel(new BorderLayout()); |
527 |
JPanel displayPane = new JPanel(); |
528 |
displayPane.add(displayButton); |
529 |
displayButton.addActionListener(this); |
530 |
buttonPanel.add(displayPane, BorderLayout.WEST); |
531 |
|
532 |
JPanel savePane = new JPanel(); |
533 |
savePane.add(saveGraph); |
534 |
savePane.add(saveTable); |
535 |
savePane.add(saveHeaders); |
536 |
saveGraph.addActionListener(this); |
537 |
saveTable.addActionListener(this); |
538 |
syncWithName.addActionListener(this); |
539 |
buttonPanel.add(savePane, BorderLayout.EAST); |
540 |
|
541 |
return buttonPanel; |
542 |
} |
543 |
|
544 |
private JPanel createGraphColumnPane() { |
545 |
JPanel barPanel = new JPanel(); |
546 |
barPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0)); |
547 |
|
548 |
barPanel.add(createLabelCombo(JMeterUtils.getResString("aggregate_graph_column"), //$NON-NLS-1$ |
549 |
columnsList)); |
550 |
|
551 |
currentColor.setBorder(new EmptyBorder(2, 5, 2, 5)); |
552 |
currentColor.setOpaque(true); |
553 |
currentColor.setBackground(colorBarGraph); |
554 |
|
555 |
barPanel.add(Box.createRigidArea(new Dimension(5,0))); |
556 |
barPanel.add(currentColor); |
557 |
barPanel.add(Box.createRigidArea(new Dimension(5,0))); |
558 |
barPanel.add(chooseBarColor); |
559 |
chooseBarColor.addActionListener(this); |
560 |
barPanel.add(Box.createRigidArea(new Dimension(5,0))); |
561 |
barPanel.add(chooseForeColor); |
562 |
chooseForeColor.addActionListener(this); |
563 |
|
564 |
barPanel.add(drawOutlinesBar); |
565 |
barPanel.add(numberShowGrouping); |
566 |
|
567 |
JPanel columnPane = new JPanel(new BorderLayout()); |
568 |
columnPane.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), |
569 |
JMeterUtils.getResString("aggregate_graph_column_settings"))); // $NON-NLS-1$ |
570 |
columnPane.add(barPanel, BorderLayout.NORTH); |
571 |
columnPane.add(Box.createRigidArea(new Dimension(5,0)), BorderLayout.CENTER); |
572 |
columnPane.add(createGraphSelectionSubPane(), BorderLayout.SOUTH); |
573 |
|
574 |
return columnPane; |
575 |
} |
576 |
|
577 |
private JPanel createGraphSelectionSubPane() { |
578 |
Font font = new Font("SansSerif", Font.PLAIN, 10); |
579 |
// Search field |
580 |
JPanel searchPanel = new JPanel(); |
581 |
searchPanel.setLayout(new BoxLayout(searchPanel, BoxLayout.X_AXIS)); |
582 |
searchPanel.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3)); |
583 |
|
584 |
searchPanel.add(columnSelection); |
585 |
columnMatchLabel.setEnabled(false); |
586 |
reloadButton.setEnabled(false); |
587 |
caseChkBox.setEnabled(false); |
588 |
regexpChkBox.setEnabled(false); |
589 |
columnSelection.addActionListener(this); |
590 |
|
591 |
searchPanel.add(columnMatchLabel); |
592 |
searchPanel.add(Box.createRigidArea(new Dimension(5,0))); |
593 |
|
594 |
// Button |
595 |
reloadButton.setFont(font); |
596 |
reloadButton.addActionListener(this); |
597 |
searchPanel.add(reloadButton); |
598 |
|
599 |
// checkboxes |
600 |
caseChkBox.setFont(font); |
601 |
searchPanel.add(caseChkBox); |
602 |
regexpChkBox.setFont(font); |
603 |
searchPanel.add(regexpChkBox); |
604 |
|
605 |
return searchPanel; |
606 |
} |
607 |
|
608 |
private JPanel createGraphTitlePane() { |
609 |
JPanel titleNamePane = new JPanel(new BorderLayout()); |
610 |
syncWithName.setFont(new Font("SansSerif", Font.PLAIN, 10)); |
611 |
titleNamePane.add(graphTitle, BorderLayout.CENTER); |
612 |
titleNamePane.add(syncWithName, BorderLayout.EAST); |
613 |
|
614 |
JPanel titleStylePane = new JPanel(); |
615 |
titleStylePane.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 5)); |
616 |
titleStylePane.add(createLabelCombo(JMeterUtils.getResString("aggregate_graph_font"), //$NON-NLS-1$ |
617 |
titleFontNameList)); |
618 |
titleFontNameList.setSelectedIndex(0); // default: sans serif |
619 |
titleStylePane.add(createLabelCombo(JMeterUtils.getResString("aggregate_graph_size"), //$NON-NLS-1$ |
620 |
titleFontSizeList)); |
621 |
titleFontSizeList.setSelectedItem(StatGraphProperties.fontSize[6]); // default: 16 |
622 |
titleStylePane.add(createLabelCombo(JMeterUtils.getResString("aggregate_graph_style"), //$NON-NLS-1$ |
623 |
titleFontStyleList)); |
624 |
titleFontStyleList.setSelectedItem(JMeterUtils.getResString("fontstyle.bold")); // default: bold |
625 |
|
626 |
JPanel titlePane = new JPanel(new BorderLayout()); |
627 |
titlePane.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), |
628 |
JMeterUtils.getResString("aggregate_graph_title_group"))); // $NON-NLS-1$ |
629 |
titlePane.add(titleNamePane, BorderLayout.NORTH); |
630 |
titlePane.add(titleStylePane, BorderLayout.SOUTH); |
631 |
return titlePane; |
632 |
} |
633 |
|
634 |
private JPanel createGraphDimensionPane() { |
635 |
JPanel dimensionPane = new JPanel(); |
636 |
dimensionPane.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0)); |
637 |
dimensionPane.setBorder(BorderFactory.createTitledBorder( |
638 |
BorderFactory.createEtchedBorder(), |
639 |
JMeterUtils.getResString("aggregate_graph_dimension"))); // $NON-NLS-1$ |
640 |
|
641 |
dimensionPane.add(dynamicGraphSize); |
642 |
dynamicGraphSize.setSelected(true); // default option |
643 |
graphWidth.setEnabled(false); |
644 |
graphHeight.setEnabled(false); |
645 |
dynamicGraphSize.addActionListener(this); |
646 |
dimensionPane.add(Box.createRigidArea(new Dimension(10,0))); |
647 |
dimensionPane.add(graphWidth); |
648 |
dimensionPane.add(Box.createRigidArea(new Dimension(5,0))); |
649 |
dimensionPane.add(graphHeight); |
650 |
return dimensionPane; |
651 |
} |
652 |
|
653 |
private JPanel createGraphXAxisPane() { |
654 |
JPanel xAxisPane = new JPanel(); |
655 |
xAxisPane.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0)); |
656 |
xAxisPane.setBorder(BorderFactory.createTitledBorder( |
657 |
BorderFactory.createEtchedBorder(), |
658 |
JMeterUtils.getResString("aggregate_graph_xaxis_group"))); // $NON-NLS-1$ |
659 |
xAxisPane.add(maxLengthXAxisLabel); |
660 |
return xAxisPane; |
661 |
} |
662 |
|
663 |
/** |
664 |
* Create pane for legend settings |
665 |
* @return Legend pane |
666 |
*/ |
667 |
private JPanel createLegendPane() { |
668 |
JPanel legendPanel = new JPanel(); |
669 |
legendPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0)); |
670 |
legendPanel.setBorder(BorderFactory.createTitledBorder( |
671 |
BorderFactory.createEtchedBorder(), |
672 |
JMeterUtils.getResString("aggregate_graph_legend"))); // $NON-NLS-1$ |
673 |
|
674 |
legendPanel.add(createLabelCombo(JMeterUtils.getResString("aggregate_graph_legend_placement"), //$NON-NLS-1$ |
675 |
legendPlacementList)); |
676 |
legendPlacementList.setSelectedItem(JMeterUtils.getResString("aggregate_graph_legend.placement.right")); // default: right |
677 |
legendPanel.add(createLabelCombo(JMeterUtils.getResString("aggregate_graph_font"), //$NON-NLS-1$ |
678 |
fontNameList)); |
679 |
fontNameList.setSelectedIndex(0); // default: sans serif |
680 |
legendPanel.add(createLabelCombo(JMeterUtils.getResString("aggregate_graph_size"), //$NON-NLS-1$ |
681 |
fontSizeList)); |
682 |
fontSizeList.setSelectedItem(StatGraphProperties.fontSize[2]); // default: 10 |
683 |
legendPanel.add(createLabelCombo(JMeterUtils.getResString("aggregate_graph_style"), //$NON-NLS-1$ |
684 |
fontStyleList)); |
685 |
fontStyleList.setSelectedItem(JMeterUtils.getResString("fontstyle.normal")); // default: normal |
686 |
|
687 |
return legendPanel; |
688 |
} |
689 |
|
690 |
private JComponent createLabelCombo(String label, JComboBox comboBox) { |
691 |
JPanel labelCombo = new JPanel(); |
692 |
labelCombo.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0)); |
693 |
JLabel caption = new JLabel(label);//$NON-NLS-1$ |
694 |
caption.setBorder(MARGIN); |
695 |
labelCombo.add(caption); |
696 |
labelCombo.add(comboBox); |
697 |
return labelCombo; |
698 |
} |
699 |
|
700 |
private Pattern createPattern(String textToFind) { |
701 |
// desactivate or not specials regexp char |
702 |
String textToFindQ = Pattern.quote(textToFind); |
703 |
if (regexpChkBox.isSelected()) { |
704 |
textToFindQ = textToFind; |
705 |
} |
706 |
Pattern pattern = null; |
707 |
try { |
708 |
if (caseChkBox.isSelected()) { |
709 |
pattern = Pattern.compile(textToFindQ); |
710 |
} else { |
711 |
pattern = Pattern |
712 |
.compile(textToFindQ, Pattern.CASE_INSENSITIVE); |
713 |
} |
714 |
} catch (PatternSyntaxException pse) { |
715 |
return null; |
716 |
} |
717 |
return pattern; |
718 |
} |
416 |
} |
719 |
} |