-
Notifications
You must be signed in to change notification settings - Fork 3
#78 - Implement Render Mode Options #89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Changes from all commits
cae8c61
14f2da8
d8b0cb1
9c16e84
68c46bc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,6 +12,8 @@ | |
| import java.util.ArrayList; | ||
| import javax.swing.JOptionPane; | ||
| import javax.swing.JProgressBar; | ||
| import javax.swing.JLabel; | ||
| import javax.swing.JPanel; | ||
| import org.jfree.chart.ChartMouseEvent; | ||
| import org.jfree.chart.ChartMouseListener; | ||
| import javax.swing.UIManager; | ||
|
|
@@ -26,6 +28,8 @@ | |
| import org.jfree.data.xy.XYSeries; | ||
| import org.jfree.data.xy.XYSeriesCollection; | ||
| import org.jfree.ui.RectangleInsets; | ||
| import jdiskmark.App; | ||
|
|
||
|
|
||
| /** | ||
| * Store GUI references for easy access | ||
|
|
@@ -35,7 +39,18 @@ public final class Gui { | |
| public static enum Palette { CLASSIC, BLUE_GREEN, BARD_COOL, BARD_WARM }; | ||
| public static Palette palette = Palette.CLASSIC; | ||
|
|
||
| private static jdiskmark.RenderFrequencyMode renderFrequencyMode = jdiskmark.RenderFrequencyMode.PER_SAMPLE; | ||
|
|
||
| public static RenderFrequencyMode getRenderFrequencyMode() { | ||
| return renderFrequencyMode; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this and line 49 could be indented by 4 spaces. |
||
| } | ||
|
|
||
| public static void setRenderFrequencyMode(RenderFrequencyMode mode) { | ||
| renderFrequencyMode = mode; | ||
| } | ||
|
|
||
| public static ChartPanel chartPanel = null; | ||
| public static JLabel renderModeLabel = new JLabel("Render Mode: PER_SAMPLE"); | ||
| public static MainFrame mainFrame = null; | ||
| public static SelectDriveFrame selFrame = null; | ||
| public static XYSeries wSeries, wAvgSeries, wMaxSeries, wMinSeries, wDrvAccess; | ||
|
|
@@ -87,7 +102,29 @@ public static void configureLaf() { | |
| } | ||
| } | ||
|
|
||
| public static ChartPanel createChartPanel() { | ||
| public static void updateRenderView() { | ||
| RenderFrequencyMode mode = Gui.mainFrame.getRenderMode(); | ||
|
|
||
| boolean showChart = true; // all modes show chart in this example | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i'm not sure we need showChart and showTable or possible to share what you had in mind for them? |
||
| boolean showTable = (mode == RenderFrequencyMode.PER_100MS || | ||
| mode == RenderFrequencyMode.PER_500MS || | ||
| mode == RenderFrequencyMode.PER_1000MS); | ||
|
|
||
| if (chartPanel != null) { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't believe we need to hide the chart, can likely remove lines 113-114 unless I'm overlooking something. |
||
| chartPanel.setVisible(showChart); | ||
| } | ||
|
|
||
| Gui.mainFrame.setTableVisible(showTable); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is probably not needed also right? or let me know if otherwise. |
||
|
|
||
| } | ||
|
|
||
| public static void refreshRenderLabel() { | ||
| if (renderModeLabel != null) { | ||
| renderModeLabel.setText("Render Mode: " + getRenderFrequencyMode()); | ||
| } | ||
| } | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. so if a render mode is displayed on the chart i believe it should show the render mode of the active selected benchmark or the selected loaded benchmark and not the mode selected for the next benchmark because the user can see the mode selected for the next benchmark from the menu. good to keep in mind that we have controls that tell us the info of a selected or current benchmark and controls that tell us what will be used for the next benchmark that is run. I might have confused the behavior with how the main benchmark controls are being used for both. In theory it is nice to keep them separate. |
||
|
|
||
| public static JPanel createChartPanel() { | ||
|
|
||
| wSeries = new XYSeries("Write"); | ||
| wAvgSeries = new XYSeries("Write Avg"); | ||
|
|
@@ -175,12 +212,9 @@ public static ChartPanel createChartPanel() { | |
|
|
||
| chart = new JFreeChart("", null , plot, true); | ||
|
|
||
| // correct the parenthesis from being below vertical centering | ||
| chart.getTitle().setFont(new Font("Verdana", Font.BOLD, 17)); | ||
|
|
||
| chartPanel = new ChartPanel(chart) { | ||
| // Only way to set the size of chart panel | ||
| // ref: http://www.jfree.org/phpBB2/viewtopic.php?p=75516 | ||
| @Override | ||
| public Dimension getPreferredSize() { | ||
| return new Dimension(500, 325); | ||
|
|
@@ -209,10 +243,35 @@ public void chartMouseMoved(ChartMouseEvent cme) { | |
| // no action | ||
| } | ||
| }); | ||
| updateLegendAndAxis(); | ||
| return chartPanel; | ||
| } | ||
|
|
||
| updateLegendAndAxis(); | ||
|
|
||
| // Creates a wrapper panel with vertical layout | ||
| JPanel wrapperPanel = new JPanel(new java.awt.BorderLayout()); | ||
|
|
||
| // Creates a small left-aligned panel for the label | ||
| JPanel topPanel = new JPanel(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT, 5, 2)); | ||
| topPanel.setOpaque(false); | ||
|
|
||
| // Render Mode label | ||
| renderModeLabel = new JLabel("Render Mode: " + Gui.getRenderFrequencyMode()); | ||
| renderModeLabel.setFont(new Font("Verdana", Font.BOLD, 10)); | ||
| renderModeLabel.setForeground(Color.BLACK); | ||
|
|
||
| // Add subtle light-gray background with slight transparency | ||
| renderModeLabel.setOpaque(true); | ||
| renderModeLabel.setBackground(new Color(240, 240, 240, 200)); // light gray w/ transparency | ||
| renderModeLabel.setBorder(javax.swing.BorderFactory.createEmptyBorder(2, 6, 2, 6)); // padding | ||
|
|
||
| // Add label to top panel | ||
| topPanel.add(renderModeLabel); | ||
|
|
||
| // Add top panel and chart panel to wrapper | ||
| wrapperPanel.add(topPanel, java.awt.BorderLayout.NORTH); | ||
| wrapperPanel.add(chartPanel, java.awt.BorderLayout.CENTER); | ||
|
|
||
| return wrapperPanel; | ||
| } | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. going to ignore formatting comments for now since we'll want to get the functionality working first but normally we would not want to see the return and the closing bracket on the same column like here. the closing bracket would be lined up with the first line of the open bracket usually. does this make sense? |
||
|
|
||
| public static void addWriteSample(Sample s) { | ||
| wSeries.add(s.sampleNum, s.bwMbSec); | ||
| wAvgSeries.add(s.sampleNum, s.cumAvg); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh sorry i should have been more specific, even though we should save the render mode to the database i don't think we need to add a column. but we should save the value and load it and send it back to the community portal. we do need a solution to show the render mode when a selected benchmark is loaded.