You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jmeter.apache.org by mi...@apache.org on 2012/08/20 21:47:33 UTC
svn commit: r1375188 - in /jmeter/trunk/src:
components/org/apache/jmeter/visualizers/RespTimeGraphVisualizer.java
components/org/apache/jmeter/visualizers/StatGraphVisualizer.java
jorphan/org/apache/jorphan/gui/GuiUtils.java
Author: milamber
Date: Mon Aug 20 19:47:32 2012
New Revision: 1375188
URL: http://svn.apache.org/viewvc?rev=1375188&view=rev
Log:
Move createLabelCombo to jorphan.GuiUtils
Modified:
jmeter/trunk/src/components/org/apache/jmeter/visualizers/RespTimeGraphVisualizer.java
jmeter/trunk/src/components/org/apache/jmeter/visualizers/StatGraphVisualizer.java
jmeter/trunk/src/jorphan/org/apache/jorphan/gui/GuiUtils.java
Modified: jmeter/trunk/src/components/org/apache/jmeter/visualizers/RespTimeGraphVisualizer.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/components/org/apache/jmeter/visualizers/RespTimeGraphVisualizer.java?rev=1375188&r1=1375187&r2=1375188&view=diff
==============================================================================
--- jmeter/trunk/src/components/org/apache/jmeter/visualizers/RespTimeGraphVisualizer.java (original)
+++ jmeter/trunk/src/components/org/apache/jmeter/visualizers/RespTimeGraphVisualizer.java Mon Aug 20 19:47:32 2012
@@ -47,7 +47,6 @@ import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JComponent;
-import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTabbedPane;
@@ -65,6 +64,7 @@ import org.apache.jmeter.samplers.Sample
import org.apache.jmeter.util.JMeterUtils;
import org.apache.jmeter.visualizers.gui.AbstractVisualizer;
import org.apache.jmeter.visualizers.utils.Colors;
+import org.apache.jorphan.gui.GuiUtils;
import org.apache.jorphan.gui.JLabeledTextField;
import org.apache.jorphan.logging.LoggingManager;
import org.apache.log.Logger;
@@ -77,8 +77,6 @@ public class RespTimeGraphVisualizer ext
private final Font FONT_SMALL = new Font("SansSerif", Font.PLAIN, 10);
- private final Border MARGIN = new EmptyBorder(0, 5, 0, 5);
-
/**
* Lock used to protect list update
*/
@@ -535,16 +533,6 @@ public class RespTimeGraphVisualizer ext
}
}
- private JComponent createLabelCombo(String label, JComboBox comboBox) {
- JPanel labelCombo = new JPanel();
- labelCombo.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
- JLabel caption = new JLabel(label);
- caption.setBorder(MARGIN);
- labelCombo.add(caption);
- labelCombo.add(comboBox);
- return labelCombo;
- }
-
private JPanel createGraphSettingsPane() {
JPanel settingsPane = new JPanel(new BorderLayout());
settingsPane.setBorder(BorderFactory.createTitledBorder(
@@ -605,13 +593,13 @@ public class RespTimeGraphVisualizer ext
JPanel titleStylePane = new JPanel();
titleStylePane.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 5));
- titleStylePane.add(createLabelCombo(JMeterUtils.getResString("aggregate_graph_font"), //$NON-NLS-1$
+ titleStylePane.add(GuiUtils.createLabelCombo(JMeterUtils.getResString("aggregate_graph_font"), //$NON-NLS-1$
titleFontNameList));
titleFontNameList.setSelectedIndex(0); // default: sans serif
- titleStylePane.add(createLabelCombo(JMeterUtils.getResString("aggregate_graph_size"), //$NON-NLS-1$
+ titleStylePane.add(GuiUtils.createLabelCombo(JMeterUtils.getResString("aggregate_graph_size"), //$NON-NLS-1$
titleFontSizeList));
titleFontSizeList.setSelectedItem(StatGraphProperties.fontSize[6]); // default: 16
- titleStylePane.add(createLabelCombo(JMeterUtils.getResString("aggregate_graph_style"), //$NON-NLS-1$
+ titleStylePane.add(GuiUtils.createLabelCombo(JMeterUtils.getResString("aggregate_graph_style"), //$NON-NLS-1$
titleFontStyleList));
titleFontStyleList.setSelectedItem(JMeterUtils.getResString("fontstyle.bold")); // default: bold
@@ -629,10 +617,10 @@ public class RespTimeGraphVisualizer ext
lineStylePane.setBorder(BorderFactory.createTitledBorder(
BorderFactory.createEtchedBorder(),
JMeterUtils.getResString("graph_resp_time_settings_line"))); // $NON-NLS-1$
- lineStylePane.add(createLabelCombo(JMeterUtils.getResString("graph_resp_time_stroke_width"), //$NON-NLS-1$
+ lineStylePane.add(GuiUtils.createLabelCombo(JMeterUtils.getResString("graph_resp_time_stroke_width"), //$NON-NLS-1$
strokeWidthList));
strokeWidthList.setSelectedItem(StatGraphProperties.strokeWidth[4]); // default: 3.0f
- lineStylePane.add(createLabelCombo(JMeterUtils.getResString("graph_resp_time_shape_label"), //$NON-NLS-1$
+ lineStylePane.add(GuiUtils.createLabelCombo(JMeterUtils.getResString("graph_resp_time_shape_label"), //$NON-NLS-1$
pointShapeLine));
pointShapeLine.setSelectedIndex(0); // default: circle
return lineStylePane;
@@ -699,16 +687,16 @@ public class RespTimeGraphVisualizer ext
BorderFactory.createEtchedBorder(),
JMeterUtils.getResString("aggregate_graph_legend"))); // $NON-NLS-1$
- legendPanel.add(createLabelCombo(JMeterUtils.getResString("aggregate_graph_legend_placement"), //$NON-NLS-1$
+ legendPanel.add(GuiUtils.createLabelCombo(JMeterUtils.getResString("aggregate_graph_legend_placement"), //$NON-NLS-1$
legendPlacementList));
legendPlacementList.setSelectedItem(JMeterUtils.getResString("aggregate_graph_legend.placement.bottom")); // default: bottom
- legendPanel.add(createLabelCombo(JMeterUtils.getResString("aggregate_graph_font"), //$NON-NLS-1$
+ legendPanel.add(GuiUtils.createLabelCombo(JMeterUtils.getResString("aggregate_graph_font"), //$NON-NLS-1$
fontNameList));
fontNameList.setSelectedIndex(0); // default: sans serif
- legendPanel.add(createLabelCombo(JMeterUtils.getResString("aggregate_graph_size"), //$NON-NLS-1$
+ legendPanel.add(GuiUtils.createLabelCombo(JMeterUtils.getResString("aggregate_graph_size"), //$NON-NLS-1$
fontSizeList));
fontSizeList.setSelectedItem(StatGraphProperties.fontSize[2]); // default: 10
- legendPanel.add(createLabelCombo(JMeterUtils.getResString("aggregate_graph_style"), //$NON-NLS-1$
+ legendPanel.add(GuiUtils.createLabelCombo(JMeterUtils.getResString("aggregate_graph_style"), //$NON-NLS-1$
fontStyleList));
fontStyleList.setSelectedItem(JMeterUtils.getResString("fontstyle.normal")); // default: normal
Modified: jmeter/trunk/src/components/org/apache/jmeter/visualizers/StatGraphVisualizer.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/components/org/apache/jmeter/visualizers/StatGraphVisualizer.java?rev=1375188&r1=1375187&r2=1375188&view=diff
==============================================================================
--- jmeter/trunk/src/components/org/apache/jmeter/visualizers/StatGraphVisualizer.java (original)
+++ jmeter/trunk/src/components/org/apache/jmeter/visualizers/StatGraphVisualizer.java Mon Aug 20 19:47:32 2012
@@ -69,6 +69,7 @@ import org.apache.jmeter.samplers.Sample
import org.apache.jmeter.save.CSVSaveService;
import org.apache.jmeter.util.JMeterUtils;
import org.apache.jmeter.visualizers.gui.AbstractVisualizer;
+import org.apache.jorphan.gui.GuiUtils;
import org.apache.jorphan.gui.JLabeledTextField;
import org.apache.jorphan.gui.NumberRenderer;
import org.apache.jorphan.gui.ObjectTableModel;
@@ -110,9 +111,7 @@ public class StatGraphVisualizer extends
private final String TOTAL_ROW_LABEL =
JMeterUtils.getResString("aggregate_report_total_label"); //$NON-NLS-1$
-
- private final Border MARGIN = new EmptyBorder(0, 5, 0, 5);
-
+
private Font FONT_SMALL = new Font("SansSerif", Font.PLAIN, 10);
private JTable myJTable;
@@ -727,13 +726,13 @@ public class StatGraphVisualizer extends
JPanel titleStylePane = new JPanel();
titleStylePane.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 5));
- titleStylePane.add(createLabelCombo(JMeterUtils.getResString("aggregate_graph_font"), //$NON-NLS-1$
+ titleStylePane.add(GuiUtils.createLabelCombo(JMeterUtils.getResString("aggregate_graph_font"), //$NON-NLS-1$
titleFontNameList));
titleFontNameList.setSelectedIndex(0); // default: sans serif
- titleStylePane.add(createLabelCombo(JMeterUtils.getResString("aggregate_graph_size"), //$NON-NLS-1$
+ titleStylePane.add(GuiUtils.createLabelCombo(JMeterUtils.getResString("aggregate_graph_size"), //$NON-NLS-1$
titleFontSizeList));
titleFontSizeList.setSelectedItem(StatGraphProperties.fontSize[6]); // default: 16
- titleStylePane.add(createLabelCombo(JMeterUtils.getResString("aggregate_graph_style"), //$NON-NLS-1$
+ titleStylePane.add(GuiUtils.createLabelCombo(JMeterUtils.getResString("aggregate_graph_style"), //$NON-NLS-1$
titleFontStyleList));
titleFontStyleList.setSelectedItem(JMeterUtils.getResString("fontstyle.bold")); // default: bold
@@ -748,13 +747,13 @@ public class StatGraphVisualizer extends
private JPanel createGraphFontValuePane() {
JPanel fontValueStylePane = new JPanel();
fontValueStylePane.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
- fontValueStylePane.add(createLabelCombo(JMeterUtils.getResString("aggregate_graph_value_font"), //$NON-NLS-1$
+ fontValueStylePane.add(GuiUtils.createLabelCombo(JMeterUtils.getResString("aggregate_graph_value_font"), //$NON-NLS-1$
valueFontNameList));
valueFontNameList.setSelectedIndex(0); // default: sans serif
- fontValueStylePane.add(createLabelCombo(JMeterUtils.getResString("aggregate_graph_size"), //$NON-NLS-1$
+ fontValueStylePane.add(GuiUtils.createLabelCombo(JMeterUtils.getResString("aggregate_graph_size"), //$NON-NLS-1$
valueFontSizeList));
valueFontSizeList.setSelectedItem(StatGraphProperties.fontSize[2]); // default: 10
- fontValueStylePane.add(createLabelCombo(JMeterUtils.getResString("aggregate_graph_style"), //$NON-NLS-1$
+ fontValueStylePane.add(GuiUtils.createLabelCombo(JMeterUtils.getResString("aggregate_graph_style"), //$NON-NLS-1$
valueFontStyleList));
valueFontStyleList.setSelectedItem(JMeterUtils.getResString("fontstyle.normal")); // default: normal //$NON-NLS-1$
@@ -819,32 +818,22 @@ public class StatGraphVisualizer extends
BorderFactory.createEtchedBorder(),
JMeterUtils.getResString("aggregate_graph_legend"))); // $NON-NLS-1$
- legendPanel.add(createLabelCombo(JMeterUtils.getResString("aggregate_graph_legend_placement"), //$NON-NLS-1$
+ legendPanel.add(GuiUtils.createLabelCombo(JMeterUtils.getResString("aggregate_graph_legend_placement"), //$NON-NLS-1$
legendPlacementList));
legendPlacementList.setSelectedItem(JMeterUtils.getResString("aggregate_graph_legend.placement.bottom")); // default: bottom
- legendPanel.add(createLabelCombo(JMeterUtils.getResString("aggregate_graph_font"), //$NON-NLS-1$
+ legendPanel.add(GuiUtils.createLabelCombo(JMeterUtils.getResString("aggregate_graph_font"), //$NON-NLS-1$
fontNameList));
fontNameList.setSelectedIndex(0); // default: sans serif
- legendPanel.add(createLabelCombo(JMeterUtils.getResString("aggregate_graph_size"), //$NON-NLS-1$
+ legendPanel.add(GuiUtils.createLabelCombo(JMeterUtils.getResString("aggregate_graph_size"), //$NON-NLS-1$
fontSizeList));
fontSizeList.setSelectedItem(StatGraphProperties.fontSize[2]); // default: 10
- legendPanel.add(createLabelCombo(JMeterUtils.getResString("aggregate_graph_style"), //$NON-NLS-1$
+ legendPanel.add(GuiUtils.createLabelCombo(JMeterUtils.getResString("aggregate_graph_style"), //$NON-NLS-1$
fontStyleList));
fontStyleList.setSelectedItem(JMeterUtils.getResString("fontstyle.normal")); // default: normal
return legendPanel;
}
- private JComponent createLabelCombo(String label, JComboBox comboBox) {
- JPanel labelCombo = new JPanel();
- labelCombo.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
- JLabel caption = new JLabel(label);//$NON-NLS-1$
- caption.setBorder(MARGIN);
- labelCombo.add(caption);
- labelCombo.add(comboBox);
- return labelCombo;
- }
-
/**
* @param textToFind
* @return pattern ready to search
Modified: jmeter/trunk/src/jorphan/org/apache/jorphan/gui/GuiUtils.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/jorphan/org/apache/jorphan/gui/GuiUtils.java?rev=1375188&r1=1375187&r2=1375188&view=diff
==============================================================================
--- jmeter/trunk/src/jorphan/org/apache/jorphan/gui/GuiUtils.java (original)
+++ jmeter/trunk/src/jorphan/org/apache/jorphan/gui/GuiUtils.java Mon Aug 20 19:47:32 2012
@@ -19,9 +19,15 @@
package org.apache.jorphan.gui;
import java.awt.Component;
+import java.awt.FlowLayout;
+import javax.swing.JComboBox;
+import javax.swing.JComponent;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
+import javax.swing.border.EmptyBorder;
import javax.swing.table.TableCellRenderer;
import javax.swing.table.TableColumn;
@@ -64,4 +70,21 @@ public class GuiUtils {
column.setPreferredWidth(width);
column.setResizable(false);
}
+
+ /**
+ * Create a GUI component JLabel + JComboBox with a left and right margin (5px)
+ * @param label
+ * @param comboBox
+ * @return the JComponent (margin+JLabel+margin+JComboBox)
+ */
+ public static JComponent createLabelCombo(String label, JComboBox comboBox) {
+ JPanel labelCombo = new JPanel();
+ labelCombo.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
+ JLabel caption = new JLabel(label);
+ caption.setBorder(new EmptyBorder(0, 5, 0, 5));
+ labelCombo.add(caption);
+ labelCombo.add(comboBox);
+ return labelCombo;
+ }
+
}