changeset 2451:1b6ba42c0fb5

Use default data display duration from ThermostatChartPanel. Reviewed-by: aazores Review-thread: http://icedtea.classpath.org/pipermail/thermostat/2016-September/020889.html
author Severin Gehwolf <sgehwolf@redhat.com>
date Wed, 14 Sep 2016 19:11:26 +0200
parents 0ecf532bd668
children bfccdcb426d0
files host-cpu/client-swing/src/main/java/com/redhat/thermostat/host/cpu/client/swing/internal/HostCpuPanel.java numa/client-swing/src/main/java/com/redhat/thermostat/numa/client/swing/internal/NumaPanel.java vm-cpu/client-swing/src/main/java/com/redhat/thermostat/vm/cpu/client/swing/internal/VmCpuPanel.java vm-gc/client-swing/src/main/java/com/redhat/thermostat/vm/gc/client/swing/internal/VmGcPanel.java vm-memory/client-swing/src/main/java/com/redhat/thermostat/vm/memory/client/swing/internal/SwingMemoryStatsViewProvider.java vm-numa/client-swing/src/main/java/com/redhat/thermostat/vm/numa/client/swing/internal/VmNumaPanel.java
diffstat 6 files changed, 9 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- a/host-cpu/client-swing/src/main/java/com/redhat/thermostat/host/cpu/client/swing/internal/HostCpuPanel.java	Wed Sep 14 17:39:54 2016 +0200
+++ b/host-cpu/client-swing/src/main/java/com/redhat/thermostat/host/cpu/client/swing/internal/HostCpuPanel.java	Wed Sep 14 19:11:26 2016 +0200
@@ -45,7 +45,6 @@
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
-import java.util.concurrent.TimeUnit;
 
 import javax.swing.Box;
 import javax.swing.JLabel;
@@ -67,6 +66,7 @@
 import com.redhat.thermostat.client.swing.components.RecentTimeSeriesChartPanel;
 import com.redhat.thermostat.client.swing.components.SectionHeader;
 import com.redhat.thermostat.client.swing.components.ValueField;
+import com.redhat.thermostat.client.swing.components.experimental.ThermostatChartPanel;
 import com.redhat.thermostat.client.swing.experimental.ComponentVisibilityNotifier;
 import com.redhat.thermostat.client.ui.ChartColors;
 import com.redhat.thermostat.client.ui.RecentTimeSeriesChartController;
@@ -171,7 +171,7 @@
     @Override
     public Duration getUserDesiredDuration() {
         if (chartController == null) {
-            return new Duration(10, TimeUnit.MINUTES);
+            return ThermostatChartPanel.DEFAULT_DATA_DISPLAY;
         }
         return new Duration(chartController.getTimeValue(), chartController.getTimeUnit());
     }
--- a/numa/client-swing/src/main/java/com/redhat/thermostat/numa/client/swing/internal/NumaPanel.java	Wed Sep 14 17:39:54 2016 +0200
+++ b/numa/client-swing/src/main/java/com/redhat/thermostat/numa/client/swing/internal/NumaPanel.java	Wed Sep 14 19:11:26 2016 +0200
@@ -46,7 +46,6 @@
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-import java.util.concurrent.TimeUnit;
 import java.util.logging.Logger;
 
 import javax.swing.BorderFactory;
@@ -116,7 +115,7 @@
         detailsPanel.setLayout(new BorderLayout());
 
 
-        duration = new Duration(10, TimeUnit.MINUTES);
+        duration = ThermostatChartPanel.DEFAULT_DATA_DISPLAY;
         chartPanel = new ThermostatChartPanel(duration);
 
         chartPanel.addPropertyChangeListener(ThermostatChartPanel.PROPERTY_VISIBLE_TIME_RANGE, new PropertyChangeListener() {
--- a/vm-cpu/client-swing/src/main/java/com/redhat/thermostat/vm/cpu/client/swing/internal/VmCpuPanel.java	Wed Sep 14 17:39:54 2016 +0200
+++ b/vm-cpu/client-swing/src/main/java/com/redhat/thermostat/vm/cpu/client/swing/internal/VmCpuPanel.java	Wed Sep 14 19:11:26 2016 +0200
@@ -41,7 +41,6 @@
 import java.beans.PropertyChangeListener;
 import java.util.ArrayList;
 import java.util.List;
-import java.util.concurrent.TimeUnit;
 
 import javax.swing.SwingUtilities;
 
@@ -71,9 +70,6 @@
 
     private static final Translate<LocaleResources> translator = LocaleResources.createLocalizer();
 
-    private static final int DEFAULT_VALUE = 10;
-    private static final TimeUnit DEFAULT_UNIT = TimeUnit.MINUTES;
-
     private Duration duration;
 
     private HeaderPanel visiblePanel;
@@ -89,7 +85,7 @@
         super();
         data.addSeries(cpuTimeSeries);
 
-        duration = new Duration(DEFAULT_VALUE, DEFAULT_UNIT);
+        duration = ThermostatChartPanel.DEFAULT_DATA_DISPLAY;
 
         initializePanel();
 
--- a/vm-gc/client-swing/src/main/java/com/redhat/thermostat/vm/gc/client/swing/internal/VmGcPanel.java	Wed Sep 14 17:39:54 2016 +0200
+++ b/vm-gc/client-swing/src/main/java/com/redhat/thermostat/vm/gc/client/swing/internal/VmGcPanel.java	Wed Sep 14 19:11:26 2016 +0200
@@ -125,9 +125,6 @@
     private static final Color BLACK = new Color(0,0,0,0);
     private static final float TRANSPARENT = 0.0f;
 
-    private static final int DEFAULT_VALUE = 10;
-    private static final TimeUnit DEFAULT_UNIT = TimeUnit.MINUTES;
-
     private JLayeredPane stack = new JLayeredPane();
     private OverlayPanel overlayPanel = new OverlayPanel(translator.localize(LocaleResources.VM_GC_PARAMETERS_TITLE), true, true);
     private HeaderPanel visiblePanel = new HeaderPanel();
@@ -307,10 +304,9 @@
         chart.getPlot().setBackgroundImageAlpha(TRANSPARENT);
         chart.getPlot().setOutlinePaint(BLACK);
 
-        Duration defaultDuration = new Duration(DEFAULT_VALUE, DEFAULT_UNIT);
         final RecentTimeSeriesChartController chartController = new RecentTimeSeriesChartController(chart);
-        final ThermostatChartPanel chartPanel = new ThermostatChartPanel(chart, defaultDuration);
-        subPanelDurations.put(tag, defaultDuration);
+        final ThermostatChartPanel chartPanel = new ThermostatChartPanel(chart, ThermostatChartPanel.DEFAULT_DATA_DISPLAY);
+        subPanelDurations.put(tag, ThermostatChartPanel.DEFAULT_DATA_DISPLAY);
         chartPanel.enableDynamicCrosshairs();
 
         chartPanel.addPropertyChangeListener(RecentTimeControlPanel.PROPERTY_VISIBLE_TIME_RANGE, new PropertyChangeListener() {
--- a/vm-memory/client-swing/src/main/java/com/redhat/thermostat/vm/memory/client/swing/internal/SwingMemoryStatsViewProvider.java	Wed Sep 14 17:39:54 2016 +0200
+++ b/vm-memory/client-swing/src/main/java/com/redhat/thermostat/vm/memory/client/swing/internal/SwingMemoryStatsViewProvider.java	Wed Sep 14 19:11:26 2016 +0200
@@ -36,9 +36,7 @@
 
 package com.redhat.thermostat.vm.memory.client.swing.internal;
 
-import java.util.concurrent.TimeUnit;
-
-import com.redhat.thermostat.common.Duration;
+import com.redhat.thermostat.client.swing.components.experimental.ThermostatChartPanel;
 import com.redhat.thermostat.vm.memory.client.core.MemoryStatsView;
 import com.redhat.thermostat.vm.memory.client.core.MemoryStatsViewProvider;
 
@@ -46,7 +44,7 @@
 
     @Override
     public MemoryStatsView createView() {
-        return new MemoryStatsViewImpl(new Duration(10, TimeUnit.MINUTES));
+        return new MemoryStatsViewImpl(ThermostatChartPanel.DEFAULT_DATA_DISPLAY);
     }
 
 }
--- a/vm-numa/client-swing/src/main/java/com/redhat/thermostat/vm/numa/client/swing/internal/VmNumaPanel.java	Wed Sep 14 17:39:54 2016 +0200
+++ b/vm-numa/client-swing/src/main/java/com/redhat/thermostat/vm/numa/client/swing/internal/VmNumaPanel.java	Wed Sep 14 19:11:26 2016 +0200
@@ -43,7 +43,6 @@
 import java.beans.PropertyChangeListener;
 import java.util.HashMap;
 import java.util.Map;
-import java.util.concurrent.TimeUnit;
 
 import javax.swing.JLabel;
 import javax.swing.JPanel;
@@ -77,9 +76,6 @@
 
     private HeaderPanel visiblePanel;
 
-    private static final int DEFAULT_VALUE = 10;
-    private static final TimeUnit DEFAULT_UNIT = TimeUnit.MINUTES;
-
     private Duration duration;
 
     private ActionNotifier<UserAction> userActionNotifier = new ActionNotifier<>(this);
@@ -104,7 +100,7 @@
     }
 
     private JPanel initializeChartsPanel() {
-        duration = new Duration(DEFAULT_VALUE, DEFAULT_UNIT);
+        duration = ThermostatChartPanel.DEFAULT_DATA_DISPLAY;
         chartPanel = new ThermostatChartPanel(duration);
 
         chartPanel.addPropertyChangeListener(ThermostatChartPanel.PROPERTY_VISIBLE_TIME_RANGE, new PropertyChangeListener() {