From: jihye424.kim Date: Wed, 16 Sep 2015 08:44:26 +0000 (+0900) Subject: Table: modified for windows os X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=93783b10d5f1655751ad99d6c740a69516106db3;p=sdk%2Femulator%2Femulator-manager.git Table: modified for windows os - add Hyperlink background (black) - add redraw() to table Change-Id: Ibadbb32c4329041f64cf6ee0bdaade1bd1138e1e Signed-off-by: jihye424.kim --- diff --git a/src/org/tizen/emulator/manager/ui/renewal/widgets/Hyperlink.java b/src/org/tizen/emulator/manager/ui/renewal/widgets/Hyperlink.java index 72c1b55..ab994b6 100644 --- a/src/org/tizen/emulator/manager/ui/renewal/widgets/Hyperlink.java +++ b/src/org/tizen/emulator/manager/ui/renewal/widgets/Hyperlink.java @@ -43,6 +43,7 @@ import org.eclipse.swt.widgets.Canvas; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Event; +import org.tizen.emulator.manager.renewal.resources.ColorResources; public class Hyperlink extends Canvas { private String text = ""; @@ -54,6 +55,8 @@ public class Hyperlink extends Canvas { this.addPaintListener(paintListener); this.addMouseListener(mouseListener); this.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE)); + // TODO + this.setBackground(ColorResources.BLACK.getColor()); focusBoxColor = Display.getCurrent().getSystemColor(SWT.COLOR_GRAY); } diff --git a/src/org/tizen/emulator/manager/ui/table/FontResources.java b/src/org/tizen/emulator/manager/ui/table/FontResources.java index 63660f5..747a6a8 100644 --- a/src/org/tizen/emulator/manager/ui/table/FontResources.java +++ b/src/org/tizen/emulator/manager/ui/table/FontResources.java @@ -34,24 +34,11 @@ import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.Font; import org.eclipse.swt.graphics.FontData; import org.eclipse.swt.widgets.Display; +import org.tizen.emulator.manager.EmulatorManager; public class FontResources { - public static Font COLUMN_FONT = setSizeDefaultFont(12); - public static Font ITEM_FONT = setSizeDefaultFont(11); - - private static boolean isMac = false; - private static boolean isWin = false; - private static boolean isLinux = false; - static { - - if (System.getProperty("os.name").toLowerCase().indexOf("linux") > -1) { - isLinux = true; - } else if (System.getProperty("os.name").toLowerCase().indexOf("win") > -1) { - isWin = true; - } else if (System.getProperty("os.name").toLowerCase().indexOf("mac") > -1) { - isMac = true; - } - } + public static Font COLUMN_FONT = setSizeDefaultFont(11); + public static Font ITEM_FONT = setSizeDefaultFont(10); private static Font defaultFont = null; @@ -62,17 +49,17 @@ public class FontResources { public static Font getDADefaultFont() { if (defaultFont == null) { String fontName = null; - if (isLinux) { + if (EmulatorManager.isLinux()) { fontName = "Dejavu Sans"; - } else if (isWin) { + } else if (EmulatorManager.isWin()) { fontName = "Verdana"; - } else if (isMac) { + } else if (EmulatorManager.isMac()) { fontName = "Lucida Grande"; } else { defaultFont = Display.getCurrent().getSystemFont(); return defaultFont; } - defaultFont = isMac + defaultFont = EmulatorManager.isMac() ? new Font(Display.getCurrent(), new FontData[] { new FontData(fontName, 11, SWT.NORMAL) }) : new Font(Display.getCurrent(), new FontData[] { new FontData(fontName, 9, SWT.NORMAL) }); } @@ -85,7 +72,7 @@ public class FontResources { defaultFont = getDADefaultFont(); } - if (isMac) { + if (EmulatorManager.isMac()) { size = size + 2; } @@ -112,7 +99,7 @@ public class FontResources { defaultFont = getDADefaultFont(); } - if (isMac) { + if (EmulatorManager.isMac()) { size = size + 2; } diff --git a/src/org/tizen/emulator/manager/ui/table/Table.java b/src/org/tizen/emulator/manager/ui/table/Table.java index 1b8469d..ba37f59 100644 --- a/src/org/tizen/emulator/manager/ui/table/Table.java +++ b/src/org/tizen/emulator/manager/ui/table/Table.java @@ -52,6 +52,7 @@ 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]; @@ -102,7 +103,7 @@ public class Table extends TableScrolledComposite { tableColumn = new Composite(table, SWT.None); - tableItem = new Composite(table, SWT.NONE); + tableItem = new Composite(table, SWT.DOUBLE_BUFFERED); tableItem.setBackground(ColorResources.ITEM_SELECTED_BG_COLOR); this.setTableItemContent(tableItem); @@ -178,6 +179,7 @@ public class Table extends TableScrolledComposite { items = new TableItem[4]; itemCount = 0; selection = EMPTY_SELECTION; + lastSelectedIndex = -1; if (isCheck) { checkBox.setSelection(false); checkBox.setEnabled(false); @@ -300,12 +302,16 @@ public class Table extends TableScrolledComposite { for (int i = 0; i < selection.length; i++) { if (index == selection[i]) { int length = selection.length; - int[] newSelection = new int[length - 1]; - System.arraycopy(selection, 0, newSelection, 0, i); - if (i < length - 1) { - System.arraycopy(selection, i+1, newSelection, i, length - i - 1); + if (length == 1) { + selection = EMPTY_SELECTION; + } else { + int[] newSelection = new int[length - 1]; + System.arraycopy(selection, 0, newSelection, 0, i); + if (i < length - 1) { + System.arraycopy(selection, i+1, newSelection, i, length - i - 1); + } + selection = newSelection; } - selection = newSelection; rearrangeItems(index); showSelection(); break; @@ -1081,11 +1087,17 @@ public class Table extends TableScrolledComposite { int height = Math.max(tableHeight, rect.height); table.setSize(width, height); + tableColumn.setBounds(0, 0, width, columnHeight); + tableItem.setBounds(0, columnHeight, width, height - columnHeight); + if (rect.width == width && rect.height == height) { redraw(); } - tableColumn.setBounds(0, 0, width, columnHeight); - tableItem.setBounds(0, columnHeight, width, height - columnHeight); + + if (EmulatorManager.isWin()) { + tableColumn.redraw(); + tableItem.redraw(); + } } public int getColumnHeightSize() { diff --git a/src/org/tizen/emulator/manager/ui/table/TableItem.java b/src/org/tizen/emulator/manager/ui/table/TableItem.java index 1c10e7b..ed8af56 100644 --- a/src/org/tizen/emulator/manager/ui/table/TableItem.java +++ b/src/org/tizen/emulator/manager/ui/table/TableItem.java @@ -43,6 +43,7 @@ import org.eclipse.swt.graphics.GC; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.graphics.Rectangle; import org.eclipse.swt.widgets.Canvas; +import org.tizen.emulator.manager.EmulatorManager; class TableItemData { String text = ""; @@ -913,4 +914,25 @@ public class TableItem extends Canvas { gc.setLineWidth(1); gc.drawLine(width - 1, 0, width - 1, clientArea.height); } + + @Override + public void redraw() { + super.redraw(); + if (!EmulatorManager.isWin()) { + return; + } + + if (parent.isChecked() && checkBox != null) { + checkBox.redraw(); + } + + if (dataList != null) { + for (TableItemData data : dataList) { + if (data == null) { + continue; + } + data.itemCanvas.redraw(); + } + } + } }