table: redraw table item view background
authorjihye424.kim <jihye424.kim@samsung.com>
Mon, 23 Nov 2015 02:25:04 +0000 (11:25 +0900)
committerSeokYeon Hwang <syeon.hwang@samsung.com>
Mon, 23 Nov 2015 05:00:28 +0000 (14:00 +0900)
- redraw table item view background when changed table item height

Change-Id: I3eeae3b1977adcc398a90d5cf932e2d71a606b96
Signed-off-by: jihye424.kim <jihye424.kim@samsung.com>
src/org/tizen/emulator/manager/ui/table/Table.java

index 5a66190..1700f98 100644 (file)
@@ -51,7 +51,6 @@ import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Event;
 import org.eclipse.swt.widgets.Listener;
 import org.eclipse.swt.widgets.TypedListener;
-import org.tizen.emulator.manager.EmulatorManager;
 
 public class Table extends TableScrolledComposite {
        private static final int[] EMPTY_SELECTION = new int[0];
@@ -1103,10 +1102,8 @@ public class Table extends TableScrolledComposite {
                        redraw();
                }
 
-               if (EmulatorManager.isWin()) {
-                       tableColumn.redraw();
-                       tableItem.redraw();
-               }
+               tableColumn.redraw();
+               tableItem.redraw();
 
                this.layout();
        }
@@ -1279,9 +1276,19 @@ public class Table extends TableScrolledComposite {
                        GC gc = e.gc;
                        int top = 0;
                        int height = getItemHeight();
-                       for (int i = 0; top < rect.height; i++, top += height) {
+                       int itemCount = getItemCount();
+                       if (itemCount > 0) {
+                               if (selection.length == 1) {
+                                       top = selectedItemHeight;
+                                       top += height * (itemCount-1);
+                               } else {
+                                       top += height * itemCount;
+                               }
+                       }
+
+                       for (;top < rect.height; itemCount++, top += height) {
                                Rectangle drawingRect = new Rectangle(0, top, rect.width, height);
-                               if ((i%2) == 0) {
+                               if ((itemCount%2) == 0) {
                                        gc.setBackground(ColorResources.ITEM_BG_COLOR_EVEN);
                                } else {
                                        gc.setBackground(ColorResources.ITEM_BG_COLOR_ODD);