public static final int TOOLTIP_SHOW_MIN = 50;
private boolean bTooltip = false;
private double startVal;
+ private double yPosRatio;
private Color backgroundColor;
private Color lineColor;
private Color textColor;
redrawRegisteredChart();
}
}
+
+ public double getYPosRatio() {
+ return yPosRatio;
+ }
+
+ public void setYPosRatio(double yPosRatio) {
+ this.yPosRatio = yPosRatio;
+ if(true == bTooltip) {
+ redrawRegisteredChart();
+ }
+ }
public boolean isTooltip() {
return bTooltip;
int textWidthMax = 0;
int textHeightMax = 0;
double realXVal = tooltip.getStartVal();
+ boolean isCheckBarStyle = seriesList.get(0).getStyle() == DACustomChartSeries.SERIES_STYLE_MULTY_CHECK_BAR ? true : false;
for (int i = 0; i < seriesList.size(); i++) {
+ if(isCheckBarStyle) {
+ i = (int)(seriesList.size() * tooltip.getYPosRatio());
+ }
DACustomChartSeries series = seriesList.get(i);
int index = series.getPrevIndexByXvalue(realXVal);
String text;
gc.setForeground(tooltip.getLineColor());
gc.setLineStyle(SWT.LINE_DOT);
- if(series.getStyle() != DACustomChartSeries.SERIES_STYLE_MULTY_CHECK_BAR) {
+ if(!isCheckBarStyle) {
gc.drawLine(0, plot.getYPixcelFromY(series, yVal, r), r.width,
plot.getYPixcelFromY(series, yVal, r));
}
if (textHeightMax < textHeight) {
textHeightMax = textHeight;
}
+
+ if(isCheckBarStyle) {
+ break;
+ }
}
int preTextWidthMargin = DACustomChartPlotTooltip.TOOLTIP_MARGIN
+ DACustomChartPlotTooltip.TOOLTIP_SERIES_RECT_LENGTH
int startX = getTooltipStartX(realXVal, textWidthMax
+ preTextWidthMargin, DACustomChartPlotTooltip.TOOLTIP_MARGIN);
- int totalHeight = seriesList.size() * textHeightMax
+ int totalHeight;
+ if(isCheckBarStyle) {
+ totalHeight = textHeightMax
+ + DACustomChartPlotTooltip.TOOLTIP_MARGIN
+ + DACustomChartPlotTooltip.TOOLTIP_MARGIN;
+ } else {
+ totalHeight = seriesList.size() * textHeightMax
+ DACustomChartPlotTooltip.TOOLTIP_MARGIN
+ DACustomChartPlotTooltip.TOOLTIP_MARGIN;
+ }
gc.setBackground(tooltip.getBackgroundColor());
gc.setForeground(tooltip.getTextColor());
int y = ((r.y + r.height) / 2) - (totalHeight / 2)
+ (textHeightMax * i)
+ DACustomChartPlotTooltip.TOOLTIP_MARGIN;
- gc.setBackground(series.getColor());
+ if(series.getStyle() != DACustomChartSeries.SERIES_STYLE_IMAGE) {
+ gc.setBackground(series.getColor());
+ }
gc.fillRectangle(
startX + DACustomChartPlotTooltip.TOOLTIP_MARGIN,
+ DACustomChartPlotTooltip.TOOLTIP_MARGIN
+ DACustomChartPlotTooltip.TOOLTIP_SERIES_RECT_LENGTH
+ DACustomChartPlotTooltip.TOOLTIP_MARGIN, y);
+ if(isCheckBarStyle) {
+ break;
+ }
}
}
Image image;
gc.setBackground(new Color(Display.getCurrent(), 193, 193, 193)); //FIXME
gc.setForeground(new Color(Display.getCurrent(), 0, 0, 193)); //FIXME
+
+ int highlightedImageIndex = ((DACustomScreenshotChartPlot)plot).getHighlightedImageIndex();
for (int i = index; i < seriesItemSize; i++) {
seriesItem = seriesItems.get(i);
double currentX = seriesItem.getX();
gc.drawRectangle(pixcelStartX, r.y + (MARGIN*2), plot.getXPixcelFromX(currentX+1.0, r) - pixcelStartX, r.height - (MARGIN*4));
}
else{
- gc.drawImage(image,pixcelStartX, (MARGIN*2));
+ int pixcelStartY = MARGIN * 2;
+ if(i == highlightedImageIndex) {
+ pixcelStartY -= 10;
+ }
+ gc.drawImage(image,pixcelStartX, (pixcelStartY));
// gc.drawImage(image, srcX, srcY, srcWidth, srcHeight, destX, destY, destWidth, destHeight);
}
if (currentX > plot.getVisibleEndX()) {
}
}
}
-
-
}
--- /dev/null
+package org.tizen.dynamicanalyzer.widgets.chart;
+
+public class DACustomScreenshotChartPlot extends DACustomChartPlot {
+ private int highlightedImageIndex = -1;
+
+ public DACustomScreenshotChartPlot(DACustomChart chart) {
+ super(chart);
+ }
+
+ public int getHighlightedImageIndex() {
+ return highlightedImageIndex;
+ }
+
+ public void setHighlightedImageIndex(int index) {
+ highlightedImageIndex = index;
+ }
+}
public static Color DEFAULT_FOREGROUND = getColor("defaultForeground"); //$NON-NLS-1$\r
public static Color DEFAULT_BACKGROUND = getColor("defaultBackground"); //$NON-NLS-1$\r
public static Color DEFAULT_RED = getColor("defaultRed"); //$NON-NLS-1$\r
+ \r
+ public static Color TIME_TICK_BG = getColor("time_tick_bg"); //$NON-NLS-1$\r
+ public static Color TIME_TICK_LINE = getColor("time_tick_line"); //$NON-NLS-1$\r
+ \r
+ public static Color LIFECYCLE_INITIALIZING_TOP = getColor("lifecycle_initializing_top");\r
+ public static Color LIFECYCLE_INITIALIZING_BOTTOM = getColor("lifecycle_initializing_bottom");\r
+ public static Color LIFECYCLE_RUNNING_TOP = getColor("lifecycle_running_top");\r
+ public static Color LIFECYCLE_RUNNING_BOTTOM = getColor("lifecycle_running_bottom");\r
+ public static Color LIFECYCLE_PAUSING_TOP = getColor("lifecycle_pausing_top");\r
+ public static Color LIFECYCLE_PAUSING_BOTTOM = getColor("lifecycle_pausing_bottom");\r
+ public static Color LIFECYCLE_TERMINATING_TOP = getColor("lifecycle_terminating_top");\r
+ public static Color LIFECYCLE_TERMINATING_BOTTOM = getColor("lifecycle_terminating_bottom");\r
\r
// circular graph\r
public static Color CPU_BAR_GRAPH_COLOR = getColor("cpu_bar_graph_color"); //$NON-NLS-1$\r
public static final Image CHART_DEVICES = getPngImage("time_line_icon_devices"); //$NON-NLS-1$\r
public static final Image UI_EVENT = getPngImage("time_line_icon_UI_events"); //$NON-NLS-1$\r
public static final Image CHART_CUSTOM = getPngImage("time_line_icon_custom"); //$NON-NLS-1$\r
+ //FIXME\r
+ public static final Image TEST_IMAGE_RED = getPngImage("test_image_red");\r
+ public static final Image TEST_IMAGE_BLUE = getPngImage("test_image_blue");\r
\r
/* Resource */\r
public static final Image TYPE_FILE = getPngImage("resource/resource_file"); //$NON-NLS-1$\r
setColor("item blue right", new RGB(131, 196, 218));//$NON-NLS-1$
setColor("item blue dark", new RGB(38, 104, 138));//$NON-NLS-1$
setColor("item background", new RGB(50, 50, 50));//$NON-NLS-1$
- setColor("item background", new RGB(50, 50, 50));//$NON-NLS-1$
- setColor("item background", new RGB(50, 50, 50));//$NON-NLS-1$
setColor("item_bg_top", new RGB(215, 215, 215)); //$NON-NLS-1$
setColor("item_bg_bottom", new RGB(157, 166, 168)); //$NON-NLS-1$
setColor("defaultForeground", new RGB(0, 0, 0)); //$NON-NLS-1$
setColor("defaultBackground", new RGB(255, 255, 255)); //$NON-NLS-1$
setColor("defaultRed", new RGB(173, 13, 1)); //$NON-NLS-1$
+ setColor("time_tick_bg", new RGB(247, 247, 247)); //$NON-NLS-1$
+ setColor("time_tick_line", new RGB(159, 159, 159)); //$NON-NLS-1$
+
+ setColor("lifecycle_initializing_top", new RGB(123, 182, 240)); //$NON-NLS-1$
+ setColor("lifecycle_initializing_bottom", new RGB(65, 141, 218)); //$NON-NLS-1$
+ setColor("lifecycle_running_top", new RGB(194, 238, 131)); //$NON-NLS-1$
+ setColor("lifecycle_running_bottom", new RGB(143, 198, 63)); //$NON-NLS-1$
+ setColor("lifecycle_pausing_top", new RGB(170, 170, 170)); //$NON-NLS-1$
+ setColor("lifecycle_pausing_bottom", new RGB(113, 113, 113)); //$NON-NLS-1$
+ setColor("lifecycle_terminating_top", new RGB(223, 143, 140)); //$NON-NLS-1$
+ setColor("lifecycle_terminating_bottom", new RGB(198, 82, 77)); //$NON-NLS-1$
// bar graph
setColor("cpu_bar_graph_color", new RGB(0, 122, 167)); //$NON-NLS-1$
import org.tizen.dynamicanalyzer.widgets.chart.DACustomChart;
import org.tizen.dynamicanalyzer.widgets.chart.DACustomChartSeries;
import org.tizen.dynamicanalyzer.widgets.chart.DACustomChartSeriesItem;
+import org.tizen.dynamicanalyzer.widgets.chart.DACustomScreenshotChartPlot;
public class ScreenshotChart extends TimelineChart {
public static ScreenshotChart instance = null;
screenshotSeries = new DACustomChartSeries(TimelineChartLabels.SCREENSHOT_CHART_TITLE, DACustomChartSeries.SERIES_STYLE_IMAGE);
- screenshotSeries.addSeriesItem(new DACustomChartSeriesItem(10, addIcon));
+ screenshotSeries.addSeriesItem(new DACustomChartSeriesItem(10, ImageResources.TEST_IMAGE_RED, "red"));
+ screenshotSeries.addSeriesItem(new DACustomChartSeriesItem(15, ImageResources.TEST_IMAGE_BLUE, "blue"));
}
@Override
public DACustomChart createDAChart(Composite parent) {
chart = new DACustomChart(parent, chartName);
+ chart.replacePlot(new DACustomScreenshotChartPlot(chart));
setChartStyle();
private DACustomChartSeries gestureEventSeries;
private DACustomChartSeries orientationEventSeries;
private DACustomChartSeries frameworkEventSeries;
-
+
private final int EVENT_TYPE = 12;
private final int X = 14;
private final int Y = 15;
private final int INFO1 = 16;
-
+
private final int TYPE_KEY = 1;
private final int TYPE_TOUCH = 2;
private final int TYPE_GESTURE = 3;
private final int TYPE_ORIENTATION = 4;
private final int TYPE_FRAMEWORK = 5;
-
public static UIEventChart getInstance() {
if (instance == null) {
chartIcon = ImageResources.CHART_UI_EVENT;
addIcon = ImageResources.ADD_CHART_UI_EVENT;
- keyEventSeries = new DACustomChartSeries(TimelineChartLabels.UI_EVENT_CHART_SERIES_NAME_KEY, DACustomChartSeries.SERIES_STYLE_MULTY_CHECK_BAR,
- ColorResources.SERIES_COLOR_UI_EVENT_KEY);
- touchEventSeries = new DACustomChartSeries(TimelineChartLabels.UI_EVENT_CHART_SERIES_NAME_TOUCH, DACustomChartSeries.SERIES_STYLE_MULTY_CHECK_BAR,
- ColorResources.SERIES_COLOR_UI_EVENT_TOUCH);
- gestureEventSeries = new DACustomChartSeries(TimelineChartLabels.UI_EVENT_CHART_SERIES_NAME_GESTURE, DACustomChartSeries.SERIES_STYLE_MULTY_CHECK_BAR,
- ColorResources.SERIES_COLOR_UI_EVENT_GESTURE);
+ keyEventSeries = new DACustomChartSeries(TimelineChartLabels.UI_EVENT_CHART_SERIES_NAME_KEY,
+ DACustomChartSeries.SERIES_STYLE_MULTY_CHECK_BAR, ColorResources.SERIES_COLOR_UI_EVENT_KEY);
+ touchEventSeries = new DACustomChartSeries(TimelineChartLabels.UI_EVENT_CHART_SERIES_NAME_TOUCH,
+ DACustomChartSeries.SERIES_STYLE_MULTY_CHECK_BAR, ColorResources.SERIES_COLOR_UI_EVENT_TOUCH);
+ gestureEventSeries = new DACustomChartSeries(TimelineChartLabels.UI_EVENT_CHART_SERIES_NAME_GESTURE,
+ DACustomChartSeries.SERIES_STYLE_MULTY_CHECK_BAR, ColorResources.SERIES_COLOR_UI_EVENT_GESTURE);
orientationEventSeries = new DACustomChartSeries(TimelineChartLabels.UI_EVENT_CHART_SERIES_NAME_ORIENTATION,
DACustomChartSeries.SERIES_STYLE_MULTY_CHECK_BAR, ColorResources.SERIES_COLOR_UI_EVENT_ORIENTATION);
frameworkEventSeries = new DACustomChartSeries(TimelineChartLabels.UI_EVENT_CHART_SERIES_NAME_FRAMEWORK,
DACustomChartSeries.SERIES_STYLE_MULTY_CHECK_BAR, ColorResources.SERIES_COLOR_UI_EVENT_FRAMEWORK);
-
+
keyEventSeries.addSeriesItem(new DACustomChartSeriesItem(10, 10, "key1"));
gestureEventSeries.addSeriesItem(new DACustomChartSeriesItem(10, 100, "gesture1"));
gestureEventSeries.addSeriesItem(new DACustomChartSeriesItem(15, 100, "gesture2"));
gestureEventSeries.addSeriesItem(new DACustomChartSeriesItem(30, 100, "gesture2"));
- keyEventSeries.addSeriesItem(new DACustomChartSeriesItem(20, 100, "kye2"));
- keyEventSeries.addSeriesItem(new DACustomChartSeriesItem(25, 100, "kye3"));
+ keyEventSeries.addSeriesItem(new DACustomChartSeriesItem(20, 100, "key2"));
+ keyEventSeries.addSeriesItem(new DACustomChartSeriesItem(25, 100, "key3"));
}
@Override
public DACustomChart createDAChart(Composite parent) {
chart = new DACustomChart(parent, chartName);
-
+
setChartStyle();
-
+
chart.addSeries(keyEventSeries);
chart.addSeries(touchEventSeries);
chart.addSeries(gestureEventSeries);
chart.addSeries(orientationEventSeries);
chart.addSeries(frameworkEventSeries);
-
+
return chart;
}
-
+
@Override
public void clear() {
keyEventSeries.clear();
@Override
public void parsingLogPackage(LogPackage logPack, int probeType) {
- if(!isAbleToParse(logPack, LogCenterConstants.LOG_RECODER)) {
+ if (!isAbleToParse(logPack, LogCenterConstants.LOG_RECODER)) {
return;
}
-
+
Logs logs = logPack.getLogs(LogCenterConstants.LOG_RECODER);
List<List<String>> logList = logs.getLogs();
-
- for(List<String> log : logList) {
+
+ for (List<String> log : logList) {
parsingLog(log);
}
}
-
+
private void parsingLog(List<String> log) {
double time = Double.parseDouble(log.get(LogCenterConstants.TIME_INDEX));
-
+
int type = Integer.parseInt(log.get(EVENT_TYPE));
- switch(type) {
+ switch (type) {
case TYPE_KEY:
keyEventSeries.addSeriesItem(new DACustomChartSeriesItem(time, 0, "keycode : " + log.get(INFO1)));
break;
touchEventSeries.addSeriesItem(new DACustomChartSeriesItem(time, 0, "x : " + log.get(X) + " y : " + log.get(Y)));
break;
case TYPE_GESTURE:
- //FIXME detail event
+ // FIXME detail event
gestureEventSeries.addSeriesItem(new DACustomChartSeriesItem(time, 0));
break;
case TYPE_ORIENTATION:
orientationEventSeries.addSeriesItem(new DACustomChartSeriesItem(time, 0, log.get(INFO1)));
break;
case TYPE_FRAMEWORK:
- //FIXME argument
+ // FIXME argument
frameworkEventSeries.addSeriesItem(new DACustomChartSeriesItem(time, 0, log.get(LogCenterConstants.APINAME_INDEX)));
break;
default:
- System.out.println("UIEventChart.java : event type errro");//$NON_NLS-1$
+ System.out.println("UIEventChart.java : event type errro");// $NON_NLS-1$
return;
}
}
-
+
@Override
public List<DACustomChartSeries> getBaseDASeriesList() {
ArrayList<DACustomChartSeries> seriesList = new ArrayList<DACustomChartSeries>();
seriesList.add(gestureEventSeries);
seriesList.add(orientationEventSeries);
seriesList.add(frameworkEventSeries);
-
+
return seriesList;
}
}
+++ /dev/null
-/*
- * Dynamic Analyzer
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * Sanghyun Lee <sanghyunnim.lee@samsung.com>
- * Juyoung Kim <j0.kim@samsung.com>
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * Contributors:
- * - S-Core Co., Ltd
- *
- */
-
-package org.tizen.dynamicanalyzer.ui.timeline.chart;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.swt.widgets.Composite;
-import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
-import org.tizen.dynamicanalyzer.logparser.LogPackage;
-import org.tizen.dynamicanalyzer.logparser.Logs;
-import org.tizen.dynamicanalyzer.resources.ImageResources;
-import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
-import org.tizen.dynamicanalyzer.widgets.chart.DACustomChart;
-import org.tizen.dynamicanalyzer.widgets.chart.DACustomChartSeries;
-
-public class UserCustomChart extends TimelineChart {
- private ArrayList<DACustomChartSeries> tempSeriesList;
- private boolean[] usedColor;
-
- public UserCustomChart(int chartType, String chartName) {
- this.chartType = chartType;
- this.chartName = chartName;
- chartIcon = ImageResources.CHART_CUSTOM;
- addIcon = ImageResources.ADD_CHART_CUSTOM;
-
- tempSeriesList = new ArrayList<DACustomChartSeries>();
- usedColor = new boolean[11];
- }
-
- @Override
- public DACustomChart createDAChart(Composite parent) {
- List<DACustomChartSeries> seriesList = null;
- if(chart != null) {
- seriesList = chart.getSeriesList();
- }
-
- chart = new DACustomChart(parent, chartName);
- if(seriesList !=null) {
- for(DACustomChartSeries series : seriesList) {
- chart.addSeries(series);
- }
- }
- setChartStyle();
-
- return chart;
- }
-
- @Override
- public void clear() {
- }
-
- @Override
- public void parsingLogPackage(LogPackage logPack, int probeType) {
- if (!isAbleToParse(logPack, LogCenterConstants.LOG_DEVICE)) {
- return;
- }
- Logs logList = logPack.getLogs(LogCenterConstants.LOG_DEVICE);
- List<List<String>> logs = logList.getLogs();
-
- if(logs.size() <= 0){
- return;
- }
- parsingLog(logs.get(logs.size()-1));
- }
-
- private void parsingLog(List<String> log) {
- double time = 0;
-
- try {
- time = Double
- .parseDouble(log
- .get(LogCenterConstants.DEVICE_TIME_INDEX))
- / TimelineConstants.MEGA;
- } catch (NumberFormatException ne) {
- ne.printStackTrace();
- } catch (NullPointerException ne) {
- ne.printStackTrace();
- } catch (Exception e) {
- e.printStackTrace();
- }
- chart.getPlot().setValidEndX(time);
- }
-
- public void addSeries(DACustomChartSeries series) {
- chart.addSeries(series);
- }
-
- public void addTempSeries(DACustomChartSeries series, int colorIndex) {
- tempSeriesList.add(series);
- usedColor[colorIndex] = true;
- }
-
- public ArrayList<DACustomChartSeries> getTempSeries() {
- return tempSeriesList;
- }
-
- public int getSeriesNum() {
- return chart.getSeriesList().size();
- }
-
- @Override
- public List<DACustomChartSeries> getBaseDASeriesList() {
- if(chart != null) {
- return chart.getSeriesList();
- }
-
- return null;
- }
-
- public DACustomChart getChart() {
- return chart;
- }
-
- public int getUnusedColorIndex() {
- for(int i = 1; i < usedColor.length; i++) {
- boolean status = usedColor[i];
- if(!status) {
- return i;
- }
- }
-
- return 0;
- }
-}
+++ /dev/null
-/*
- * Dynamic Analyzer
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * Sanghyun Lee <sanghyunnim.lee@samsung.com>
- * Juyoung Kim <j0.kim@samsung.com>
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * Contributors:
- * - S-Core Co., Ltd
- *
- */
-
-package org.tizen.dynamicanalyzer.ui.timeline.common;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.swt.graphics.Color;
-import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
-import org.tizen.dynamicanalyzer.logparser.LogPackage;
-import org.tizen.dynamicanalyzer.logparser.Logs;
-import org.tizen.dynamicanalyzer.resources.ColorResources;
-import org.tizen.dynamicanalyzer.ui.timeline.custom.UserCustomChart;
-import org.tizen.dynamicanalyzer.widgets.chart.DACustomChartSeries;
-import org.tizen.dynamicanalyzer.widgets.chart.DACustomChartSeriesItem;
-
-public class CustomLogParser {
- private static final String API_NAME_CREATE_CHART = "da_create_chart"; //$NON-NLS-1$
- private static final String API_NAME_CREATE_SERIES = "da_create_series"; //$NON-NLS-1$
- private static final String API_NAME_CREATE_DEFAULT_SERIES = "da_create_default_series"; //$NON-NLS-1$
- private static final String API_NAME_DA_LOG= "da_log"; //$NON-NLS-1$
- private static final String API_NAME_DA_MARK = "da_mark"; //$NON-NLS-1$
- private static final String API_NAME_TIMER_THREAD = "_chart_timerThread"; //$NON-NLS-1$
-
- private final static int CUSTOM_COLOR_AUTO = 0;
- private final static int CUSTOM_COLOR_BLUE = 1;
- private final static int CUSTOM_COLOR_GREEN = 2;
- private final static int CUSTOM_COLOR_RED = 3;
- private final static int CUSTOM_COLOR_BROWN = 4;
- private final static int CUSTOM_COLOR_PURPLE = 5;
- private final static int CUSTOM_COLOR_NAVY = 6;
- private final static int CUSTOM_COLOR_CHOCOLATE = 7;
- private final static int CUSTOM_COLOR_INDIGO = 8;
- private final static int CUSTOM_COLOR_MAGNETA = 9;
- private final static int CUSTOM_COLOR_TEAL = 10;
-
-
- private static TimelineChartManager chartManager = TimelineChartManager.getInstance();
- private static Map<Integer, DACustomChartSeries> customChartSeriesMap = new HashMap<Integer, DACustomChartSeries>();
-
- public static void parsingLogPackage(LogPackage logPack) {
- if(!isAbleToParse(logPack, LogCenterConstants.LOG_CUSTOM_CHART)) {
- return;
- }
-
- Logs logs = logPack.getLogs(LogCenterConstants.LOG_CUSTOM_CHART);
- List<List<String>> logList = logs.getLogs();
- for(int i = 0; i< logList.size(); i++) {
- parsingLog(logList.get(i));
- }
- }
-
- private static void parsingLog(List<String> log) {
- String apiName = log.get(LogCenterConstants.APINAME_INDEX);
-
- if(apiName.equals(API_NAME_CREATE_CHART)) {
- int chartHandle = Integer.parseInt(log.get(LogCenterConstants.RETURN_INDEX));
- String chartName = log.get(LogCenterConstants.CUSTOM_CHART_TEXT);
- chartManager.addCustomChart(new UserCustomChart(chartHandle, chartName));
- } else if(apiName.equals(API_NAME_CREATE_SERIES)) {
- int chartType = Integer.parseInt(log.get(LogCenterConstants.CUSTOM_CHART_HANDLE));
- UserCustomChart chart = (UserCustomChart)chartManager.getChartInstance(chartType);
- if(chart == null) {
- System.out.println("unrecognized chart handle"); //$NON-NLS-1$
- return;
- }
-
- int seriesHandle = Integer.parseInt(log.get(LogCenterConstants.RETURN_INDEX));
- int seriesStyle = Integer.parseInt(log.get(LogCenterConstants.CUSTOM_CHART_TYPE));
- String seriesName = log.get(LogCenterConstants.CUSTOM_CHART_TEXT);
- int colorIndex = Integer.parseInt(log.get(LogCenterConstants.CUSTOM_CHART_COLOR));
- if(colorIndex == CUSTOM_COLOR_AUTO) {
- colorIndex = chart.getUnusedColorIndex();
- }
- Color seriesColor = getCustomColor(colorIndex);
- if(seriesColor == null) {
- System.out.println("undefined custom color"); //$NON-NLS-1$
- return;
- }
-
- DACustomChartSeries series = new DACustomChartSeries(seriesName, seriesStyle, seriesColor);
- chart.addTempSeries(series, colorIndex);
- customChartSeriesMap.put(seriesHandle, series);
- } else if(apiName.equals(API_NAME_CREATE_DEFAULT_SERIES)) {
- int chartType = Integer.parseInt(log.get(LogCenterConstants.CUSTOM_CHART_HANDLE));
- UserCustomChart chart = (UserCustomChart)chartManager.getChartInstance(chartType);
- if(chart == null) {
- System.out.println("unrecognized chart handle"); //$NON-NLS-1$
- return;
- }
-
- int seriesHandle = Integer.parseInt(log.get(LogCenterConstants.RETURN_INDEX));
- int colorIndex = chart.getUnusedColorIndex();
- String seriesName = log.get(LogCenterConstants.CUSTOM_CHART_TEXT);
-
- DACustomChartSeries series = new DACustomChartSeries(seriesName, DACustomChartSeries.SERIES_STYLE_LINE, getCustomColor(colorIndex));
- chart.addTempSeries(series, colorIndex);
- customChartSeriesMap.put(seriesHandle, series);
- } else if(apiName.equals(API_NAME_DA_LOG) || apiName.equals(API_NAME_TIMER_THREAD)) {
- int seriesHandle = Integer.parseInt(log.get(LogCenterConstants.CUSTOM_CHART_HANDLE));
- double time = Double.parseDouble(log.get(LogCenterConstants.TIME_INDEX))
- / TimelineConstants.MEGA;
- double value = Double.parseDouble(log.get(LogCenterConstants.CUSTOM_CHART_VALUE));
- DACustomChartSeries series = customChartSeriesMap.get(seriesHandle);
- series.addSeriesItem(new DACustomChartSeriesItem(time, value, String.valueOf(value)));
- } else if(apiName.equals(API_NAME_DA_MARK)) {
- // TODO custom marking
- }
- }
-
- private static boolean isAbleToParse(LogPackage logPack, int probeType) {
- Logs logList = logPack.getLogs(probeType);
-
- if (null == logList) {
- return false;
- }
-
- if (null == logList.getLogs()) {
- return false;
- }
-
- if (0 > logList.getLogs().size()) {
- return false;
- }
-
- return true;
- }
-
- public static void clear() {
- customChartSeriesMap.clear();
- }
-
- private static Color getCustomColor(int colorType) {
- switch(colorType) {
- case CUSTOM_COLOR_BLUE:
- return ColorResources.BLUE;
- case CUSTOM_COLOR_GREEN:
- return ColorResources.GREEN;
- case CUSTOM_COLOR_RED:
- return ColorResources.RED;
- case CUSTOM_COLOR_BROWN:
- return ColorResources.BROWN;
- case CUSTOM_COLOR_PURPLE:
- return ColorResources.PURPLE;
- case CUSTOM_COLOR_NAVY:
- return ColorResources.NAVY;
- case CUSTOM_COLOR_CHOCOLATE:
- return ColorResources.CHOCOLATE;
- case CUSTOM_COLOR_INDIGO:
- return ColorResources.INDIGO;
- case CUSTOM_COLOR_MAGNETA:
- return ColorResources.MAGNETA;
- case CUSTOM_COLOR_TEAL:
- return ColorResources.TEAL;
- default:
- return null;
- }
- }
-}
import org.tizen.dynamicanalyzer.resources.FontResources;
public class TimeTickComposite extends Composite {
+ private final int TICK_LINE_SHORT = 2;
+ private final int TICK_LINE_MIDDLE = 4;
+ private final int TICK_LINE_LONG = 5;
+
private Canvas timeTickCanvas;
private GC gc = null;
private final TimelineMaster timelineMaster = TimelineMaster.getInstance();
graphCompLayoutData.grabExcessHorizontalSpace = true;
graphCompLayoutData.grabExcessVerticalSpace = true;
graphComposite.setLayoutData(graphCompLayoutData);
- graphComposite.setBackground(ColorResources.WHITE);
+ graphComposite.setBackground(ColorResources.TIME_TICK_BG);
timeTickCanvas = new Canvas(graphComposite, SWT.DOUBLE_BUFFERED | SWT.TRANSPARENT);
TimelineGlobalVariable.timetickWidthPx = w = timeTickRect.width;
h = timeTickRect.height;
- gc.setBackground(ColorResources.TABLE_HEADER_BG);
- gc.setForeground(ColorResources.TABLE_LINE);
+ gc.setForeground(ColorResources.TIME_TICK_LINE);
gc.fillRectangle(x, y, w, h);
gc.setFont(FontResources.TIMELINE_TICK_FONT);
tickLabelValue -= currentScaleSec;
while (posXPx < w) {
tickOrder = tickOrder % 10;
- int tickLineHeight = 2;
+ int tickLineHeight = TICK_LINE_SHORT;
if (tickOrder == 0) {
- tickLineHeight = 6;
+ tickLineHeight = TICK_LINE_LONG;
tickLabelValue += currentScaleSec;
gc.setForeground(ColorResources.TABLE_HEADER_FONT_COLOR);
gc.drawText(timeFormat(tickLabelValue * MS * US), (int) Math.round(posXPx) - halfStringWidth + 1, 1);
} else if (tickOrder == 5) {
- tickLineHeight = 4;
+ tickLineHeight = TICK_LINE_MIDDLE;
}
- gc.setForeground(ColorResources.TABLE_LINE);
+ gc.setForeground(ColorResources.TIME_TICK_LINE);
gc.drawLine((int) Math.round(posXPx), y + h - (1 + tickLineHeight), (int) Math.round(posXPx), y + h - 1);
posXPx += oneTickPx;
+++ /dev/null
-/*
- * Dynamic Analyzer
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * Sanghyun Lee <sanghyunnim.lee@samsung.com>
- * Juyoung Kim <j0.kim@samsung.com>
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * Contributors:
- * - S-Core Co., Ltd
- *
- */
-
-package org.tizen.dynamicanalyzer.ui.timeline.common;
-
-
-
-public class TimelineGlobalVriable {
- public static int currentScaleValue = 0;
- public static int oriScaleValue = 0;
-
- public static int timetickWidthPx = TimelineConstants.NOT_INITED;
-
- public static int startPx = 0;
- public static int endPx = TimelineConstants.NOT_INITED;
-
- public static int originalEndPx = TimelineConstants.NOT_INITED;
- public static int chartRunningSec = TimelineConstants.NOT_INITED;
-
- public static boolean scaleChanged = false;
- public static boolean allowRedrawTimeTickCanvas = true;
-
- public enum EnumScaleSec {
- SCALE_0(10), SCALE_1(5), SCALE_2(1);
- private int scaleSec;
- private EnumScaleSec(int scaleValue) {
- this.scaleSec = scaleValue;
- }
-
- public int getScaleSec() {
- return scaleSec;
- }
- }
-
- public static long TOTAL_MEMORY = 90;
- public static boolean SUPPORT_WIFI = false;
- public static boolean SUPPORT_BLUETOOTH = false;
- public static boolean SUPPORT_GPS = false;
-}
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.layout.RowData;
+import org.eclipse.swt.widgets.Canvas;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Event;
import org.tizen.dynamicanalyzer.widgets.chart.DACustomChartPlotIntervalMarker;
import org.tizen.dynamicanalyzer.widgets.chart.DACustomChartPlotTooltip;
import org.tizen.dynamicanalyzer.widgets.chart.DACustomChartSeries;
+import org.tizen.dynamicanalyzer.widgets.chart.DACustomScreenshotChartPlot;
public class TimelineItemManager {
private static TimelineItemManager instance = null;
}
};
- private double getTooltipStartX(DACustomChartPlot plot, List<DACustomChartSeries> seriesList, int x) {
+ private double getTooltipStartX(DACustomChartPlot plot, List<DACustomChartSeries> seriesList, int x, double yPosRatio) {
+ boolean isCheckBarStyle = seriesList.get(0).getStyle() == DACustomChartSeries.SERIES_STYLE_MULTY_CHECK_BAR ? true : false;
+
double ret = -1;
for (int i = 0; i < seriesList.size(); i++) {
+ if(isCheckBarStyle) {
+ i = (int)(seriesList.size() * yPosRatio);
+ }
DACustomChartSeries series = seriesList.get(i);
int index = series.getPrevIndexByXvalue(plot.getXFromXPixcel(x));
if (-1 == index) {
+ if(isCheckBarStyle) {
+ break;
+ }
continue;
}
double startVal = series.getSeriesItemList().get(index).getX();
if (ret < startVal) {
ret = startVal;
}
+
+ if(isCheckBarStyle) {
+ break;
+ }
}
return ret;
}
+
+ private int getHighlightedImageIndex(DACustomChartPlot plot, List<DACustomChartSeries> seriesList, int x) {
+ DACustomChartSeries series = seriesList.get(0);
+ boolean isImageStyle = series.getStyle() == DACustomChartSeries.SERIES_STYLE_IMAGE ? true : false;
+
+ if(!isImageStyle) {
+ return TimelineConstants.NOT_INITED;
+ }
+
+ int index = series.getPrevIndexByXvalue(plot.getXFromXPixcel(x));
+
+ return index;
+ }
private Listener chartMouseListener = new Listener() {
if (null == tooltip) {
return;
}
+
+ double oldYPosRatio = tooltip.getYPosRatio();
+ double newYPosRatio = (double)event.y / ((Canvas)event.widget).getSize().y;
+
+ if(oldYPosRatio != newYPosRatio) {
+ tooltip.setYPosRatio(newYPosRatio);
+ }
+
double oldStartVal = tooltip.getStartVal();
- double newStartVal = getTooltipStartX(plot, chart.getSeriesList(), event.x);
+ double newStartVal = getTooltipStartX(plot, chart.getSeriesList(), event.x, newYPosRatio);
if (oldStartVal != newStartVal) {
tooltip.setStartVal(newStartVal);
}
+
+ if(plot instanceof DACustomScreenshotChartPlot) {
+ ((DACustomScreenshotChartPlot)plot).setHighlightedImageIndex(getHighlightedImageIndex(plot, chart.getSeriesList(), event.x));
+ }
}
break;
case SWT.MouseDown:
if (null == tooltip) {
return;
}
- tooltip.setStartVal(getTooltipStartX(plot, chart.getSeriesList(), event.x));
+
+ double oldYPosRatio = tooltip.getYPosRatio();
+ double newYPosRatio = (double)event.y / ((Canvas)event.widget).getSize().y;
+
+ if(oldYPosRatio != newYPosRatio) {
+ tooltip.setYPosRatio(newYPosRatio);
+ }
+
+ tooltip.setStartVal(getTooltipStartX(plot, chart.getSeriesList(), event.x, newYPosRatio));
tooltip.setTooltip(true);
double endVal = plot.getXFromXPixcel(event.x);
if (null == tooltip) {
return;
}
- tooltip.setStartVal(getTooltipStartX(plot, chart.getSeriesList(), event.x));
+
+ oldYPosRatio = tooltip.getYPosRatio();
+ newYPosRatio = (double)event.y / ((Canvas)event.widget).getSize().y;
+
+ if(oldYPosRatio != newYPosRatio) {
+ tooltip.setYPosRatio(newYPosRatio);
+ }
+
+ tooltip.setStartVal(getTooltipStartX(plot, chart.getSeriesList(), event.x,newYPosRatio));
tooltip.setTooltip(true);
break;
case SWT.MouseExit:
return;
}
tooltip.setTooltip(false);
+
+ if(plot instanceof DACustomScreenshotChartPlot) {
+ ((DACustomScreenshotChartPlot)plot).setHighlightedImageIndex(TimelineConstants.NOT_INITED);
+ }
break;
default:
break;
+++ /dev/null
-/*
- * Dynamic Analyzer
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * Sanghyun Lee <sanghyunnim.lee@samsung.com>
- * Juyoung Kim <j0.kim@samsung.com>
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * Contributors:
- * - S-Core Co., Ltd
- *
- */
-
-package org.tizen.dynamicanalyzer.ui.timeline.common;
-
-
-public class TimelineSelection {
-
- private long milisecond;
- private long microsecond;
- private long second;
- private double fixedMilisecond;
- private int seletedPixel;
-
- public TimelineSelection() {
- clear();
- };
-
- public long getMilisecond() {
- return milisecond;
- }
-
- public void setMilisecond(long milisecond) {
- this.milisecond = milisecond;
- }
-
- public long getSecond() {
- return second;
- }
-
- public void setSecond(long second) {
- this.second = second;
- }
-
- public double getFixedMilisecond() {
- return fixedMilisecond;
- }
-
- public void setFixedMilisecond(double fixedMilisecond) {
- this.fixedMilisecond = fixedMilisecond;
- }
-
- public int getSeletedPixel() {
- return seletedPixel;
- }
-
- public void setSeletedPixel(int seletedPixel) {
- this.seletedPixel = seletedPixel;
- }
-
- public long getMicrosecond() {
- return microsecond;
- }
-
- public void setMicrosecond(long microsecond) {
- this.microsecond = microsecond;
- }
-
- public void clear() {
- microsecond = 0;
- microsecond = 0;
- second = 0;
- fixedMilisecond = 0;
- seletedPixel = 0;
-
- }
-}
fData.left = new FormAttachment(0);
fData.right = new FormAttachment(100);
fData.top = new FormAttachment(0);
- fData.bottom = new FormAttachment(90);
+ fData.bottom = new FormAttachment(80);
timeTickComp.setLayoutData(fData);
/* Lifecycle Bar */
LifecycleBar lifecycleBar = new LifecycleBar(timeTickArea);
TimelineMaster.getInstance().setLifecycleBarCanvas(lifecycleBar);
LifecycleLogParser.getInstance().addLifecycleBar(lifecycleBar);
-
fData = new FormData();
fData.left = new FormAttachment(0);
fData.right = new FormAttachment(100);
- fData.top = new FormAttachment(90);
+ fData.top = new FormAttachment(80);
fData.bottom = new FormAttachment(100);
lifecycleBar.setLayoutData(fData);
import org.tizen.dynamicanalyzer.resources.ColorResources;
public enum EnumLifecycle {
- //FIXME NLS
- INITIALIZING(ColorResources.RED, "Initializing"), RUNNING(ColorResources.BLUE, "Running"), PAUSING(ColorResources.PURPLE, "Pausing"), TERMINATING(ColorResources.RED, "terminating");
- private Color color;
+ // FIXME NLS
+ INITIALIZING(ColorResources.LIFECYCLE_INITIALIZING_TOP, ColorResources.LIFECYCLE_INITIALIZING_BOTTOM, "Initializing"),
+ RUNNING(ColorResources.LIFECYCLE_RUNNING_TOP, ColorResources.LIFECYCLE_RUNNING_BOTTOM, "Running"),
+ PAUSING(ColorResources.LIFECYCLE_PAUSING_TOP, ColorResources.LIFECYCLE_PAUSING_BOTTOM, "Pausing"),
+ TERMINATING(ColorResources.LIFECYCLE_TERMINATING_TOP, ColorResources.LIFECYCLE_TERMINATING_BOTTOM, "Terminating");
+ private Color colorTop;
+ private Color colorBottom;
private String decription;
- private EnumLifecycle(Color color, String description) {
- this.color = color;
+
+ private EnumLifecycle(Color colorTop, Color colorBottom, String description) {
+ this.colorTop = colorTop;
+ this.colorBottom = colorBottom;
this.decription = description;
}
-
- public Color getColor() {
- return color;
+
+ public Color getTopColor() {
+ return colorTop;
+ }
+
+ public Color getBottomColor() {
+ return colorBottom;
}
}
if(endPx > TimelineGlobalVariable.startPx) {
GC gc = e.gc;
- gc.setBackground(lifecycleData.getLifecycle().getColor());
- gc.fillRectangle(startPx - TimelineGlobalVariable.startPx + 1, 0, endPx - startPx + 1, 10);
- System.out.println();
+ gc.setForeground(lifecycleData.getLifecycle().getTopColor());
+ gc.setBackground(lifecycleData.getLifecycle().getBottomColor());
+ gc.fillGradientRectangle(startPx - TimelineGlobalVariable.startPx + 1, 0, endPx - startPx + 1, 10, true);
}
} else {
break;