[Title] fix. windowing table
authorHyunjong,Pakr <phjwithyou.park@samsung.com>
Tue, 28 Jan 2014 07:36:42 +0000 (16:36 +0900)
committerHyunjong,Pakr <phjwithyou.park@samsung.com>
Tue, 28 Jan 2014 07:36:42 +0000 (16:36 +0900)
[Desc.] add horizontalbar in windowing table
[Issue] -

org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/kernel/KernelListView.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/network/NetworkDetailInfoView.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/calltrace/CallTraceView.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/widgets/table/DATableComposite.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/widgets/table/DAWindowingTableComposite.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/widgets/table/WindowingTableColumnSizePackListener.java

index 7bca362..e82be6b 100644 (file)
@@ -89,7 +89,7 @@ public class KernelListView extends DAView {
                contents.setBackground(ColorResources.WINDOW_BG_COLOR);
                contents.setLayout(new FillLayout());
                tableComp = new KernelListTable(contents, SWT.NONE, SWT.MULTI
-                               | SWT.BORDER | SWT.FULL_SELECTION | SWT.H_SCROLL);
+                               | SWT.BORDER | SWT.FULL_SELECTION);
                tableComp.setSortTypes(sortTypes);
                tableComp.setColumnAlignment(columnAlignment);
                tableComp.setColumns(columnNames);
@@ -110,7 +110,7 @@ public class KernelListView extends DAView {
                        KernelSelectionData sdata = (KernelSelectionData) data;
                        boolean isCore = (sdata.getType() == KernelSelectionData.KERNEL_DATA_TYPE_CONTEXTSWITCH);
                        tableComp.setSelectedData(sdata.getData(), isCore);
-                       if(isCore) {
+                       if (isCore) {
                                tableComp.setColumnVisibility(columnVisibility_core);
                        } else {
                                tableComp.setColumnVisibility(columnVisibility_function);
index fbe99af..c719e2d 100644 (file)
@@ -104,6 +104,8 @@ public class NetworkDetailInfoView extends DAView {
                buttonData.right = new FormAttachment(100, 0);
                buttonData.bottom = new FormAttachment(100, 0);
                detailText.setLayoutData(buttonData);
+               detailText.getVerticalBar().setVisible(false);
+               detailText.getHorizontalBar().setVisible(false);
 
                Listener listener = new Listener() {
                        public void handleEvent(Event e) {
index f85736e..1b11a73 100644 (file)
@@ -80,11 +80,12 @@ public class CallTraceView extends DAView {
                contents.setBackground(ColorResources.WINDOW_BG_COLOR);
                contents.setLayout(new FillLayout());
                tableComp = new CallTraceTable(contents, SWT.NONE, SWT.MULTI
-                               | SWT.BORDER | SWT.FULL_SELECTION | SWT.H_SCROLL);
+                               | SWT.BORDER | SWT.FULL_SELECTION);
                tableComp.setSortTypes(sortTypes);
                tableComp.setColumns(columnNames);
                tableComp.setColumnSize(columnSizes);
                tableComp.setColumnVisibility(columnVisibility);
+               tableComp.setItemHeightSize(16);
                contents.addControlListener(new WindowingTableColumnSizePackListener(
                                tableComp, columnSizes));
 
index 9278f17..384fd86 100644 (file)
@@ -100,6 +100,10 @@ public abstract class DATableComposite extends Composite {
        protected DAPopupMenu popupMenu = null;
 
        protected Point mousePoint = new Point(0, 0);
+       
+       protected int totalColumnSize = 0;
+       
+       private int itemHeightSize = 16;
 
        protected RangeDataManager rangeDataManager = RangeDataManager
                        .getInstance();
@@ -123,7 +127,7 @@ public abstract class DATableComposite extends Composite {
 
                table.setEmptyColumnHeaderRenderer(new DATableEmptyColumnHeaderRenderer());
                table.setEmptyCellRenderer(new DATableEmptyCellRenderer());
-               table.setItemHeight(16);
+               table.setItemHeight(getItemHeightSize());
                
                setTableLayout();
                addMouseMoveListener();
@@ -341,12 +345,14 @@ public abstract class DATableComposite extends Composite {
                        return;
                }
 
+               totalColumnSize = 0;
                for (int i = 0; i < size; i++) {
                        if (columnSizes[i] == 0) {
                                columns[i].pack();
                        } else {
                                columns[i].setWidth(columnSizes[i]);
                        }
+                       totalColumnSize += columnSizes[i];
                }
        }
 
@@ -679,4 +685,12 @@ public abstract class DATableComposite extends Composite {
        public boolean isAutoColumnPackEnabled() {
                return autoColumnPack;
        }
+       
+       public int getItemHeightSize() {
+               return itemHeightSize;
+       }
+
+       public void setItemHeightSize(int itemHeightSize) {
+               this.itemHeightSize = itemHeightSize;
+       }
 }
index 602390c..b7e1dcc 100644 (file)
@@ -57,7 +57,8 @@ import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
 public abstract class DAWindowingTableComposite extends DATableComposite {
 
        protected Composite scrollComp;
-       protected ScrollBar scrollbar;
+       protected ScrollBar vScrollbar;
+       protected ScrollBar hScrollbar;
 
        protected long selectionStartTime = -1;
        protected long selectionEndTime = -1;
@@ -80,18 +81,19 @@ public abstract class DAWindowingTableComposite extends DATableComposite {
 
        @Override
        protected Grid createGrid(int tableStyle) {
-               scrollComp = new Composite(this, SWT.V_SCROLL);
+               scrollComp = new Composite(this, SWT.V_SCROLL | SWT.H_SCROLL);
                scrollComp.setBackground(ColorResources.TABLE_CONTENTS_NORMAL);
                scrollComp.setLayout(new FormLayout());
 
-               scrollbar = scrollComp.getVerticalBar();
-               scrollbar.setMaximum(0);
-               scrollbar.setMinimum(0);
-               scrollbar.setVisible(false);
-               scrollbar.addSelectionListener(new SelectionListener() {
+               vScrollbar = scrollComp.getVerticalBar();
+               vScrollbar.setMaximum(0);
+               vScrollbar.setMinimum(0);
+               vScrollbar.setVisible(false);
+
+               vScrollbar.addSelectionListener(new SelectionListener() {
                        @Override
                        public void widgetSelected(SelectionEvent e) {
-                               if (previousSelectionScrollIndex != scrollbar.getSelection()) {
+                               if (previousSelectionScrollIndex != vScrollbar.getSelection()) {
                                        synchronized (me) {
                                                updateTable();
                                        }
@@ -103,6 +105,26 @@ public abstract class DAWindowingTableComposite extends DATableComposite {
                        }
                });
 
+               hScrollbar = scrollComp.getHorizontalBar();
+               hScrollbar.setMaximum(0);
+               hScrollbar.setThumb(0);
+               hScrollbar.setVisible(false);
+               hScrollbar.addSelectionListener(new SelectionListener() {
+                       @Override
+                       public void widgetSelected(SelectionEvent e) {
+                               int currentPosition = hScrollbar.getSelection();
+                               int xPosition = -currentPosition;
+                               int width = totalColumnSize;
+                               int height = table.getHeaderHeight()
+                                               + (getTableLength() * (getItemHeightSize() + 1)) + 10;
+                               table.setBounds(xPosition, 0, width, height);
+                       }
+
+                       @Override
+                       public void widgetDefaultSelected(SelectionEvent e) {
+                       }
+               });
+
                return new DAGrid(scrollComp, tableStyle);
        }
 
@@ -110,13 +132,13 @@ public abstract class DAWindowingTableComposite extends DATableComposite {
        protected void setTableLayout() {
                FormData data = new FormData();
                data.top = new FormAttachment(0, 0);
-               data.bottom = new FormAttachment(100, 0);
                data.left = new FormAttachment(0, 0);
-
                if (AnalyzerUtil.isLinux()) {
                        data.right = new FormAttachment(100, -2);
+                       data.bottom = new FormAttachment(100, -2);
                } else {
                        data.right = new FormAttachment(100, 0);
+                       data.bottom = new FormAttachment(100, 0);
                }
                table.setLayoutData(data);
        }
@@ -189,28 +211,28 @@ public abstract class DAWindowingTableComposite extends DATableComposite {
                                                }
                                        }
                                } else if (e.keyCode == SWT.ARROW_UP) {
-                                       int nowScrollBar = scrollbar.getSelection();
+                                       int nowScrollBar = vScrollbar.getSelection();
                                        int tableSelectionIndex = table.getSelectionIndex();
                                        if (nowScrollBar > 0 && tableSelectionIndex == 0) {
-                                               scrollbar.setSelection(nowScrollBar - 1);
+                                               vScrollbar.setSelection(nowScrollBar - 1);
                                                setTableSeqNumber(0);
                                        }
                                } else if (e.keyCode == SWT.ARROW_DOWN) {
-                                       int nowScrollBar = scrollbar.getSelection();
+                                       int nowScrollBar = vScrollbar.getSelection();
                                        int tableSelectionIndex = table.getSelectionIndex();
                                        if (tableSelectionIndex >= getTableLength()) {
-                                               scrollbar.setSelection(nowScrollBar + 1);
+                                               vScrollbar.setSelection(nowScrollBar + 1);
                                                setTableSeqNumber(getTableLength());
                                        }
                                } else if (e.keyCode == SWT.PAGE_UP) {
-                                       int nowScrollBar = scrollbar.getSelection();
+                                       int nowScrollBar = vScrollbar.getSelection();
                                        int pageChagneInde = getTableLength();
-                                       scrollbar.setSelection(nowScrollBar - pageChagneInde + 1);
+                                       vScrollbar.setSelection(nowScrollBar - pageChagneInde + 1);
                                        setTableSeqNumber(0);
                                } else if (e.keyCode == SWT.PAGE_DOWN) {
-                                       int nowScrollBar = scrollbar.getSelection();
+                                       int nowScrollBar = vScrollbar.getSelection();
                                        int pageChagneInde = getTableLength() - 1;
-                                       scrollbar.setSelection(nowScrollBar + pageChagneInde);
+                                       vScrollbar.setSelection(nowScrollBar + pageChagneInde);
                                        setTableSeqNumber(getTableLength() - 1);
                                }
                        }
@@ -264,6 +286,13 @@ public abstract class DAWindowingTableComposite extends DATableComposite {
                                / (itemHeight + 1);
        }
 
+       public void updateHScrollBar(int tableWidth) {
+               System.out.println("width : " + tableWidth);
+               hScrollbar.setMaximum(totalColumnSize);
+               hScrollbar.setThumb(tableWidth);
+               hScrollbar.setVisible(true);
+       }
+
        @Override
        public void updateTable() {
                int itemCount = getItemCount();
@@ -277,10 +306,10 @@ public abstract class DAWindowingTableComposite extends DATableComposite {
                        return;
                }
 
-               scrollbar.setMinimum(0);
-               scrollbar.setMaximum(itemCount);
-               scrollbar.setThumb(getTableLength());
-               scrollbar.setVisible(true);
+               vScrollbar.setMinimum(0);
+               vScrollbar.setMaximum(itemCount);
+               vScrollbar.setThumb(getTableLength());
+               vScrollbar.setVisible(true);
                table.removeAll();
 
                if (null != comparator) {
@@ -371,7 +400,7 @@ public abstract class DAWindowingTableComposite extends DATableComposite {
        private List<TableInput> makeTableInputFromDB(int itemCount) {
                boolean isQueryDB = false;
 
-               int scrollSelection = scrollbar.getSelection();
+               int scrollSelection = vScrollbar.getSelection();
                if (previousSelectionScrollIndex != scrollSelection) {
                        isQueryDB = true;
                        previousSelectionScrollIndex = scrollSelection;
@@ -405,7 +434,7 @@ public abstract class DAWindowingTableComposite extends DATableComposite {
        }
 
        private List<List<String>> getStringDataFromDB(int itemCount) {
-               int scrollSelection = scrollbar.getSelection();
+               int scrollSelection = vScrollbar.getSelection();
                if (scrollSelection > itemCount) { // change PID
                        scrollSelection = 0;
                }
@@ -420,7 +449,7 @@ public abstract class DAWindowingTableComposite extends DATableComposite {
        }
 
        private List<LogData> getLogDataFromDB(int itemCount) {
-               int scrollSelection = scrollbar.getSelection();
+               int scrollSelection = vScrollbar.getSelection();
                if (scrollSelection > itemCount) { // change PID
                        scrollSelection = 0;
                }
@@ -437,13 +466,14 @@ public abstract class DAWindowingTableComposite extends DATableComposite {
        @Override
        public void clear() {
                super.clear();
-               scrollbar.setMaximum(0);
-               scrollbar.setMinimum(0);
-               scrollbar.setVisible(false);
+               vScrollbar.setMaximum(0);
+               vScrollbar.setMinimum(0);
+               vScrollbar.setVisible(false);
+               hScrollbar.setMaximum(0);
+               hScrollbar.setThumb(0);
+               hScrollbar.setVisible(false);
                selectionStartTime = -1;
                selectionEndTime = -1;
-               // scrollStartSelection = 0;
-               // scrollEndSelection = 0;
                queriedLogData = null;
                queriedStringData = null;
                totalItemCount = 0;
@@ -487,7 +517,7 @@ public abstract class DAWindowingTableComposite extends DATableComposite {
                int selectionIndex = SqlManager.getInstance().getSelectionIndex(
                                getDBTableName(), getTimeColumnName(), selectionStartTime,
                                getSelectQueryCountOption());
-               scrollbar.setSelection(selectionIndex - 1);
+               vScrollbar.setSelection(selectionIndex - 1);
        }
 
        public void setDataType(boolean isLogData, int timeColumnIndex) {
@@ -498,6 +528,7 @@ public abstract class DAWindowingTableComposite extends DATableComposite {
        public int getScrollSelectionIndex(int selection) {
                return 1;
        }
+
        public int searchString(FindProperty findProperty) {
                return -1;
        }
index 151df64..f1f40b3 100644 (file)
@@ -102,7 +102,8 @@ public class WindowingTableColumnSizePackListener implements ControlListener {
                        }
                }
                tableComp.setColumnSize(columnSizes);
-               this.tableComp.updateTableLength();
-               this.tableComp.updateTable();
+               tableComp.updateTableLength();
+               tableComp.updateHScrollBar(rect.width);
+               tableComp.updateTable();
        }
 }