package org.tizen.dynamicanalyzer.ui.memory.chart;\r
\r
import java.util.ArrayList;\r
+import java.util.Collections;\r
import java.util.List;\r
\r
import org.eclipse.swt.graphics.Image;\r
import org.tizen.dynamicanalyzer.nl.TimelineChartLabels;\r
import org.tizen.dynamicanalyzer.resources.FontResources;\r
import org.tizen.dynamicanalyzer.resources.ImageResources;\r
-import org.tizen.dynamicanalyzer.ui.common.PopupAnalysisMenuItemClickListener;\r
-import org.tizen.dynamicanalyzer.ui.common.PopupClearMenuItemClickListener;\r
-import org.tizen.dynamicanalyzer.ui.common.PopupEndMenuItemClickListener;\r
-import org.tizen.dynamicanalyzer.ui.common.PopupFromSelectionMenuItemClickListener;\r
-import org.tizen.dynamicanalyzer.ui.common.PopupStartMenuItemClickListener;\r
+import org.tizen.dynamicanalyzer.ui.common.PopupRangeAnalysisMenuItemListener;\r
+import org.tizen.dynamicanalyzer.ui.range.RangeDataManager;\r
+import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;\r
import org.tizen.dynamicanalyzer.widgets.chart.DAChart;\r
import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlot;\r
import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlot.AutoRangeType;\r
+import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlotIntervalMarker;\r
+import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlotMarker;\r
import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlotTooltip;\r
import org.tizen.dynamicanalyzer.widgets.chart.DAChartSeries;\r
import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoard;\r
\r
protected void initPopupMenu(DAChartBoard chartBoard, DAPopupMenu popupMenu) {\r
popupMenu.setFont(FontResources.CONTEXT_MENU_ITEM_FONT);\r
- DAPopupMenuItem startItem = new DAPopupMenuItem(popupMenu);\r
- startItem.setText(TimelineChartLabels.RANGE_CONTEXT_SET_START);\r
- startItem.addListener(new PopupStartMenuItemClickListener(startItem,\r
- chartBoard));\r
-\r
- DAPopupMenuItem endItem = new DAPopupMenuItem(popupMenu);\r
- endItem.setText(TimelineChartLabels.RANGE_CONTEXT_SET_END);\r
- endItem.addListener(new PopupEndMenuItemClickListener(endItem,\r
- chartBoard));\r
-\r
- DAPopupMenuItem fromSelectionItem = new DAPopupMenuItem(popupMenu);\r
- fromSelectionItem\r
- .setText(TimelineChartLabels.RANGE_CONTEXT_SET_FROM_SELECTION);\r
- fromSelectionItem\r
- .addListener(new PopupFromSelectionMenuItemClickListener(\r
- fromSelectionItem, chartBoard));\r
-\r
DAPopupMenuItem analysisItem = new DAPopupMenuItem(popupMenu);\r
analysisItem.setText(TimelineChartLabels.RANGE_CONTEXT_ANALYSIS);\r
- analysisItem.addListener(new PopupAnalysisMenuItemClickListener());\r
-\r
- DAPopupMenuItem clearItem = new DAPopupMenuItem(popupMenu);\r
- clearItem.setText(TimelineChartLabels.RANGE_CONTEXT_CLEAR);\r
- clearItem.addListener(new PopupClearMenuItemClickListener());\r
+ analysisItem.addListener(new PopupRangeAnalysisMenuItemListener(analysisItem, chartBoard) {\r
+ @Override\r
+ public void widgetSelected(DAPopupMenuItem menuItem) {\r
+ double time = menuItem.getDoubleData();\r
+ Collections.sort(RangeDataManager.getInstance().getMarerTimeList());\r
+ RangeDataManager.getInstance().setRangeFromMarkerList((long) (time * TimelineConstants.MEGA_DOUBLE));\r
+ \r
+ DAChartPlotMarker marker = chart.getPlot().getMarkers().get(0);\r
+ DAChartPlotIntervalMarker intervalMarker = (DAChartPlotIntervalMarker) marker;\r
+ double startVal = RangeDataManager.getInstance().getMarkerStartTime();\r
+ double endVal = RangeDataManager.getInstance().getMarkerEndTime();\r
+ intervalMarker.setInterval(startVal / TimelineConstants.MEGA_DOUBLE, \r
+ endVal / TimelineConstants.MEGA_DOUBLE);\r
+ }\r
+ });\r
}\r
\r
public void pushChild(MemoryChart child) {\r
package org.tizen.dynamicanalyzer.ui.memory.chart;\r
\r
import java.util.ArrayList;\r
+import java.util.Collections;\r
import java.util.Iterator;\r
import java.util.List;\r
import java.util.Map;\r
import org.tizen.dynamicanalyzer.ui.common.PopupClearMenuItemClickListener;\r
import org.tizen.dynamicanalyzer.ui.common.PopupEndMenuItemClickListener;\r
import org.tizen.dynamicanalyzer.ui.common.PopupFromSelectionMenuItemClickListener;\r
+import org.tizen.dynamicanalyzer.ui.common.PopupRangeAnalysisMenuItemListener;\r
import org.tizen.dynamicanalyzer.ui.common.PopupStartMenuItemClickListener;\r
import org.tizen.dynamicanalyzer.ui.common.TimeLineChartKeyListener;\r
+import org.tizen.dynamicanalyzer.ui.common.TimelineChartMouseEventListener;\r
import org.tizen.dynamicanalyzer.ui.common.TimelineChartMouseTrackAdapter;\r
import org.tizen.dynamicanalyzer.ui.memory.MemoryPage;\r
import org.tizen.dynamicanalyzer.ui.memory.data.MemoryDataManager;\r
import org.tizen.dynamicanalyzer.ui.memory.data.ProcessMemoryDBTable;\r
+import org.tizen.dynamicanalyzer.ui.range.RangeDataManager;\r
import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineChartManager;\r
+import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;\r
import org.tizen.dynamicanalyzer.ui.toolbar.Toolbar;\r
import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;\r
import org.tizen.dynamicanalyzer.widgets.chart.DAChart;\r
import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlot;\r
import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlotIntervalMarker;\r
+import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlotMarker;\r
import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlotTooltip;\r
import org.tizen.dynamicanalyzer.widgets.chart.DAChartRenderer;\r
import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoard;\r
chartWidget.getPlot().setAxisRangeX(getVisibleStartTime(), getVisibleEndTime());\r
\r
chartWidget.getPlot().setMarkers(getMarkers());\r
- MemoryChartMouseEventListener chartMouseEventListener = new MemoryChartMouseEventListener(\r
+ TimelineChartMouseEventListener chartMouseEventListener = new TimelineChartMouseEventListener(\r
memoryChart.getPopupMenu(), getTimeline(), MemoryPage.pageID);\r
chartWidget.addMouseListener(chartMouseEventListener);\r
chartWidget.addMouseMoveListener(chartMouseEventListener);\r
DAChart.CHART_STYLE_NORMAL);\r
DAChart parentDAChart = parentItem.getChart();\r
\r
- initMemoryChart(parentDAChart);\r
MemoryChart chart = new SystemMemoryChart(MemoryPage.pageID, chartName, parentItem, parentDAChart);\r
+ initMemoryChart(chart);\r
chart.setChartStyle();\r
chart.chart.getPlot().setAxisUnit("B");\r
chart.chart.getPlot().setAxisUnitType(DAChartPlot.UnitType.BINARY);\r
parentItem.useExpand(false);\r
DAChart parentDAChart = parentItem.getChart();\r
\r
- initMemoryChart(parentDAChart);\r
MemoryChart processMemoryChart = new ProcessMemoryChart(MemoryPage.pageID, chartName, parentItem, parentDAChart);\r
+ initMemoryChart(processMemoryChart);\r
processMemoryChart.setPid(pid);\r
processMemoryChart.setChartStyle();\r
processMemoryChart.chart.getPlot().setAxisUnit("B");\r
String chartName = MemoryPageLabels.MEMORY_CHART_HEAP_MEMORY;\r
DAChartBoardItem parentItem = new DAChartBoardItem(this, chartName, ImageResources.FEATURE_HEAPALLOC_SMALL, DAChart.CHART_STYLE_NORMAL);\r
DAChart parentDAChart = parentItem.getChart();\r
- initMemoryChart(parentDAChart);\r
+ \r
String libName = getLibNameByID(libId);\r
MemoryChart parentHeapMemoryChart = new HeapMemoryChart(MemoryPage.pageID, chartName, libId, libName, parentItem, parentDAChart);\r
+ initMemoryChart(parentHeapMemoryChart);\r
parentHeapMemoryChart.setPid(pid);\r
parentHeapMemoryChart.setChartStyle();\r
parentHeapMemoryChart.chart.getPlot().setAxisUnit("B");\r
DAChartBoardItem parentItem = parent.getChartItem();\r
DAChartBoardItem childItem = new DAChartBoardItem(parentItem, chartName);\r
DAChart childDAChart = childItem.getChart();\r
- initMemoryChart(childDAChart);\r
+ \r
MemoryChart childHeapMemoryChart = new HeapMemoryChart(MemoryPage.pageID, chartName, libId, libName, childItem, childDAChart);\r
+ initMemoryChart(childHeapMemoryChart);\r
childHeapMemoryChart.setPid(pid);\r
childHeapMemoryChart.setChartStyle();\r
childHeapMemoryChart.chart.getPlot().setAxisUnit("B");\r
return libPath.substring(0, index) + "\n" + libPath.substring(index+1);\r
}\r
\r
- private void initMemoryChart(DAChart chart) {\r
+ private void initMemoryChart(MemoryChart chart) {\r
if(null == chart) {\r
return;\r
}\r
\r
- chart.setChartRenderer(new DAChartRenderer());\r
- DAChartPlot plot = chart.getPlot();\r
+ chart.getChart().setChartRenderer(new DAChartRenderer());\r
+ DAChartPlot plot = chart.getChart().getPlot();\r
if(null == plot) {\r
return;\r
}\r
tooltip.setFont(FontResources.CHART_TOOLTIP_FONT);\r
plot.setTooltip(tooltip);\r
\r
- DAPopupMenu popupMenu = new DAPopupMenu(chart);\r
+ final MemoryChart tmp = chart;\r
+ \r
+ DAPopupMenu popupMenu = new DAPopupMenu(chart.getChart());\r
popupMenu.setFont(FontResources.CONTEXT_MENU_ITEM_FONT);\r
- DAPopupMenuItem startItem = new DAPopupMenuItem(popupMenu, DAPopupMenuItem.NONE);\r
- startItem.setText(TimelineChartLabels.RANGE_CONTEXT_SET_START);\r
- startItem.addListener(new PopupStartMenuItemClickListener(startItem, this));\r
-\r
- DAPopupMenuItem endItem = new DAPopupMenuItem(popupMenu, DAPopupMenuItem.NONE);\r
- endItem.setText(TimelineChartLabels.RANGE_CONTEXT_SET_END);\r
- endItem.addListener(new PopupEndMenuItemClickListener(endItem, this));\r
-\r
- DAPopupMenuItem fromSelectionItem = new DAPopupMenuItem(popupMenu, DAPopupMenuItem.NONE);\r
- fromSelectionItem.setText(TimelineChartLabels.RANGE_CONTEXT_SET_FROM_SELECTION);\r
- fromSelectionItem.addListener(new PopupFromSelectionMenuItemClickListener(\r
- fromSelectionItem, this));\r
-\r
- DAPopupMenuItem analysisItem = new DAPopupMenuItem(popupMenu, DAPopupMenuItem.NONE);\r
+ DAPopupMenuItem analysisItem = new DAPopupMenuItem(popupMenu);\r
analysisItem.setText(TimelineChartLabels.RANGE_CONTEXT_ANALYSIS);\r
- analysisItem.addListener(new PopupAnalysisMenuItemClickListener());\r
-\r
- DAPopupMenuItem clearItem = new DAPopupMenuItem(popupMenu, DAPopupMenuItem.NONE);\r
- clearItem.setText(TimelineChartLabels.RANGE_CONTEXT_CLEAR);\r
- clearItem.addListener(new PopupClearMenuItemClickListener());\r
+ analysisItem.addListener(new PopupRangeAnalysisMenuItemListener(analysisItem, this) {\r
+ @Override\r
+ public void widgetSelected(DAPopupMenuItem menuItem) {\r
+ double time = menuItem.getDoubleData();\r
+ Collections.sort(RangeDataManager.getInstance().getMarerTimeList());\r
+ RangeDataManager.getInstance().setRangeFromMarkerList((long) (time * TimelineConstants.MEGA_DOUBLE));\r
+ \r
+ DAChartPlotMarker marker = tmp.getChart().getPlot().getMarkers().get(0);\r
+ DAChartPlotIntervalMarker intervalMarker = (DAChartPlotIntervalMarker) marker;\r
+ double startVal = RangeDataManager.getInstance().getMarkerStartTime();\r
+ double endVal = RangeDataManager.getInstance().getMarkerEndTime();\r
+ intervalMarker.setInterval(startVal / TimelineConstants.MEGA_DOUBLE, \r
+ endVal / TimelineConstants.MEGA_DOUBLE);\r
+ }\r
+ });\r
+ \r
+ chart.popupMenu = popupMenu;\r
\r
- MemoryChartMouseEventListener memoryChartMouseEventListener = new MemoryChartMouseEventListener(\r
- popupMenu, getTimeline(), MemoryPage.pageID);\r
- chart.addMouseListener(memoryChartMouseEventListener);\r
- chart.addMouseMoveListener(memoryChartMouseEventListener);\r
- chart.addMouseTrackListener(new TimelineChartMouseTrackAdapter(getTimeline()));\r
+ TimelineChartMouseEventListener memoryChartMouseEventListener = new TimelineChartMouseEventListener(\r
+ chart.getPopupMenu(), getTimeline(), MemoryPage.pageID);\r
+ chart.getChart().addMouseListener(memoryChartMouseEventListener);\r
+ chart.getChart().addMouseMoveListener(memoryChartMouseEventListener);\r
+ chart.getChart().addMouseTrackListener(new TimelineChartMouseTrackAdapter(getTimeline()));\r
\r
///Add Keylistener 0215\r
TimeLineChartKeyListener timelineKeyListener = new TimeLineChartKeyListener(this);\r
- chart.addKeyListener(timelineKeyListener);\r
+ chart.getChart().addKeyListener(timelineKeyListener);\r
\r
plot.setMarkers(getMarkers());\r
}\r