[Title] Enable latest button function
authorkamuru <kamuru@kamuru-Samsung-Desktop-System.(none)>
Tue, 5 Nov 2013 07:24:15 +0000 (16:24 +0900)
committerkamuru <kamuru@kamuru-Samsung-Desktop-System.(none)>
Tue, 5 Nov 2013 07:24:15 +0000 (16:24 +0900)
[Desc.] enable latest button on snapshot view
[Issue]

org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/chartBoard/DAChartBoard.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/GLPageLabels.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/GLPageLabels.properties
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/common/TimelineChartMouseEventListener.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/info/snapshot/SnapshotView.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/ui/chart/GLChartView.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/ui/chart/GLTitleComboRenderer.java [new file with mode: 0644]
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/ui/context/GLContextView.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/CPUChart.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/common/TimelineView.java

index 02a03bf..f0703eb 100644 (file)
@@ -793,4 +793,8 @@ public class DAChartBoard extends Composite {
        protected void setInterval(int interval) {
                this.interval = interval;
        }
+       
+       public ScrollBar getHScrollBar() {
+               return hScroll;
+       }
 }
index dddbf90..524d080 100644 (file)
@@ -31,8 +31,8 @@ import org.eclipse.osgi.util.NLS;
 public class GLPageLabels extends NLS {
        private static final String BUNDLE_NAME = "org.tizen.dynamicanalyzer.nl.GLPageLabels"; //$NON-NLS-1$
 
-       public static String GL_CHART_TITLE_TIME;
-       public static String GL_CHART_TITLE_FRAME;
+       public static String GL_CHART_TITLE_FRAME_RATE;
+       public static String GL_CHART_TITLE_FRAME_TIME;
 
        public static String GL_DETAILS_VIEW_TITLE;
 
index 2a1e283..498fe0e 100644 (file)
@@ -10,11 +10,15 @@ import org.eclipse.swt.events.MouseMoveListener;
 import org.eclipse.swt.widgets.Canvas;
 import org.tizen.dynamicanalyzer.common.AnalyzerManager;
 import org.tizen.dynamicanalyzer.common.DASelectionData;
+import org.tizen.dynamicanalyzer.ui.info.snapshot.SnapshotView;
 import org.tizen.dynamicanalyzer.ui.range.RangeDataManager;
+import org.tizen.dynamicanalyzer.ui.timeline.TimelinePage;
 import org.tizen.dynamicanalyzer.ui.timeline.chart.ScreenshotChart;
 import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
 import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineView;
 import org.tizen.dynamicanalyzer.ui.toolbar.ToolbarArea;
+import org.tizen.dynamicanalyzer.ui.widgets.DATabComposite;
+import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
 import org.tizen.dynamicanalyzer.widgets.chart.DAChart;
 import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlot;
 import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlotIntervalMarker;
@@ -118,6 +122,13 @@ public class TimelineChartMouseEventListener extends MouseAdapter implements
 
                        return;
                }
+               
+               DATabComposite timelineTabComp = (DATabComposite) AnalyzerUtil
+                               .getView(TimelinePage.ID, DATabComposite.ID);
+               SnapshotView snapshotView = (SnapshotView) timelineTabComp
+                               .getTab(SnapshotView.ID);
+               snapshotView.setLatestButtonEnable(true);
+               
                boolean bShift = false;
                if ((e.stateMask & SWT.SHIFT) != 0) {
                        bShift = true;
index 4c96d4c..07774b0 100644 (file)
@@ -63,6 +63,7 @@ import org.tizen.dynamicanalyzer.swap.model.data.LogData;
 import org.tizen.dynamicanalyzer.swap.model.data.SystemData;
 import org.tizen.dynamicanalyzer.ui.page.DAPageComposite;
 import org.tizen.dynamicanalyzer.ui.page.ViewAction;
+import org.tizen.dynamicanalyzer.ui.toolbar.ToolbarArea;
 import org.tizen.dynamicanalyzer.ui.widgets.ViewContainer;
 import org.tizen.dynamicanalyzer.ui.widgets.table.DATableComposite;
 import org.tizen.dynamicanalyzer.ui.widgets.table.DATableDataFormat;
@@ -236,6 +237,12 @@ public class SnapshotView extends DAView {
                        public void handleClickEvent(DACustomButton button) {
                                setLatestButtonEnable(false);
                                setSelectTime(lastStartTime);
+
+                               DASelectionData selData = new DASelectionData(ID, ToolbarArea
+                                               .getInstance().getTime(), ToolbarArea.getInstance()
+                                               .getTime(), null, latestButton);
+                               AnalyzerManager.getCurrentPage().updatePage(selData);
+
                                updateView();
                        }
                });
@@ -300,6 +307,9 @@ public class SnapshotView extends DAView {
                setLatestButtonEnable(true);
                long selStartTime = selData.getStartTime();
                if (selData.getViewId().equals(SnapshotView.ID)) {
+                       if(selData.getControl() == latestButton) {
+                               setLatestButtonEnable(false);
+                       }
                        if (selStartTime < 0) {
                                selStartTime = 0;
                        }
@@ -453,4 +463,8 @@ public class SnapshotView extends DAView {
                        latestButton.setButtonEnabled(false);
                }
        }
+       
+       public boolean isLatestButtonEnabled() {
+               return latestButton.isButtonEnabled();
+       }
 }
index cd37c2a..588692e 100644 (file)
@@ -51,7 +51,6 @@ import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
 import org.tizen.dynamicanalyzer.ui.timeline.logparser.LifecycleLogParser;
 import org.tizen.dynamicanalyzer.ui.toolbar.ToolbarArea;
 import org.tizen.dynamicanalyzer.ui.widgets.TitleComboPopupRenderer;
-import org.tizen.dynamicanalyzer.ui.widgets.TitleComboRenderer;
 import org.tizen.dynamicanalyzer.ui.widgets.ViewContainer;
 import org.tizen.dynamicanalyzer.widgets.button.DACustomButtonRenderer;
 import org.tizen.dynamicanalyzer.widgets.chart.DAChart;
@@ -91,11 +90,11 @@ public class GLChartView extends DAView {
                contents.setLayout(stackLayout);
 
                frameChartBoard = new DAChartBoard(contents,
-                               GLPageLabels.GL_CHART_TITLE_FRAME, DAChartBoard.BOARD_STYLE_FRAME);
+                               GLPageLabels.GL_CHART_TITLE_FRAME_TIME, DAChartBoard.BOARD_STYLE_FRAME);
                frameChartBoard.setNameFont(FontResources.CHART_NAME_FONT);
 
                timeChartBoard = new DAChartBoard(contents,
-                               GLPageLabels.GL_CHART_TITLE_TIME, DAChartBoard.BOARD_STYLE_TIME);
+                               GLPageLabels.GL_CHART_TITLE_FRAME_RATE, DAChartBoard.BOARD_STYLE_TIME);
                timeChartBoard.setNameFont(FontResources.CHART_NAME_FONT);
 
                stackLayout.topControl = frameChartBoard;
@@ -105,8 +104,8 @@ public class GLChartView extends DAView {
                                ImageResources.TIMELINE_DROPDOWN_HOVER,
                                ImageResources.TIMELINE_DROPDOWN_PUSH,
                                ImageResources.TIMELINE_DROPDOWN_NORMAL);
-               frameCombo.add(GLPageLabels.GL_CHART_TITLE_FRAME);
-               frameCombo.add(GLPageLabels.GL_CHART_TITLE_TIME);
+               frameCombo.add(GLPageLabels.GL_CHART_TITLE_FRAME_TIME);
+               frameCombo.add(GLPageLabels.GL_CHART_TITLE_FRAME_RATE);
                frameCombo.setTextAlign(DACustomCombo.TEXT_ALIGN_CENTER);
                frameCombo.select(0);
                frameCombo.setComboButtonGradation(
@@ -122,7 +121,7 @@ public class GLChartView extends DAView {
                                ImageResources.COMBO_DROPDOWN_DOWN);
                frameCombo.setEnabled(true);
                frameCombo.setItemHeight(COMBO_HEIGHT);
-               frameCombo.setComboRender(new TitleComboRenderer());
+               frameCombo.setComboRender(new GLTitleComboRenderer());
                frameCombo.setComboPopupRender(new TitleComboPopupRenderer());
                frameCombo.setButtonRenderer(new DACustomButtonRenderer());
                frameCombo.addSelectionListener(new DACustomComboSelectionListener() {
@@ -133,7 +132,7 @@ public class GLChartView extends DAView {
                                        return;
                                }
                                if (selected
-                                               .equals(GLPageLabels.GL_CHART_TITLE_TIME)) {
+                                               .equals(GLPageLabels.GL_CHART_TITLE_FRAME_RATE)) {
                                        changeComboFrameToTime();
                                } else {
                                        return;
@@ -147,8 +146,8 @@ public class GLChartView extends DAView {
                                ImageResources.TIMELINE_DROPDOWN_HOVER,
                                ImageResources.TIMELINE_DROPDOWN_PUSH,
                                ImageResources.TIMELINE_DROPDOWN_NORMAL);
-               timeCombo.add(GLPageLabels.GL_CHART_TITLE_FRAME);
-               timeCombo.add(GLPageLabels.GL_CHART_TITLE_TIME);
+               timeCombo.add(GLPageLabels.GL_CHART_TITLE_FRAME_TIME);
+               timeCombo.add(GLPageLabels.GL_CHART_TITLE_FRAME_RATE);
                timeCombo.setTextAlign(DACustomCombo.TEXT_ALIGN_CENTER);
                timeCombo.select(1);
                timeCombo.setComboButtonGradation(
@@ -164,7 +163,7 @@ public class GLChartView extends DAView {
                                ImageResources.COMBO_DROPDOWN_DOWN);
                timeCombo.setEnabled(true);
                timeCombo.setItemHeight(COMBO_HEIGHT);
-               timeCombo.setComboRender(new TitleComboRenderer());
+               timeCombo.setComboRender(new GLTitleComboRenderer());
                timeCombo.setComboPopupRender(new TitleComboPopupRenderer());
                timeCombo.setButtonRenderer(new DACustomButtonRenderer());
                timeCombo.addSelectionListener(new DACustomComboSelectionListener() {
@@ -175,7 +174,7 @@ public class GLChartView extends DAView {
                                        return;
                                }
                                if (selected
-                                               .equals(GLPageLabels.GL_CHART_TITLE_FRAME)) {
+                                               .equals(GLPageLabels.GL_CHART_TITLE_FRAME_TIME)) {
                                        changeComboTimeToFrame();
                                } else {
                                        return;
@@ -211,7 +210,7 @@ public class GLChartView extends DAView {
        private void changeComboFrameToTime() {
                stackLayout.topControl = timeChartBoard;
                contents.layout();
-               timeCombo.setText(GLPageLabels.GL_CHART_TITLE_TIME);
+               timeCombo.setText(GLPageLabels.GL_CHART_TITLE_FRAME_RATE);
                timeChartBoard.setScaleVal(frameChartBoard.getScaleVal());
                timeChartBoard.setVisibleStart(frameChartBoard.getVisibleStart());
                timeChartBoard.setItemsHeightMode(frameChartBoard.isItemMinimized());
@@ -221,7 +220,7 @@ public class GLChartView extends DAView {
        private void changeComboTimeToFrame() {
                stackLayout.topControl = frameChartBoard;
                contents.layout();
-               frameCombo.setText(GLPageLabels.GL_CHART_TITLE_FRAME);
+               frameCombo.setText(GLPageLabels.GL_CHART_TITLE_FRAME_TIME);
                frameChartBoard.setScaleVal(timeChartBoard.getScaleVal());
                frameChartBoard.setVisibleStart(timeChartBoard.getVisibleStart());
                frameChartBoard.setItemsHeightMode(timeChartBoard.isItemMinimized());
@@ -299,24 +298,6 @@ public class GLChartView extends DAView {
        private void initializeCharts() {
                initIntervalMarkers(frameChartBoard);
                
-//             GLFPSChart fpsChart = GLFPSChart.getInstance();
-//             DAChartBoardItem fpsChartItem = fpsChart.createBoardItem(frameChartBoard);
-//             DAChart fpsChartWidget = fpsChartItem.getChart();
-//
-//             GLFrameChartMouseEventListener glFrameChartMouseEventListener = new GLFrameChartMouseEventListener(
-//                             fpsChart.getPopupMenu(), frameChartBoard.getTimeline());
-//             
-//             fpsChartWidget.getPlot().setMarkers(frameChartBoard.getMarkers());
-//             fpsChartWidget.addMouseListener(glFrameChartMouseEventListener);
-//             fpsChartWidget.addMouseMoveListener(glFrameChartMouseEventListener);
-//             fpsChartWidget.addMouseTrackListener(new TimelineChartMouseTrackAdapter(
-//                             frameChartBoard.getTimeline()));
-//             
-//             BoundLineEventListener underBoundLineEventListener = new BoundLineEventListener(fpsChartWidget, DAChartPlot.BoundType.UNDER);
-//             fpsChartWidget.addMouseListener(underBoundLineEventListener);
-//             fpsChartWidget.addMouseMoveListener(underBoundLineEventListener);
-//             fpsChartWidget.addMouseTrackListener(underBoundLineEventListener);
-               
                GLFrameTimeChart frameTimeChart = GLFrameTimeChart.getInstance();
                DAChartBoardItem frameTimeChartItem = frameTimeChart.createBoardItem(frameChartBoard);
                DAChart frameTimeChartWidget = frameTimeChartItem.getChart();
diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/ui/chart/GLTitleComboRenderer.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/ui/chart/GLTitleComboRenderer.java
new file mode 100644 (file)
index 0000000..4dc01e4
--- /dev/null
@@ -0,0 +1,42 @@
+package org.tizen.dynamicanalyzer.ui.opengl.ui.chart;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.widgets.Canvas;
+import org.tizen.dynamicanalyzer.resources.ColorResources;
+import org.tizen.dynamicanalyzer.resources.FontResources;
+import org.tizen.dynamicanalyzer.ui.widgets.TitleComboRenderer;
+import org.tizen.dynamicanalyzer.widgets.combo.DACustomCombo;
+
+public class GLTitleComboRenderer extends TitleComboRenderer {
+       @Override
+       public void drawImage(GC gc, Canvas canvas, Image image, String text,
+                       int textAlign, Font font, int state) {
+               Rectangle rect = canvas.getClientArea();
+               gc.drawImage(image, rect.x, rect.y);
+               if (null == font) {
+                       gc.setFont(FontResources.COMBO);
+               } else {
+                       gc.setFont(font);
+               }
+               gc.setForeground(ColorResources.DEVICE_APPLICATION_ENABLE);
+               Point p = gc.textExtent(text, SWT.DRAW_MNEMONIC);
+               int textX = 0;
+               if (textAlign == DACustomCombo.TEXT_ALIGN_LEFT) {
+                       textX = 5;
+               } else if (textAlign == DACustomCombo.TEXT_ALIGN_RIGHT) {
+                       textX = rect.width - p.x;
+               } else {
+                       textX = (rect.width / 2) - (p.x / 2);
+               }
+               gc.drawString(text, textX, (rect.height - p.y) / 2, true);
+               Rectangle clipping = new Rectangle(rect.x + rect.width - 17, rect.y, 0,
+                               rect.height);
+               gc.setClipping(clipping);
+               gc.drawImage(image, rect.x, rect.y);
+       }
+}
index 7203012..5eecac5 100644 (file)
@@ -32,7 +32,6 @@ import org.eclipse.swt.custom.SashForm;
 import org.eclipse.swt.layout.FillLayout;
 import org.eclipse.swt.widgets.Composite;
 import org.tizen.dynamicanalyzer.common.DASelectionData;
-import org.tizen.dynamicanalyzer.listeners.TableTooltipListener;
 import org.tizen.dynamicanalyzer.model.DAView;
 import org.tizen.dynamicanalyzer.nl.GLPageLabels;
 import org.tizen.dynamicanalyzer.resources.ColorResources;
index d6465b7..4e3f716 100644 (file)
@@ -241,7 +241,12 @@ public class CPUChart extends TimelineChart {
                                                        ColorResources.SERIES_COLOR_CPU_SYSTEM);
                                        newSeries.addSeriesItem(new DAChartSeriesItem(time, load,
                                                        Formatter.toPercentageFormat(load)));
+                                       //FIXME debut
+                                       try{
                                        childItem.getChart().addSeries(newSeries);
+                                       } catch(NullPointerException e) {
+                                               e.printStackTrace();
+                                       }
 
                                        childSeriesMap.put(pid, newSeries);
                                }
index d030177..fdbf7a6 100644 (file)
@@ -29,9 +29,12 @@ package org.tizen.dynamicanalyzer.ui.timeline.common;
 import java.util.List;
 
 import org.eclipse.swt.custom.StackLayout;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
 import org.eclipse.swt.layout.FillLayout;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.ScrollBar;
 import org.tizen.dynamicanalyzer.common.DASelectionData;
 import org.tizen.dynamicanalyzer.model.DAView;
 import org.tizen.dynamicanalyzer.resources.ColorResources;
@@ -43,7 +46,9 @@ import org.tizen.dynamicanalyzer.ui.common.SetRangeMarkerMouseMoveListener;
 import org.tizen.dynamicanalyzer.ui.common.TimelineChartMouseEventListener;
 import org.tizen.dynamicanalyzer.ui.common.TimelineChartMouseTrackAdapter;
 import org.tizen.dynamicanalyzer.ui.common.UICommonConstants;
+import org.tizen.dynamicanalyzer.ui.info.snapshot.SnapshotView;
 import org.tizen.dynamicanalyzer.ui.range.RangeDataManager;
+import org.tizen.dynamicanalyzer.ui.timeline.TimelinePage;
 import org.tizen.dynamicanalyzer.ui.timeline.chart.CPUChart;
 import org.tizen.dynamicanalyzer.ui.timeline.chart.HeapChart;
 import org.tizen.dynamicanalyzer.ui.timeline.chart.ScreenshotChart;
@@ -53,6 +58,7 @@ import org.tizen.dynamicanalyzer.ui.timeline.logparser.CustomLogParser;
 import org.tizen.dynamicanalyzer.ui.timeline.logparser.DeviceLogParser;
 import org.tizen.dynamicanalyzer.ui.timeline.logparser.LifecycleLogParser;
 import org.tizen.dynamicanalyzer.ui.toolbar.ToolbarArea;
+import org.tizen.dynamicanalyzer.ui.widgets.DATabComposite;
 import org.tizen.dynamicanalyzer.ui.widgets.ViewContainer;
 import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
 import org.tizen.dynamicanalyzer.widgets.chart.DAChart;
@@ -89,6 +95,22 @@ public class TimelineView extends DAView {
                chartBoard.setNameFont(FontResources.CHART_NAME_FONT);
                timelineChartManager.setChartTimelineChartBoard(chartBoard);
                chartBoard.setSelectable(false);
+               
+               ScrollBar hScrollBar = chartBoard.getHScrollBar();
+               hScrollBar.addSelectionListener(new SelectionListener() {
+                       @Override
+                       public void widgetSelected(SelectionEvent e) {
+                               DATabComposite timelineTabComp = (DATabComposite) AnalyzerUtil
+                                               .getView(TimelinePage.ID, DATabComposite.ID);
+                               SnapshotView snapshotView = (SnapshotView) timelineTabComp
+                                               .getTab(SnapshotView.ID);
+                               snapshotView.setLatestButtonEnable(true); 
+                       }
+                       
+                       @Override
+                       public void widgetDefaultSelected(SelectionEvent e) {
+                       }
+               });
 
                StackLayout stackLayout = new StackLayout();
                stackLayout.topControl = chartBoard;
@@ -130,8 +152,8 @@ public class TimelineView extends DAView {
                long start = selData.getStartTime();
                long end = selData.getEndTime();
 
-               Double startTime = (double) start / TimelineConstants.MEGA_DOUBLE;
-               Double endTime = (double) end / TimelineConstants.MEGA_DOUBLE;
+               Double startTime = start / TimelineConstants.MEGA_DOUBLE;
+               Double endTime = end / TimelineConstants.MEGA_DOUBLE;
                double middleTime = (startTime + endTime) / 2.0;
                if (startTime.equals(endTime)) {
                        middleTime = startTime;
@@ -151,6 +173,20 @@ public class TimelineView extends DAView {
                        return;
                }
 
+               DATabComposite timelineTabComp = (DATabComposite) AnalyzerUtil
+                               .getView(TimelinePage.ID, DATabComposite.ID);
+               SnapshotView snapshotView = (SnapshotView) timelineTabComp
+                               .getTab(SnapshotView.ID);
+               if (snapshotView != null && !snapshotView.isLatestButtonEnabled()) {
+                       DAChartPlotIntervalMarker intervalMarker = (DAChartPlotIntervalMarker) chartBoard
+                                       .getMarkers().get(UICommonConstants.SELECTION_MARKER_INDEX);
+
+                       double time = ToolbarArea.getInstance().getTime()
+                                       / TimelineConstants.MEGA_DOUBLE;
+                       intervalMarker.setStartVal(time);
+                       intervalMarker.setEndVal(time);
+               }
+
                timelineChartManager.addNewCustomChart();
                chartBoard.setTotalEndTime(ToolbarArea.getInstance().getTime());