UI: add VMName item.
authorminkee.lee <minkee.lee@samsung.com>
Fri, 18 Sep 2015 05:57:33 +0000 (14:57 +0900)
committerminkee.lee <minkee.lee@samsung.com>
Fri, 18 Sep 2015 06:04:02 +0000 (15:04 +0900)
- Profile & Image item is added for test.
  (They only have a title.)
- do refactoring nine patch button.
- add text input box widget.
- add VMModifyHandler to control VM modification.

Change-Id: I2d736a8c15c375c1420073961ebcc7d5f67209c2
Signed-off-by: minkee.lee <minkee.lee@samsung.com>
19 files changed:
src/org/tizen/emulator/manager/handler/renewal/VMModifyHandler.java [new file with mode: 0644]
src/org/tizen/emulator/manager/renewal/resources/ColorResources.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/MainDialog.java
src/org/tizen/emulator/manager/ui/renewal/detail/item/IModifyDialogItem.java [new file with mode: 0644]
src/org/tizen/emulator/manager/ui/renewal/detail/item/ImageItem.java [new file with mode: 0644]
src/org/tizen/emulator/manager/ui/renewal/detail/item/ItemTitle.java [new file with mode: 0644]
src/org/tizen/emulator/manager/ui/renewal/detail/item/ModifyItem.java [new file with mode: 0644]
src/org/tizen/emulator/manager/ui/renewal/detail/item/ProfileItem.java [new file with mode: 0644]
src/org/tizen/emulator/manager/ui/renewal/detail/item/VMNameItem.java [new file with mode: 0644]
src/org/tizen/emulator/manager/ui/renewal/dialog/VMModifyDialog.java
src/org/tizen/emulator/manager/ui/renewal/tableviewer/VMListTable.java
src/org/tizen/emulator/manager/ui/renewal/widgets/ButtonResourceInfo.java [deleted file]
src/org/tizen/emulator/manager/ui/renewal/widgets/GrayButton.java
src/org/tizen/emulator/manager/ui/renewal/widgets/NinePatchBox.java [new file with mode: 0644]
src/org/tizen/emulator/manager/ui/renewal/widgets/NinePatchButton.java
src/org/tizen/emulator/manager/ui/renewal/widgets/NinePatchResourceMap.java [new file with mode: 0644]
src/org/tizen/emulator/manager/ui/renewal/widgets/TextInputBox.java [new file with mode: 0644]

diff --git a/src/org/tizen/emulator/manager/handler/renewal/VMModifyHandler.java b/src/org/tizen/emulator/manager/handler/renewal/VMModifyHandler.java
new file mode 100644 (file)
index 0000000..b04c850
--- /dev/null
@@ -0,0 +1,82 @@
+/*
+ * 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.handler.renewal;
+
+import java.util.ArrayList;
+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.vms.VMProperty;
+
+public class VMModifyHandler {
+
+       public static void modify(VMProperty property) {
+
+               // open modify dialog
+               VMModifyDialog dialog = new VMModifyDialog(MainDialog.getShell());
+               dialog.create(getItemList(property));
+
+               // TODO set display value to dialog
+
+               int retValue = dialog.open();
+
+               if (retValue == SWT.OK) {
+                       // TODO do modify
+               }
+       }
+
+       private static List<IModifyDialogItem> getItemList(VMProperty property) {
+               // TODO make item list using Image's item-template
+               return getTmpItemList();
+
+       }
+
+
+       // FOR TEST
+       public static List<IModifyDialogItem> getTmpItemList() {
+               List<IModifyDialogItem> itemList = new ArrayList<IModifyDialogItem>();
+
+               itemList.add(new VMNameItem());
+               itemList.add(new ProfileItem());
+               itemList.add(new ImageItem());
+               return itemList;
+       }
+
+
+
+}
index 1c31545..4dbab68 100644 (file)
@@ -58,9 +58,15 @@ public enum ColorResources {
        MESSAGE_BOX_BG(224, 224, 224),
        MESSAGE_BOX_BUTTON_BG(149, 159, 165),
        MESSAGE_BOX_BUTTON_FONT(255, 255, 255),
-       MESSABE_BOX_BORDER(155,155,155);
+       MESSABE_BOX_BORDER(155,155,155),
+
+       MODIFY_ITEM_TITLE_BACKGROUND(235, 241, 245),
+       MODIFY_ITEM_TITLE_SUB_BACKGROUDN(218, 230, 240),
+       MODIFY_ITEM_TITLE(41, 41, 41),
+       MODIFY_ITEM_LINE(208, 212, 215);
 
        public static ColorResources GRAY_BTN_FONT = WHITE;
+       public static ColorResources CONTENT_FONT = MESSAGE_BOX_CONTENTS_FONT;
 
 
        Color color;
index 5d5dd23..7aee8ab 100644 (file)
@@ -45,7 +45,13 @@ public enum FontResources {
        TABLE_VIEWER_LINK_MENU("link_menu_font", resizeDefaultFont(9)),
        COMBO_BUTTON("combo_button_font", resizeDefaultFont(9)),
        MESSAGE_BOX_TITLE("msg_box_title", resizeDefaultFont(10)),
-       MESSAGE_BOX_CONTENTS("msg_box_contents", resizeDefaultFont(9));
+       MESSAGE_BOX_CONTENTS("msg_box_contents", resizeDefaultFont(9)),
+
+       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 CONTENT = DEFAULT_FONT_9;
 
        String name;
        Font font;
index 37bf810..a421752 100644 (file)
@@ -75,6 +75,33 @@ public enum ImageResources {
        GRAY_BTN_PUSH_RT("9p_btn_push_rt"),
        GRAY_BTN_PUSH_T("9p_btn_push_t"),
 
+       // text input box
+       TEXT_INPUT_BOX_HOVER_B("9p_text_input_box_hover_b"),
+       TEXT_INPUT_BOX_HOVER_L("9p_text_input_box_hover_l"),
+       TEXT_INPUT_BOX_HOVER_LB("9p_text_input_box_hover_lb"),
+       TEXT_INPUT_BOX_HOVER_LT("9p_text_input_box_hover_lt"),
+       TEXT_INPUT_BOX_HOVER_R("9p_text_input_box_hover_r"),
+       TEXT_INPUT_BOX_HOVER_RB("9p_text_input_box_hover_rb"),
+       TEXT_INPUT_BOX_HOVER_RT("9p_text_input_box_hover_rt"),
+       TEXT_INPUT_BOX_HOVER_T("9p_text_input_box_hover_t"),
+       TEXT_INPUT_BOX_NORMAL_B("9p_text_input_box_normal_b"),
+       TEXT_INPUT_BOX_NORMAL_L("9p_text_input_box_normal_l"),
+       TEXT_INPUT_BOX_NORMAL_LB("9p_text_input_box_normal_lb"),
+       TEXT_INPUT_BOX_NORMAL_LT("9p_text_input_box_normal_lt"),
+       TEXT_INPUT_BOX_NORMAL_R("9p_text_input_box_normal_r"),
+       TEXT_INPUT_BOX_NORMAL_RB("9p_text_input_box_normal_rb"),
+       TEXT_INPUT_BOX_NORMAL_RT("9p_text_input_box_normal_rt"),
+       TEXT_INPUT_BOX_NORMAL_T("9p_text_input_box_normal_t"),
+       TEXT_INPUT_BOX_SELECT_B("9p_text_input_box_selected_b"),
+       TEXT_INPUT_BOX_SELECT_L("9p_text_input_box_selected_l"),
+       TEXT_INPUT_BOX_SELECT_LB("9p_text_input_box_selected_lb"),
+       TEXT_INPUT_BOX_SELECT_LT("9p_text_input_box_selected_lt"),
+       TEXT_INPUT_BOX_SELECT_R("9p_text_input_box_selected_r"),
+       TEXT_INPUT_BOX_SELECT_RB("9p_text_input_box_selected_rb"),
+       TEXT_INPUT_BOX_SELECT_RT("9p_text_input_box_selected_rt"),
+       TEXT_INPUT_BOX_SELECT_T("9p_text_input_box_selected_t"),
+
+
        DROP_DOWN_BOX_HOVER_B("9p_drop_down_box_hover_b"),
        DROP_DOWN_BOX_HOVER_L("9p_drop_down_box_hover_l"),
        DROP_DOWN_BOX_HOVER_LB("9p_drop_down_box_hover_lb"),
@@ -160,7 +187,11 @@ public enum ImageResources {
        ICON_CREATE_MOBILE("icon_create_mobile"),
        ICON_CREATE_NEW_VM("icon_create_new_vm"),
        ICON_CREATE_TV("icon_create_tv"),
-       ICON_CREATE_WEARABLE("icon_create_wearable");
+       ICON_CREATE_WEARABLE("icon_create_wearable"),
+
+       ICON_TITLE_VMNAME("icon_title_vmname"),
+       ICON_TITLE_IMAGE("icon_title_image"),
+       ICON_TITLE_PROFILE("icon_title_profile");
 
        String name;
        Image image;
index 09a6145..d3cb5f8 100644 (file)
@@ -63,7 +63,7 @@ public class MainDialog {
        private int frameY = 0;
 
        private final StackLayout stackLayout = new StackLayout();
-       private List<AbstractTableViewer> viewerList = new ArrayList<AbstractTableViewer>();
+       private final List<AbstractTableViewer> viewerList = new ArrayList<AbstractTableViewer>();
 
        public MainDialog() {
                Display.setAppName(Messages.getString("MainDialog.AppName.0"));
@@ -119,7 +119,10 @@ public class MainDialog {
 
        public void dispose() {
                ImageResources.dispose();
-               //ColorResources.dispose();
+               org.tizen.emulator.manager.renewal.resources.ColorResources.dispose();
+               org.tizen.emulator.manager.renewal.resources.FontResources.dispose();
+
+//             ColorResources.dispose();
                if(icon != null) {
                        icon.dispose();
                }
diff --git a/src/org/tizen/emulator/manager/ui/renewal/detail/item/IModifyDialogItem.java b/src/org/tizen/emulator/manager/ui/renewal/detail/item/IModifyDialogItem.java
new file mode 100644 (file)
index 0000000..50e7be4
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ * 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.widgets.Composite;
+
+public interface IModifyDialogItem {
+
+       public void create(Composite parent);
+
+       // to decide modify dialog.
+       public int getHeight();
+
+}
diff --git a/src/org/tizen/emulator/manager/ui/renewal/detail/item/ImageItem.java b/src/org/tizen/emulator/manager/ui/renewal/detail/item/ImageItem.java
new file mode 100644 (file)
index 0000000..d951c55
--- /dev/null
@@ -0,0 +1,60 @@
+/*
+ * 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.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.tizen.emulator.manager.renewal.resources.ImageResources;
+
+public class ImageItem implements IModifyDialogItem {
+
+       private ModifyItem item;
+
+       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();
+       }
+
+       private void makeBody() {
+               // TODO
+       }
+}
diff --git a/src/org/tizen/emulator/manager/ui/renewal/detail/item/ItemTitle.java b/src/org/tizen/emulator/manager/ui/renewal/detail/item/ItemTitle.java
new file mode 100644 (file)
index 0000000..9102725
--- /dev/null
@@ -0,0 +1,114 @@
+/*
+ * 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.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.ImageData;
+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 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 String title;
+       private Image titleIcon;
+       private final ImageResources titleIconResource;
+
+
+       public ItemTitle(Composite parent, String title, ImageResources titleIconResources) {
+               super(parent, SWT.NONE);
+               this.title = title;
+               this.titleIconResource = titleIconResources;
+
+       }
+
+       public void create() {
+               initTitle();
+               makeTitle();
+       }
+
+       private void initTitle() {
+               GridData data = new GridData();
+               data.grabExcessVerticalSpace = true;
+               data.verticalAlignment = GridData.FILL;
+               data.widthHint = TITLE_CANVAS_WIDTH;
+               this.setLayoutData(data);
+               this.setBackground(ColorResources.MODIFY_ITEM_TITLE_BACKGROUND.getColor());
+       }
+
+
+       private void makeTitle() {
+               // draw icon, title
+               this.addPaintListener(new PaintListener() {
+
+                       @Override
+                       public void paintControl(PaintEvent e) {
+                               GC gc = e.gc;
+                               int itemHeight = ModifyItem.ITEM_HEIGHT;
+
+                               // draw icon
+                               if (titleIcon == null) {
+                                       titleIcon = titleIconResource.getImage();
+                               }
+                               ImageData imageData = titleIcon.getImageData();
+                               int iconY = (itemHeight - imageData.height) / 2;
+                               gc.drawImage(titleIcon, TITLE_MARGIN_LEFT, iconY);
+
+                               // draw text
+                               gc.setForeground(ColorResources.MODIFY_ITEM_TITLE.getColor());
+                               gc.setFont(FontResources.DETAIL_ITEM_TITLE.getFont());
+                               Point textExt = gc.textExtent(title);
+                               int titleY = (itemHeight - textExt.y) / 2;
+                               gc.drawText(title,
+                                               TITLE_MARGIN_LEFT + imageData.width + TITLE_SPACING, titleY);
+
+                               // draw under line
+                               int lineWidth = ModifyItem.LINE_WIDTH;
+                               gc.setForeground(ColorResources.MODIFY_ITEM_LINE.getColor());
+                               gc.setLineWidth(lineWidth);
+                               gc.drawLine(lineWidth, 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/detail/item/ModifyItem.java
new file mode 100644 (file)
index 0000000..829507e
--- /dev/null
@@ -0,0 +1,105 @@
+package org.tizen.emulator.manager.ui.renewal.detail.item;
+
+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.Rectangle;
+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.ColorResources;
+import org.tizen.emulator.manager.renewal.resources.ImageResources;
+
+public class ModifyItem {
+
+       public static final int ITEM_HEIGHT = 31;
+       public static final int LINE_WIDTH = 1;
+       public static final int LINE_INDENT = 7;
+       public static final int BODY_MARGIN_LEFT = 10;
+
+       private Composite comp;
+       private ItemTitle itemTitle;
+       private Composite bodyComp;
+
+       public ModifyItem(Composite parent, String title, ImageResources iconResource) {
+               create(parent);
+
+               createTitle(title, iconResource);
+               createEmptyBody();
+       }
+
+       private void createTitle(String title, ImageResources iconResource) {
+               itemTitle = new ItemTitle(comp, title, iconResource);
+               itemTitle.create();
+       }
+
+       private void createEmptyBody() {
+               initBody();
+               drawUnderLine();
+       }
+
+       private void drawUnderLine() {
+               bodyComp.addPaintListener(new PaintListener() {
+                       // draw under line
+                       @Override
+                       public void paintControl(PaintEvent e) {
+                               GC gc = e.gc;
+                               Rectangle rect = ((Composite)e.widget).getBounds();
+                               // draw under line
+                               gc.setForeground(ColorResources.MODIFY_ITEM_LINE.getColor());
+                               gc.setLineWidth(ModifyItem.LINE_WIDTH);
+                               gc.drawLine(-1, ModifyItem.ITEM_HEIGHT,
+                                               rect.width, ModifyItem.ITEM_HEIGHT);
+                       }
+               });
+       }
+
+
+       private void initBody() {
+               bodyComp = new Composite(comp, SWT.NONE);
+               GridData data = new GridData();
+               data.grabExcessHorizontalSpace = true;
+               data.horizontalAlignment = GridData.FILL;
+               data.grabExcessVerticalSpace = true;
+               data.verticalAlignment = GridData.FILL;
+               bodyComp.setLayoutData(data);
+               bodyComp.setBackground(ColorResources.WHITE.getColor());
+
+               // for the transparency of corners rounded-box
+               bodyComp.setBackgroundMode(SWT.INHERIT_DEFAULT);
+       }
+
+       public Composite getBody() {
+               return bodyComp;
+       }
+
+       public int getHeight() {
+               return ITEM_HEIGHT + LINE_WIDTH;
+       }
+
+       private void create(Composite parent) {
+               initComp(parent);
+               makeComp();
+       }
+
+
+       private void initComp(Composite parent) {
+               comp = new Composite(parent, SWT.NONE);
+               GridData data = new GridData();
+               data.grabExcessHorizontalSpace = true;
+               data.horizontalAlignment = GridData.FILL;
+               data.heightHint = ITEM_HEIGHT + LINE_WIDTH;
+               comp.setLayoutData(data);
+       }
+
+       private void makeComp() {
+               GridLayout layout = new GridLayout();
+               layout.numColumns = 2;
+               layout.marginWidth = 0;
+               layout.marginHeight = 0;
+               layout.horizontalSpacing = 0;
+               comp.setLayout(layout);
+       }
+
+}
diff --git a/src/org/tizen/emulator/manager/ui/renewal/detail/item/ProfileItem.java b/src/org/tizen/emulator/manager/ui/renewal/detail/item/ProfileItem.java
new file mode 100644 (file)
index 0000000..f268617
--- /dev/null
@@ -0,0 +1,58 @@
+/*
+ * 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.widgets.Composite;
+import org.tizen.emulator.manager.renewal.resources.ImageResources;
+
+public class ProfileItem implements IModifyDialogItem {
+
+       private ModifyItem item;
+
+       private final String TITLE = "Profile";
+       private final ImageResources TITLE_ICON_RESOURCE = ImageResources.ICON_TITLE_PROFILE;
+
+
+       @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() {
+               // TODO
+       }
+}
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
new file mode 100644 (file)
index 0000000..a9fd123
--- /dev/null
@@ -0,0 +1,88 @@
+/*
+ * 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 814c71a..1fcb2c8 100644 (file)
@@ -31,6 +31,8 @@
 
 package org.tizen.emulator.manager.ui.renewal.dialog;
 
+import java.util.List;
+
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.custom.ScrolledComposite;
 import org.eclipse.swt.layout.FillLayout;
@@ -38,6 +40,8 @@ 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.vms.VMProperty;
 
 public class VMModifyDialog extends Dialog {
 
@@ -47,26 +51,49 @@ public class VMModifyDialog extends Dialog {
        private final static int BUTTON_STYLE = SWT.OK | SWT.CANCEL;
 
        private Composite scrolledContent;
+       private List<IModifyDialogItem> itemList;
 
        public VMModifyDialog(Shell parent) {
                super(parent, TITLE, WIDTH, HEIGHT, BUTTON_STYLE);
        }
 
 
-       @Override
-       public void create() {
+       public void create(List<IModifyDialogItem> itemList) {
                // - create title, buttons
                // - init body
                super.create();
 
                // make body contents
+               this.itemList = itemList;
                createScrolledComposite();
        }
 
 
+       public void setItemValue(VMProperty property) {
+
+       }
+
+
        private void createScrolledComposite() {
                initScrolledComposite();
-               // TODO make detail item
+               makeModifyItem();
+       }
+
+       private void makeModifyItem() {
+               for (IModifyDialogItem item : itemList) {
+                       item.create(scrolledContent);
+               }
+
+               // set scrolled-content size
+               computeScrolledContentSize();
+       }
+
+       private void computeScrolledContentSize() {
+               int height = 0;
+               for (IModifyDialogItem item : itemList) {
+                       height += item.getHeight();
+               }
+               scrolledContent.setSize(WIDTH - Dialog.BORDER_WIDTH * 2, height);
        }
 
 
index 27f3a14..2cfe124 100644 (file)
@@ -42,11 +42,11 @@ import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Display;
 import org.eclipse.swt.widgets.Event;
 import org.eclipse.swt.widgets.Listener;
+import org.tizen.emulator.manager.handler.renewal.VMModifyHandler;
 import org.tizen.emulator.manager.platform.Profile;
 import org.tizen.emulator.manager.platform.ProfileList;
 import org.tizen.emulator.manager.renewal.resources.ImageResources;
 import org.tizen.emulator.manager.ui.renewal.MainDialog;
-import org.tizen.emulator.manager.ui.renewal.dialog.VMModifyDialog;
 import org.tizen.emulator.manager.ui.renewal.widgets.CreateVMCombo;
 import org.tizen.emulator.manager.ui.renewal.widgets.ImageButton;
 import org.tizen.emulator.manager.ui.table.Table;
@@ -419,10 +419,10 @@ public class VMListTable {
        }
 
        public void modifyEmulator() {
-               VMModifyDialog dialog = new VMModifyDialog(MainDialog.getShell());
-               dialog.create();
-               dialog.open();
-               // TODO do modify
+               if (table.getSelectionCount() != 1) {
+                       return;
+               }
+               VMModifyHandler.modify((VMProperty)table.getSelection()[0].getData());
        }
 
        public void launchEmulator() {
diff --git a/src/org/tizen/emulator/manager/ui/renewal/widgets/ButtonResourceInfo.java b/src/org/tizen/emulator/manager/ui/renewal/widgets/ButtonResourceInfo.java
deleted file mode 100644 (file)
index 23f1283..0000000
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * 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.renewal.widgets;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.tizen.emulator.manager.renewal.resources.ColorResources;
-import org.tizen.emulator.manager.renewal.resources.ImageResources;
-
-public class ButtonResourceInfo {
-
-       private final Map<WSTATE, NinePatchResourceInfo> map
-               = new HashMap<WSTATE, NinePatchResourceInfo>();
-
-       private final WSTATE disableState = WSTATE.DISABLE_ON;
-
-       public void setNormalImage(ColorResources background, ColorResources transparentColor,
-                                                                       ImageResources lt, ImageResources t,
-                                                                       ImageResources rt, ImageResources r,
-                                                                       ImageResources rb, ImageResources b,
-                                                                       ImageResources lb, ImageResources l) {
-               setImages(WSTATE.NORMAL, background, transparentColor, lt, t, rt, r, rb, b, lb, l);
-       }
-
-       public void setHoverImage(ColorResources background, ColorResources transparentColor,
-                                                                       ImageResources lt, ImageResources t,
-                                                                       ImageResources rt, ImageResources r,
-                                                                       ImageResources rb, ImageResources b,
-                                                                       ImageResources lb, ImageResources l) {
-               setImages(WSTATE.HOVER, background, transparentColor, lt, t, rt, r, rb, b, lb, l);
-       }
-
-       public void setPushImage(ColorResources background, ColorResources transparentColor,
-                                                                       ImageResources lt, ImageResources t,
-                                                                       ImageResources rt, ImageResources r,
-                                                                       ImageResources rb, ImageResources b,
-                                                                       ImageResources lb, ImageResources l) {
-               setImages(WSTATE.PUSH, background, transparentColor, lt, t, rt, r, rb, b, lb, l);
-       }
-
-       public void setDisableImage(ColorResources background, ColorResources transparentColor,
-                                                                       ImageResources lt, ImageResources t,
-                                                                       ImageResources rt, ImageResources r,
-                                                                       ImageResources rb, ImageResources b,
-                                                                       ImageResources lb, ImageResources l) {
-                       setImages(disableState, background, transparentColor, lt, t, rt, r, rb, b, lb, l);
-       }
-
-       private void setImages(WSTATE wState, ColorResources background, ColorResources transparentColor,
-                                                                       ImageResources lt, ImageResources t,
-                                                                       ImageResources rt, ImageResources r,
-                                                                       ImageResources rb, ImageResources b,
-                                                                       ImageResources lb, ImageResources l) {
-               map.put(wState, new NinePatchResourceInfo(background, transparentColor,
-                               lt, t, rt, r, rb, b, lb, l));
-
-       }
-
-       public NinePatchResourceInfo getNormalImages() {
-               return map.get(WSTATE.NORMAL);
-       }
-
-       public NinePatchResourceInfo getHoverImages() {
-               return map.get(WSTATE.HOVER);
-       }
-
-       public NinePatchResourceInfo getPushImages() {
-               return map.get(WSTATE.PUSH);
-       }
-
-       public NinePatchResourceInfo getDisableImages() {
-               return map.get(disableState);
-       }
-}
index 0d6e1ae..2df345f 100644 (file)
@@ -37,14 +37,12 @@ import org.tizen.emulator.manager.renewal.resources.ImageResources;
 
 public class GrayButton extends NinePatchButton {
 
-       static ButtonResourceInfo buttonResourceInfo;
-       static {
-               initButtonResourceInfo();
-       }
+       private static NinePatchResourceMap ninePatchResourceMap;
 
        public GrayButton(Composite parent, int style) {
                super(parent, style);
                initFont();
+               initNinePatchResourceMap();
        }
 
        protected void initFont() {
@@ -52,9 +50,9 @@ public class GrayButton extends NinePatchButton {
                setButtonFontColor(ColorResources.GRAY_BTN_FONT.getColor());
        }
 
-       private static void initButtonResourceInfo() {
-               buttonResourceInfo = new ButtonResourceInfo();
-               buttonResourceInfo.setNormalImage(ColorResources.GRAY_BTN_NORMAL,
+       private static void initNinePatchResourceMap() {
+               ninePatchResourceMap = new NinePatchResourceMap();
+               ninePatchResourceMap.setImages(WSTATE.NORMAL, ColorResources.GRAY_BTN_NORMAL,
                                ColorResources.BLACK,
                                ImageResources.GRAY_BTN_NORMAL_LT,
                                ImageResources.GRAY_BTN_NORMAL_T,
@@ -65,7 +63,7 @@ public class GrayButton extends NinePatchButton {
                                ImageResources.GRAY_BTN_NORMAL_LB,
                                ImageResources.GRAY_BTN_NORMAL_L);
 
-               buttonResourceInfo.setHoverImage(ColorResources.GRAY_BTN_HOVER,
+               ninePatchResourceMap.setImages(WSTATE.HOVER, ColorResources.GRAY_BTN_HOVER,
                                ColorResources.BLACK,
                                ImageResources.GRAY_BTN_HOVER_LT,
                                ImageResources.GRAY_BTN_HOVER_T,
@@ -76,7 +74,7 @@ public class GrayButton extends NinePatchButton {
                                ImageResources.GRAY_BTN_HOVER_LB,
                                ImageResources.GRAY_BTN_HOVER_L);
 
-               buttonResourceInfo.setPushImage(ColorResources.GRAY_BTN_PUSH,
+               ninePatchResourceMap.setImages(WSTATE.PUSH, ColorResources.GRAY_BTN_PUSH,
                                ColorResources.BLACK,
                                ImageResources.GRAY_BTN_PUSH_LT,
                                ImageResources.GRAY_BTN_PUSH_T,
@@ -87,7 +85,7 @@ public class GrayButton extends NinePatchButton {
                                ImageResources.GRAY_BTN_PUSH_LB,
                                ImageResources.GRAY_BTN_PUSH_L);
 
-               buttonResourceInfo.setDisableImage(ColorResources.GRAY_BTN_DISABLE,
+               ninePatchResourceMap.setImages(WSTATE.DISABLE_ON, ColorResources.GRAY_BTN_DISABLE,
                                ColorResources.BLACK,
                                ImageResources.GRAY_BTN_DISABLE_LT,
                                ImageResources.GRAY_BTN_DISABLE_T,
@@ -100,8 +98,8 @@ public class GrayButton extends NinePatchButton {
        }
 
        @Override
-       public ButtonResourceInfo getButtonResourceInfo() {
-               return buttonResourceInfo;
+       public NinePatchResourceMap getNinePatchResourceMap() {
+               return ninePatchResourceMap;
        }
 
 }
diff --git a/src/org/tizen/emulator/manager/ui/renewal/widgets/NinePatchBox.java b/src/org/tizen/emulator/manager/ui/renewal/widgets/NinePatchBox.java
new file mode 100644 (file)
index 0000000..e84b64f
--- /dev/null
@@ -0,0 +1,121 @@
+/*
+ * Emulator Manager
+ *
+ * Copyright (C) 2011 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * JiHye Kim <jihye1128.kim@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ * SeokYeon Hwang <syeon.hwang@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.widgets;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+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.Rectangle;
+import org.eclipse.swt.widgets.Canvas;
+import org.eclipse.swt.widgets.Composite;
+import org.tizen.emulator.manager.renewal.resources.PatchImageResources;
+
+public abstract class NinePatchBox extends Canvas{
+
+       public abstract NinePatchResourceMap getNinePatchResourceMap();
+
+       private final Map<WSTATE, Image> imageMap = new HashMap<WSTATE, Image>();
+       private WSTATE state = WSTATE.NORMAL;
+
+       protected void setState(WSTATE state) {
+               this.state = state;
+       }
+
+       protected WSTATE getState() {
+               return state;
+       }
+
+       public NinePatchBox(Composite parent, int style) {
+               super(parent, style);
+
+               addPaintListener();
+               addDisposeListener();
+       }
+
+
+       private void addPaintListener() {
+               this.addPaintListener(new PaintListener() {
+
+                       @Override
+                       public void paintControl(PaintEvent e) {
+                               drawBox(e);
+                       }
+               });
+       }
+
+       private void drawBox(PaintEvent e) {
+               // get box image
+               Image image = imageMap.get(state);
+               if (image == null) {
+                       NinePatchResourceMap map = getNinePatchResourceMap();
+                       if (map == null) {
+                               return;
+                       }
+                       Rectangle rect = ((Canvas) e.widget).getClientArea();
+                       image = PatchImageResources.getNinePatchButtonImage(
+                                       rect.width, rect.height, map.get(state));
+                       imageMap.put(state, image);
+               }
+
+               // draw box image
+               if (image != null) {
+                       GC gc = e.gc;
+                       Rectangle imgRect = image.getBounds();
+                       gc.drawImage(image, imgRect.x, imgRect.y);
+               }
+       }
+
+       private void addDisposeListener() {
+               this.addDisposeListener(new DisposeListener() {
+
+                       @Override
+                       public void widgetDisposed(DisposeEvent e) {
+                               for (WSTATE state : imageMap.keySet()) {
+                                       Image img = imageMap.get(state);
+                                       if (img != null) {
+                                               img.dispose();
+                                       }
+                               }
+                       }
+               });
+       }
+
+
+
+
+
+
+}
index 417671e..4d9d494 100644 (file)
@@ -46,7 +46,7 @@ public abstract class NinePatchButton extends ImageButton {
        public final List<WSTATE> BUTTON_STATE =
                        Arrays.asList(WSTATE.NORMAL, WSTATE.HOVER, WSTATE.PUSH, WSTATE.DISABLE_ON);
 
-       public abstract ButtonResourceInfo getButtonResourceInfo();
+       public abstract NinePatchResourceMap getNinePatchResourceMap();
 
        public NinePatchButton(Composite parent, int style) {
                super(parent, style);
@@ -71,28 +71,28 @@ public abstract class NinePatchButton extends ImageButton {
                case HOVER:
                        if (hoverImage == null) {
                                hoverImage = PatchImageResources.getNinePatchButtonImage(width, height,
-                                               getButtonResourceInfo().getHoverImages());
+                                               getNinePatchResourceMap().get(state));
                        }
                        image = hoverImage;
                        break;
                case PUSH:
                        if (pushImage == null) {
                                pushImage = PatchImageResources.getNinePatchButtonImage(width, height,
-                                               getButtonResourceInfo().getPushImages());
+                                               getNinePatchResourceMap().get(state));
                        }
                        image = pushImage;
                        break;
                case DISABLE_ON:
                        if (disableImage == null) {
                                disableImage = PatchImageResources.getNinePatchButtonImage(width, height,
-                                               getButtonResourceInfo().getDisableImages());
+                                               getNinePatchResourceMap().get(state));
                        }
                        image = disableImage;
                        break;
                default:
                        if (nomalImage == null) {
                                nomalImage = PatchImageResources.getNinePatchButtonImage(width, height,
-                                               getButtonResourceInfo().getNormalImages());
+                                               getNinePatchResourceMap().get(WSTATE.NORMAL));
                        }
                        image = nomalImage;
                        break;
diff --git a/src/org/tizen/emulator/manager/ui/renewal/widgets/NinePatchResourceMap.java b/src/org/tizen/emulator/manager/ui/renewal/widgets/NinePatchResourceMap.java
new file mode 100644 (file)
index 0000000..ac76f77
--- /dev/null
@@ -0,0 +1,60 @@
+/*
+ * 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.renewal.widgets;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.tizen.emulator.manager.renewal.resources.ColorResources;
+import org.tizen.emulator.manager.renewal.resources.ImageResources;
+
+public class NinePatchResourceMap {
+
+       private final Map<WSTATE, NinePatchResourceInfo> map
+               = new HashMap<WSTATE, NinePatchResourceInfo>();
+
+       public void setImages(WSTATE wState, ColorResources background, ColorResources transparentColor,
+                                                                       ImageResources lt, ImageResources t,
+                                                                       ImageResources rt, ImageResources r,
+                                                                       ImageResources rb, ImageResources b,
+                                                                       ImageResources lb, ImageResources l) {
+               map.put(wState, new NinePatchResourceInfo(background, transparentColor,
+                               lt, t, rt, r, rb, b, lb, l));
+       }
+
+       public NinePatchResourceInfo get(WSTATE state) {
+               return map.get(state);
+       }
+
+       public void put(WSTATE state, NinePatchResourceInfo ninePatchResourceInfo) {
+               map.put(state, ninePatchResourceInfo);
+       }
+}
diff --git a/src/org/tizen/emulator/manager/ui/renewal/widgets/TextInputBox.java b/src/org/tizen/emulator/manager/ui/renewal/widgets/TextInputBox.java
new file mode 100644 (file)
index 0000000..0f9700f
--- /dev/null
@@ -0,0 +1,214 @@
+/*
+ * 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.widgets;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.FocusEvent;
+import org.eclipse.swt.events.FocusListener;
+import org.eclipse.swt.events.PaintEvent;
+import org.eclipse.swt.events.PaintListener;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Text;
+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 class TextInputBox extends NinePatchBox{
+
+       private static NinePatchResourceMap ninePatchResourceMap;
+
+       private Text text;
+       private final ColorResources TEXT_BACKGROUND = ColorResources.WHITE;
+
+       private final int TEXT_MARGIN_WIDTH = 2;
+       private final int TEXT_MARGIN_HEIGHT = 2;
+       private final int TEXT_BORDER_WIDTH = 3;
+
+       public TextInputBox(Composite parent, int style) {
+               super(parent, style);
+               initNinePatchResourceMap();
+               init();
+       }
+
+
+       @Override
+       public NinePatchResourceMap getNinePatchResourceMap() {
+               return ninePatchResourceMap;
+       }
+
+
+       private void init() {
+               initBox();
+               initText();
+       }
+
+
+       private void initBox() {
+               GridLayout layout = new GridLayout();
+               layout.marginHeight = TEXT_MARGIN_HEIGHT;
+               layout.marginWidth = TEXT_MARGIN_WIDTH;
+               layout.numColumns = 1;
+               this.setLayout(layout);
+       }
+
+
+       private void initText() {
+               GridData data = new GridData();
+               data.grabExcessHorizontalSpace = true;
+               data.grabExcessVerticalSpace = true;
+               data.horizontalAlignment = SWT.FILL;
+               data.verticalAlignment = SWT.FILL;
+
+               text = new Text(this, SWT.NONE);
+               text.setFont(FontResources.CONTENT.getFont());
+               text.setForeground(ColorResources.CONTENT_FONT.getColor());
+               text.setBackground(TEXT_BACKGROUND.getColor());
+               text.setLayoutData(data);
+
+
+               removeTextBorder();
+               addFocusListener();
+               addMouseListener();
+       }
+
+
+       private void addFocusListener() {
+               text.addFocusListener(new FocusListener() {
+
+                       @Override
+                       public void focusLost(FocusEvent arg0) {
+                               setState(WSTATE.NORMAL);
+                               redraw();
+                       }
+
+                       @Override
+                       public void focusGained(FocusEvent arg0) {
+                               setState(WSTATE.SELECTED);
+                               redraw();
+                       }
+               });
+       }
+
+
+       private void addMouseListener() {
+               Listener mouseListener = new Listener() {
+
+                       @Override
+                       public void handleEvent(Event e) {
+                               if (getState() == WSTATE.SELECTED) {
+                                       return;
+                               }
+
+                               if (e.type == SWT.MouseEnter) {
+                                       setState(WSTATE.HOVER);
+                                       redraw();
+
+                               } else  if (e.type == SWT.MouseExit) {
+                                       setState(WSTATE.NORMAL);
+                                       redraw();
+                               }
+                       }
+               };
+               text.addListener(SWT.MouseEnter, mouseListener);
+               text.addListener(SWT.MouseExit, mouseListener);
+
+               // for space between text and box.
+               this.addListener(SWT.MouseEnter, mouseListener);
+               this.addListener(SWT.MouseExit, mouseListener);
+       }
+
+
+       private void removeTextBorder() {
+               text.addPaintListener(new PaintListener() {
+
+                       @Override
+                       public void paintControl(PaintEvent e) {
+                               // remove by overwriting border with background's color
+                               e.gc.setForeground(TEXT_BACKGROUND.getColor());
+                               e.gc.setLineWidth(TEXT_BORDER_WIDTH);
+
+                               Rectangle rect = ((Text)e.widget).getBounds();
+                               Rectangle drawRect = new Rectangle(0, 0,
+                                               rect.width - 1, rect.height - 1);
+                               e.gc.drawRectangle(drawRect);
+                       }
+               });
+       }
+
+
+
+       private static void initNinePatchResourceMap() {
+               ninePatchResourceMap = new NinePatchResourceMap();
+               ninePatchResourceMap.setImages(WSTATE.NORMAL, ColorResources.WHITE,
+                               ColorResources.BLACK,
+                               ImageResources.TEXT_INPUT_BOX_NORMAL_LT,
+                               ImageResources.TEXT_INPUT_BOX_NORMAL_T,
+                               ImageResources.TEXT_INPUT_BOX_NORMAL_RT,
+                               ImageResources.TEXT_INPUT_BOX_NORMAL_R,
+                               ImageResources.TEXT_INPUT_BOX_NORMAL_RB,
+                               ImageResources.TEXT_INPUT_BOX_NORMAL_B,
+                               ImageResources.TEXT_INPUT_BOX_NORMAL_LB,
+                               ImageResources.TEXT_INPUT_BOX_NORMAL_L);
+
+               ninePatchResourceMap.setImages(WSTATE.HOVER, ColorResources.WHITE,
+                               ColorResources.BLACK,
+                               ImageResources.TEXT_INPUT_BOX_HOVER_LT,
+                               ImageResources.TEXT_INPUT_BOX_HOVER_T,
+                               ImageResources.TEXT_INPUT_BOX_HOVER_RT,
+                               ImageResources.TEXT_INPUT_BOX_HOVER_R,
+                               ImageResources.TEXT_INPUT_BOX_HOVER_RB,
+                               ImageResources.TEXT_INPUT_BOX_HOVER_B,
+                               ImageResources.TEXT_INPUT_BOX_HOVER_LB,
+                               ImageResources.TEXT_INPUT_BOX_HOVER_L);
+
+               ninePatchResourceMap.setImages(WSTATE.SELECTED, ColorResources.WHITE,
+                               ColorResources.BLACK,
+                               ImageResources.TEXT_INPUT_BOX_SELECT_LT,
+                               ImageResources.TEXT_INPUT_BOX_SELECT_T,
+                               ImageResources.TEXT_INPUT_BOX_SELECT_RT,
+                               ImageResources.TEXT_INPUT_BOX_SELECT_R,
+                               ImageResources.TEXT_INPUT_BOX_SELECT_RB,
+                               ImageResources.TEXT_INPUT_BOX_SELECT_B,
+                               ImageResources.TEXT_INPUT_BOX_SELECT_LB,
+                               ImageResources.TEXT_INPUT_BOX_SELECT_L);
+
+       }
+
+
+
+}