+++ /dev/null
-/*
- * Dynamic Analyzer
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * Jooyoul Lee <jy.exe.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.communicator;
-
-import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
-import org.tizen.dynamicanalyzer.common.AnalyzerPaths;
-import org.tizen.dynamicanalyzer.common.AnalyzerShellCommands;
-import org.tizen.sdblib.MultiLineReceiver;
-
-public class DaemonExecution {
-
- private static boolean isDaemonExist = false;
-
- private static DaemonExecution execution = new DaemonExecution();
-
- public static DaemonExecution getInstance() {
- return execution;
- }
-
- private boolean listen = false;
-
- private MultiLineReceiver netDaemonReceiver = new MultiLineReceiver() {
- @Override
- public void processNewLines(String[] lines) {
- for (String line : lines) {
- if (line.contains(AnalyzerConstants.DA_DAEMON_NAME)) {
- listen = true;
- }
- }
- }
- };
-
- private boolean isDaemonListen() {
- DACommunicator.execShellCommand(AnalyzerShellCommands.CMD_IS_DAEMON_LISTEN,
- netDaemonReceiver);
-
- return listen;
- }
-
- public boolean runDaemon() {
- DACommunicator.execCommand(AnalyzerPaths.DA_REMOTE_DAEMON_BINARY_PATH);
- int i = 1;
-
- while (!isDaemonListen()) {
- if (i > AnalyzerConstants.DAEMON_LISTEN_TRY) {
- return false;
- }
- System.out.println("waiting for daemon until listening. try # : " //$NON-NLS-1$
- + i);
- try {
- Thread.sleep(100);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- i++;
- }
- return true;
- }
-
- private MultiLineReceiver isDaemonReceiver = new MultiLineReceiver() {
- @Override
- public void processNewLines(String[] lines) {
- if (0 == lines.length
- || lines[0].startsWith(AnalyzerShellCommands.CMD_NO_LIST)) {
- return;
- }
-
- for (String line : lines) {
- if (line.contains(AnalyzerPaths.DA_REMOTE_DAEMON_BINARY_PATH)) {
- isDaemonExist = true;
- break;
- }
- }
- }
- };
-
- public boolean isDaemonExist() {
- DACommunicator.execShellCommand(AnalyzerShellCommands.CMD_IS_DAEMON_EXIST,
- isDaemonReceiver);
-
- return isDaemonExist;
- }
-}
+++ /dev/null
-/*
- * Dynamic Analyzer
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * Jooyoul Lee <jy.exe.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.communicator;
-
-import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
-import org.tizen.dynamicanalyzer.common.CommonConstants;
-import org.tizen.dynamicanalyzer.model.DeviceInfo;
-import org.tizen.dynamicanalyzer.nl.ConfigureLabels;
-import org.tizen.dynamicanalyzer.ui.toolbar.ConfigureManager;
-
-public class ResourceCommunicator extends DACommunicator {
-
- public static boolean connect() {
-
- if (isDaemonAlive()) {
- killDaemon();
- }
-
- if (needUpdateVersion()) {
- System.out.println("Update utils and libs..."); //$NON-NLS-1$
- if (!upload()) {
- System.out.println("Failed to upload files..."); //$NON-NLS-1$
- return false;
- }
- }
-
- if (!DaemonExecution.getInstance().runDaemon()) {
- System.out.println("Failed to start da_daemon"); //$NON-NLS-1$
- return false;
- }
-
- foward(LOCAL_PORT, REMOTE_PORT);
-
- setRunning(true);
-
- if (null == createSocket(LOCAL_PORT)) {
- System.out.println("socket creation failed."); //$NON-NLS-1$
- return false;
- }
-
- return true;
- }
-
- public static void sendStartMessage() {
- int isArm = 0;
- int isEmul = 0;
- int res = 0;
-
- if (!isCurrentDeviceArmArch()) {
- isArm = 1;
- }
-
- DeviceInfo device = getSelectedDevice();
- if (null != device
- && device.getIDevice().getSerialNumber()
- .startsWith(CommonConstants.EMULATOR)) {
- isEmul = 1;
- }
-
- String message = AnalyzerConstants.MSG_START
- + CommonConstants.CMD_SPLIT
- + (ResourceCommunicator.getSelectedApp().getExecPath().length() + 7)
- + CommonConstants.CMD_SPLIT
- + res
- + isEmul
- + isArm
- + CommonConstants.CMD_SPLIT
- + ConfigureManager.getInstance().getValueInt(
- ConfigureLabels.SNAPSHOT)
- + ConfigureManager.getInstance().getValueInt(
- ConfigureLabels.INTERNALCALL)
- + CommonConstants.CMD_SPLIT
- + ResourceCommunicator.getSelectedApp().getExecPath();
- System.out.println("Send message :" + message); //$NON-NLS-1$
- sendMessage(message);
- }
-
- public static void sendSnapshotMessage(int state) {
- if (state != AnalyzerConstants.SNAPSHOT_ON) {
- state = AnalyzerConstants.SNAPSHOT_OFF;
- }
- String message = AnalyzerConstants.MSG_SNAPSHOT
- + CommonConstants.CMD_SPLIT + 1 + CommonConstants.CMD_SPLIT
- + state;
- sendMessage(message);
- }
-}
+++ /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.common;
-
-import org.eclipse.swt.events.MouseAdapter;
-import org.eclipse.swt.events.MouseEvent;
-import org.tizen.dynamicanalyzer.ui.range.RangeDataManager;
-import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
-import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoard;
-import org.tizen.dynamicanalyzer.widgets.timeline.DACustomTimeline;
-
-public class SetRangeMarkerMouseAdapter extends MouseAdapter {
- private RangeDataManager rangeDataManager;
- private DAChartBoard chartBoard;
- private DACustomTimeline timeline;
-
- public SetRangeMarkerMouseAdapter(RangeDataManager rangeDataManager,
- DAChartBoard chartBoard, DACustomTimeline timeline) {
- this.rangeDataManager = rangeDataManager;
- this.chartBoard = chartBoard;
- this.timeline = timeline;
- }
-
- public void mouseUp(MouseEvent e) {
- double startTime = timeline.getStartRangeMarker().getTime();
- double endTime = timeline.getEndRangeMarker().getTime();
-
- rangeDataManager
- .setMarkerStartTime((long) (startTime * TimelineConstants.MEGA));
- rangeDataManager
- .setMarkerEndTime((long) (endTime * TimelineConstants.MEGA));
-
- chartBoard.setHighlight(startTime, endTime, 1);
- }
-}
+++ /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.common;
-
-import java.util.List;
-
-import org.eclipse.swt.events.MouseAdapter;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.widgets.Canvas;
-import org.tizen.dynamicanalyzer.common.AnalyzerManager;
-import org.tizen.dynamicanalyzer.common.DASelectionData;
-import org.tizen.dynamicanalyzer.ui.range.RangeDataManager;
-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.widgets.chart.DAChart;
-import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlot;
-import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlotIntervalMarker;
-import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlotTooltip;
-import org.tizen.dynamicanalyzer.widgets.chart.DAChartSeries;
-import org.tizen.dynamicanalyzer.widgets.chart.DAChartSeriesItem;
-import org.tizen.dynamicanalyzer.widgets.chart.DAScreenshotChartPlot;
-import org.tizen.dynamicanalyzer.widgets.chart.DAUIEventChartPlot;
-import org.tizen.dynamicanalyzer.widgets.contextMenu.DAContextMenu;
-import org.tizen.dynamicanalyzer.widgets.contextMenu.DAContextMenuItem;
-
-public class TimelineChartMouseAdapter extends MouseAdapter {
- private RangeDataManager rangeDataManager = RangeDataManager.getInstance();
- private DAContextMenu menu;
-
- public TimelineChartMouseAdapter(DAContextMenu menu) {
- this.menu = menu;
- }
-
- @Override
- public void mouseDown(MouseEvent e) {
- DAChart chart = (DAChart) e.widget;
- DAChartPlot plot = chart.getPlot();
- DAChartPlotIntervalMarker intervalMarker = plot.getIntervalMarker();
-
- double eventTime = plot.getXFromXPixcel(e.x);
-
- if (e.button == 3) {
- List<DAContextMenuItem> itemList = menu.getItems();
- DAContextMenuItem startItem = itemList.get(0);
- DAContextMenuItem endItem = itemList.get(1);
- DAContextMenuItem analysisItem = itemList.get(2);
- DAContextMenuItem clearItem = itemList.get(3);
-
- if (eventTime * TimelineConstants.MEGA <= ToolbarArea.getInstance()
- .getTime()) {
- startItem.setEnabled(true);
- endItem.setEnabled(true);
- analysisItem.setEnabled(rangeDataManager.isAnalyzable());
- clearItem.setEnabled(rangeDataManager.isClearable());
-
- startItem.setDoubleData(eventTime);
- endItem.setDoubleData(eventTime);
- } else {
- startItem.setEnabled(false);
- endItem.setEnabled(false);
- analysisItem.setEnabled(rangeDataManager.isAnalyzable());
- clearItem.setEnabled(rangeDataManager.isClearable());
- }
-
- if (plot instanceof DAUIEventChartPlot) {
- double newYPosRatio = (double) e.y
- / ((Canvas) e.widget).getSize().y;
- int seriesIndex = (int) (newYPosRatio * chart.getSeriesList()
- .size());
- int startIndex = chart.getSeriesList().get(seriesIndex)
- .getPrevIndexByXvalue(intervalMarker.getStartVal()) + 1;
- int endIndex = chart.getSeriesList().get(seriesIndex)
- .getPrevIndexByXvalue(intervalMarker.getEndVal());
-
- DAContextMenuItem eventListItem = menu.getItems().get(
- menu.getItems().size() - 1);
- eventListItem.setSeriesIndex(seriesIndex);
- eventListItem.setEventListStartIndex(startIndex);
- eventListItem.setEventListEndIndex(endIndex);
-
- eventListItem.setEnabled(true);
- }
-
- return;
- }
-
- if (plot instanceof DAScreenshotChartPlot) {
- DAChartSeries series = chart.getSeries(0);
- int index = series.getPrevIndexByXvalue(eventTime);
- if (index >= 0 && index < series.getSeriesItemList().size()) {
- DAChartSeriesItem item = series.getSeriesItemList().get(index);
- double itemTime = item.getX();
- int imageWidth = item.getImage().getBounds().width;
- double imageRightTime = itemTime
- + plot.getXFromXPixcel(imageWidth)
- - plot.getVisibleStartX();
-
- if (eventTime > itemTime && eventTime < imageRightTime) {
- if (e.button == 3) {
- intervalMarker.setInterval(itemTime, itemTime);
- } else {
- intervalMarker.setInterval(itemTime, eventTime);
- }
- } else {
- intervalMarker.setInterval(eventTime, eventTime);
- }
- } else {
- intervalMarker.setInterval(eventTime, eventTime);
- }
- } else {
- intervalMarker.setInterval(eventTime, eventTime);
- }
-
- DAChart chartWidget = ScreenshotChart.getInstance().getChart();
- DAScreenshotChartPlot screenshotChartPlot = (DAScreenshotChartPlot) chartWidget
- .getPlot();
- screenshotChartPlot.setSelectedImageIndex(getHighlightedImageIndex(
- screenshotChartPlot, chartWidget.getSeriesList(), e.x));
- chart.redraw();
- }
-
- @Override
- public void mouseUp(MouseEvent e) {
- if (e.button == 3) {
- return;
- }
-
- DAChart chart = (DAChart) e.widget;
- DAChartPlot plot = chart.getPlot();
- DAChartPlotIntervalMarker intervalMarker = plot.getIntervalMarker();
- DAChartPlotTooltip tooltip = plot.getTooltip();
-
- if (null == tooltip) {
- return;
- }
-
- double oldYPosRatio = tooltip.getYPosRatio();
- double newYPosRatio = (double) e.y / ((Canvas) e.widget).getSize().y;
-
- if (oldYPosRatio != newYPosRatio) {
- tooltip.setYPosRatio(newYPosRatio);
- }
-
- tooltip.setStartVal(getTooltipStartX(plot, chart.getSeriesList(), e.x,
- newYPosRatio));
- tooltip.setTooltip(true);
-
- double eventTime = plot.getXFromXPixcel(e.x);
-
- double markerStartTime = intervalMarker.getStartVal();
- double markerEndTime = eventTime;
-
- if (markerStartTime > markerEndTime) {
- double temp = markerStartTime;
- markerStartTime = markerEndTime;
- markerEndTime = temp;
- }
-
- double toolbarTime = ToolbarArea.getInstance().getTime()
- / TimelineConstants.MEGA;
- if (markerStartTime < 0) {
- markerStartTime = 0;
- } else if (markerStartTime > toolbarTime) {
- markerStartTime = toolbarTime;
- }
-
- if (markerEndTime > toolbarTime) {
- markerEndTime = toolbarTime;
- } else if (markerEndTime < 0) {
- markerEndTime = 0;
- }
-
- if (plot instanceof DAScreenshotChartPlot) {
- DAChartSeries series = chart.getSeries(0);
- int index = series.getPrevIndexByXvalue(plot.getXFromXPixcel(e.x));
- if (index >= 0 && index < series.getSeriesItemList().size()) {
- DAChartSeriesItem item = series.getSeriesItemList().get(index);
- double itemTime = item.getX();
- int imageWidth = item.getImage().getBounds().width;
- double imageRightTime = itemTime
- + plot.getXFromXPixcel(imageWidth)
- - plot.getVisibleStartX();
-
- if (markerEndTime > itemTime && markerEndTime < imageRightTime) {
- intervalMarker.setInterval(markerStartTime, itemTime);
- } else {
- if (markerEndTime <= plot.getVisibleEndX()) {
- intervalMarker.setInterval(markerStartTime,
- markerEndTime);
- } else {
- intervalMarker.setInterval(markerStartTime,
- plot.getVisibleEndX());
- }
- }
- } else {
- if (markerEndTime <= plot.getVisibleEndX()) {
- intervalMarker.setInterval(markerStartTime, markerEndTime);
- } else {
- intervalMarker.setInterval(markerStartTime,
- plot.getVisibleEndX());
- }
- }
- } else {
- if (markerEndTime <= plot.getVisibleEndX()) {
- intervalMarker.setInterval(markerStartTime, markerEndTime);
- } else {
- intervalMarker.setInterval(markerStartTime,
- plot.getVisibleEndX());
- }
- }
-
- sendSelectionTimes(intervalMarker.getStartVal(),
- intervalMarker.getEndVal());
- }
-
- private double getTooltipStartX(DAChartPlot plot,
- List<DAChartSeries> seriesList, int x, double yPosRatio) {
- double ret = -1;
- for (int i = 0; i < seriesList.size(); i++) {
- if (plot instanceof DAUIEventChartPlot) {
- i = (int) (seriesList.size() * yPosRatio);
- if (i < 0 || i > 4) {
- System.out.println(yPosRatio + " " + i);//$NON-NLS-1$
- }
- }
- DAChartSeries series = seriesList.get(i);
- int index = series.getPrevIndexByXvalue(plot.getXFromXPixcel(x));
- if (-1 == index) {
- if (plot instanceof DAUIEventChartPlot) {
- break;
- }
- continue;
- }
- double startVal = series.getSeriesItemList().get(index).getX();
- if (ret < startVal) {
- ret = startVal;
- }
-
- if (plot instanceof DAUIEventChartPlot) {
- break;
- }
- }
- return ret;
- }
-
- private void sendSelectionTimes(double start, double end) {
- long startTime = (long) (start * TimelineConstants.MEGA);
- long endTime = (long) (end * TimelineConstants.MEGA);
- if (endTime < startTime) {
- long temp = startTime;
- startTime = endTime;
- endTime = temp;
- }
- if (startTime < 0) {
- startTime = 0;
- }
- AnalyzerManager.getCurrentPage().updatePage(
- new DASelectionData(TimelineView.ID, startTime, endTime, null,
- null));
- }
-
- private int getHighlightedImageIndex(DAChartPlot plot,
- List<DAChartSeries> seriesList, int x) {
- if (plot instanceof DAScreenshotChartPlot) {
- DAChartSeries series = seriesList.get(0);
-
- return series.getPrevIndexByXvalue(plot.getXFromXPixcel(x));
- } else {
- return TimelineConstants.NOT_INITED;
- }
- }
-}
+++ /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.common;
-
-import java.util.List;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.events.MouseMoveListener;
-import org.eclipse.swt.widgets.Canvas;
-import org.tizen.dynamicanalyzer.widgets.chart.DAChart;
-import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlot;
-import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlotIntervalMarker;
-import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlotTooltip;
-import org.tizen.dynamicanalyzer.widgets.chart.DAChartSeries;
-import org.tizen.dynamicanalyzer.widgets.chart.DAChartSeriesItem;
-import org.tizen.dynamicanalyzer.widgets.chart.DAScreenshotChartPlot;
-import org.tizen.dynamicanalyzer.widgets.chart.DAUIEventChartPlot;
-import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoard;
-import org.tizen.dynamicanalyzer.widgets.timeline.DACustomTimeline;
-
-public class TimelineChartMouseMoveListener implements MouseMoveListener {
- private DACustomTimeline timeline;
-
- public TimelineChartMouseMoveListener(DACustomTimeline timeline) {
- this.timeline = timeline;
- }
-
- @Override
- public void mouseMove(MouseEvent e) {
- DAChart chart = (DAChart) e.widget;
- DAChartPlot plot = chart.getPlot();
- DAChartPlotIntervalMarker intervalMarker = plot.getIntervalMarker();
- DAChartPlotTooltip tooltip;
-
- if ((e.stateMask & SWT.BUTTON1) != 0) {
- if (null == intervalMarker) {
- return;
- }
- intervalMarker.setEndVal(plot.getXFromXPixcel(e.x));
- }
- tooltip = plot.getTooltip();
- if (null == tooltip) {
- return;
- }
-
- double oldYPosRatio = tooltip.getYPosRatio();
- double newYPosRatio = (double) e.y / ((Canvas) e.widget).getSize().y;
-
- if (oldYPosRatio != newYPosRatio) {
- if (newYPosRatio < 0) {
- newYPosRatio = 0.01;
- } else if (newYPosRatio >= 1) {
- newYPosRatio = 0.99;
- }
-
- tooltip.setYPosRatio(newYPosRatio);
- }
-
- double oldStartVal = tooltip.getStartVal();
- double newStartVal = getTooltipStartX(plot, chart.getSeriesList(), e.x,
- newYPosRatio);
-
- if (oldStartVal != newStartVal) {
- tooltip.setStartVal(newStartVal);
- }
-
- if (plot instanceof DAScreenshotChartPlot) {
- ((DAScreenshotChartPlot) plot)
- .setHighlightedImageIndex(getHighlightedImageIndex(e));
- chart.redraw();
- } else if (plot instanceof DAUIEventChartPlot) {
- DAUIEventChartPlot uiEventChartPlot = (DAUIEventChartPlot) plot;
- int seriesIndex = (int) (newYPosRatio * chart.getSeriesList()
- .size());
-
- uiEventChartPlot.setHighlightedEventIndexX(chart.getSeriesList()
- .get(seriesIndex)
- .getPrevIndexByXvalue(plot.getXFromXPixcel(e.x)));
- uiEventChartPlot.setHighlightedEventIndexY(seriesIndex);
- chart.redraw();
- }
-
- timeline.setDetailedTime(plot.getXFromXPixcel(e.x));
- timeline.setDetailedTimePosition(e.x);
- timeline.setDrawDetailedTime(true);
- timeline.redraw();
- }
-
- private double getTooltipStartX(DAChartPlot plot,
- List<DAChartSeries> seriesList, int x, double yPosRatio) {
- double ret = -1;
- for (int i = 0; i < seriesList.size(); i++) {
- if (plot instanceof DAUIEventChartPlot) {
- i = (int) (seriesList.size() * yPosRatio);
- if (i < 0 || i > 4) {
- System.out.println(yPosRatio + " " + i);//$NON-NLS-1$
- }
- }
- DAChartSeries series = seriesList.get(i);
- int index = series.getPrevIndexByXvalue(plot.getXFromXPixcel(x));
- if (-1 == index) {
- if (plot instanceof DAUIEventChartPlot) {
- break;
- }
- continue;
- }
- double startVal = series.getSeriesItemList().get(index).getX();
- if (ret < startVal) {
- ret = startVal;
- }
-
- if (plot instanceof DAUIEventChartPlot) {
- break;
- }
- }
- return ret;
- }
-
- private int getHighlightedImageIndex(MouseEvent e) {
- DAChart chart = (DAChart) e.widget;
- DAChartPlot plot = chart.getPlot();
- DAChartSeries series = chart.getSeriesList().get(0);
-
- int index = series.getPrevIndexByXvalue(plot.getXFromXPixcel(e.x));
- if (index < 0) {
- return -1;
- }
-
- DAChartSeriesItem item = series.getSeriesItemList().get(index);
- int screenshotWidth = item.getImage().getBounds().width;
- if (chart.getBounds().height != DAChartBoard.DEFAULT_CHART_ZOOMIN_HEIGHT - 1) {
- screenshotWidth /= 2;
- }
-
- if (e.x < plot.getXPixcelFromX(item.getX()) + screenshotWidth
- && e.x >= plot.getXPixcelFromX(item.getX())) {
- return index;
- } else {
- return -1;
- }
- }
-}