From: minkee.lee Date: Fri, 18 Sep 2015 09:44:36 +0000 (+0900) Subject: VM-modify: add profile, image item to modify dialog. X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7adfd0f1bda4ff18b41f92d790456cb50d874b89;p=sdk%2Femulator%2Femulator-manager.git VM-modify: add profile, image item to modify dialog. - refactoring that VMNameItem, ImageItem extends TextLabelItem. - add VMProperty to VMModifyDialog in order to give display data to each item in dialog. Change-Id: I6f353500faeeedae03881601b519f800bfca4763 Signed-off-by: minkee.lee --- diff --git a/src/org/tizen/emulator/manager/handler/renewal/VMModifyHandler.java b/src/org/tizen/emulator/manager/handler/renewal/VMModifyHandler.java index b04c850..ca1e54c 100644 --- a/src/org/tizen/emulator/manager/handler/renewal/VMModifyHandler.java +++ b/src/org/tizen/emulator/manager/handler/renewal/VMModifyHandler.java @@ -36,11 +36,11 @@ import java.util.List; import org.eclipse.swt.SWT; import org.tizen.emulator.manager.ui.renewal.MainDialog; -import org.tizen.emulator.manager.ui.renewal.detail.item.IModifyDialogItem; -import org.tizen.emulator.manager.ui.renewal.detail.item.ImageItem; -import org.tizen.emulator.manager.ui.renewal.detail.item.ProfileItem; -import org.tizen.emulator.manager.ui.renewal.detail.item.VMNameItem; import org.tizen.emulator.manager.ui.renewal.dialog.VMModifyDialog; +import org.tizen.emulator.manager.ui.renewal.item.modify.vm.ImageItem; +import org.tizen.emulator.manager.ui.renewal.item.modify.vm.ProfileItem; +import org.tizen.emulator.manager.ui.renewal.item.modify.vm.VMNameItem; +import org.tizen.emulator.manager.ui.renewal.item.modify.vm.common.IModifyDialogItem; import org.tizen.emulator.manager.vms.VMProperty; public class VMModifyHandler { @@ -49,7 +49,7 @@ public class VMModifyHandler { // open modify dialog VMModifyDialog dialog = new VMModifyDialog(MainDialog.getShell()); - dialog.create(getItemList(property)); + dialog.create(property, getItemList(property)); // TODO set display value to dialog diff --git a/src/org/tizen/emulator/manager/renewal/resources/FontResources.java b/src/org/tizen/emulator/manager/renewal/resources/FontResources.java index 7aee8ab..6c3202a 100644 --- a/src/org/tizen/emulator/manager/renewal/resources/FontResources.java +++ b/src/org/tizen/emulator/manager/renewal/resources/FontResources.java @@ -50,7 +50,7 @@ public enum FontResources { DEFAULT_FONT_10("default_font_10", resizeDefaultFont(10)), DEFAULT_FONT_9("default_font_9", resizeDefaultFont(9)); - public static FontResources DETAIL_ITEM_TITLE = DEFAULT_FONT_9; + public static FontResources MODIFY_ITEM_TITLE = DEFAULT_FONT_9; public static FontResources CONTENT = DEFAULT_FONT_9; String name; diff --git a/src/org/tizen/emulator/manager/renewal/resources/ImageResources.java b/src/org/tizen/emulator/manager/renewal/resources/ImageResources.java index a421752..be1fe1b 100644 --- a/src/org/tizen/emulator/manager/renewal/resources/ImageResources.java +++ b/src/org/tizen/emulator/manager/renewal/resources/ImageResources.java @@ -189,9 +189,22 @@ public enum ImageResources { ICON_CREATE_TV("icon_create_tv"), ICON_CREATE_WEARABLE("icon_create_wearable"), + // Modify item title icon ICON_TITLE_VMNAME("icon_title_vmname"), ICON_TITLE_IMAGE("icon_title_image"), - ICON_TITLE_PROFILE("icon_title_profile"); + ICON_TITLE_PROFILE("icon_title_profile"), + + // profile select button + BTN_PROFILE_MOBILE_SELECTED("btn_profile_mobile_selected"), + BTN_PROFILE_MOBILE_UNSELECTED_HOVER("btn_profile_mobile_unselected_hover"), + BTN_PROFILE_MOBILE_UNSELECTED_NML("btn_profile_mobile_unselected_nml"), + BTN_PROFILE_WEARABLE_SELECTED("btn_profile_wearable_selected"), + BTN_PROFILE_WEARABLE_UNSELECTED_HOVER("btn_profile_wearable_unselected_hover"), + BTN_PROFILE_WEARABLEE_UNSELECTED_NML("btn_profile_wearable_unselected_nml"), + BTN_PROFILE_TV_SELECTED("btn_profile_tv_selected"), + BTN_PROFILE_TV_UNSELECTED_HOVER("btn_profile_tv_unselected_hover"), + BTN_PROFILE_TV_UNSELECTED_NML("btn_profile_tv_unselected_nml"); + String name; Image image; diff --git a/src/org/tizen/emulator/manager/ui/renewal/detail/item/VMNameItem.java b/src/org/tizen/emulator/manager/ui/renewal/detail/item/VMNameItem.java deleted file mode 100644 index a9fd123..0000000 --- a/src/org/tizen/emulator/manager/ui/renewal/detail/item/VMNameItem.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Emulator Manager - * - * Copyright (C) 2015 Samsung Electronics Co., Ltd. All rights reserved. - * - * Contact: - * Minkee Lee - * JiHye Kim - * SeokYeon Hwang - * Sangho Park - * - * 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.renewal.detail.item; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.tizen.emulator.manager.renewal.resources.ImageResources; -import org.tizen.emulator.manager.ui.renewal.widgets.TextInputBox; - -public class VMNameItem implements IModifyDialogItem { - - private ModifyItem item; - private TextInputBox textInputBox; - - private final String TITLE = "VM Name"; - private final ImageResources TITLE_ICON_RESOURCE = ImageResources.ICON_TITLE_VMNAME; - private final int TEXT_BOX_WIDTH = 236; - private final int TEXT_BOX_HEIGHT = 23; - - - @Override - public int getHeight() { - return item.getHeight(); - } - - @Override - public void create(Composite parent) { - item = new ModifyItem(parent, TITLE, TITLE_ICON_RESOURCE); - makeBody(); - } - - private void makeBody() { - setBodyLayout(); - makeTextInputBox(); - } - - private void setBodyLayout() { - GridLayout layout = new GridLayout(); - layout.numColumns = 1; - layout.marginWidth = ModifyItem.BODY_MARGIN_LEFT; - layout.marginHeight = 0; - - item.getBody().setLayout(layout); - } - - - private void makeTextInputBox() { - // text box - GridData data = new GridData(TEXT_BOX_WIDTH, TEXT_BOX_HEIGHT); - data.verticalAlignment = SWT.CENTER; - data.grabExcessVerticalSpace = true; - - Composite bodyComp = item.getBody(); - textInputBox = new TextInputBox(bodyComp, SWT.NONE); - textInputBox.setLayoutData(data); - } - -} diff --git a/src/org/tizen/emulator/manager/ui/renewal/dialog/VMModifyDialog.java b/src/org/tizen/emulator/manager/ui/renewal/dialog/VMModifyDialog.java index 1fcb2c8..4bb14ae 100644 --- a/src/org/tizen/emulator/manager/ui/renewal/dialog/VMModifyDialog.java +++ b/src/org/tizen/emulator/manager/ui/renewal/dialog/VMModifyDialog.java @@ -40,7 +40,7 @@ import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Shell; import org.tizen.emulator.manager.renewal.resources.ColorResources; -import org.tizen.emulator.manager.ui.renewal.detail.item.IModifyDialogItem; +import org.tizen.emulator.manager.ui.renewal.item.modify.vm.common.IModifyDialogItem; import org.tizen.emulator.manager.vms.VMProperty; public class VMModifyDialog extends Dialog { @@ -52,18 +52,20 @@ public class VMModifyDialog extends Dialog { private Composite scrolledContent; private List itemList; + private VMProperty property; public VMModifyDialog(Shell parent) { super(parent, TITLE, WIDTH, HEIGHT, BUTTON_STYLE); } - public void create(List itemList) { + public void create(VMProperty property, List itemList) { // - create title, buttons // - init body super.create(); // make body contents + this.property = property; this.itemList = itemList; createScrolledComposite(); } @@ -81,6 +83,7 @@ public class VMModifyDialog extends Dialog { private void makeModifyItem() { for (IModifyDialogItem item : itemList) { + item.setItemData(property); item.create(scrolledContent); } diff --git a/src/org/tizen/emulator/manager/ui/renewal/detail/item/ImageItem.java b/src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/ImageItem.java similarity index 76% rename from src/org/tizen/emulator/manager/ui/renewal/detail/item/ImageItem.java rename to src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/ImageItem.java index d951c55..bdad2df 100644 --- a/src/org/tizen/emulator/manager/ui/renewal/detail/item/ImageItem.java +++ b/src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/ImageItem.java @@ -28,33 +28,28 @@ * */ -package org.tizen.emulator.manager.ui.renewal.detail.item; +package org.tizen.emulator.manager.ui.renewal.item.modify.vm; import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Label; import org.tizen.emulator.manager.renewal.resources.ImageResources; +import org.tizen.emulator.manager.ui.renewal.item.modify.vm.common.TextLabelItem; +import org.tizen.emulator.manager.vms.VMProperty; -public class ImageItem implements IModifyDialogItem { - - private ModifyItem item; +public class ImageItem extends TextLabelItem { private final String TITLE = "Image"; private final ImageResources TITLE_ICON_RESOURCE = ImageResources.ICON_TITLE_IMAGE; - private Label label; - - @Override - public int getHeight() { - return item.getHeight(); - } - @Override public void create(Composite parent) { - item = new ModifyItem(parent, TITLE, TITLE_ICON_RESOURCE); - makeBody(); + create(parent, TITLE, TITLE_ICON_RESOURCE); } - private void makeBody() { - // TODO + @Override + public void setItemData(VMProperty property) { + if (property == null) { + return; + } + value = property.getBaseImageName(); } } diff --git a/src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/ProfileItem.java b/src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/ProfileItem.java new file mode 100644 index 0000000..bae93d2 --- /dev/null +++ b/src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/ProfileItem.java @@ -0,0 +1,108 @@ +/* + * Emulator Manager + * + * Copyright (C) 2015 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * Minkee Lee + * JiHye Kim + * SeokYeon Hwang + * Sangho Park + * + * 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.renewal.item.modify.vm; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.widgets.Canvas; +import org.eclipse.swt.widgets.Composite; +import org.tizen.emulator.manager.renewal.resources.ImageResources; +import org.tizen.emulator.manager.ui.renewal.item.modify.vm.common.IModifyDialogItem; +import org.tizen.emulator.manager.ui.renewal.item.modify.vm.common.ModifyItem; +import org.tizen.emulator.manager.vms.VMProperty; + +public class ProfileItem implements IModifyDialogItem { + + private ModifyItem item; + private Canvas canvas; + private String profile = ""; + + private final String TITLE = "Profile"; + private final ImageResources TITLE_ICON_RESOURCE = ImageResources.ICON_TITLE_PROFILE; + private final String MOBILE = "mobile"; + private final String WEARABLE = "wearable"; + private final String TV = "tv"; + private final int PROFILE_IMAGE_WIDTH = 34; + private final int PROFILE_IMAGE_HEIGHT = 25; + + + private void addProfileImage() { + item.setBodyLayoutDefault(); + + // init canvas + GridData data = new GridData(PROFILE_IMAGE_WIDTH, PROFILE_IMAGE_HEIGHT); + data.verticalAlignment = SWT.CENTER; + data.grabExcessVerticalSpace = true; + canvas = new Canvas(item.getBody(), SWT.NONE); + canvas.setLayoutData(data); + + // set image + Image profileImage = getProfileImage(profile); + if (profileImage != null) { + canvas.setBackgroundImage(profileImage); + } + } + + private Image getProfileImage(String profile) { + if (profile.equals(MOBILE)) { + return ImageResources.BTN_PROFILE_MOBILE_SELECTED.getImage(); + + } else if (profile.equals(WEARABLE)) { + return ImageResources.BTN_PROFILE_WEARABLE_SELECTED.getImage(); + + } else if (profile.equals(TV)) { + return ImageResources.BTN_PROFILE_TV_SELECTED.getImage(); + } + + return null; + } + + @Override + public void setItemData(VMProperty property) { + if (property == null) { + return; + } + this.profile = property.getImageProfile(); + + } + + @Override + public int getHeight() { + return item.getHeight(); + } + + @Override + public void create(Composite parent) { + item = new ModifyItem(parent, TITLE, TITLE_ICON_RESOURCE); + addProfileImage(); + } +} diff --git a/src/org/tizen/emulator/manager/ui/renewal/detail/item/ProfileItem.java b/src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/VMNameItem.java similarity index 73% rename from src/org/tizen/emulator/manager/ui/renewal/detail/item/ProfileItem.java rename to src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/VMNameItem.java index f268617..3121ce6 100644 --- a/src/org/tizen/emulator/manager/ui/renewal/detail/item/ProfileItem.java +++ b/src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/VMNameItem.java @@ -28,31 +28,30 @@ * */ -package org.tizen.emulator.manager.ui.renewal.detail.item; +package org.tizen.emulator.manager.ui.renewal.item.modify.vm; import org.eclipse.swt.widgets.Composite; import org.tizen.emulator.manager.renewal.resources.ImageResources; +import org.tizen.emulator.manager.ui.renewal.item.modify.vm.common.TextLabelItem; +import org.tizen.emulator.manager.vms.VMProperty; -public class ProfileItem implements IModifyDialogItem { - - private ModifyItem item; - - private final String TITLE = "Profile"; - private final ImageResources TITLE_ICON_RESOURCE = ImageResources.ICON_TITLE_PROFILE; +public class VMNameItem extends TextLabelItem { + private final String TITLE = "VM Name"; + private final ImageResources TITLE_ICON_RESOURCE = ImageResources.ICON_TITLE_VMNAME; @Override - public int getHeight() { - return item.getHeight(); + public void create(Composite parent) { + create(parent, TITLE, TITLE_ICON_RESOURCE); } @Override - public void create(Composite parent) { - item = new ModifyItem(parent, TITLE, TITLE_ICON_RESOURCE); - makeBody(); + public void setItemData(VMProperty property) { + if (property == null) { + return; + } + value = property.getName(); } - private void makeBody() { - // TODO - } + } diff --git a/src/org/tizen/emulator/manager/ui/renewal/detail/item/IModifyDialogItem.java b/src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/common/IModifyDialogItem.java similarity index 85% rename from src/org/tizen/emulator/manager/ui/renewal/detail/item/IModifyDialogItem.java rename to src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/common/IModifyDialogItem.java index 50e7be4..b6654d0 100644 --- a/src/org/tizen/emulator/manager/ui/renewal/detail/item/IModifyDialogItem.java +++ b/src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/common/IModifyDialogItem.java @@ -27,15 +27,17 @@ * - S-Core Co., Ltd * */ -package org.tizen.emulator.manager.ui.renewal.detail.item; +package org.tizen.emulator.manager.ui.renewal.item.modify.vm.common; import org.eclipse.swt.widgets.Composite; +import org.tizen.emulator.manager.vms.VMProperty; public interface IModifyDialogItem { public void create(Composite parent); - // to decide modify dialog. + /** To decide modify dialog */ public int getHeight(); + public void setItemData(VMProperty property); } diff --git a/src/org/tizen/emulator/manager/ui/renewal/detail/item/ItemTitle.java b/src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/common/ItemTitle.java similarity index 94% rename from src/org/tizen/emulator/manager/ui/renewal/detail/item/ItemTitle.java rename to src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/common/ItemTitle.java index 9102725..7475f8d 100644 --- a/src/org/tizen/emulator/manager/ui/renewal/detail/item/ItemTitle.java +++ b/src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/common/ItemTitle.java @@ -28,7 +28,7 @@ * */ -package org.tizen.emulator.manager.ui.renewal.detail.item; +package org.tizen.emulator.manager.ui.renewal.item.modify.vm.common; import org.eclipse.swt.SWT; import org.eclipse.swt.events.PaintEvent; @@ -49,6 +49,7 @@ public class ItemTitle extends Canvas{ private final int TITLE_MARGIN_LEFT = 15; private final int TITLE_SPACING = 8; private final int TITLE_CANVAS_WIDTH = 144; + private final int LINE_INDENT = 5; private final String title; private Image titleIcon; @@ -96,7 +97,7 @@ public class ItemTitle extends Canvas{ // draw text gc.setForeground(ColorResources.MODIFY_ITEM_TITLE.getColor()); - gc.setFont(FontResources.DETAIL_ITEM_TITLE.getFont()); + gc.setFont(FontResources.MODIFY_ITEM_TITLE.getFont()); Point textExt = gc.textExtent(title); int titleY = (itemHeight - textExt.y) / 2; gc.drawText(title, @@ -106,7 +107,7 @@ public class ItemTitle extends Canvas{ int lineWidth = ModifyItem.LINE_WIDTH; gc.setForeground(ColorResources.MODIFY_ITEM_LINE.getColor()); gc.setLineWidth(lineWidth); - gc.drawLine(lineWidth, itemHeight, + gc.drawLine(LINE_INDENT, itemHeight, TITLE_CANVAS_WIDTH, itemHeight); } }); diff --git a/src/org/tizen/emulator/manager/ui/renewal/detail/item/ModifyItem.java b/src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/common/ModifyItem.java similarity index 87% rename from src/org/tizen/emulator/manager/ui/renewal/detail/item/ModifyItem.java rename to src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/common/ModifyItem.java index 829507e..23e0bac 100644 --- a/src/org/tizen/emulator/manager/ui/renewal/detail/item/ModifyItem.java +++ b/src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/common/ModifyItem.java @@ -1,4 +1,4 @@ -package org.tizen.emulator.manager.ui.renewal.detail.item; +package org.tizen.emulator.manager.ui.renewal.item.modify.vm.common; import org.eclipse.swt.SWT; import org.eclipse.swt.events.PaintEvent; @@ -24,7 +24,6 @@ public class ModifyItem { public ModifyItem(Composite parent, String title, ImageResources iconResource) { create(parent); - createTitle(title, iconResource); createEmptyBody(); } @@ -70,6 +69,7 @@ public class ModifyItem { bodyComp.setBackgroundMode(SWT.INHERIT_DEFAULT); } + /** For a constructor parameter of child widget */ public Composite getBody() { return bodyComp; } @@ -78,6 +78,16 @@ public class ModifyItem { return ITEM_HEIGHT + LINE_WIDTH; } + /** For item which has single widget. */ + public void setBodyLayoutDefault() { + GridLayout layout = new GridLayout(); + layout.numColumns = 1; + layout.marginWidth = ModifyItem.BODY_MARGIN_LEFT; + layout.marginHeight = 0; + + bodyComp.setLayout(layout); + } + private void create(Composite parent) { initComp(parent); makeComp(); diff --git a/src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/common/TextLabelItem.java b/src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/common/TextLabelItem.java new file mode 100644 index 0000000..ebd3792 --- /dev/null +++ b/src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/common/TextLabelItem.java @@ -0,0 +1,92 @@ +/* + * Emulator Manager + * + * Copyright (C) 2015 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * Minkee Lee + * JiHye Kim + * SeokYeon Hwang + * Sangho Park + * + * 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.renewal.item.modify.vm.common; + +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.Point; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.widgets.Canvas; +import org.eclipse.swt.widgets.Composite; +import org.tizen.emulator.manager.renewal.resources.ColorResources; +import org.tizen.emulator.manager.renewal.resources.FontResources; +import org.tizen.emulator.manager.renewal.resources.ImageResources; + +public abstract class TextLabelItem implements IModifyDialogItem { + + private ModifyItem item; + private Canvas canvas; + + protected String value = ""; + + @Override + public int getHeight() { + return item.getHeight(); + } + + protected void create(Composite parent, String title, ImageResources iconResources) { + item = new ModifyItem(parent, title, iconResources); + makeBody(); + } + + protected void makeBody() { + item.setBodyLayoutDefault(); + + // init canvas; + GridData data = new GridData(); + data.heightHint = ModifyItem.ITEM_HEIGHT; + data.horizontalAlignment = SWT.FILL; + data.grabExcessHorizontalSpace = true; + canvas = new Canvas(item.getBody(), SWT.NONE); + canvas.setLayoutData(data); + + drawImageName(); + } + + private void drawImageName() { + canvas.addPaintListener(new PaintListener() { + + @Override + public void paintControl(PaintEvent e) { + GC gc = e.gc; + gc.setForeground(ColorResources.CONTENT_FONT.getColor()); + gc.setFont(FontResources.CONTENT.getFont()); + Point textExt = gc.textExtent(value); + int poxY = (ModifyItem.ITEM_HEIGHT - textExt.y) / 2; + gc.drawText(value, 0, poxY); + } + }); + } + +} diff --git a/src/org/tizen/emulator/manager/ui/renewal/widgets/TextInputBox.java b/src/org/tizen/emulator/manager/ui/renewal/widgets/TextInputBox.java index 0f9700f..9e0f3a5 100644 --- a/src/org/tizen/emulator/manager/ui/renewal/widgets/TextInputBox.java +++ b/src/org/tizen/emulator/manager/ui/renewal/widgets/TextInputBox.java @@ -71,6 +71,10 @@ public class TextInputBox extends NinePatchBox{ return ninePatchResourceMap; } + public void setText(String value) { + text.setText(value); + } + private void init() { initBox(); @@ -100,7 +104,6 @@ public class TextInputBox extends NinePatchBox{ text.setBackground(TEXT_BACKGROUND.getColor()); text.setLayoutData(data); - removeTextBorder(); addFocusListener(); addMouseListener();