VM-modify: add profile, image item to modify dialog.
authorminkee.lee <minkee.lee@samsung.com>
Fri, 18 Sep 2015 09:44:36 +0000 (18:44 +0900)
committerminkee.lee <minkee.lee@samsung.com>
Fri, 18 Sep 2015 09:54:39 +0000 (18:54 +0900)
- 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 <minkee.lee@samsung.com>
13 files changed:
src/org/tizen/emulator/manager/handler/renewal/VMModifyHandler.java
src/org/tizen/emulator/manager/renewal/resources/FontResources.java
src/org/tizen/emulator/manager/renewal/resources/ImageResources.java
src/org/tizen/emulator/manager/ui/renewal/detail/item/VMNameItem.java [deleted file]
src/org/tizen/emulator/manager/ui/renewal/dialog/VMModifyDialog.java
src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/ImageItem.java [moved from src/org/tizen/emulator/manager/ui/renewal/detail/item/ImageItem.java with 76% similarity]
src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/ProfileItem.java [new file with mode: 0644]
src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/VMNameItem.java [moved from src/org/tizen/emulator/manager/ui/renewal/detail/item/ProfileItem.java with 73% similarity]
src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/common/IModifyDialogItem.java [moved from src/org/tizen/emulator/manager/ui/renewal/detail/item/IModifyDialogItem.java with 85% similarity]
src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/common/ItemTitle.java [moved from src/org/tizen/emulator/manager/ui/renewal/detail/item/ItemTitle.java with 94% similarity]
src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/common/ModifyItem.java [moved from src/org/tizen/emulator/manager/ui/renewal/detail/item/ModifyItem.java with 87% similarity]
src/org/tizen/emulator/manager/ui/renewal/item/modify/vm/common/TextLabelItem.java [new file with mode: 0644]
src/org/tizen/emulator/manager/ui/renewal/widgets/TextInputBox.java

index b04c850..ca1e54c 100644 (file)
@@ -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
 
index 7aee8ab..6c3202a 100644 (file)
@@ -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;
index a421752..be1fe1b 100644 (file)
@@ -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 (file)
index a9fd123..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Emulator Manager
- *
- * Copyright (C) 2015 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * Minkee Lee <minkee.lee@samsung.com>
- * JiHye Kim <jihye424.kim@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.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);
-       }
-
-}
index 1fcb2c8..4bb14ae 100644 (file)
@@ -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<IModifyDialogItem> itemList;
+       private VMProperty property;
 
        public VMModifyDialog(Shell parent) {
                super(parent, TITLE, WIDTH, HEIGHT, BUTTON_STYLE);
        }
 
 
-       public void create(List<IModifyDialogItem> itemList) {
+       public void create(VMProperty property, List<IModifyDialogItem> 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);
                }
 
  *
  */
 
-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 (file)
index 0000000..bae93d2
--- /dev/null
@@ -0,0 +1,108 @@
+/*
+ * Emulator Manager
+ *
+ * Copyright (C) 2015 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Minkee Lee <minkee.lee@samsung.com>
+ * JiHye Kim <jihye424.kim@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.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();
+       }
+}
  *
  */
 
-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
-       }
+
 }
  * - 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);
 }
@@ -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);
                        }
                });
@@ -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 (file)
index 0000000..ebd3792
--- /dev/null
@@ -0,0 +1,92 @@
+/*
+ * Emulator Manager
+ *
+ * Copyright (C) 2015 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Minkee Lee <minkee.lee@samsung.com>
+ * JiHye Kim <jihye424.kim@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.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);
+                       }
+               });
+       }
+
+}
index 0f9700f..9e0f3a5 100644 (file)
@@ -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();