[Title] thread page
authoryeongtaik.byeon <yeongtaik.byeon@samsung.com>
Wed, 28 Nov 2012 05:26:05 +0000 (14:26 +0900)
committeryeongtaik.byeon <yeongtaik.byeon@samsung.com>
Wed, 28 Nov 2012 05:26:05 +0000 (14:26 +0900)
[Desc.] detail info & design
[Issue] redmine #5322

org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/chart/DACustomChartRenderer.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/ThreadPageLabels.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/ThreadPageLabels.properties
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/theme/DAThemeBlack.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/theme/DAThemeWhite.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/thread/ThreadDetailInfoView.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/thread/ThreadPageThreadData.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/thread/ThreadPageThreadDataManager.java

index 7b07350..8c39199 100644 (file)
@@ -44,7 +44,7 @@ public class DACustomChartRenderer {
        public static final int MARGIN = 3; // FIXME
        public static final int ARROW_MARGIN = 2;
        public static final int EVENT_WIDTH = 2;
-       public static final double EVENT_HEIGHT_MARGIN_RATIO = 0.20;
+       public static final double EVENT_HEIGHT_MARGIN_RATIO = 0.25;
        public static final double LOAD_HEIGHT_MARGIN_RATIO = 0.25;
        private boolean bInitialized = false;
        private List<DACustomChartSeries> seriesList = null;
@@ -887,9 +887,9 @@ public class DACustomChartRenderer {
                        int pixcelStartX = plot.getXPixcelFromX(seriesItem.getX(), r);
 
                        int heightMargin = (int) ((r.y + r.height) * EVENT_HEIGHT_MARGIN_RATIO);
+                       int barHeight = r.y + r.height - heightMargin - r.height / 2;
 
-                       gc.fillRectangle(pixcelStartX, r.y + r.height / 2, EVENT_WIDTH, r.y
-                                       + r.height - heightMargin - r.height / 2);
+                       gc.fillRectangle(pixcelStartX, r.y + r.height / 2, EVENT_WIDTH, barHeight);
 
                        if (0 == arrowPosition) {
 
@@ -897,7 +897,9 @@ public class DACustomChartRenderer {
                                String number = String
                                                .valueOf((int) (seriesItem.getBarWidth()));
                                Rectangle arrowRect = imageRect;
-                               arrowRect.y = (r.y + r.height) / 2 - imageRect.height / 2;
+                               // arrowRect.y = (r.y + r.height) / 2 - imageRect.height / 2;
+                               arrowRect.y = r.y + r.height - r.height / 2 + barHeight/2 - imageRect.height
+                                               / 2;
                                if (0 > arrowPosition) {
                                        arrowRect.x = pixcelStartX - imageRect.width;
                                } else {
index 09073a2..cf201f7 100644 (file)
@@ -43,6 +43,9 @@ public class ThreadPageLabels extends NLS {
        public static String THREAD_ITEM_TYPE_PTHREAD;
        
        public static String THREAD_API_JOIN;
+       
+       public static String THREAD_CHART_NAME_PREFIX;
+       public static String THREAD_CHART_NAME_POSTFIX;
 
        /* Thread API List view */
        public static String THREAD_API_LIST_VEIW_TITLE;
@@ -53,6 +56,10 @@ public class ThreadPageLabels extends NLS {
        public static String THREAD_API_LIST_VIEW_THREAD_ID;
        public static String THREAD_API_LIST_VIEW_RETURN;
        public static String THREAD_API_LIST_VIEW_ERRNO;
+       
+       /* Thread Details*/
+       public static String THREAD_DETAILS_TID;
+       public static String THREAD_DETAILS_TTYPE;
 
        static {
                // initialize resource bundle
index d6b82c0..1c4df4a 100644 (file)
@@ -6,17 +6,23 @@ THREAD_CHART_SERIES_LOAD=LOAD
 THREAD_CHART_SERIES_EVENT=EVENT
 THREAD_CHART_SERIES_API=API
 
-THREAD_ITEM_TYPE_MAIN=\n(main)
-THREAD_ITEM_TYPE_OSP=\n(OSP)
-THREAD_ITEM_TYPE_PTHREAD=\n(Pthread)
+THREAD_ITEM_TYPE_MAIN=main
+THREAD_ITEM_TYPE_OSP=OSP
+THREAD_ITEM_TYPE_PTHREAD=pthread
 
 THREAD_API_JOIN=Thread::Join
 
+THREAD_CHART_NAME_PREFIX=\n(
+THREAD_CHART_NAME_POSTFIX=)
+
 THREAD_API_LIST_VEIW_TITLE=Thread API List
-THREAD_API_LIST_VIEW_ERRNO=Error Code
 THREAD_API_LIST_VIEW_INDEX=#
+THREAD_API_LIST_VIEW_TIME=Time
 THREAD_API_LIST_VIEW_NAME=Thread API
 THREAD_API_LIST_VIEW_PARAMETER=Parameter
-THREAD_API_LIST_VIEW_RETURN=Return value
 THREAD_API_LIST_VIEW_THREAD_ID=Thread ID
-THREAD_API_LIST_VIEW_TIME=Time
+THREAD_API_LIST_VIEW_RETURN=Return value
+THREAD_API_LIST_VIEW_ERRNO=Error Code
+
+THREAD_DETAILS_TID=Thread ID : 
+THREAD_DETAILS_TTYPE=Thread type : 
\ No newline at end of file
index 777a377..d90334d 100644 (file)
@@ -46,7 +46,7 @@ public class DAThemeBlack extends DATheme {
                // defaule
                setColor("blue", new RGB(0, 102, 134));
                setColor("green", new RGB(68, 98, 12));
-               setColor("yellow", new RGB(255, 255, 0));
+               setColor("yellow", new RGB(255, 210, 10));
                setColor("purple", new RGB(139, 42, 118));
                setColor("brown", new RGB(138, 83, 0));
                setColor("navy", new RGB(57, 66, 161));
index 060f73e..96031b8 100644 (file)
@@ -46,7 +46,7 @@ public class DAThemeWhite extends DATheme {
                // defaule
                setColor("blue", new RGB(0, 102, 134));
                setColor("green", new RGB(68, 98, 12));
-               setColor("yellow", new RGB(255, 255, 0));
+               setColor("yellow", new RGB(255, 210, 10));
                setColor("purple", new RGB(139, 42, 118));
                setColor("brown", new RGB(138, 83, 0));
                setColor("navy", new RGB(57, 66, 161));
index 5281dc9..d154dc0 100644 (file)
@@ -26,7 +26,6 @@
  */
 package org.tizen.dynamicanalyzer.ui.thread;
 
-import org.eclipse.nebula.widgets.grid.GridItem;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.events.PaintEvent;
 import org.eclipse.swt.events.PaintListener;
@@ -39,43 +38,28 @@ import org.eclipse.swt.widgets.Control;
 import org.tizen.dynamicanalyzer.common.DASelectionData;
 import org.tizen.dynamicanalyzer.model.DAView;
 import org.tizen.dynamicanalyzer.nl.AnalyzerLabels;
-import org.tizen.dynamicanalyzer.nl.FilePageLabels;
 import org.tizen.dynamicanalyzer.nl.ThreadPageLabels;
 import org.tizen.dynamicanalyzer.resources.ColorResources;
 import org.tizen.dynamicanalyzer.resources.FontResources;
-import org.tizen.dynamicanalyzer.ui.file.FileChartItemData;
-import org.tizen.dynamicanalyzer.ui.file.chart.FileChartManager;
 import org.tizen.dynamicanalyzer.ui.widgets.ViewContainer;
-import org.tizen.dynamicanalyzer.ui.widgets.table.DATableDataFormat;
-import org.tizen.dynamicanalyzer.utils.Formatter;
 
 public class ThreadDetailInfoView extends DAView {
        public static final String ID = ThreadDetailInfoView.class.getName();
+       public static final int LEFT_MARGIN = 10;
+       public static final int HEIGHT_MARGIN = 20;
 
        private Canvas canvas = null;
-       private String fileName = AnalyzerLabels.EMPTY_STRING;
-       private String filePath = AnalyzerLabels.EMPTY_STRING;
-       // private String fileMode = "";
-       private int totalSize = 0;
-       private int readSize = 0;
-       private int writeSize = 0;
-       private long totalUseTime = 0;
-       private int apiCount = 0;
-       private int failedApiCount = 0;
+       private int tid = 0;
+       private String type = AnalyzerLabels.EMPTY_STRING;
+       private boolean select = false;
 
        int[] innerMaxWeight = { 0, 100 };
        int[] outerMaxWeight = { 0, 100 };
 
        private void init() {
-               fileName = AnalyzerLabels.EMPTY_STRING;
-               filePath = AnalyzerLabels.EMPTY_STRING;
-               // fileMode = "";
-               totalSize = 0;
-               readSize = 0;
-               writeSize = 0;
-               totalUseTime = 0;
-               apiCount = 0;
-               failedApiCount = 0;
+               tid = 0;
+               type = AnalyzerLabels.EMPTY_STRING;
+               select = false;
        }
 
        public ThreadDetailInfoView(Composite parent, int style) {
@@ -94,118 +78,43 @@ public class ThreadDetailInfoView extends DAView {
 
                        @Override
                        public void paintControl(PaintEvent e) {
-                               int x = 0;
-                               int y = 0;
                                Rectangle rect = canvas.getBounds();
                                e.gc.setBackground(ColorResources.VIEW_BG_COLOR);
                                e.gc.fillRectangle(rect.x, rect.y, rect.width, rect.height);
                                e.gc.setForeground(ColorResources.TABLE_CONTENTS_FONT_COLOR);
                                e.gc.setFont(FontResources.DETAIL_INFO_FONT);
 
-                               String fName = FilePageLabels.FILE_DETAILS_FILE_NAME + fileName;
-                               Point textSize = e.gc.textExtent(fName, SWT.DRAW_MNEMONIC);
-                               if (textSize.x > rect.width) {
-                                       fName = FilePageLabels.FILE_DETAILS_FILE_NAME_NEWLINE
-                                                       + fileName;
-                               }
-                               int fontHeight = textSize.y + 5;
-                               // e.gc.drawString(fName, x += 10, y += fontHeight);
-
-                               // file path bolck
-                               {
-                                       String pathLabel = FilePageLabels.FILE_DETAILS_FILE_PATH;
-                                       // e.gc.drawString(pathLabel, x, y + fontHeight);
-                                       Point pathSize = e.gc.textExtent(pathLabel,
-                                                       SWT.DRAW_MNEMONIC);
-                                       int xPos = x + pathSize.x;
-                                       int width = rect.width - xPos;
-                                       String text = filePath;
-                                       if (text.length() > 0) {
-                                               while (text.length() > 0) {
-                                                       Point tSize = e.gc.textExtent(text,
-                                                                       SWT.DRAW_MNEMONIC);
-                                                       String inputText = AnalyzerLabels.EMPTY_STRING;
-                                                       if (tSize.x > width) {
-                                                               int strLen = (width * text.length()) / tSize.x;
-                                                               inputText += text.substring(0, strLen - 1);
-                                                               text = text.substring(strLen - 1, text.length());
-                                                       } else {
-                                                               inputText += text;
-                                                               text = AnalyzerLabels.EMPTY_STRING;
-                                                       }
-                                                       // e.gc.drawString(inputText, xPos, y +=
-                                                       // fontHeight);
-                                               }
-                                       } else {
-                                               y += fontHeight;
-                                       }
+                               String threadID;
+                               String threhadType;
+
+                               if (true == select) {
+                                       threadID = ThreadPageLabels.THREAD_DETAILS_TID
+                                                       + String.valueOf(tid);
+                                       threhadType = ThreadPageLabels.THREAD_DETAILS_TTYPE + type;
+                               } else {
+                                       threadID = ThreadPageLabels.THREAD_DETAILS_TID;
+                                       threhadType = ThreadPageLabels.THREAD_DETAILS_TTYPE;
                                }
 
-                               // e.gc.drawString(FilePageLabels.FILE_DETAILS_TOTAL_SIZE
-                               // + Integer.toString(totalSize), x, y += fontHeight);
-                               // e.gc.drawString(
-                               // FilePageLabels.FILE_DETAILS_READ_SIZE
-                               // + Integer.toString(readSize), x,
-                               // y += fontHeight);
-                               // e.gc.drawString(FilePageLabels.FILE_DETAILS_WRITE_SIZE
-                               // + Integer.toString(writeSize), x, y += fontHeight);
-                               // e.gc.drawString(FilePageLabels.FILE_DETAILS_TOTAL_USE_TIME
-                               // + Formatter.toTimeFormat(Long.toString(totalUseTime)),
-                               // x, y += fontHeight);
-                               // e.gc.drawString(
-                               // FilePageLabels.FILE_DETAILS_API_COUNT
-                               // + Integer.toString(apiCount), x,
-                               // y += fontHeight);
-                               // e.gc.drawString(FilePageLabels.FILE_DETAILS_FAILED_API_COUNT
-                               // + Integer.toString(failedApiCount), x, y += fontHeight);
+                               int y = HEIGHT_MARGIN;
+                               e.gc.drawText(threadID, LEFT_MARGIN, y);
+                               Point p = e.gc.textExtent(threadID, SWT.DRAW_DELIMITER);
+                               y = y + p.y + HEIGHT_MARGIN;
 
+                               e.gc.drawText(threhadType, LEFT_MARGIN, y);
                        }
                });
        }
 
        @Override
        public void updateView(DASelectionData data) {
-               Object obj = data.getData();
-               if (!(obj instanceof GridItem)) {
+               ThreadPageThreadData item = (ThreadPageThreadData) data.getData();
+               if (!(item instanceof ThreadPageThreadData)) {
                        return;
                }
-               GridItem ti = (GridItem) obj;
-               DATableDataFormat tableData = (DATableDataFormat) ti.getData();
-               FileChartItemData item = (FileChartItemData) tableData.getObject();
-               // FileChartItemData item = (FileChartItemData) ti.getData();
-               // fileMode = "";
-               totalSize = 0;
-               readSize = 0;
-               writeSize = 0;
-               apiCount = 0;
-               failedApiCount = 0;
-               if (!item.isParent()) {
-                       item = FileChartManager.getInstance().getFileRegister()
-                                       .get(item.getParentKey());
-               }
-               fileName = item.getFileName();
-               filePath = item.getPath();
-               int readSize = 0;
-               int writeSize = 0;
-               int totalSize = 0;
-               int size = item.getChildern().size();
-               for (int i = 0; i < size; i++) {
-                       FileChartItemData child = item.getChildern().get(i);
-                       readSize += child.getReadSize();
-                       writeSize += child.getWriteSize();
-                       totalSize += child.getTotalSize();
-
-                       for (int ii = 0; ii < child.getData().size(); ii++) {
-                               apiCount += child.getData().get(ii).getRelations().size();
-                       }
-               }
-               failedApiCount = item.getFailedData().size();
-               apiCount += failedApiCount;
-               this.readSize = readSize;
-               this.writeSize = writeSize;
-               this.totalSize = totalSize;
-
-               totalUseTime = item.getTotalFileUseTime();
+               select = true;
+               tid = item.getTid();
+               type = item.getType();
                canvas.redraw();
        }
 
index 4802bf7..fa32add 100644 (file)
@@ -39,6 +39,7 @@ import org.tizen.dynamicanalyzer.widgets.chartBoard.DACustomChartBoardItem;
 public class ThreadPageThreadData {
        private ThreadPageThreadDataManager manager;
        private int tid;
+       private String type;
        private String name;
        private String address;
        private List<ThreadPageThreadDataEvent> contents = new ArrayList<ThreadPageThreadDataEvent>();
@@ -50,9 +51,11 @@ public class ThreadPageThreadData {
        private DACustomChartSeries apiSeries;
 
        public ThreadPageThreadData(ThreadPageThreadDataManager manager,
-                       String name, int tid, String address) {
+                       String type, int tid, String address) {
                setManager(manager);
-               setName(name);
+               setType(type);
+               setName(String.valueOf(tid)+ThreadPageLabels.THREAD_CHART_NAME_PREFIX
+                               + type + ThreadPageLabels.THREAD_CHART_NAME_POSTFIX);
                setTid(tid);
                setAddress(address);
        }
@@ -209,4 +212,12 @@ public class ThreadPageThreadData {
        public List<ThreadPageThreadDataEvent> getContents() {
                return contents;
        }
+
+       public String getType() {
+               return type;
+       }
+
+       public void setType(String type) {
+               this.type = type;
+       }
 }
index f55be01..7082df8 100644 (file)
@@ -106,6 +106,7 @@ public class ThreadPageThreadDataManager {
                                                chart.getData(), chart));
        }
 
+       // FIXME : chart range selection
        private Listener chartMouseListener = new Listener() {
 
                @Override
@@ -203,14 +204,14 @@ public class ThreadPageThreadDataManager {
                long startTime = 0;
 
                ThreadPageThreadData mainData = new ThreadPageThreadData(this,
-                               String.valueOf(tid) + ThreadPageLabels.THREAD_ITEM_TYPE_MAIN,
+                               ThreadPageLabels.THREAD_ITEM_TYPE_MAIN,
                                tid, null);
                pushRow(mainData);
-               ThreadPageThreadDataEvent mainEvent = new ThreadPageThreadDataEvent(
-                               this, ThreadPageThreadDataEvent.TYPE_EVENT,
-                               LogCenterConstants.THREAD_TYPE_MAIN,
-                               LogCenterConstants.THREAD_API_TYPE_START, startTime, tid, null);
-               pushEvent(mainEvent);
+//             ThreadPageThreadDataEvent mainEvent = new ThreadPageThreadDataEvent(
+//                             this, ThreadPageThreadDataEvent.TYPE_EVENT,
+//                             LogCenterConstants.THREAD_TYPE_MAIN,
+//                             LogCenterConstants.THREAD_API_TYPE_START, startTime, tid, null);
+//             pushEvent(mainEvent);
        }
 
        public List<List<String>> getLogsFromLogPackage(LogPackage logPack,
@@ -319,8 +320,7 @@ public class ThreadPageThreadDataManager {
                        String address = input
                                        .get(LogCenterConstants.THREAD_PTHREAD_ID_INDEX);
                        ThreadPageThreadData data = new ThreadPageThreadData(this,
-                                       String.valueOf(tid)
-                                                       + ThreadPageLabels.THREAD_ITEM_TYPE_PTHREAD, tid,
+                                       ThreadPageLabels.THREAD_ITEM_TYPE_PTHREAD, tid,
                                        address);
                        pushRow(data);
                        event = new ThreadPageThreadDataEvent(this,
@@ -386,7 +386,7 @@ public class ThreadPageThreadDataManager {
                                        .get(LogCenterConstants.THREAD_PTHREAD_ID_INDEX);
                        ThreadPageThreadData data = new ThreadPageThreadData(
                                        this,
-                                       String.valueOf(tid) + ThreadPageLabels.THREAD_ITEM_TYPE_OSP,
+                                       ThreadPageLabels.THREAD_ITEM_TYPE_OSP,
                                        tid, address);
                        pushRow(data);
                        event = new ThreadPageThreadDataEvent(this,