From: jihye424.kim Date: Wed, 21 Oct 2015 03:55:20 +0000 (+0900) Subject: Table: fixed bug X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=86ae1e14d3730b6171c8dde18ba27ea027d3720b;p=sdk%2Femulator%2Femulator-manager.git Table: fixed bug - fixed insert error -- error: if new table item has same index as selected item index, throw index out of bounds exception when copy selection array -- cause: table item set item index itself before creaetd by table so items had same index are two...so throw exception -- solution: table item does not set index itself, only table set item index - fixed select table item error -- error: when select table item..you can see parts that not drawing -- cause: table item and table have different width if table width has been changed, table item width has not changed.. -- solution: when table width has been changed, also change table item width Change-Id: I2e30e145bee5ec0bb2844da91c993fdaee94cb90 Signed-off-by: jihye424.kim --- diff --git a/src/org/tizen/emulator/manager/ui/table/Table.java b/src/org/tizen/emulator/manager/ui/table/Table.java index 387f5a4..3a9ef1e 100644 --- a/src/org/tizen/emulator/manager/ui/table/Table.java +++ b/src/org/tizen/emulator/manager/ui/table/Table.java @@ -894,11 +894,11 @@ public class Table extends TableScrolledComposite { items[index] = item; itemCount++; - if (itemCount == 1 &&isCheck) { + if (itemCount == 1 && isCheck) { checkBox.setEnabled(true); } - adjustItemIndices( index ); + adjustItemIndices(index); // advance focusIndex when an item is inserted before the focused item if( index <= focusIndex ) { @@ -1069,6 +1069,7 @@ public class Table extends TableScrolledComposite { } setTableSize(); + } void computeTableSize() { @@ -1098,14 +1099,25 @@ public class Table extends TableScrolledComposite { if (hVisible) { tableHeight += this.getScrollBarWidth(); } - int width = Math.max(tableWidth, rect.width); - int height = Math.max(tableHeight, rect.height); + tableWidth = Math.max(tableWidth, rect.width); + tableHeight = Math.max(tableHeight, rect.height); + + table.setSize(tableWidth, tableHeight); + + if (tableColumn.getBounds().width != tableWidth) { + tableColumn.setBounds(0, 0, tableWidth, columnHeight); + } - table.setSize(width, height); - tableColumn.setBounds(0, 0, width, columnHeight); - tableItem.setBounds(0, columnHeight, width, height - columnHeight); + if (tableItem.getBounds().width != tableWidth) { + tableItem.setBounds(0, columnHeight, tableWidth, tableHeight - columnHeight); + for (TableItem item : items) { + if (item != null) { + item.updateSizeAndLocation(-1); + } + } + } - if (rect.width == width && rect.height == height) { + if (rect.width == tableWidth && rect.height == tableHeight) { redraw(); } @@ -1231,7 +1243,7 @@ public class Table extends TableScrolledComposite { // for table item int getTableWidth() { - return table.getSize().x; + return tableWidth; } public void showColumn(TableColumn column) {} @@ -1280,7 +1292,6 @@ public class Table extends TableScrolledComposite { @Override public void paintControl(PaintEvent e) { Rectangle rect= ((Composite)e.widget).getClientArea(); - GC gc = e.gc; int top = 0; int height = getItemHeight(); diff --git a/src/org/tizen/emulator/manager/ui/table/TableItem.java b/src/org/tizen/emulator/manager/ui/table/TableItem.java index 7c1a352..3695519 100644 --- a/src/org/tizen/emulator/manager/ui/table/TableItem.java +++ b/src/org/tizen/emulator/manager/ui/table/TableItem.java @@ -77,7 +77,7 @@ public class TableItem extends Canvas { private boolean checked; private boolean grayed; - private int index; + private int index = -1; //private boolean isHoverState = false; private boolean isSelected = false; @@ -91,7 +91,7 @@ public class TableItem extends Canvas { public TableItem(final Table parent, int style, int index) { super(parent.tableItem, style); this.parent = parent; - this.index = index; + //this.index = index; makeTableItemCanvas(); @@ -544,11 +544,6 @@ public class TableItem extends Canvas { } } - @Override - public Rectangle getBounds() { - return getBounds(0); - } - public Rectangle getBounds(int index) { checkWidget(); if (!parent.checkData(this, parent.indexOf(this))) { @@ -840,6 +835,10 @@ public class TableItem extends Canvas { width += parent.getColumn(i).getWidth(); } + if (parent.isChecked()) { + width += parent.getCheckBoxWidth(); + } + width = Math.max(width, parent.getTableWidth()); int top = getTop(index); int height = getHeight();