From 70de1f87494ffa106e8183cc2a3797878a24015c Mon Sep 17 00:00:00 2001 From: jaeyong lee Date: Mon, 30 May 2016 12:01:55 +0900 Subject: [PATCH] [SRADA-687] Modify some logics about DAScale - Set default scale level to level2 which has 0~4 levels - Sync scale level between pages Change-Id: I4331e143304d400788124c3a608ae2b5a0c0a1dc --- .../dynamicanalyzer/widgets/scale/DAScale.java | 7 +++++- .../dynamicanalyzer/ui/file/FileChartView.java | 17 +++++++++++++ .../dynamicanalyzer/ui/memory/MemoryChartView.java | 19 ++++++++++++++- .../ui/network/NetworkChartView.java | 17 +++++++++++++ .../ui/opengl/chart/GLChartView.java | 28 ++++++++++++++++++++++ .../org/tizen/dynamicanalyzer/ui/page/MenuBar.java | 1 + .../ui/thread/chart/ThreadChartView.java | 17 +++++++++++++ .../ui/timeline/common/TimelineChartView.java | 19 +++++++++++++-- .../tizen/dynamicanalyzer/ui/toolbar/Toolbar.java | 10 ++++++++ 9 files changed, 131 insertions(+), 4 deletions(-) diff --git a/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/scale/DAScale.java b/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/scale/DAScale.java index dc51973..783776d 100644 --- a/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/scale/DAScale.java +++ b/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/scale/DAScale.java @@ -58,6 +58,8 @@ public class DAScale extends Canvas { private static final int THUMB_HEIGHT = 7; private static final int THUMB_WIDTH = 7; + public static final int DEFAULT_SCALE_INDEX = 2; + private DAScaleAttribute attr; private DAScaleDefaultRenderer renderer; private DAScaleSelectionListener selectionListener = null; @@ -85,7 +87,7 @@ public class DAScale extends Canvas { private Rectangle rightRect = null; public DAScale(Composite parent, int maximum, int style) { - this(parent, maximum, 0, style); + this(parent, maximum, DEFAULT_SCALE_INDEX, style); } public DAScale(Composite parent, int maximum, int selection, int style) { @@ -128,6 +130,9 @@ public class DAScale extends Canvas { } public int getSelection() { + if(areaRect == null) { + return selection; + } int tick = getTickSize(); int thumbX = thumbRect.x + THUMB_WIDTH / 2; diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/file/FileChartView.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/file/FileChartView.java index 356c249..3927bde 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/file/FileChartView.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/file/FileChartView.java @@ -75,6 +75,7 @@ import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoardItem; import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoardSelectionListener; import org.tizen.dynamicanalyzer.widgets.da.view.DAViewComposite; import org.tizen.dynamicanalyzer.widgets.da.view.DAViewData; +import org.tizen.dynamicanalyzer.widgets.scale.DAScaleSelectionListener; import org.tizen.dynamicanalyzer.widgets.timeline.DATimeline; public class FileChartView extends DAViewComposite { @@ -150,6 +151,20 @@ public class FileChartView extends DAViewComposite { processCombo.setLayoutData(data); initProcessCombo(); + updateScale(); + fileChartBoard.getScale().addSelectionListener(new DAScaleSelectionListener() { + @Override + public void widgetSelected() { + Toolbar.INSTANCE.setScaleSelection(fileChartBoard.getScale().getSelection()); + updateScale(); + } + }); + } + + private void updateScale() { + int scaleSelection = Toolbar.INSTANCE.getScaleSelection(); + fileChartBoard.getBoardManager().scaleChanged(scaleSelection); + fileChartBoard.setScaleVal(scaleSelection); } private DAToolBarCustomCombo makeDACustomCombo(Composite parent) { @@ -285,6 +300,7 @@ public class FileChartView extends DAViewComposite { @Override public void updateView() { + updateScale(); updateProcessCombo(); fileChartBoard.updateChart(); @@ -320,6 +336,7 @@ public class FileChartView extends DAViewComposite { @Override public void updateView(DAViewData data) { + updateScale(); updateProcessCombo(); fileChartBoard.updateChart(); if (data instanceof DASelectionData) { diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/memory/MemoryChartView.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/memory/MemoryChartView.java index 70dae5b..7b5bcef 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/memory/MemoryChartView.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/memory/MemoryChartView.java @@ -62,6 +62,7 @@ import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlotIntervalMarker; import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoard; import org.tizen.dynamicanalyzer.widgets.da.view.DAViewComposite; import org.tizen.dynamicanalyzer.widgets.da.view.DAViewData; +import org.tizen.dynamicanalyzer.widgets.scale.DAScaleSelectionListener; import org.tizen.dynamicanalyzer.widgets.timeline.DATimeline; public class MemoryChartView extends DAViewComposite { @@ -126,8 +127,23 @@ public class MemoryChartView extends DAViewComposite { processCombo.setLayoutData(data); initProcessCombo(); + updateScale(); + memoryChartBoard.getScale().addSelectionListener(new DAScaleSelectionListener() { + @Override + public void widgetSelected() { + Toolbar.INSTANCE.setScaleSelection(memoryChartBoard.getScale().getSelection()); + updateScale(); + } + }); } + private void updateScale() { + int scaleSelection = Toolbar.INSTANCE.getScaleSelection(); + memoryChartBoard.getBoardManager().scaleChanged(scaleSelection); + memoryChartBoard.setScaleVal(scaleSelection); + } + + public void updateProcessCombo() { int index = Toolbar.INSTANCE.getProcessCombo().getSelectionIndex(); if(index+1 > processCombo.getItems().size()) { @@ -277,6 +293,7 @@ public class MemoryChartView extends DAViewComposite { @Override public void updateView() { + updateScale(); updateProcessCombo(); /* * In case of Latest status, update visibleStartTime of chartBoard. @@ -316,7 +333,7 @@ public class MemoryChartView extends DAViewComposite { @Override public void updateView(DAViewData data) { - + updateScale(); } @Override diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/network/NetworkChartView.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/network/NetworkChartView.java index db79054..c5ca6bd 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/network/NetworkChartView.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/network/NetworkChartView.java @@ -71,6 +71,7 @@ import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoardItem; import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoardSelectionListener; import org.tizen.dynamicanalyzer.widgets.da.view.DAViewComposite; import org.tizen.dynamicanalyzer.widgets.da.view.DAViewData; +import org.tizen.dynamicanalyzer.widgets.scale.DAScaleSelectionListener; import org.tizen.dynamicanalyzer.widgets.timeline.DATimeline; public class NetworkChartView extends DAViewComposite { @@ -152,6 +153,20 @@ public class NetworkChartView extends DAViewComposite { processCombo.setLayoutData(data); initProcessCombo(); + updateScale(); + networkChartBoard.getScale().addSelectionListener(new DAScaleSelectionListener() { + @Override + public void widgetSelected() { + Toolbar.INSTANCE.setScaleSelection(networkChartBoard.getScale().getSelection()); + updateScale(); + } + }); + } + + private void updateScale() { + int scaleSelection = Toolbar.INSTANCE.getScaleSelection(); + networkChartBoard.getBoardManager().scaleChanged(scaleSelection); + networkChartBoard.setScaleVal(scaleSelection); } private void updateProcessCombo() { @@ -300,6 +315,7 @@ public class NetworkChartView extends DAViewComposite { @Override public void updateView() { + updateScale(); updateProcessCombo(); networkChartBoard.updateChart(); @@ -338,6 +354,7 @@ public class NetworkChartView extends DAViewComposite { @Override public void updateView(DAViewData data) { + updateScale(); updateProcessCombo(); networkChartBoard.updateChart(); if (data instanceof DASelectionData == false) { diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/chart/GLChartView.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/chart/GLChartView.java index 2693483..96f9c7b 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/chart/GLChartView.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/chart/GLChartView.java @@ -72,6 +72,7 @@ import org.tizen.dynamicanalyzer.widgets.combo.DACustomCombo; import org.tizen.dynamicanalyzer.widgets.combo.DACustomComboSelectionListener; import org.tizen.dynamicanalyzer.widgets.da.view.DAViewComposite; import org.tizen.dynamicanalyzer.widgets.da.view.DAViewData; +import org.tizen.dynamicanalyzer.widgets.scale.DAScaleSelectionListener; import org.tizen.dynamicanalyzer.widgets.timeline.DATimeline; public class GLChartView extends DAViewComposite { @@ -131,8 +132,33 @@ public class GLChartView extends DAViewComposite { processCombo.setLayoutData(data); initProcessCombo(); + updateScale(); + frameTimeChartBoard.getScale().addSelectionListener(new DAScaleSelectionListener() { + @Override + public void widgetSelected() { + Toolbar.INSTANCE.setScaleSelection(frameTimeChartBoard.getScale().getSelection()); + updateScale(); + } + }); + frameRateChartBoard.getScale().addSelectionListener(new DAScaleSelectionListener() { + @Override + public void widgetSelected() { + Toolbar.INSTANCE.setScaleSelection(frameRateChartBoard.getScale().getSelection()); + updateScale(); + } + }); } + + private void updateScale() { + int scaleSelection = Toolbar.INSTANCE.getScaleSelection(); + frameTimeChartBoard.getBoardManager().scaleChanged(scaleSelection); + frameTimeChartBoard.setScaleVal(scaleSelection); + frameRateChartBoard.getBoardManager().scaleChanged(scaleSelection); + frameRateChartBoard.setScaleVal(scaleSelection); + } + + private DAToolBarCustomCombo makeProcessCombo(Composite parent) { int PROCESS_COMBO = 2; DAToolBarCustomCombo returnCombo = new DAToolBarCustomCombo(parent, SWT.NONE); @@ -413,6 +439,7 @@ public class GLChartView extends DAViewComposite { @Override public void updateView() { + updateScale(); updateProcessCombo(); if (stackLayout.topControl == frameTimeChartBoard) { frameTimeChartBoard.updateView(); @@ -423,6 +450,7 @@ public class GLChartView extends DAViewComposite { @Override public void updateView(DAViewData vdata) { + updateScale(); updateProcessCombo(); if (vdata instanceof GLSelectionData) { updateViewFromHistory((GLSelectionData) vdata); diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/page/MenuBar.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/page/MenuBar.java index 29869d0..14f37fa 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/page/MenuBar.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/page/MenuBar.java @@ -264,6 +264,7 @@ public class MenuBar { // change UI state Toolbar.INSTANCE.changeUIState(DAState.INIT); + Toolbar.INSTANCE.setScaleSelection(DAScale.DEFAULT_SCALE_INDEX); FlatFeatureDialog featureDialog = new FlatFeatureDialog(currentShell); featureDialog.open(); diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/thread/chart/ThreadChartView.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/thread/chart/ThreadChartView.java index 17afc9d..2f7419f 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/thread/chart/ThreadChartView.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/thread/chart/ThreadChartView.java @@ -71,6 +71,7 @@ import org.tizen.dynamicanalyzer.widgets.combo.DACustomCombo; import org.tizen.dynamicanalyzer.widgets.combo.DACustomComboSelectionListener; import org.tizen.dynamicanalyzer.widgets.da.view.DAViewComposite; import org.tizen.dynamicanalyzer.widgets.da.view.DAViewData; +import org.tizen.dynamicanalyzer.widgets.scale.DAScaleSelectionListener; import org.tizen.dynamicanalyzer.widgets.timeline.DATimeline; public class ThreadChartView extends DAViewComposite { @@ -116,6 +117,14 @@ public class ThreadChartView extends DAViewComposite { processCombo.setLayoutData(data); initProcessCombo(); + updateScale(); + threadChartBoard.getScale().addSelectionListener(new DAScaleSelectionListener() { + @Override + public void widgetSelected() { + Toolbar.INSTANCE.setScaleSelection(threadChartBoard.getScale().getSelection()); + updateScale(); + } + }); } private DACustomCombo makeDACustomCombo(Composite parent) { @@ -217,6 +226,12 @@ public class ThreadChartView extends DAViewComposite { } }); } + + private void updateScale() { + int scaleSelection = Toolbar.INSTANCE.getScaleSelection(); + threadChartBoard.getBoardManager().scaleChanged(scaleSelection); + threadChartBoard.setScaleVal(scaleSelection); + } private void initSyncChart() { syncChartBoard = new SyncChartBoard(contents, ThreadPageLabels.THREAD_CHART_SYNC, @@ -427,6 +442,7 @@ public class ThreadChartView extends DAViewComposite { @Override public void updateView() { + updateScale(); updateProcessCombo(); if (stackLayout.topControl == syncChartBoard) { updateTimeLine(syncChartBoard); @@ -475,6 +491,7 @@ public class ThreadChartView extends DAViewComposite { @Override public void updateView(DAViewData data) { + updateScale(); updateProcessCombo(); if (data instanceof DASelectionData == false) { return; diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/common/TimelineChartView.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/common/TimelineChartView.java index a4f7b70..de836d8 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/common/TimelineChartView.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/common/TimelineChartView.java @@ -73,10 +73,9 @@ import org.tizen.dynamicanalyzer.widgets.chart.DAChart; import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlotIntervalMarker; import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoard; import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoardItem; -import org.tizen.dynamicanalyzer.widgets.combo.DACustomCombo; -import org.tizen.dynamicanalyzer.widgets.combo.DACustomComboSelectionListener; import org.tizen.dynamicanalyzer.widgets.da.view.DAViewComposite; import org.tizen.dynamicanalyzer.widgets.da.view.DAViewData; +import org.tizen.dynamicanalyzer.widgets.scale.DAScaleSelectionListener; import org.tizen.dynamicanalyzer.widgets.timeline.DATimeline; public class TimelineChartView extends DAViewComposite { @@ -146,6 +145,14 @@ public class TimelineChartView extends DAViewComposite { processCombo.setLayoutData(data); initProcessCombo(); + updateScale(); + chartBoard.getScale().addSelectionListener(new DAScaleSelectionListener() { + @Override + public void widgetSelected() { + Toolbar.INSTANCE.setScaleSelection(chartBoard.getScale().getSelection()); + updateScale(); + } + }); } private DAToolBarCustomCombo makeDACustomCombo(Composite parent) { @@ -295,6 +302,12 @@ public class TimelineChartView extends DAViewComposite { chartBoard.getScale().changeScale(zoom); } + private void updateScale() { + int scaleSelection = Toolbar.INSTANCE.getScaleSelection(); + chartBoard.getBoardManager().scaleChanged(scaleSelection); + chartBoard.setScaleVal(scaleSelection); + } + public void reArrangeChart(List order, List showInfo) { if (order != null) { chartBoard.reArrangeItem(order.toArray(new Integer[order.size()])); @@ -310,6 +323,7 @@ public class TimelineChartView extends DAViewComposite { @Override public void updateView(DAViewData data) { + updateScale(); updateProcessCombo(); if (data instanceof DASelectionData) { DASelectionData selData = (DASelectionData) data; @@ -336,6 +350,7 @@ public class TimelineChartView extends DAViewComposite { @Override public void updateView() { + updateScale(); updateProcessCombo(); timelineChartManager.makeChartSeries(AnalyzerUtil.translateSecToMicroSec(chartBoard.getVisibleStartTime()), AnalyzerUtil.translateSecToMicroSec(chartBoard.getVisibleEndTime())); diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/Toolbar.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/Toolbar.java index 7528028..294ebe6 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/Toolbar.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/Toolbar.java @@ -141,6 +141,16 @@ public enum Toolbar { private static final int DEVICE_COMBO = 0; private static final int APP_COMBO = 1; + private int scaleSelection = 2; + + public int getScaleSelection() { + return scaleSelection; + } + + public void setScaleSelection(int scale) { + scaleSelection = scale; + } + public void create(Composite parent) { parent.setBackground(ColorResources.GRAY_220); createToolbar(parent); -- 2.7.4