[SRADA-824] Support calltrace table for search
authorjoon.c.baek <joon.c.baek@samsung.com>
Thu, 23 Jun 2016 06:47:36 +0000 (15:47 +0900)
committerdongkyu6 lee <dongkyu6.lee@samsung.com>
Mon, 27 Jun 2016 02:44:09 +0000 (11:44 +0900)
Support calltrace table for search,
DAWindowingTable get override method to searching well.

Change-Id: I2d7075e27d6476ff7bf7d143e7ccd2e9ac08e286
Signed-off-by: joon.c.baek <joon.c.baek@samsung.com>
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/widgets/table/DATableComposite.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/widgets/table/DAWindowingTableComposite.java

index 9013eab..ac4e51d 100755 (executable)
@@ -526,7 +526,7 @@ public abstract class DATableComposite extends Composite {
                table.deselectAll();
        }
 
-       private int getScrollSelectionIndex(int selection) {
+       protected int getScrollSelectionIndex(int selection) {
                int size = table.getVerticalBar().getThumb() / 2;
                int output = selection - size;
 
@@ -583,7 +583,7 @@ public abstract class DATableComposite extends Composite {
                return -1;
        }
 
-       private boolean checkText(FindProperty findProperty, GridItem items) {
+       protected boolean checkText(FindProperty findProperty, GridItem items) {
                GridColumn[] columns = table.getColumns();
                int columnSize = columns.length;
                String input = findProperty.getLastSearch();
index 09a42a3..a6a80e1 100755 (executable)
@@ -567,11 +567,62 @@ public abstract class DAWindowingTableComposite extends DATableComposite {
                this.timeColumnIndex = timeColumnIndex;
        }
 
+       @Override
        public int getScrollSelectionIndex(int selection) {
-               return 1;
+               int size = vScrollbar.getThumb() / 2;
+               int output = selection - size;
+
+               output = (output < 0) ? 0 : output;
+               return output;
        }
 
+       @Override
        public int searchString(FindProperty findProperty) {
+               GridItem[] items = table.getItems();
+               int size = items.length;
+               boolean next = !findProperty.isBackward();
+               int start = findProperty.getIndex();
+               setFindProferty(findProperty);
+
+               // forward
+               if (next) {
+                       for (int i = start; i < size; i++) {
+                               if (checkText(findProperty, items[i])) {
+                                       vScrollbar.setSelection(getScrollSelectionIndex(i));
+                                       table.setSelection(i);
+                                       updateTable();
+                                       return i;
+                               }
+                       }
+                       // can't find
+                       for (int i = 0; i < start; i++) {
+                               if (checkText(findProperty, items[i])) {
+                                       vScrollbar.setSelection(getScrollSelectionIndex(i));
+                                       table.setSelection(i);
+                                       updateTable();
+                                       return i;
+                               }
+                       }
+               } else { // back
+                       for (int i = start; i >= 0; i--) {
+                               if (checkText(findProperty, items[i])) {
+                                       vScrollbar.setSelection(getScrollSelectionIndex(i));
+                                       table.setSelection(i);
+                                       updateTable();
+                                       return i;
+                               }
+                       }
+
+                       for (int i = size - 1; i > start; i--) {
+                               if (checkText(findProperty, items[i])) {
+                                       vScrollbar.setSelection(getScrollSelectionIndex(i));
+                                       table.setSelection(i);
+                                       updateTable();
+                                       return i;
+                               }
+                       }
+               }
+               table.deselectAll();
                return -1;
        }