Skip to content

Commit

Permalink
Bug 58684 - JMeterColor does not need to extend java.awt.Color
Browse files Browse the repository at this point in the history
#resolve #37
Bugzilla Id: 58684

git-svn-id: https://svn.apache.org/repos/asf/jmeter/trunk@1717751 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
pmouawad committed Dec 3, 2015
1 parent 8683336 commit cb992d5
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 20 deletions.
4 changes: 2 additions & 2 deletions src/components/org/apache/jmeter/visualizers/Graph.java
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ private void drawSample(long x, Sample oneSample, Graphics g) {
if (wantMedian) {
int median = (int) (oneSample.getMedian() * height / graphMax);

g.setColor(JMeterColor.purple);
g.setColor(JMeterColor.PURPLE);
g.drawLine(adjustedWidth, height - median, adjustedWidth, (height - median - 1));
}

Expand All @@ -249,7 +249,7 @@ private void drawSample(long x, Sample oneSample, Graphics g) {
if (wantThroughput) {
int throughput = (int) (oneSample.getThroughput() * height / throughputMax);

g.setColor(JMeterColor.dark_green);
g.setColor(JMeterColor.DARK_GREEN);
g.drawLine(adjustedWidth, height - throughput, adjustedWidth, (height - throughput - 1));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -291,8 +291,8 @@ private JPanel createChoosePanel() {
data = createChooseCheckBox("graph_results_data", Color.black); // $NON-NLS-1$
average = createChooseCheckBox("graph_results_average", Color.blue); // $NON-NLS-1$
deviation = createChooseCheckBox("graph_results_deviation", Color.red); // $NON-NLS-1$
throughput = createChooseCheckBox("graph_results_throughput", JMeterColor.dark_green); // $NON-NLS-1$
median = createChooseCheckBox("graph_results_median", JMeterColor.purple); // $NON-NLS-1$
throughput = createChooseCheckBox("graph_results_throughput", JMeterColor.DARK_GREEN); // $NON-NLS-1$
median = createChooseCheckBox("graph_results_median", JMeterColor.PURPLE); // $NON-NLS-1$

chooseGraphsPanel.add(selectGraphsLabel);
chooseGraphsPanel.add(data);
Expand Down Expand Up @@ -353,8 +353,8 @@ private Box createGraphInfoPanel() {
dataField = createInfoField(Color.black, 5);
averageField = createInfoField(Color.blue, 5);
deviationField = createInfoField(Color.red, 5);
throughputField = createInfoField(JMeterColor.dark_green, 15);
medianField = createInfoField(JMeterColor.purple, 5);
throughputField = createInfoField(JMeterColor.DARK_GREEN, 15);
medianField = createInfoField(JMeterColor.PURPLE, 5);

graphInfoPanel.add(createInfoColumn(createInfoLabel("graph_results_no_samples", noSamplesField), // $NON-NLS-1$
noSamplesField, createInfoLabel("graph_results_deviation", deviationField), deviationField)); // $NON-NLS-1$
Expand Down
23 changes: 9 additions & 14 deletions src/core/org/apache/jmeter/gui/util/JMeterColor.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,15 @@

import java.awt.Color;

public class JMeterColor extends Color {
private static final long serialVersionUID = 240L;
public class JMeterColor {

public static final Color DARK_GREEN = new Color(0F, .5F, 0F);
@Deprecated
public static final Color dark_green = DARK_GREEN;

public static final Color dark_green = new JMeterColor(0F, .5F, 0F);
public static final Color LAVENDER = new Color(206F / 255F, 207F / 255F, 1F);

public static final Color LAVENDER = new JMeterColor(206F / 255F, 207F / 255F, 1F);

public static final Color purple = new JMeterColor(150 / 255F, 0, 150 / 255F);

public JMeterColor(float r, float g, float b) {
super(r, g, b);
}

public JMeterColor() {
super(0, 0, 0);
}
public static final Color PURPLE = new Color(150 / 255F, 0, 150 / 255F);
@Deprecated
public static final Color purple = PURPLE;
}
1 change: 1 addition & 0 deletions xdocs/changes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ Summary
<li>Updated to slf4j-1.7.12 (from 1.7.10)</li>
<li>Updated to xmlgraphics-commons-2.0.1 (from 1.5)</li>
<li><bug>57981</bug>Require a minimum of Java 7. Partly contributed by Graham Russell (jmeter at ham1.co.uk)</li>
<li><bug>58684</bug>JMeterColor does not need to extend java.awt.Color. Contributed by Benoit Wiart (benoit dot wiart at gmail.com)</li>
</ul>

<!-- =================== Bug fixes =================== -->
Expand Down

0 comments on commit cb992d5

Please sign in to comment.