From c38e18a751b81159076e223c69adb2d9b8db5e1d Mon Sep 17 00:00:00 2001 From: jaeyong lee Date: Tue, 30 Aug 2016 16:13:32 +0900 Subject: [PATCH] [SRADA-996][SPTSDKUX-1978] Enable UI event dialog * Add detail field * change column index * without double click listener (UX is not desided yet) Change-Id: I7b14f6e461a28df5da5f71f32f4f5d7215a22ea9 --- .../dynamicanalyzer/common/AnalyzerConstants.java | 1 + .../dynamicanalyzer/nl/TimelinePageLabels.java | 4 +- .../nl/TimelinePageLabels.properties | 2 +- .../ui/timeline/chart/UIEventChart.java | 6 +- .../ui/timeline/common/TimelineChartView.java | 14 +- .../ui/timeline/uievent/UIEventListDialog.java | 68 +++++---- .../UIEventListDialogTableCellRenderer.java | 162 +-------------------- .../ui/widgets/table/DefaultTableComparator.java | 18 ++- 8 files changed, 69 insertions(+), 206 deletions(-) diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/common/AnalyzerConstants.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/common/AnalyzerConstants.java index a295697..47df980 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/common/AnalyzerConstants.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/common/AnalyzerConstants.java @@ -209,6 +209,7 @@ public class AnalyzerConstants { public final static int SORT_TYPE_NUM = 1; public final static int SORT_TYPE_STRING = 2; public final static int SORT_TYPE_GRID = 3; + public final static int SORT_TYPE_GRID_NUM = 4; // function usage profile data type public final static int FUPD_APPLICATION = 1; diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/TimelinePageLabels.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/TimelinePageLabels.java index 380f8c1..0a2c284 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/TimelinePageLabels.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/TimelinePageLabels.java @@ -41,11 +41,11 @@ public class TimelinePageLabels extends NLS { public static String CALL_TRACE_VIEW_BINARY_PATH; public static String CALL_TRACE_VIEW_FILE; public static String CALL_TRACE_VIEW_LINE_NUMBER; - + public static String UI_EVENT_LIST_TYPE; public static String UI_EVENT_LIST_NAME; public static String UI_EVENT_LIST_TIME; - public static String UI_EVENT_LIST_SET_RANGE; + public static String UI_EVENT_LIST_DETAIL; static { // initialize resource bundle NLS.initializeMessages(BUNDLE_NAME, TimelinePageLabels.class); diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/TimelinePageLabels.properties b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/TimelinePageLabels.properties index 998abb4..0c2244b 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/TimelinePageLabels.properties +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/TimelinePageLabels.properties @@ -10,4 +10,4 @@ CALL_TRACE_VIEW_LINE_NUMBER=Line number UI_EVENT_LIST_TYPE=Type UI_EVENT_LIST_NAME=Name UI_EVENT_LIST_TIME=Time -UI_EVENT_LIST_SET_RANGE=Set range \ No newline at end of file +UI_EVENT_LIST_DETAIL=Detail \ No newline at end of file diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/UIEventChart.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/UIEventChart.java index 729b628..8075e09 100755 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/UIEventChart.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/UIEventChart.java @@ -100,11 +100,7 @@ public class UIEventChart extends TimelineChart { eventListItem.addListener(new DAPopupMenuListener() { @Override public void widgetSelected(DAPopupMenuItem menuItem) { - List chartSeriesList = eventListItem.getChartSeriesList(); - List startIndexList = eventListItem.getStartIndexList(); - List endIndexList = eventListItem.getEndIndexList(); - - uiEventListDialog.setSelectedEventInfo(chartSeriesList, startIndexList, endIndexList); + uiEventListDialog.setSelectedEventInfo(chart.getSeriesList()); uiEventListDialog.open(); } }); diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/common/TimelineChartView.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/common/TimelineChartView.java index 3a75efe..7bcdf93 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/common/TimelineChartView.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/common/TimelineChartView.java @@ -302,7 +302,7 @@ public class TimelineChartView extends DAViewComposite { Toolbar.INSTANCE.getProcessCombo().add(buffer.toString()); } } - + private void updateProcessCombo() { int index = Toolbar.INSTANCE.getProcessCombo().getSelectionIndex(); if(index+1 > processCombo.getItems().size()) { @@ -310,17 +310,17 @@ public class TimelineChartView extends DAViewComposite { } processCombo.select(index); } - + public void ScaleChanged(boolean zoom){ chartBoard.getScale().changeScale(zoom); } - + private void updateScale() { int scaleSelection = Toolbar.INSTANCE.getScaleSelection(); chartBoard.getBoardManager().scaleChanged(scaleSelection); chartBoard.setScaleVal(scaleSelection); } - + public void reArrangeChart(List order, List showInfo) { if (order != null) { chartBoard.reArrangeItem(order.toArray(new Integer[order.size()])); @@ -333,13 +333,12 @@ public class TimelineChartView extends DAViewComposite { } } } - + public void updateMarker() { List markerTimeList = Toolbar.INSTANCE.getMarkerTimeList(); List chartList = TimelineChartManager.getInstance().getChartList(); for(TimelineChart chart : chartList) { chart.getChart().getPlot().clearMarkerTime(); - if(chart instanceof CPUChart && ((CPUChart) chart).getProcessChart() != null) { ((CPUChart) chart).getProcessChart().getChart().getPlot().clearMarkerTime(); } @@ -347,8 +346,7 @@ public class TimelineChartView extends DAViewComposite { for(double time : markerTimeList) { for(TimelineChart chart : chartList) { chart.getChart().getPlot().addMarkerTime(time); - - if(chart instanceof CPUChart && ((CPUChart) chart).getProcessChart().getChart() != null) { + if(chart instanceof CPUChart && ((CPUChart) chart).getProcessChart() != null) { ((CPUChart) chart).getProcessChart().getChart().getPlot().addMarkerTime(time); } } diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/uievent/UIEventListDialog.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/uievent/UIEventListDialog.java index 53dbf4d..0cab7a2 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/uievent/UIEventListDialog.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/uievent/UIEventListDialog.java @@ -44,7 +44,6 @@ import org.eclipse.swt.widgets.Shell; import org.tizen.dynamicanalyzer.appearance.DesignConstants; import org.tizen.dynamicanalyzer.common.AnalyzerConstants; import org.tizen.dynamicanalyzer.common.AnalyzerManager; -import org.tizen.dynamicanalyzer.model.FilterProperty; import org.tizen.dynamicanalyzer.model.TableInput; import org.tizen.dynamicanalyzer.nl.TimelinePageLabels; import org.tizen.dynamicanalyzer.nl.WidgetLabels; @@ -52,8 +51,8 @@ import org.tizen.dynamicanalyzer.resources.ColorResources; import org.tizen.dynamicanalyzer.resources.FontResources; import org.tizen.dynamicanalyzer.ui.range.RangeDataManager; import org.tizen.dynamicanalyzer.ui.timeline.TimelinePage; -import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants; import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineChartView; +import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants; import org.tizen.dynamicanalyzer.ui.widgets.table.DATableComposite; import org.tizen.dynamicanalyzer.ui.widgets.table.DATableDataFormat; import org.tizen.dynamicanalyzer.ui.widgets.table.DATableHeaderRenderer; @@ -76,18 +75,21 @@ public class UIEventListDialog extends Dialog { private Shell parent; private UIEventListTable uiEventListTable; private List chartSeriesList; - private List startIndexList; - private List endIndexList; - private String[] columnNames = { TimelinePageLabels.UI_EVENT_LIST_TYPE, - TimelinePageLabels.UI_EVENT_LIST_NAME, + private String[] columnNames = { TimelinePageLabels.UI_EVENT_LIST_TIME, - TimelinePageLabels.UI_EVENT_LIST_SET_RANGE }; - private int[] columnSizes = { 74, 102, 100, 140 }; - private boolean[] columnVisibility = { true, true, true, true }; - int[] sortTypes = { AnalyzerConstants.SORT_TYPE_GRID, - AnalyzerConstants.SORT_TYPE_GRID, AnalyzerConstants.SORT_TYPE_GRID, - AnalyzerConstants.SORT_TYPE_NONE }; + TimelinePageLabels.UI_EVENT_LIST_TYPE, + TimelinePageLabels.UI_EVENT_LIST_NAME, + TimelinePageLabels.UI_EVENT_LIST_DETAIL + }; + private int[] columnSizes = { 100, 100, 175, 425}; + private boolean[] columnVisibility = { true, true, true, true}; + int[] sortTypes = { + AnalyzerConstants.SORT_TYPE_GRID_NUM, + AnalyzerConstants.SORT_TYPE_GRID, + AnalyzerConstants.SORT_TYPE_GRID, + AnalyzerConstants.SORT_TYPE_GRID + }; DefaultTableComparator comparator = new DefaultTableComparator(); public UIEventListDialog(Shell parent) { @@ -98,7 +100,7 @@ public class UIEventListDialog extends Dialog { public int open() { shell = new Shell(parent, SWT.APPLICATION_MODAL | SWT.DIALOG_TRIM); shell.setText("Event list"); // FIXME - shell.setSize(446, 450); + shell.setSize(825, 450); shell.setLayout(new FormLayout()); Composite tableComp = new Composite(shell, SWT.NONE); @@ -118,7 +120,8 @@ public class UIEventListDialog extends Dialog { uiEventListTable.setColumnSize(columnSizes); uiEventListTable.setColumnVisibility(columnVisibility); uiEventListTable.setSortTypes(sortTypes); - comparator.setColumn(2); + comparator.setColumn(0); + comparator.setType(AnalyzerConstants.SORT_TYPE_GRID_NUM); uiEventListTable.setComparator(comparator); uiEventListTable.getTable().setData(UIEventListDialog.KEY_START_TIME, -1.0); @@ -148,7 +151,7 @@ public class UIEventListDialog extends Dialog { okButton.setFont(FontResources.EDIT_CHART_DLG_BUTTON); data = new FormData(); data.top = new FormAttachment(0, 8); - data.left = new FormAttachment(0, 119); + data.left = new FormAttachment(0, 569); data.width = DesignConstants.DA_BUTTON_WIDTH; data.height = DesignConstants.DA_BUTTON_HEIGHT; okButton.setLayoutData(data); @@ -183,11 +186,8 @@ public class UIEventListDialog extends Dialog { return 0; } - public void setSelectedEventInfo(List chartSeriesList, - List startIndexList, List endIndexList) { + public void setSelectedEventInfo(List chartSeriesList) { this.chartSeriesList = chartSeriesList; - this.startIndexList = startIndexList; - this.endIndexList = endIndexList; } private DACustomButtonClickEventListener okButtonListener = new DACustomButtonClickEventListener() { @@ -255,23 +255,35 @@ public class UIEventListDialog extends Dialog { protected List makeTableInput() { List inputList = new ArrayList(); + if(chartSeriesList == null && chartSeriesList.size() == 0) { + return null; + } + for (int i = 0; i < chartSeriesList.size(); i++) { String seriesName = chartSeriesList.get(i).getName(); - int fromIndex = startIndexList.get(i); - int toIndex = endIndexList.get(i); - - if (fromIndex > toIndex || fromIndex == -1 || toIndex == -1) { - continue; - } List subItemList = chartSeriesList.get(i) - .getSeriesItemList().subList(fromIndex, toIndex); + .getSeriesItemList(); for (DAChartSeriesItem item : subItemList) { + String[] eventDetailDatas = item.getTooltipText().split("\n"); + String eventName = eventDetailDatas[0]; + String detailData = ""; + for(String tmpDetail : eventDetailDatas) { + detailData = detailData.concat(tmpDetail).concat("|"); + } + detailData = detailData.split(eventName)[1]; + if(detailData.length() > 1 ) { + detailData = detailData.substring(1, detailData.length()-1); + } else { + detailData = ""; + } + List columnTexts = new ArrayList(); - columnTexts.add(seriesName); - columnTexts.add(item.getTooltipText().split("\n")[0]);//$NON-NLS-1$ columnTexts.add(String.valueOf(item.getX())); + columnTexts.add(seriesName); + columnTexts.add(eventName);//$NON-NLS-1$ + columnTexts.add(detailData); TableInput tableInput = new TableInput(); tableInput.setText(columnTexts); diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/uievent/UIEventListDialogTableCellRenderer.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/uievent/UIEventListDialogTableCellRenderer.java index 0aa17b9..4406c2d 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/uievent/UIEventListDialogTableCellRenderer.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/uievent/UIEventListDialogTableCellRenderer.java @@ -27,20 +27,15 @@ package org.tizen.dynamicanalyzer.ui.timeline.uievent; -import org.eclipse.nebula.widgets.grid.Grid; import org.eclipse.nebula.widgets.grid.GridItem; -import org.eclipse.nebula.widgets.grid.IInternalWidget; import org.eclipse.nebula.widgets.grid.internal.DefaultCellRenderer; import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.Color; 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.tizen.dynamicanalyzer.resources.ColorResources; import org.tizen.dynamicanalyzer.resources.FontResources; -import org.tizen.dynamicanalyzer.ui.widgets.table.DATableDataFormat; -import org.tizen.dynamicanalyzer.widgets.helper.ImageResources; public class UIEventListDialogTableCellRenderer extends DefaultCellRenderer { private int leftMargin = 4; @@ -48,11 +43,6 @@ public class UIEventListDialogTableCellRenderer extends DefaultCellRenderer { private int textTopMargin = 1; private int insideMargin = 3; - private int CHECK_INDEX = 3; - - private final int buttonWidth = ImageResources.UIEVENT_DIALOG_START_SELECTED_NORMAL - .getBounds().width; - @Override public void paint(GC gc, Object value) { GridItem item = (GridItem) value; @@ -90,43 +80,6 @@ public class UIEventListDialogTableCellRenderer extends DefaultCellRenderer { } int x = leftMargin; - if (getColumn() == CHECK_INDEX) { - Image buttonImage; - Integer data = (Integer) item - .getData(UIEventListDialog.KEY_OLD_HOVERED_INDEX); - if (item.getChecked(CHECK_INDEX)) { - if (data != null && data == CHECK_INDEX) { - buttonImage = ImageResources.UIEVENT_DIALOG_START_SELECTED_HOVER; - } else { - buttonImage = ImageResources.UIEVENT_DIALOG_START_SELECTED_NORMAL; - } - } else { - if (data != null && data == CHECK_INDEX) { - buttonImage = ImageResources.UIEVENT_DIALOG_START_HOVER; - } else { - buttonImage = ImageResources.UIEVENT_DIALOG_START_NORMAL; - } - } - gc.drawImage(buttonImage, getStartButtonXPostion(), - getBounds().y + 1); - - if (item.getChecked(CHECK_INDEX - 1)) { - if (data != null && data == CHECK_INDEX - 1) { - buttonImage = ImageResources.UIEVENT_DIALOG_END_SELECTED_HOVER; - } else { - buttonImage = ImageResources.UIEVENT_DIALOG_END_SELECTED_NORMAL; - } - } else { - if (data != null && data == CHECK_INDEX - 1) { - buttonImage = ImageResources.UIEVENT_DIALOG_END_HOVER; - } else { - buttonImage = ImageResources.UIEVENT_DIALOG_END_NORMAL; - } - } - gc.drawImage(buttonImage, getEndButtonXPosition(), - getBounds().y + 1); - } - Image image = item.getImage(getColumn()); if (image != null) { int y = getBounds().y; @@ -162,11 +115,8 @@ public class UIEventListDialogTableCellRenderer extends DefaultCellRenderer { } gc.setFont(FontResources.TABLE_CELL_FONT); + gc.drawText(text, getBounds().x + x, getBounds().y + textTopMargin, true); - if (getColumn() != CHECK_INDEX) { - gc.drawText(text, getBounds().x + x, getBounds().y + textTopMargin, - true); - } if (item.getParent().getLinesVisible()) { gc.setForeground(ColorResources.TABLE_LINE); gc.drawLine(getBounds().x, getBounds().y + getBounds().height, @@ -191,114 +141,4 @@ public class UIEventListDialogTableCellRenderer extends DefaultCellRenderer { } } } - - private int getStartButtonXPostion() { - return getBounds().x + getBounds().width / 2 - buttonWidth - 5; - } - - private int getEndButtonXPosition() { - return getBounds().x + getBounds().width / 2 + 5; - } - - private int getCheckBoxIndex(Point point) { - Image buttonImage; - if (point.x < getBounds().x + getBounds().width / 2) { - buttonImage = ImageResources.UIEVENT_DIALOG_START_NORMAL; - } else { - buttonImage = ImageResources.UIEVENT_DIALOG_END_NORMAL; - } - - if (point.x >= getStartButtonXPostion() - && point.x <= getStartButtonXPostion() - + buttonImage.getBounds().width) { - return CHECK_INDEX; - } else if (point.x >= getEndButtonXPosition() - && point.x <= getEndButtonXPosition() - + buttonImage.getBounds().width) { - return CHECK_INDEX - 1; - } else { - return -1; - } - } - - public boolean notify(int event, Point point, Object value) { - if (getColumn() == CHECK_INDEX) { - if (event == IInternalWidget.MouseMove) { - GridItem item = (GridItem) value; - int checkBoxIndex = getCheckBoxIndex(point); - Grid parentGrid = item.getParent(); - GridItem oldHoveredItem = (GridItem) parentGrid - .getData(UIEventListDialog.KEY_OLD_HOVERED_ITEM); - if (oldHoveredItem != null) { - oldHoveredItem.setData( - UIEventListDialog.KEY_OLD_HOVERED_INDEX, null); - } - - if (checkBoxIndex != -1) { - parentGrid.setData(UIEventListDialog.KEY_OLD_HOVERED_ITEM, - item); - item.setData(UIEventListDialog.KEY_OLD_HOVERED_INDEX, - checkBoxIndex); - } - - parentGrid.redraw(); - } else if (event == IInternalWidget.LeftMouseButtonDown) { - GridItem item = (GridItem) value; - int checkBoxIndex = getCheckBoxIndex(point); - if (checkBoxIndex != -1) { - boolean isCheckEvent = !item - .getChecked(getCheckBoxIndex(point)); - - Grid parentGrid = item.getParent(); - if (isCheckEvent) { - double data = (Double) ((DATableDataFormat) item - .getData()).getObject(); - - if (checkBoxIndex == CHECK_INDEX) { - GridItem oldCheckedItem = (GridItem) parentGrid - .getData(UIEventListDialog.KEY_START_OLD_CHECKED_ITEM); - - if (oldCheckedItem != null) { - oldCheckedItem.setChecked(CHECK_INDEX, false); - } - parentGrid - .setData( - UIEventListDialog.KEY_START_OLD_CHECKED_ITEM, - item); - - parentGrid.setData( - UIEventListDialog.KEY_START_TIME, data); - } else { - GridItem oldCheckedItem = (GridItem) parentGrid - .getData(UIEventListDialog.KEY_END_OLD_CHECKED_ITEM); - - if (oldCheckedItem != null) { - oldCheckedItem.setChecked(CHECK_INDEX - 1, - false); - } - parentGrid.setData( - UIEventListDialog.KEY_END_OLD_CHECKED_ITEM, - item); - - parentGrid.setData(UIEventListDialog.KEY_END_TIME, - data); - } - } else { - if (checkBoxIndex == CHECK_INDEX) { - parentGrid.setData( - UIEventListDialog.KEY_START_TIME, -1.0); - } else { - parentGrid.setData(UIEventListDialog.KEY_END_TIME, - -1.0); - } - } - - item.setChecked(checkBoxIndex, isCheckEvent); - - return true; - } - } - } - return false; - } } diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/widgets/table/DefaultTableComparator.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/widgets/table/DefaultTableComparator.java index acac432..1a1e83a 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/widgets/table/DefaultTableComparator.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/widgets/table/DefaultTableComparator.java @@ -72,7 +72,7 @@ public class DefaultTableComparator implements Comparator, Serializable String str2 = null; int rc = 0; - if (type != AnalyzerConstants.SORT_TYPE_GRID) { + if (type != AnalyzerConstants.SORT_TYPE_GRID && type != AnalyzerConstants.SORT_TYPE_GRID_NUM) { DATableDataFormat tableData1 = (DATableDataFormat) item1.getData(); DATableDataFormat tableData2 = (DATableDataFormat) item2.getData(); @@ -106,6 +106,22 @@ public class DefaultTableComparator implements Comparator, Serializable Logger.exception(e); break; } + case AnalyzerConstants.SORT_TYPE_GRID_NUM: + try { + + double returnData = Double.parseDouble(str1) - Double.parseDouble(str2); + if (returnData > 0) { + rc = 1; + } else if (returnData < 0) { + rc = -1; + } else { + rc = 0; + } + break; + } catch (NumberFormatException e) { + Logger.exception(e); + break; + } case AnalyzerConstants.SORT_TYPE_STRING: case AnalyzerConstants.SORT_TYPE_GRID: rc = str1.compareTo(str2); -- 2.7.4