import org.eclipse.swt.events.PaintListener;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.layout.FormAttachment;
System.arraycopy(selection, i+1, newSelection, i, length - i - 1);
}
selection = newSelection;
- rearrange(index);
+ rearrangeItems(index);
showSelection();
break;
}
public void deselect(int[] indices) {}
public void deselectAll() {
+ deselectAll(false);
+ }
+
+ private void deselectAll(boolean needRearrange) {
checkWidget();
selection = EMPTY_SELECTION;
- rearrange(-1);
+ if (needRearrange) {
+ lastSelectedIndex = -1;
+ rearrangeItems(-1);
+ }
}
-
public void select(int index) {
checkWidget();
if (index >= 0 && index < itemCount) {
int length = indices.length;
if (length != 0 && ((getStyle() & SWT.SINGLE) == 0
|| length <= 1)) {
- // for (int i = length - 1; i >= 0; --i) {
- // select(indices[i]);
- // }
for (int i = 0; i < length; i++) {
select(indices[i]);
}
return result;
}
- private void rearrange(int selectedIndex) {
+ private void rearrangeItems(int selectedIndex) {
if (isCheck) {
if (selection.length != itemCount) {
checkBox.setSelection(false);
setFocusIndex(index);
}
- rearrange(index);
+ rearrangeItems(index);
}
public void setSelection(int start, int end) {
setFocusIndex(Math.max(0, start));
}
- rearrange(start);
+ rearrangeItems(start);
}
public void setSelection(TableItem item) {
setFocusIndex(indices[0]);
}
- rearrange(indices[0]);
+ rearrangeItems(indices[0]);
}
public void setSelection(TableItem[] items) {}
}
setSelection(newSelection);
} else {
- deselectAll();
+ deselectAll(true);
}
}
if (this.isSelected(index)) {
if (selection.length == 1) {
this.deselect(index);
- int[] newSelection = new int[selection.length];
- System.arraycopy(selection, 0, newSelection, 0, selection.length);
- setSelection(newSelection);
} else {
this.deselect(index);
int[] newSelection = new int[selection.length];
}
adjustItemIndices( index );
- // adjust the selection indices
- /*
- for( int i = 0; i < selection.length; i++ ) {
- if( selection[ i ] >= index ) {
- selection[ i ] = selection[ i ] + 1;
- }
- }
- */
+
// advance focusIndex when an item is inserted before the focused item
if( index <= focusIndex ) {
focusIndex++;
hHint = 0;
}
- int width = 0;
- int height = 0;
- if( columns.size() > 0 ) {
- for (TableColumn colum : columns) {
- width += colum.getWidth();
- }
- } else {
- //width = getItemsPreferredWidth( 0 );
- }
- height += getHeaderHeight();
- //TODO: item height is fixed
- height += getItemCount() * getItemHeight();
+ computeTableSize();
+ int width = this.tableWidth;
+ int height = this.tableHeight;
+
if( width == 0) {
width = DEFAULT_WIDTH;
}
if(height == 0) {
height = DEFAULT_HEIGHT;
}
- if(wHint > 0) {
+ if(wHint > 0 && wHint > width) {
width = wHint;
}
- if(hHint > 0) {
+ if(hHint > 0 && hHint > height) {
height = hHint;
}
int border = getBorderWidth();
return new Point( width, height );
}
- private int getHeaderHeight() {
- checkWidget();
- int result = 0;
- if(headerVisible) {
- Font headerFont = FontResources.COLUMN_FONT; // TODO
- int textHeight = (int)TextSizeUtil.getCharHeight(headerFont);
- int imageHeight = 0;
- for(int i = 0; i < columns.size(); i++) {
- TableColumn column = columns.get(i);
- /*
- if(column.getText().contains("\n")) {
- int columnTextHeight = TextSizeUtil.textExtent( headerFont, column.getText(), 0 ).y;
- textHeight = Math.max( textHeight, columnTextHeight );
- }
- */
- Image image = column.getImage();
- int height = image == null ? 0 : image.getBounds().height;
- if(height > imageHeight) {
- imageHeight = height;
- }
- }
- result = Math.max(textHeight, imageHeight);
- result = Math.max(result, columnHeight);
- }
- return result;
- }
-
public boolean getHeaderVisible() {
checkWidget();
return headerVisible;
}
private void adjustTopIndex() {
- // int visibleItemCount = getVisibleItemCount(false);
int visibleItemCount = 0;
int correction = visibleItemCount == 0 ? 1 : 0;
if (topIndex > itemCount - visibleItemCount - correction) {
int getCheckBoxWidth() {
return checkBoxWidth;
}
- /*
- public Point getCheckSize() {
- return new Point(0, 0);
- }
- public Point getCheckSize(int index) {
- if (index == 0 && getColumnCount() == 0) {
- return getCheckSize();
- } else {
- int[] columnOrder = getColumnOrder();
- if(columnOrder[0] == index) {
- return getCheckSize();
- }
- }
- return new Point(0, 0);
- }
- */
public boolean hasColumnImages(int index) {
return columns.get(index).getImage() == null ? false : true;
}
public int getItemHeight() {
checkWidget();
- /*
- int result = -1; //customItemHeight;
- if (result == -1) {
- int textHeight = (int)TextSizeUtil.getCharHeight(getFont());
- int imageHeight = getItemImageSize().y;
- result = Math.max(imageHeight, textHeight) + getCellPadding().height;
- result = Math.max(itemHeight, result);
- // TODO check style
- }
- return result;
- */
return itemHeight;
}
if (headerVisible) {
gc.setBackground(ColorResources.COLUMN_BG_COLOR);
Rectangle columnRect = new Rectangle(0, 0, rect.width, columnHeight);
- gc.setClipping(columnRect);
gc.fillRectangle(columnRect);
if (isCheck) {
checkBox.setBounds(0, 0, checkBoxWidth - 1, columnHeight);
int height = getItemHeight();
for (int i = 0; top < rect.height; i++, top += height) {
Rectangle drawingRect = new Rectangle(0, top, rect.width, height);
- //gc.setClipping(drawingRect);
if ((i%2) == 0) {
gc.setBackground(ColorResources.ITEM_BG_COLOR_EVEN);
} else {
gc.setBackground(ColorResources.ITEM_BG_COLOR_ODD);
}
- //gc.fillRectangle(drawingRect);
- gc.drawRectangle(drawingRect);
+ gc.fillRectangle(drawingRect);
}
gc.setForeground(ColorResources.DEFAULT_STROKE);
gc.setLineWidth(1);
int leftOffset = isCheck ? checkBoxWidth : 0;
- //gc.setClipping(rect);
if (isCheck) {
gc.drawLine(checkBoxWidth -1, 0, checkBoxWidth - 1, rect.height);
}
}
}
newItems[j + 1] = items[i];
- // for (int j = 0; j < i; j++) {
- // if (items[j] == null) {
- // continue;
- // }
- // String value2 = items[j].getText(index);
- // boolean needSort = false;
- // int compare = collator.compare(value1, value2);
- // if (compare > 0 && dir == SWT.UP) {
- // needSort = true;
- // } else if (compare < 0 && dir == SWT.DOWN){
- // needSort = true;
- // }
-
- // if (needSort) {
- // TableItem item = items[i];
- // TableItem[] newItems = new TableItem[itemCount];
- // if (j > 0) {
- // System.arraycopy(items, 0, newItems, 0, j);
- // }
- // System.arraycopy(items, j, newItems,j+1, i - j);
- // System.arraycopy(items, i + 1, newItems, i + 1, itemCount - i - 1);
- // newItems[j] = item;
- // items = newItems;
- // adjustItemIndices(0);
- // }
}
adjustItemIndices(0);
@Override
public void controlMoved(ControlEvent e) {
int left = getLeft();
- Rectangle rect = new Rectangle(left, 0, width, parent.getColumnHeightSize());
- setBounds(rect);
+ setLocation(left, 0);
}
@Override
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Canvas;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Listener;
-public class TableItem extends Canvas {
- private static final class Data {
- String text = "";
- Image image;
- private Image selectedImage;
- Font font;
- Color backgroundColor;
- Color foregroundColor;
+class TableItemData {
+ String text = "";
+ Image image;
+ Image selectedImage;
+ Font font;
+ Color backgroundColor;
+ Color foregroundColor;
- int textWidth = -1;
- boolean needRedrawingText = true;
- String drawingText = "";
- }
+ // for drawing table item
+ int textWidth = -1;
+ boolean needRedrawingText = true;
+ String drawingText = "";
+
+ TableItemCell itemCanvas;
+}
+public class TableItem extends Canvas {
private Table parent;
- private Data[] dataList;
+ private TableItemData[] dataList;
private Font font;
private Color background;
private Color selectedBackground;
this.parent = parent;
this.index = index;
+ makeTableItemCanvas();
+
parent.createItem(this, index);
setFont(FontResources.ITEM_FONT);
}
private void addListeners() {
- this.addListener(SWT.MouseDown, mouseEventListener);
+ //this.addListener(SWT.MouseDown, mouseEventListener);
this.addControlListener(controlListener);
this.addPaintListener(paintListener);
if (parent.isChecked()) {
}
}
+ private void makeTableItemCanvas() {
+ int count = parent.getColumnCount();
+ for (int i = 0; i < count; i++) {
+ ensureData(i, count);
+ dataList[i].itemCanvas = new TableItemCell(this, i);
+ }
+ }
+
@Override
public Table getParent() {
checkWidget();
return getBackground();
}
+ Color getSelectedBackground() {
+ checkWidget();
+ if (!parent.checkData(this, parent.indexOf(this))) {
+ SWT.error(SWT.ERROR_WIDGET_DISPOSED);
+ }
+ if (selectedBackground == null) {
+ return getBackground();
+ } else {
+ return this.selectedBackground;
+ }
+ }
+
@Override
public void setFont(Font font) {
checkWidget();
int count = Math.max(1, parent.getColumnCount());
if (index >= 0 && index < count) {
ensureData(index, count);
- Data data = dataList[index];
+ TableItemData data = dataList[index];
if (!equals(font, data.font)) {
data.font = font;
data.textWidth = -1;
return getForeground();
}
+ public Color getSelectedForground() {
+ checkWidget();
+ if (!parent.checkData(this, parent.indexOf(this))) {
+ SWT.error(SWT.ERROR_WIDGET_DISPOSED);
+ }
+ if (selectedForeground == null) {
+ return getForeground();
+ } else {
+ return this.selectedForeground;
+ }
+ }
+
public void setChecked(boolean checked) {
checkWidget();
if ((parent.getStyle() & SWT.CHECK) != 0) {
}
/**
- *
+ *
* @return the grayed state of the check box
*/
public boolean getGrayed() {
if (index >= 0 && index < count) {
ensureData(index, count);
if (!equals(dataList[index].image, image)) {
- //parent.updateColumnImageCount(index, dataList[index].image, image);
dataList[index].image = image;
- //parent.updateImageImageSize(image);
if (parent.getColumnCount() == 0) {
parent.updateScrollBars(true);
}
final void shiftData(int index) {
if (dataList != null && dataList.length > index
&& parent.getColumnCount() > 1) {
- Data[] newDataList = new Data[dataList.length + 1];
+ TableItemData[] newDataList = new TableItemData[dataList.length + 1];
System.arraycopy(dataList, 0, newDataList, 0, index);
int offset = dataList.length - index;
System.arraycopy(dataList, index, newDataList, index + 1, offset);
final void removeData(int index) {
if (dataList != null && dataList.length > index
&& parent.getColumnCount() > 1) {
- Data[] newDataList = new Data[dataList.length - 1];
+ TableItemData[] newDataList = new TableItemData[dataList.length - 1];
System.arraycopy(dataList, 0, newDataList, 0, index);
int offset = dataList.length - index - 1;
System.arraycopy(dataList, index + 1, newDataList, index, offset);
if (index == 0 && columnCount == 0) {
result = parent.getLeftOffset();
} else if (index >= 0 && index < columnCount){
- int columnLeft = parent.getColumn(index).getLeft();
- result = columnLeft - parent.getColumnLeftOffset(index);
+ result = parent.getColumn(index).getLeft();
}
return result;
}
private int getTextWidth(int index, Font font) {
if (hasData(index)) {
- Data data = dataList[index];
+ TableItemData data = dataList[index];
if (data.textWidth == -1) {
data.textWidth
= TextSizeUtil.stringExtend(font, data.text);
private void clearTextWidth() {
if (dataList != null) {
- for (Data data : dataList) {
+ for (TableItemData data : dataList) {
if (data != null) {
data.textWidth = -1;
}
private void ensureData(int index, int columnCount) {
if (dataList == null) {
- dataList = new Data[columnCount];
+ dataList = new TableItemData[columnCount];
} else if (dataList.length < columnCount) {
- Data[] newDataList = new Data[columnCount];
+ TableItemData[] newDataList = new TableItemData[columnCount];
System.arraycopy(dataList, 0, newDataList, 0, dataList.length);
dataList = newDataList;
}
if (dataList[index] == null) {
- dataList[index] = new Data();
+ dataList[index] = new TableItemData();
}
}
&& index < dataList.length && dataList[index] != null;
}
+ TableItemData getData(int index) {
+ if (index < 0 || index >= dataList.length) {
+ return null;
+ }
+ return dataList[index];
+ }
private static Table checkNull (Table control) {
if (control == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
return control;
width = Math.max(width, parent.getWidth());
int top = getTop(index);
- setBounds(new Rectangle(0, top, width, getHeight()));
+ int height = getHeight();
+
+ setBounds(new Rectangle(0, top, width, height));
+
+ // set bounds to table item cell
+ for (int i = 0; i < parent.getColumnCount(); i++) {
+ TableItemData data = dataList[i];
+ Rectangle rect = getBounds(i);
+ data.itemCanvas.setBounds(rect.x, 0, rect.width, rect.height);
+ }
}
protected ControlListener controlListener = new ControlListener() {
}
};
- protected Listener mouseEventListener = new Listener() {
-
- @Override
- public void handleEvent(Event event) {
- switch(event.type) {
- /*
- case SWT.MouseEnter:
- isHoverState = true;
- redraw();
- break;
- case SWT.MouseExit:
- isHoverState = false;
- redraw();
- break;
- */
- case SWT.MouseDown:
- parent.setFocus();
- parent._select(index);
- break;
- default:
- break;
- }
- }
-
- };
+// protected Listener mouseEventListener = new Listener() {
+//
+// @Override
+// public void handleEvent(Event event) {
+// switch(event.type) {
+// /*
+// case SWT.MouseEnter:
+// isHoverState = true;
+// redraw();
+// break;
+// case SWT.MouseExit:
+// isHoverState = false;
+// redraw();
+// break;
+// */
+// case SWT.MouseDown:
+// parent.setFocus();
+// parent._select(index);
+// break;
+// default:
+// break;
+// }
+// }
+// };
- private Rectangle clientArea;
protected PaintListener paintListener = new PaintListener() {
@Override
public void paintControl(PaintEvent e) {
- clientArea = ((Canvas)e.widget).getClientArea();
+ Rectangle clientArea = ((Canvas)e.widget).getClientArea();
GC gc = e.gc;
isSelected = parent.isSelected(index);
if (isSelected) {
if (parent.isChecked()) {
drawCheckBox(e);
}
-
- int leftOffset = parent.isChecked() ? parent.getCheckBoxWidth() : 0;
- drawItem(e, 0, leftOffset);
- for (int i = 1; i < parent.getColumnCount(); i++) {
- leftOffset += getBounds(i-1).width;
- drawItem(e, i, leftOffset);
- }
}
};
private void drawCheckBox(PaintEvent e) {
- if (clientArea == null) {
- return;
- }
GC gc = e.gc;
+ Rectangle clientArea = ((Canvas)e.widget).getClientArea();
int width = parent.getCheckBoxWidth();
Rectangle drawingRect = new Rectangle(clientArea.x, clientArea.y, width, clientArea.height);
- gc.setClipping(drawingRect);
checkBox.setBounds(drawingRect.x, drawingRect.y, width - 1, drawingRect.height);
if (isSelected) {
gc.setLineWidth(1);
gc.drawLine(width - 1, 0, width - 1, clientArea.height);
}
-
- private void drawItem(PaintEvent e, int index, int leftOffset) {
- if (clientArea == null) {
- return;
- }
- GC gc = e.gc;
- int width = getBounds(index).width;
- Rectangle drawingRect = new Rectangle(clientArea.x + leftOffset, clientArea.y, width, clientArea.height);
- gc.setClipping(drawingRect);
-
- if (dataList[index] != null) {
- int imageX = clientArea.x;
- int textX = clientArea.x;
- int imageY = 0;
- int textY = 0;
-
- Point imageEX = new Point(0, 0);
- Image image = null;
- if (isSelected && parent.getSelectionCount() == 1) {
- image = getSelectedImage(index);
- } else {
- image = getImage(index);
- }
- if (image != null) {
- imageEX = new Point(image.getImageData().width,
- image.getImageData().height);
- }
-
- String drawingText = dataList[index].drawingText;
- if (dataList[index].needRedrawingText) {
- drawingText = getText(index);
- int textWidth = TextSizeUtil.textExtent(getFont(), drawingText);
- if (textWidth > (drawingRect.width - imageEX.x - 10)) {
- while((textWidth > (drawingRect.width - 10) - TextSizeUtil.OMITLEN)
- && drawingText.length() > 1) {
- drawingText = drawingText.substring(0, drawingText.length() - 1);
- textWidth = TextSizeUtil.textExtent(getFont(), drawingText);
- }
- drawingText = drawingText + TextSizeUtil.OMIT;
- }
- dataList[index].needRedrawingText = false;
- dataList[index].drawingText = drawingText;
- }
-
- int textWidth = TextSizeUtil.textExtent(getFont(), drawingText);
- switch(parent.getColumn(index).getAlignment()) {
- case SWT.LEFT:
- imageX += (image != null
- ? leftOffset + 5
- : leftOffset + 5);
- textX += imageX + imageEX.x + 5;
- break;
- case SWT.RIGHT:
- imageX += (image != null
- ? leftOffset + drawingRect.width - imageEX.x -2 - textWidth - 10
- : leftOffset + drawingRect.width - textWidth - 10);
- textX += imageX + imageEX.x + 5;
- break;
- case SWT.CENTER:
- imageX += (image != null
- ? leftOffset + (drawingRect.width - image.getImageData().width - textWidth) / 2
- : leftOffset + (drawingRect.width - textWidth) / 2);
- textX += imageX + imageEX.x;
- break;
- default:
- }
-
- if (image != null) {
- imageY = drawingRect.y + ((drawingRect.height - image.getImageData().height)/2);
- gc.drawImage(image, imageX, imageY);
- }
-
- if (getText(index) != null && !getText(index).isEmpty()) {
- gc.setFont(font);
- textY = drawingRect.y + (drawingRect.height - gc.getFontMetrics().getHeight())/2 - 1;
- gc.setForeground(isSelected ? selectedForeground : foreground);
- gc.drawText(drawingText, textX, textY);
- }
- }
- gc.setForeground(ColorResources.DEFAULT_STROKE);
- gc.setLineWidth(1);
- gc.drawLine(leftOffset + width - 1, 0, leftOffset + width -1, drawingRect.height);
- }
}
--- /dev/null
+/*
+ * Emulator Manager
+ *
+ * Copyright (C) 2015 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * JiHye Kim <jihye424.kim@samsung.com>
+ * Minkee Lee <minkee.lee@samsung.com>
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ * Sangho Park <sangho1206.park@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+package org.tizen.emulator.manager.ui.table;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.PaintEvent;
+import org.eclipse.swt.events.PaintListener;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+
+
+class TableItemCell extends Composite {
+ private TableItem item;
+ // table column index
+ private int index;
+
+ public TableItemCell(TableItem tableItem, int index) {
+ super(tableItem, SWT.DOUBLE_BUFFERED);
+
+ this.item = tableItem;
+ this.index = index;
+
+ this.addPaintListener(patinListener);
+ this.addListener(SWT.MouseDown, eventListener);
+ }
+
+ private Listener eventListener = new Listener() {
+ @Override
+ public void handleEvent(Event event) {
+ switch(event.type) {
+ case SWT.MouseDown:
+ item.getParent()._select(item.getIndex());
+ break;
+ default:
+ break;
+ }
+ }
+ };
+
+ private PaintListener patinListener = new PaintListener() {
+ @Override
+ public void paintControl(PaintEvent e) {
+ TableItemData data = item.getData(index);
+ if (data == null) {
+ return;
+ }
+
+ GC gc = e.gc;
+ Rectangle rect = ((Composite)e.widget).getClientArea();
+
+ int imageX = rect.x;
+ int textX = rect.x;
+ int imageY = rect.y;
+ int textY = rect.y;
+
+ Point imageSize = new Point(0, 0);
+ Image image = null;
+ boolean isSelected = item.getParent().isSelected(item.getIndex());
+
+ if (isSelected) {
+ if (item.getParent().getSelectionCount() == 1) {
+ image = item.getSelectedImage(index);
+ } else {
+ image = item.getImage(index);
+ }
+ gc.setBackground(item.getSelectedBackground());
+ } else {
+ image = item.getImage(index);
+ gc.setBackground(item.getBackground());
+ }
+
+ gc.fillRectangle(rect.x, rect.y, rect.width, rect.height);
+
+ if (image != null) {
+ imageSize = new Point(image.getImageData().width,
+ image.getImageData().height);
+ }
+
+ String drawingText = data.drawingText;
+ if (data.needRedrawingText) {
+ drawingText = item.getText(index);
+ int textWidth = TextSizeUtil.textExtent(getFont(), drawingText);
+ if (textWidth > (rect.width - imageSize.x - 10)) {
+ while((textWidth > (rect.width - 10) - TextSizeUtil.OMITLEN)
+ && drawingText.length() > 1) {
+ drawingText = drawingText.substring(0, drawingText.length() - 1);
+ textWidth = TextSizeUtil.textExtent(getFont(), drawingText);
+ }
+ drawingText = drawingText + TextSizeUtil.OMIT;
+ }
+ data.needRedrawingText = false;
+ data.drawingText = drawingText;
+ data.textWidth = TextSizeUtil.textExtent(getFont(), drawingText);
+ }
+
+ switch(item.getParent().getColumn(index).getAlignment()) {
+ case SWT.LEFT:
+ imageX += (image != null ? 5 : 0);
+ textX += imageX + imageSize.x + 5;
+ break;
+ case SWT.RIGHT:
+ imageX += (image != null
+ ? rect.width - imageSize.x - data.textWidth - 10
+ : rect.width - data.textWidth - 10);
+ textX += imageX + imageSize.x + 5;
+ break;
+ case SWT.CENTER:
+ imageX += (image != null
+ ? (rect.width - imageSize.x - data.textWidth) / 2 + 5
+ : (rect.width - data.textWidth) / 2) - 5;
+ textX += imageX + imageSize.x + 5;
+ break;
+ default:
+ }
+
+ if (image != null) {
+ imageY = rect.y + ((rect.height - imageSize.y)/2);
+ gc.drawImage(image, imageX, imageY);
+ }
+
+ if (data.text != null && !data.text.isEmpty()) {
+ gc.setFont(item.getFont(index));
+ textY = rect.y + (rect.height - gc.getFontMetrics().getHeight())/2 - 1;
+ gc.setForeground(isSelected ? item.getSelectedForground(): item.getForeground());
+ gc.drawText(drawingText, textX, textY);
+ }
+
+ gc.setForeground(ColorResources.DEFAULT_STROKE);
+ gc.setLineWidth(1);
+ gc.drawLine(rect.width - 1, 0, rect.width -1, rect.height);
+ }
+
+
+ };
+}