From 002e5c577e708ccd70dacdf1add9793d451959c3 Mon Sep 17 00:00:00 2001 From: jihye kim Date: Mon, 1 Apr 2013 11:32:55 +0900 Subject: [PATCH] [Title] emulator-manager : update ux [Desc.] update ux [Issue] N/A Change-Id: Ib6b4f30d826cf8b4f2b8788623d16e58a6f8bcf9 --- resource/res/add_new_hover.gif | Bin 0 -> 1542 bytes resource/res/add_new_nml.gif | Bin 0 -> 1552 bytes resource/res/add_new_pushed.gif | Bin 0 -> 1492 bytes resource/res/arrow_down.gif | Bin 0 -> 106 bytes resource/res/arrow_up.gif | Bin 0 -> 158 bytes resource/res/background.gif | Bin 0 -> 43 bytes resource/res/button_file_dis.gif | Bin 0 -> 549 bytes resource/res/button_file_hover.gif | Bin 0 -> 549 bytes resource/res/button_file_nml.gif | Bin 0 -> 514 bytes resource/res/button_file_pushed.gif | Bin 0 -> 731 bytes resource/res/button_hover_left.gif | Bin 0 -> 604 bytes resource/res/button_hover_middle.gif | Bin 0 -> 261 bytes resource/res/button_hover_right.gif | Bin 0 -> 601 bytes resource/res/button_launch_hover.gif | Bin 0 -> 408 bytes resource/res/button_launch_nml.gif | Bin 0 -> 388 bytes resource/res/button_launch_pushed.gif | Bin 0 -> 385 bytes resource/res/button_nml_left.gif | Bin 0 -> 403 bytes resource/res/button_nml_middle.gif | Bin 0 -> 261 bytes resource/res/button_nml_right.gif | Bin 0 -> 403 bytes resource/res/button_off_hover.gif | Bin 0 -> 800 bytes resource/res/button_off_nml.gif | Bin 0 -> 776 bytes resource/res/button_off_pushed.gif | Bin 0 -> 782 bytes resource/res/button_on_hover.gif | Bin 0 -> 785 bytes resource/res/button_on_nml.gif | Bin 0 -> 760 bytes resource/res/button_on_pushed.gif | Bin 0 -> 766 bytes resource/res/button_pushed_left.gif | Bin 0 -> 610 bytes resource/res/button_pushed_middle.gif | Bin 0 -> 261 bytes resource/res/button_pushed_right.gif | Bin 0 -> 610 bytes resource/res/create_new_hover.gif | Bin 0 -> 5055 bytes resource/res/create_new_nml.gif | Bin 0 -> 5054 bytes resource/res/create_new_pushed.gif | Bin 0 -> 5457 bytes resource/res/detail_category_left.gif | Bin 0 -> 102 bytes resource/res/detail_category_middle.gif | Bin 0 -> 45 bytes resource/res/detail_category_right.gif | Bin 0 -> 102 bytes resource/res/detail_list_bottom.gif | Bin 0 -> 438 bytes resource/res/detail_list_item.gif | Bin 0 -> 132 bytes resource/res/detail_list_middle.gif | Bin 0 -> 243 bytes resource/res/detail_list_top.gif | Bin 0 -> 451 bytes resource/res/dropdown_arrow.gif | Bin 0 -> 58 bytes resource/res/dropdown_disable.png | Bin 0 -> 2945 bytes resource/res/dropdown_down.png | Bin 0 -> 2828 bytes resource/res/dropdown_hover.png | Bin 0 -> 3019 bytes resource/res/dropdown_normal.png | Bin 0 -> 3011 bytes resource/res/dropdown_push.png | Bin 0 -> 3008 bytes resource/res/dropdown_up.png | Bin 0 -> 2827 bytes resource/res/emulator_list_image_hover.gif | Bin 0 -> 2632 bytes resource/res/emulator_list_image_new_ani.gif | Bin 0 -> 25026 bytes resource/res/emulator_list_image_nml.gif | Bin 0 -> 2636 bytes resource/res/emulator_list_selected.gif | Bin 0 -> 818 bytes resource/res/info_icon_hover.gif | Bin 0 -> 606 bytes resource/res/info_icon_nml.gif | Bin 0 -> 605 bytes resource/res/info_icon_pushed.gif | Bin 0 -> 249 bytes resource/res/inputbox_off_left.gif | Bin 0 -> 105 bytes resource/res/inputbox_off_middle.gif | Bin 0 -> 45 bytes resource/res/inputbox_off_right.gif | Bin 0 -> 105 bytes resource/res/inputbox_on_left.gif | Bin 0 -> 106 bytes resource/res/inputbox_on_middle.gif | Bin 0 -> 45 bytes resource/res/inputbox_on_right.gif | Bin 0 -> 106 bytes resource/res/modify_cancel_hover.gif | Bin 0 -> 176 bytes resource/res/modify_cancel_nml.gif | Bin 0 -> 176 bytes resource/res/modify_cancel_pushed.gif | Bin 0 -> 152 bytes resource/res/modify_hover.gif | Bin 0 -> 228 bytes resource/res/modify_nml.gif | Bin 0 -> 228 bytes resource/res/modify_pushed.gif | Bin 0 -> 177 bytes resource/res/reset_icon_hover.gif | Bin 0 -> 633 bytes resource/res/reset_icon_nml.gif | Bin 0 -> 628 bytes resource/res/reset_icon_pushed.gif | Bin 0 -> 363 bytes resource/res/tab_selected_left.gif | Bin 0 -> 103 bytes resource/res/tab_selected_middle.gif | Bin 0 -> 52 bytes resource/res/tab_selected_right.gif | Bin 0 -> 104 bytes resource/res/tab_unselected_left.gif | Bin 0 -> 325 bytes resource/res/tab_unselected_left_hover.gif | Bin 0 -> 332 bytes resource/res/tab_unselected_middle.gif | Bin 0 -> 155 bytes resource/res/tab_unselected_middle_hover.gif | Bin 0 -> 155 bytes resource/res/tab_unselected_right.gif | Bin 0 -> 329 bytes resource/res/tab_unselected_right_hover.gif | Bin 0 -> 332 bytes .../tizen/emulator/manager/EmulatorManager.java | 159 ++- .../tizen/emulator/manager/console/ActionList.java | 14 +- .../manager/console/CommandLineParser.java | 7 +- .../emulator/manager/console/ConsoleCreateVM.java | 45 +- .../emulator/manager/console/ConsoleModifyVM.java | 10 +- .../emulator/manager/console/ConsoleProcessor.java | 57 +- .../manager/da/widgets/button/DACustomButton.java | 277 +++++ .../da/widgets/button/DACustomButtonAttribute.java | 158 +++ .../button/DACustomButtonClickEventListener.java | 54 + .../button/DACustomButtonDefaultRenderer.java | 165 +++ .../da/widgets/button/DACustomButtonRenderer.java | 36 + .../button/toggle/DACustomToggleButton.java | 175 ++++ .../toggle/DACustomToggleButtonRenderer.java | 57 + .../manager/da/widgets/combo/DACustomCombo.java | 757 +++++++++++++ .../combo/DACustomComboDefaultRenderer.java | 76 ++ .../combo/DACustomComboPopupDefaultRenderer.java | 76 ++ .../widgets/combo/DACustomComboPopupRenderer.java | 45 + .../da/widgets/combo/DACustomComboRenderer.java | 37 + .../combo/DACustomComboSelectionListener.java | 46 + .../da/widgets/combo/TitleComboPopupRenderer.java | 96 ++ .../da/widgets/combo/TitleComboRenderer.java | 100 ++ src/org/tizen/emulator/manager/image/Skins.java | 75 -- .../tizen/emulator/manager/logging/EMLogger.java | 2 +- .../manager/{image => platform}/BaseImage.java | 121 ++- .../emulator/manager/platform/CustomBaseImage.java | 14 + .../emulator/manager/platform/CustomPlatform.java | 65 ++ .../manager/{image => platform}/Platform.java | 189 ++-- .../emulator/manager/{image => platform}/Skin.java | 61 +- .../manager/{image => platform}/SkinList.java | 58 +- .../emulator/manager/resources/ColorResources.java | 195 ++++ .../tizen/emulator/manager/resources/DATheme.java | 152 +++ .../emulator/manager/resources/DAThemeWhite.java | 186 ++++ .../manager/{tool => resources}/FilePath.java | 28 +- .../emulator/manager/resources/FontResources.java | 169 +++ .../emulator/manager/resources/ImageResources.java | 242 +++++ .../manager/resources/PatchImageResources.java | 262 +++++ .../StringResources.java} | 15 +- src/org/tizen/emulator/manager/tool/About.java | 29 +- .../tizen/emulator/manager/tool/CheckSDCard.java | 34 +- .../emulator/manager/tool/CheckVirtualization.java | 8 +- .../emulator/manager/tool/SelectTemplate.java | 19 +- .../emulator/manager/tool/SelectWorkspace.java | 59 +- .../emulator/manager/ui/ArchitectureGroup.java | 89 -- src/org/tizen/emulator/manager/ui/MainDialog.java | 580 ++-------- .../tizen/emulator/manager/ui/MenuHandling.java | 104 +- .../emulator/manager/ui/ResourceRegistry.java | 120 --- src/org/tizen/emulator/manager/ui/StatusBar.java | 62 ++ .../tizen/emulator/manager/ui/VMButtonFactory.java | 86 ++ .../tizen/emulator/manager/ui/VMsDetailView.java | 95 ++ src/org/tizen/emulator/manager/ui/VMsListView.java | 367 +++++++ src/org/tizen/emulator/manager/ui/VMsMainView.java | 294 ++++++ .../manager/ui/detail/DetailTableView.java | 282 ----- .../emulator/manager/ui/detail/DetailViewItem.java | 330 ++++++ .../ui/detail/DetailViewItemChangeListener.java | 12 + .../emulator/manager/ui/detail/DetailViewPage.java | 116 ++ .../manager/ui/detail/EMComboButtonRenderer.java | 29 + .../emulator/manager/ui/detail/PEmptyViewPage.java | 44 + .../emulator/manager/ui/detail/PInfoViewPage.java | 149 +++ .../manager/ui/detail/PModifyViewPage.java | 184 ++++ .../emulator/manager/ui/detail/TDisplayItem.java | 412 ++++++++ .../emulator/manager/ui/detail/TFileShareItem.java | 279 +++++ .../emulator/manager/ui/detail/THWSupportItem.java | 304 ++++++ .../emulator/manager/ui/detail/TNameTextItem.java | 363 +++++++ .../tizen/emulator/manager/ui/detail/TRAMItem.java | 136 +++ .../manager/ui/detail/TTouchPointItem.java | 73 ++ .../emulator/manager/ui/detail/TableWidget.java | 1107 -------------------- .../ui/detail/TableWidgetChangeListener.java | 35 - .../manager/ui/detail/TableWidgetList.java | 88 -- .../emulator/manager/ui/detail/VMPropertyView.java | 227 ---- .../detail/{VMResource.java => VMResources.java} | 14 +- .../manager/ui/{ => dialog}/AboutDialog.java | 40 +- .../manager/ui/{ => dialog}/CloneDialog.java | 55 +- .../manager/ui/{ => dialog}/MessageDialog.java | 19 +- .../ui/{ => dialog}/SelectWorkspaceDialog.java | 24 +- .../manager/ui/tabfolder/PlatformTabButton.java | 130 +++ .../manager/ui/tabfolder/PlatformTabFolder.java | 227 ++++ .../manager/ui/tabfolder/PlatformTabItem.java | 58 + .../manager/ui/vmstree/ColumnContentHelper.java | 134 --- .../manager/ui/vmstree/ColumnSortListner.java | 107 -- .../emulator/manager/ui/vmstree/ContextMenu.java | 203 ---- .../tizen/emulator/manager/ui/vmstree/RowItem.java | 105 -- .../tizen/emulator/manager/ui/vmstree/VMsTree.java | 366 ------- .../emulator/manager/ui/widgets/ImageLabel.java | 96 ++ .../manager/ui/widgets/ImageLabelAttribute.java | 73 ++ .../ui/widgets/ImageLabelDefaultRenderer.java | 64 ++ .../manager/ui/widgets/ImageLabelRenderer.java | 8 + .../manager/ui/widgets/ModifyViewCombo.java | 29 + .../ui/widgets/ModifyViewComboRenderer.java | 31 + .../emulator/manager/ui/widgets/VMButton.java | 165 +++ .../manager/ui/widgets/VMButtonAttribute.java | 22 + .../ui/widgets/VMButtonClickEventListener.java | 37 + src/org/tizen/emulator/manager/vms/Creator.java | 60 +- .../vms/{EmulatorVMs.java => EmulatorVMList.java} | 71 +- .../vms/{VMCreateHelper.java => HelperClass.java} | 61 +- src/org/tizen/emulator/manager/vms/Launcher.java | 45 +- src/org/tizen/emulator/manager/vms/Modifier.java | 11 +- .../tizen/emulator/manager/vms/QemuImgProc.java | 2 +- src/org/tizen/emulator/manager/vms/RESOLUTION.java | 14 +- src/org/tizen/emulator/manager/vms/SKIN_TYPE.java | 9 + ...eatorException.java => VMCreatorException.java} | 4 +- .../vms/{VMsProperty.java => VMProperty.java} | 51 +- .../emulator/manager/vms/VMPropertyValue.java | 30 +- .../manager/vms/{VMsWorker.java => VMWorker.java} | 113 +- ...WorkerException.java => VMWorkerException.java} | 4 +- 180 files changed, 8750 insertions(+), 4129 deletions(-) create mode 100755 resource/res/add_new_hover.gif create mode 100755 resource/res/add_new_nml.gif create mode 100755 resource/res/add_new_pushed.gif create mode 100755 resource/res/arrow_down.gif create mode 100755 resource/res/arrow_up.gif create mode 100755 resource/res/background.gif create mode 100755 resource/res/button_file_dis.gif create mode 100755 resource/res/button_file_hover.gif create mode 100755 resource/res/button_file_nml.gif create mode 100755 resource/res/button_file_pushed.gif create mode 100755 resource/res/button_hover_left.gif create mode 100755 resource/res/button_hover_middle.gif create mode 100755 resource/res/button_hover_right.gif create mode 100755 resource/res/button_launch_hover.gif create mode 100644 resource/res/button_launch_nml.gif create mode 100755 resource/res/button_launch_pushed.gif create mode 100755 resource/res/button_nml_left.gif create mode 100755 resource/res/button_nml_middle.gif create mode 100755 resource/res/button_nml_right.gif create mode 100755 resource/res/button_off_hover.gif create mode 100755 resource/res/button_off_nml.gif create mode 100755 resource/res/button_off_pushed.gif create mode 100755 resource/res/button_on_hover.gif create mode 100755 resource/res/button_on_nml.gif create mode 100755 resource/res/button_on_pushed.gif create mode 100755 resource/res/button_pushed_left.gif create mode 100755 resource/res/button_pushed_middle.gif create mode 100755 resource/res/button_pushed_right.gif create mode 100755 resource/res/create_new_hover.gif create mode 100755 resource/res/create_new_nml.gif create mode 100755 resource/res/create_new_pushed.gif create mode 100755 resource/res/detail_category_left.gif create mode 100755 resource/res/detail_category_middle.gif create mode 100755 resource/res/detail_category_right.gif create mode 100755 resource/res/detail_list_bottom.gif create mode 100644 resource/res/detail_list_item.gif create mode 100755 resource/res/detail_list_middle.gif create mode 100755 resource/res/detail_list_top.gif create mode 100755 resource/res/dropdown_arrow.gif create mode 100644 resource/res/dropdown_disable.png create mode 100644 resource/res/dropdown_down.png create mode 100644 resource/res/dropdown_hover.png create mode 100644 resource/res/dropdown_normal.png create mode 100644 resource/res/dropdown_push.png create mode 100644 resource/res/dropdown_up.png create mode 100755 resource/res/emulator_list_image_hover.gif create mode 100755 resource/res/emulator_list_image_new_ani.gif create mode 100755 resource/res/emulator_list_image_nml.gif create mode 100755 resource/res/emulator_list_selected.gif create mode 100755 resource/res/info_icon_hover.gif create mode 100755 resource/res/info_icon_nml.gif create mode 100755 resource/res/info_icon_pushed.gif create mode 100755 resource/res/inputbox_off_left.gif create mode 100755 resource/res/inputbox_off_middle.gif create mode 100755 resource/res/inputbox_off_right.gif create mode 100755 resource/res/inputbox_on_left.gif create mode 100755 resource/res/inputbox_on_middle.gif create mode 100755 resource/res/inputbox_on_right.gif create mode 100755 resource/res/modify_cancel_hover.gif create mode 100755 resource/res/modify_cancel_nml.gif create mode 100755 resource/res/modify_cancel_pushed.gif create mode 100755 resource/res/modify_hover.gif create mode 100755 resource/res/modify_nml.gif create mode 100755 resource/res/modify_pushed.gif create mode 100755 resource/res/reset_icon_hover.gif create mode 100755 resource/res/reset_icon_nml.gif create mode 100755 resource/res/reset_icon_pushed.gif create mode 100755 resource/res/tab_selected_left.gif create mode 100755 resource/res/tab_selected_middle.gif create mode 100755 resource/res/tab_selected_right.gif create mode 100755 resource/res/tab_unselected_left.gif create mode 100755 resource/res/tab_unselected_left_hover.gif create mode 100755 resource/res/tab_unselected_middle.gif create mode 100755 resource/res/tab_unselected_middle_hover.gif create mode 100755 resource/res/tab_unselected_right.gif create mode 100755 resource/res/tab_unselected_right_hover.gif create mode 100644 src/org/tizen/emulator/manager/da/widgets/button/DACustomButton.java create mode 100644 src/org/tizen/emulator/manager/da/widgets/button/DACustomButtonAttribute.java create mode 100644 src/org/tizen/emulator/manager/da/widgets/button/DACustomButtonClickEventListener.java create mode 100644 src/org/tizen/emulator/manager/da/widgets/button/DACustomButtonDefaultRenderer.java create mode 100644 src/org/tizen/emulator/manager/da/widgets/button/DACustomButtonRenderer.java create mode 100644 src/org/tizen/emulator/manager/da/widgets/button/toggle/DACustomToggleButton.java create mode 100644 src/org/tizen/emulator/manager/da/widgets/button/toggle/DACustomToggleButtonRenderer.java create mode 100644 src/org/tizen/emulator/manager/da/widgets/combo/DACustomCombo.java create mode 100644 src/org/tizen/emulator/manager/da/widgets/combo/DACustomComboDefaultRenderer.java create mode 100644 src/org/tizen/emulator/manager/da/widgets/combo/DACustomComboPopupDefaultRenderer.java create mode 100644 src/org/tizen/emulator/manager/da/widgets/combo/DACustomComboPopupRenderer.java create mode 100644 src/org/tizen/emulator/manager/da/widgets/combo/DACustomComboRenderer.java create mode 100644 src/org/tizen/emulator/manager/da/widgets/combo/DACustomComboSelectionListener.java create mode 100644 src/org/tizen/emulator/manager/da/widgets/combo/TitleComboPopupRenderer.java create mode 100644 src/org/tizen/emulator/manager/da/widgets/combo/TitleComboRenderer.java delete mode 100644 src/org/tizen/emulator/manager/image/Skins.java rename src/org/tizen/emulator/manager/{image => platform}/BaseImage.java (57%) create mode 100644 src/org/tizen/emulator/manager/platform/CustomBaseImage.java create mode 100644 src/org/tizen/emulator/manager/platform/CustomPlatform.java rename src/org/tizen/emulator/manager/{image => platform}/Platform.java (84%) rename src/org/tizen/emulator/manager/{image => platform}/Skin.java (68%) rename src/org/tizen/emulator/manager/{image => platform}/SkinList.java (70%) create mode 100644 src/org/tizen/emulator/manager/resources/ColorResources.java create mode 100644 src/org/tizen/emulator/manager/resources/DATheme.java create mode 100644 src/org/tizen/emulator/manager/resources/DAThemeWhite.java rename src/org/tizen/emulator/manager/{tool => resources}/FilePath.java (91%) create mode 100644 src/org/tizen/emulator/manager/resources/FontResources.java create mode 100644 src/org/tizen/emulator/manager/resources/ImageResources.java create mode 100644 src/org/tizen/emulator/manager/resources/PatchImageResources.java rename src/org/tizen/emulator/manager/{tool/StringResource.java => resources/StringResources.java} (92%) delete mode 100644 src/org/tizen/emulator/manager/ui/ArchitectureGroup.java delete mode 100644 src/org/tizen/emulator/manager/ui/ResourceRegistry.java create mode 100644 src/org/tizen/emulator/manager/ui/StatusBar.java create mode 100644 src/org/tizen/emulator/manager/ui/VMButtonFactory.java create mode 100644 src/org/tizen/emulator/manager/ui/VMsDetailView.java create mode 100644 src/org/tizen/emulator/manager/ui/VMsListView.java create mode 100644 src/org/tizen/emulator/manager/ui/VMsMainView.java delete mode 100644 src/org/tizen/emulator/manager/ui/detail/DetailTableView.java create mode 100644 src/org/tizen/emulator/manager/ui/detail/DetailViewItem.java create mode 100644 src/org/tizen/emulator/manager/ui/detail/DetailViewItemChangeListener.java create mode 100644 src/org/tizen/emulator/manager/ui/detail/DetailViewPage.java create mode 100644 src/org/tizen/emulator/manager/ui/detail/EMComboButtonRenderer.java create mode 100644 src/org/tizen/emulator/manager/ui/detail/PEmptyViewPage.java create mode 100644 src/org/tizen/emulator/manager/ui/detail/PInfoViewPage.java create mode 100644 src/org/tizen/emulator/manager/ui/detail/PModifyViewPage.java create mode 100644 src/org/tizen/emulator/manager/ui/detail/TDisplayItem.java create mode 100644 src/org/tizen/emulator/manager/ui/detail/TFileShareItem.java create mode 100644 src/org/tizen/emulator/manager/ui/detail/THWSupportItem.java create mode 100644 src/org/tizen/emulator/manager/ui/detail/TNameTextItem.java create mode 100644 src/org/tizen/emulator/manager/ui/detail/TRAMItem.java create mode 100644 src/org/tizen/emulator/manager/ui/detail/TTouchPointItem.java delete mode 100644 src/org/tizen/emulator/manager/ui/detail/TableWidget.java delete mode 100644 src/org/tizen/emulator/manager/ui/detail/TableWidgetChangeListener.java delete mode 100644 src/org/tizen/emulator/manager/ui/detail/TableWidgetList.java delete mode 100644 src/org/tizen/emulator/manager/ui/detail/VMPropertyView.java rename src/org/tizen/emulator/manager/ui/detail/{VMResource.java => VMResources.java} (91%) rename src/org/tizen/emulator/manager/ui/{ => dialog}/AboutDialog.java (82%) rename src/org/tizen/emulator/manager/ui/{ => dialog}/CloneDialog.java (77%) rename src/org/tizen/emulator/manager/ui/{ => dialog}/MessageDialog.java (90%) rename src/org/tizen/emulator/manager/ui/{ => dialog}/SelectWorkspaceDialog.java (90%) create mode 100644 src/org/tizen/emulator/manager/ui/tabfolder/PlatformTabButton.java create mode 100644 src/org/tizen/emulator/manager/ui/tabfolder/PlatformTabFolder.java create mode 100644 src/org/tizen/emulator/manager/ui/tabfolder/PlatformTabItem.java delete mode 100644 src/org/tizen/emulator/manager/ui/vmstree/ColumnContentHelper.java delete mode 100644 src/org/tizen/emulator/manager/ui/vmstree/ColumnSortListner.java delete mode 100644 src/org/tizen/emulator/manager/ui/vmstree/ContextMenu.java delete mode 100644 src/org/tizen/emulator/manager/ui/vmstree/RowItem.java delete mode 100644 src/org/tizen/emulator/manager/ui/vmstree/VMsTree.java create mode 100644 src/org/tizen/emulator/manager/ui/widgets/ImageLabel.java create mode 100644 src/org/tizen/emulator/manager/ui/widgets/ImageLabelAttribute.java create mode 100644 src/org/tizen/emulator/manager/ui/widgets/ImageLabelDefaultRenderer.java create mode 100644 src/org/tizen/emulator/manager/ui/widgets/ImageLabelRenderer.java create mode 100644 src/org/tizen/emulator/manager/ui/widgets/ModifyViewCombo.java create mode 100644 src/org/tizen/emulator/manager/ui/widgets/ModifyViewComboRenderer.java create mode 100644 src/org/tizen/emulator/manager/ui/widgets/VMButton.java create mode 100644 src/org/tizen/emulator/manager/ui/widgets/VMButtonAttribute.java create mode 100644 src/org/tizen/emulator/manager/ui/widgets/VMButtonClickEventListener.java rename src/org/tizen/emulator/manager/vms/{EmulatorVMs.java => EmulatorVMList.java} (78%) rename src/org/tizen/emulator/manager/vms/{VMCreateHelper.java => HelperClass.java} (57%) create mode 100644 src/org/tizen/emulator/manager/vms/SKIN_TYPE.java rename src/org/tizen/emulator/manager/vms/{VMsCreatorException.java => VMCreatorException.java} (91%) rename src/org/tizen/emulator/manager/vms/{VMsProperty.java => VMProperty.java} (69%) rename src/org/tizen/emulator/manager/vms/{VMsWorker.java => VMWorker.java} (77%) rename src/org/tizen/emulator/manager/vms/{VMsWorkerException.java => VMWorkerException.java} (92%) diff --git a/resource/res/add_new_hover.gif b/resource/res/add_new_hover.gif new file mode 100755 index 0000000000000000000000000000000000000000..cace0aa5408e342f73d472aee073942e7175b263 GIT binary patch literal 1542 zcmbu)3p>+$0KoCz*2WC^BeZp!t!5-=DxzH0*wUekj_xYgEDwdFCz0Bv$tDdY6d6`K zg|<~wm~3k?nMD$j!@3eZF5Re(o#(uU^L+uI=lO2hO!xARj0Xjv2Y}bFUmFaDp`oF{ z!NGxnf#=VkcXxN|_4+9?4>g00y zojZ3V5=m`sZB0#0b#=8^EWUpIx=19ds;UwSg=J-BB_$a>MwTKOIi?LZP<%T2Sn5|7amB$r3@i!bXhyV;Xivti@+~d1)Fu4FF zI0-BSRsmK5ivSxzCa@DkP^)sXgODUr#Wsmlc8AX1PPl!yzM(O2cd|mMQUk}>N3B{3 z#<{ISAJk4?QS!7$)kSm0ym-}UmH2XC@Qtef?T5zqBV)3U;}f(Yy4{1xiN0^Mn`VCe zL;W@P1%_bacPRgyH@IZE({HcTr_swE=8%$?Jm%}MHWlY&1Ii0;{Mc`aDKT;ua*JOu zX>06iM00j{>SzM7BgXUC()OEwyxQV{ zHrXG&{`O>~9nYG`{VVaa*sjA$-9p%EoOEbdgid!r;3gz_Uac-^#6F!aJ)V;$8SwW)6cK+{v5KY zNpIuqqtr+3Uwq9cX1_CLZ!M$x@RDZ+^V?mv^ZYXQemBIGoqqSrA(#pGqvOb59a$0V zTHo$rYb)x5MX6Gf)6y(S7{h2tUhL;s=9adZsWKtm_zTZp;`2hqCm&_95Ywjgn%Zc6oxO20BON3hjFg^ zEh)+p#*LGQVdg${6j*%AW+iyZ9fiD6Zp9X`uOY?3*Bn#c#AWCYFdVLNO&mttubAcA zRHEHnbd&=9Wm0y*=sd=a*#tf&p6cP?EFR&bzUa0>7BdWckbH7=*1Yg)N zmn|xgH}G{ALwAj?D9-KqJmMAm#5=A`9Lm+@>iOCG?lo9wtmU#0?kd-Q&uEsZ3$h2PkMuAf47w!xAXy zX|yZcEUo~!p|C)>5j|sb;M2WEO2m0Hnyqp*_!tl1nO^g@%eqjlD?J+a5kgjP#3{z6 zo@vvB6DpwdIop6AUbOGUep@CRIi(**s#o?le%2K}Q{Qtt5!0pAALER%UhV11lp$+E zaPlZpUXq7d@kCUj?>4V3i081XtIW=QhZ65;#t$Z}dkQpVcOT+JlT%%^s!XHU)!nvY zBgQN+fsOi+&ZLcBXzo}KTON^oAF>ybwNI9fRYu+%P*)b$_J}WMu77y+80`$Tl#=^B zm=b*2`hEE}?eIq@cgVE#zR@baZ=FZxt!e*IW8Kf_0sl~`GZocR?Apo0kkSqgU7q`XknH7tc62F zdszTT=z=P|kPAB|QGr3$c2q9{;R?iczEo*`5a=)pupm@QP+6W>pkAbacO Y!X2HaUWZ{w7N-L5(59v12`I4PU#zdPK>z>% literal 0 HcmV?d00001 diff --git a/resource/res/add_new_nml.gif b/resource/res/add_new_nml.gif new file mode 100755 index 0000000000000000000000000000000000000000..9b8e5cecdc339220ed32db402854f1a8b6fcf75c GIT binary patch literal 1552 zcmbW1{Xf$Q0D!;y#vhnfp(b3Uo&z_Bpj7X)@p`oF{!NGxnfxf=J?(XicuCC6`PKiX) z(b3V?)+Q7R1p+~1V`F`NJ&(t$si~=|s;aE4P)cm8Vvpehn0-pvNh?yWr67i*u7D2z!* zSp|&OQk1=sy5zhIchNE3)uvH4=$vlu$(UM0?>2w&`Bs1XKX4cr1(Tk^0$~~H=L2#v z`QT=DGKga9QgqoUiUIoy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9}qcA7ts%aftoRVmA3A kOCP7Ov(YTxa@^n%Vl}?U=3Z#RfxJrd?e6Xuzt7X*UvKlY?f?J) literal 0 HcmV?d00001 diff --git a/resource/res/add_new_pushed.gif b/resource/res/add_new_pushed.gif new file mode 100755 index 0000000000000000000000000000000000000000..7726b272d336511b4c2e854ad89e9a770fa0a636 GIT binary patch literal 1492 zcmbWyi8~W~0KoCz>|m~48M0oj`w+9_b(9A?P?oJiZzx1lwpy-UFNuxOR?VbHDYREb za=j6AY|5Il$%Bq}c`ECnj2sg(%kYin=ZxFM6tDk>_<%gZlax>Qn9 zB9%%D3kyXe(dpBt1p)z|&(FxnNJ&ZIa=9E1CowVc@ZrO3HajLJCMqf_A|fI@JUlcs zG$bU1!C(Xh1qB2IP$(3m(Fp!8;x`xs0H=TZ*MCm{Vf4-B1v)L2sAWlg9Ivw`eZuQ# zbC2gveu3&kaR0oLW_z-#tTHaxewV7K@=(9s&dyLpYDXxxdWkiJVx1=x0EjRzHB4-M z7QiIw03k7>m`M;6bID0yDT(&KE-nZ(ad4;%sc&d(qVt*fJI!tFa%%YT4u!G@EQ!DW zP+f0L=+kHeAJgqF4U8xUX$0%1FXd+37rIfs^6$43^6__u#>uG}+AF%{z1f-PU%mx= zUHIw$WAPIN)|gh-`b7m8{KG2iYL?0+7Di!OWZf!Dz@D&V6Yp{w2Q$W zu=R2sQ(9FUZnN=6JR_|NcDgxX#}%}$C=!Vwjy(FFDtfYlc4OosEt$>HRblogXwF zimyxmxbk(DdXbo0fSJ(O+87CK4XsHZ4W@HSN*c;ByW&;$hmqC&dwMpNjPfnrJsgh9 zm)lt$wGMm!`k35|*@sqc@-tTEEx&k(k-t6DF1EmK1tk`{=4wKW$a}7OhuGQ6Oz)(! zi8(;}iYawGwdjec$oA33N3#}l8?GLl_M8|}j-xY{$`7O_`Vm7jOyzK=Mc&=%exZjhH{RRmUKU<}5$B ze{h2VLLdOpGh>dK0R%S#7j6qfE8y~-vjCuYzIE#Mdy`ZXRU9b^Afe1DD2}(+70eX{ zJ2#V1;>~RU=a$p7P#t;G8MD{h8K6-t4t!XcmaK(vo`7a_hM#lKV63IF6zCy9ab&qlKb>0%1FxsT{@ltgUr&!o5jqy^jZE?UwUX9~wV~mAe9F1ZNsX zn2MNJ(~~{L_o-W%bjb7}X3kwqG$dWO(`C^WA7(KKOa;q3>YY7>hYh$);lfa^XUSzh8Fy^_lrtl^%A|R{ z!-2(F=t;+}`HS_(=+VRS?gw93gRhEzZb%KuU6?ltek@Et_XBo`&ukki{LS~E?+d0i z>^9V?fSlKX(XlXO3O@(>S15vgR~c@j_o#b!&80#i8n<^bPsQ>fU=T}lT7f;km%2JO zq2Lua7Gn!jSXp62yJw$RN_=xISj1c+xeCcD^;(h#g7`>2e2r dliJkzOb+y9bS&N-xFgEu&Ljluz4-um{{v>?kH!E1 literal 0 HcmV?d00001 diff --git a/resource/res/arrow_down.gif b/resource/res/arrow_down.gif new file mode 100755 index 0000000000000000000000000000000000000000..38fb43800a7ae840a733bbef7f803fe9b8125226 GIT binary patch literal 106 zcmZ?wbhEHbWM^P!*v!DNZQHgjTefW4v}y6;#ogWAot>T8+1Z(ynGOyPN=iynQc~R9 z+?<@83=9na|NjS)ia%Kx85sB&bbxH23G56EEaCzuID>ZkayCUzJkjcN_z=&O!T<*W IA3+9d06R_}rvLx| literal 0 HcmV?d00001 diff --git a/resource/res/arrow_up.gif b/resource/res/arrow_up.gif new file mode 100755 index 0000000000000000000000000000000000000000..d28e6d853d5142ab958068304d397f06a309c397 GIT binary patch literal 158 zcmZ?wbhEHbWM^P!IKsfNZQHgD8#c_FH*e0IIsN_p?d|Oi4Gm>wWl>R4-rn9878X)c zQW6ppY;0^SEG!HR4FCWC2a?1C#h)yU3=9GcIv_0|I~iD|6$BYnX6m?cs+?cUk@nl< S=q;m{uN0Ikd9)lj7_0$Fk0J#C literal 0 HcmV?d00001 diff --git a/resource/res/background.gif b/resource/res/background.gif new file mode 100755 index 0000000000000000000000000000000000000000..c1d7c47ba708aeee65672de762c912258e0e5fcc GIT binary patch literal 43 tcmZ?wbhEHbWMp7uXkcJ4H#h(P|G(l-7Dfi3fDQu?fMgh$m|PectO3$?2cG}{ literal 0 HcmV?d00001 diff --git a/resource/res/button_file_dis.gif b/resource/res/button_file_dis.gif new file mode 100755 index 0000000000000000000000000000000000000000..ec532b6b8d098888ed8b73f185c2f9cd93841880 GIT binary patch literal 549 zcmV+=0^0pYNk%w1VI}|+0M!5h`1ttu_xJVn_4D)d^78WW@$vBR@b2#J?d|RC?Ck67 z>+0(2=;-L@=jZ0;=H%q$(^($dh-(9X`z%gf8k%F4;f$;ima#l^+M#KgkF!ok78zrVk|y}i7=ytcNsw6wIc zva+eEsi>%^prD|ipP!qXo0gWAl$4Z{larE?l8}&)j*gCujEskehlYlRgoK2HgM)#A zf&c&iA^8LW002J#EC2ui044ww000L6z}3oC)A^3bq;kpB)m*}r47Wi50@$o}%iRJH z8=P$Qq7euPg?i0yyWfcO>}Asw7!Qbk&+q&H4-5quHar9i5fX}vjE#p%*g{Q1AdEgovk5qe`6$H3SF`6cEgj nfR99ZR;X*|7{3IM5&_3Y{HH;>u03!^R6CK>z?ddu=Cz literal 0 HcmV?d00001 diff --git a/resource/res/button_file_hover.gif b/resource/res/button_file_hover.gif new file mode 100755 index 0000000000000000000000000000000000000000..1eea78c5812bc2e03232eeefce8cfd042b9a29ce GIT binary patch literal 549 zcmV+=0^0pYNk%w1VI}|+0M!5hCnhE`F)>|STwGgQ`1ttu_xJVn_4D)d^78WW@$vBR z@b2#J?d|RC?Ck67>+0(2=;-L@=jZ0;=H%q$(^($dh-(9X`z%gf8k%F4;f$;ima#l^+K!otD9!N0%1y}iA> zyu7-)y0*5qsi~=`sHmHpo0gWAl$4Z{larE?l8}&)j*gCphlhrShJ=KKgM)*Cfr0=3 z{{R30A^8LW002G!EC2ui044ww000L6z}E{_%k_@Pq;kp3)nLMx4EJFW3fQc6%iR(f zADrwJqahFshkDI!yWfoSEN1g0AQOsy&+q&H6A%d;HaiFp6&8w%jE#y z7nz!yoSmMV5(Y;H6B(wbsHv)}s1pZA2o@W&w6(UkxV07tM+p}mz`?@9#KpoF2}cSU zA_rr=;`X~?CBj0M-3k*^!4;C00H$j00R5{ z_5yxr5HAFZg9s10$cOL-fB_93CY%_8V2=hOQmEL-v7^V2AUCEEL2$t~;!$u4tK>z?dSsxx` literal 0 HcmV?d00001 diff --git a/resource/res/button_file_nml.gif b/resource/res/button_file_nml.gif new file mode 100755 index 0000000000000000000000000000000000000000..e3791bbd41982ccf29a6056a776bd5651da155df GIT binary patch literal 514 zcmV+d0{#6*Nk%w1VI}|+0M!5hCnhE`F)>|STwGgQ^78WW@$u~J?Cb06>gww0>FMa` z=;!C><>lq$yu7=+ySlo%wzjsZsi~-_sGFOcm6es0 zl$4W`lai8>kdTm$j*g9ujfaPahK7cOgoJ~GgMop8|Ns9000000000000000000000 z00000A^8LW001}uEC2ui044ww000L6KolzFn%$1bq;koexl%&ZDyC5o3fQc6%iR(b zn%D}ZY8em41ehz*xB0I4@VFk;NjsU00H4I00QUf;_V#}M-dAcu{78 zhY==D$ec;Drp=lrMtGReLWL9`85}TJxInb1(W6L@TEM_T#uy=WXfT;dH3Hq)$ literal 0 HcmV?d00001 diff --git a/resource/res/button_file_pushed.gif b/resource/res/button_file_pushed.gif new file mode 100755 index 0000000000000000000000000000000000000000..4f885436ad6f3f2c5b632ac4d1d6ff7a7517a433 GIT binary patch literal 731 zcmZ?wbhEHbRAUffc*elc*50nJre-L?yx1{yjbtRrWefIpt%NM%s zI^yp?eEjtJ%V(W-ZLwd!|NQ;;|DV@i566WI4mNWLYx&H0bb*soK-p`K$3~^2!tGuT zH%@F^e7s-5ewu~Lp~jPw)wNj!3XI$sm~`V8&3V~yL{X5p=+za=#HD@`jBI~+c5TjJ z7HoIY2{^E2<>lo8i|u$nHnVfFac;`Gdur?I>ub6FzHA6oW@=*2xV$R%^fuin7D0=w z8xaQ|A8BS`<9c!T^!D}l_pu4tSR71lT_R`VmUH63j*X9xPms@-a9n&`!*Oew!L2iv N7yEWLF)=b&0{|kl7XttQ literal 0 HcmV?d00001 diff --git a/resource/res/button_hover_left.gif b/resource/res/button_hover_left.gif new file mode 100755 index 0000000000000000000000000000000000000000..719afbc248d6375f9ab43d73e27ae120fe5564cf GIT binary patch literal 604 zcmZ?wbhEHbWMfcac*el+>n%a<-)x_I&8g$ozXpFe-@+_|%7 z&z?DR=Je^)r%s(ZdGh4(?dJ|HH4+?h>W;fyo8q|(K6QYu%SIb_ssIdjTt z+`l8I`Pi9DLHos1Mcp^f+{$_%-zn>Vb>>ku{N>E6ZuI|;-x&#uBaU2B9Neo`9Nh4r xOIqOP${mf&?E>uTIZsYpeB8_?VP5p$!$OC{oMIgfEe#hOF7V2=F)=b&0|1B->Wu&Z literal 0 HcmV?d00001 diff --git a/resource/res/button_hover_middle.gif b/resource/res/button_hover_middle.gif new file mode 100755 index 0000000000000000000000000000000000000000..e02ac493f4b015a75ee10bb7a49fa01942d9ecd3 GIT binary patch literal 261 zcmZ?wbhEHbWMoibxXQrr{rmUVuU|iZ{`~3Fr%#?ddHneCqeqV(K74rp{{4IR?%la_ z=l1Q}H*em&e*OBjYuBz^xpL{!r3)7>oI7{!?Af!YPoF+{^5lsVCypOKe(cz>BS(%L zI&|pZ!Grtv@87p?-<~~tcJJQ3YuB!wJ9joVHva$rpMeHI@h1x-1A{Vy4#;efpBUJb p90U~%6hwH~U7R*1n8@&ZxEL)A(VNkecKBt5-GT|O3S3MK)&ODxX7d05 literal 0 HcmV?d00001 diff --git a/resource/res/button_hover_right.gif b/resource/res/button_hover_right.gif new file mode 100755 index 0000000000000000000000000000000000000000..8408eae18301231624094462a351e3542a8e58ba GIT binary patch literal 601 zcmZ?wbhEHbWMfcac*el+>n%a<-)x_I&8g$ozXpFe-@+_|%7 z&z?DR=Je^)r%s(ZdGh4(TUU=0A%807!} literal 0 HcmV?d00001 diff --git a/resource/res/button_launch_hover.gif b/resource/res/button_launch_hover.gif new file mode 100755 index 0000000000000000000000000000000000000000..ad6a94f9e70a4a2ca0b3577f16ae0b6eeb7fbf2a GIT binary patch literal 408 zcmZ?wbhEHb)L`IaxXQqwtfH>2sjH%~^=pN{iT4d=RZ0Qwb?BFKh93truAZ=_bV`3*~ z=HQuCVc_QPom;K%;_IDL<&|CGomK9cR>ZLDKhwrfOzYpX&A-7m`!aX^YM!daBJnjM zaaBg1LI3~%XCMVA{$ycfU@&0N0cisHiGgjagYyYzt}c?quw{>L1`it(OLY;WfU8h*E|aX56bCa8 zcV~`}o8aVZE*Uj79e&QH8LWct(-$#I&r#FRW12K$iRiK!D^{uNu3NNm^W<4`w1pXX z7A+Q4?O4>UDcL{q$kd9e$+hea3m3JjD5YQO%)fr4R7qY`Tp%L;<*Nh%aZwRAePvhQ OuirfUmG#*i8LR=6#dJad literal 0 HcmV?d00001 diff --git a/resource/res/button_launch_nml.gif b/resource/res/button_launch_nml.gif new file mode 100644 index 0000000000000000000000000000000000000000..d90abdc23659bb8dc1c3eaabcbae57b9d609e928 GIT binary patch literal 388 zcmZ?wbh9u|)L`IaSgOsy$i$?mtg5V{uB-|~8Y*f)q$#hVqpYs2s;;T3t|hOjtEQo) zrlBpTWvHyFr=X>$rm3T-tuLoztf8$ZZEUM$U?O8;r)_AeZD=NE=AdV0E$I*-;T&S* z;9=zGVdCg+>f|XBS0xf(!&9}GyM8s>?8|KPZ!oQY&$RIq!><1n0v!e*0QrT1ZKcD3 zgThRb{U??bb@Ej5HLzw(J{Ym?#+tIzdy|Z$FFe}3&_(LS7OS-x>+iqjNd3&2dhWy4 zM~(^-B9#S#lCENn*=$m3GK?&oJndOxZfz4YSjDxpRQQ-1rtwZzm^zI`be5Ke65E7n ziR%L4~r4iPao+^A|KLrlc*%y?CiuJ}4wC Y_QAur1O)*GAs3%luRZ;Q7#ta_0R>c}qyPW_ literal 0 HcmV?d00001 diff --git a/resource/res/button_launch_pushed.gif b/resource/res/button_launch_pushed.gif new file mode 100755 index 0000000000000000000000000000000000000000..bea863b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5SUoq@1fENcl8HE`LI~s}_2|F8)8wxuelpPB@ zADJHvJ0PAQ4Lc#DAr3nts3H$LBdsG4J0!9s5j!QfB@#O)yeAVoD8VQcJ1NE~6+0@+ xDi%8{&@0X@)GZi0F4-;@J1^cW7dkL7FD4>1FfAn(HZB<(A~;M!Gc86z06U2C&I$kk literal 0 HcmV?d00001 diff --git a/resource/res/button_off_hover.gif b/resource/res/button_off_hover.gif new file mode 100755 index 0000000000000000000000000000000000000000..c0c3cbaac49e26881892dd223ef2a263644ef20b GIT binary patch literal 800 zcmZ?wbhEHbRAUffc*ejG6datCoc!a*kMG~VfBpLP^XJc>K7IQ5@#BXNAKtxt_xA1E zH*em&e*OB@t5+{xymsWz&6_uG+_-W5 z`t@tqu3f!)^~#kimoHzwbm`KC3m49vJ9ql@=~JgpojiH+#EBC}j~+dA=+MD~2lwya zzjyE6J$v@--o1O*u3g)=Z{N0U+sc(ISFBhufByX0vu976Hf_q3DU&Bpo-}DvUteE) zdwW}3TT4qzb8~Z3Q&VGOV?#qjb#--BRaIqWWpQzFK|w)&etuqFUT$t~Mn*<_e0*$d zY*bWKaB%Sd|Nj{VB~bjy!pOkj%b){t9Vkv1*#9@^>l>I^+O>Cdc6Ikyni(|d8(YY7 zF)`1WIcxTu*-Tur7RLI9rfh6nJgZi(S-WmM*K!j>a~XC%L7`o{_w3!bUyzSo%G{cb zS6JlK=`&}~oj)ba%W7lCA|QHG$Cbh7-u(v;A2PV=+!PgHX=fD_f5+(U<@x!`*Kgmv zycyq#3$nJeX{1QZU^zKa$wf#j=0rf^L}iajJZBsZ9$3gMYLVe$cy#-ioHq4w!+O@9(xf-m+fxW(1&Xm}97#G}|G#2B<$LrKA{=a$LMGNO zF(n%gIiDRH68V*)e%LZ5z3pR@^II~*XXmD;r)Q|o|FEIqI4`fL*OGvZi?+PHydrpU z*u+IGtVxC$8XFj#j&KO=D1LqKto3&eK?NO+8LFJ@>>Ru@HWBCc?EL)vjI2q+0ml%P RD61!@t`;h{EpTA41^~a;KPvzL literal 0 HcmV?d00001 diff --git a/resource/res/button_off_nml.gif b/resource/res/button_off_nml.gif new file mode 100755 index 0000000000000000000000000000000000000000..a2c24b40befd0590497c6446fe839b80c13a33cb GIT binary patch literal 776 zcmZ?wbhEHbRAUffc*ejG6datCoc!t2r;i^$zIpTJ_3PKKUcGwx^5u&cFP=Yt{`Be7 z$B!RBdi3bw!-x0p-@kY7-km#lZr{Fr>(;FsH*Q?Ne*N0DYgeycy?pudrAwDCUc7kj z+_}@IPoFq(;`s67M~@yobm-8*g9rET-@k9)zP)?*?%A_v_wL=hcJ11}efzd;+g7ez zxnjkN`Sa(`o;`c&)TvXZOqo1+@}xp1r#`Bn(X1czBN;KXLNZ=@UGxW)>{`m-$ug8QgB( zx_##kgT3k%ewKDtf#(8@t}f1R-@X6v!NryFg#c?iyYO#eXD3Jd8V(tc4G#{;JGSsV zG=F$tA&Zz&l)$Ct_P%ZjFh+3&}oKHc`P{U%2L$fch zUCD+!ogVG|v!%pjvNkMy!6t20`R+>M;TLUe?J@;3P9?eqE!8evv*6UhgA3W^4pmtc zGHaifRzFfzQNY2}v0Wk6CufJl_H}o6SLo*$Fp9IV$e60sa5(PR@bGYlu=GEMgKRy# zGHw%Q`0U*D^z;n%{s$Wv-BxnQx=b-}+_mN9Y~JJI=ttbm>3zX0nMW*8UO$Q literal 0 HcmV?d00001 diff --git a/resource/res/button_off_pushed.gif b/resource/res/button_off_pushed.gif new file mode 100755 index 0000000000000000000000000000000000000000..291d13db6840f77a55e8a08643c1f62037243589 GIT binary patch literal 782 zcmZ?wbhEHbRAUffc*ejG6dW9%kg#~klD78tXV0EJe*E~+qel-PK78=t!M%I;?%ut7 z=gytmw{PFNb?e5B8&|Jhy?pudrAwDCUc7kj+_^Jn&YV7d`oxJ7$B!RBcI?>Eqel-O zJb2*1f&KgU@7uR;&z?QIcJ11^bLaN$+qZ4owt4gBO`A4t+_-VWh7If1ty{Zx?V2@f zRqv10l1retv#lUS4i) zZbn8%e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ibxskY7bnKs!76v^F2*K`oyCpV3?6TQ^eZg;iLJ&kPd`ft~ku%jmZpX5yILhhEn)XYW-AMf4v zUS+#Ly37TY&i8I9q%+CA4zCjqzpi83wY)jjqjx=p@To^PD&w+Cul=Xct4q)@=@awH zUc_Uj8F+*8BlbWc@5R}^oi>l_a{I2l9xN+>cwq;=b%N&^&}&gWZv*=mURk&N-Lqr7 zAN#oQ#lD`^kPNp^p^g4cSH?kSm*j$6$Xy9U9xR4PjkT0>zU4&jWOFFqG0kU8DhNhm z%NUxiQS;2`uX8a6Hbx!2M=epYwh9%J6uv_$X|?s801-<*Dg-I)1Y`V!JM6OnGRPYb z^(uPy8g`rkeL)3nu+NSI(3z-b!{acsb6d(s*yB?_p5d|2-w+;XxQ{Q7!xXj8hik{p za{DjxLL(Y!7uE?&G|+)x7p8|GhSK0i1C#nWO4f&d7o<&zzgzWluW=GfsrB64^P&X#uZ*#H0l literal 0 HcmV?d00001 diff --git a/resource/res/create_new_pushed.gif b/resource/res/create_new_pushed.gif new file mode 100755 index 0000000000000000000000000000000000000000..fc4aadabb82c78e9964f8d6547082081f8bf777e GIT binary patch literal 5457 zcmeH`XH%02qd=c0g#<*1q1O#Xx*9AraZM=FRJwp5QbdZNbVxu+=$(WT0t5&>p(aQ# znt)V6BOn5z23G|v@0)d9S1ik&`y=kRd;Y+gIWx!3;hdRy;630T@DBj2K7009Aeevn zaBhBnW_EUBa*{tWF*ZIvI5gBhFu?8YWwF`Jh6YA$Z4HA_L8HBX{d#L_ODGh+diCn% z%a<=+yx82_eE$6T#>U3_`uf`1+OucRR##V_K7G2fva-CqytK6RDESyQ{0Kv$M0K zqocjOoy}&mSgf|Tw$|3xmX?<0=H{lRrpCs`hK2?vlUZM1UsqRGTU*OuFluUQs;jH3 zs;cO8dSzuLjYg}es3KR+)oFE=+g zCnqO6J3A{YD>E}QBO@a{J)KM@lSrhrw6r^S?%ck8J0&HBNF)*ng!uUQsHmvO$jBQv zZiI)2hlYj*1_oZaa>du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r^! zy^07UT9x8TGj!+yHp9=+g!Suo#BAN5PXvoGW*R!Bqz%SJX|!-W53E^%JEL`Em=F&ge_7E5=GN1IGxApjn9_6dAzd<|FSOiU z!T(kwYz3>gx*$OlPfPL7d@qFDvzgiMBrNQL_@T>=J79JhMh!)ty|kvm19NL58)YEQ zv(ZRR3&tO00K2Xw0$*GQ)r4k^P3vmQ>sc={TI|=Br!y|QZDbvRsPSS=SD)2X%E(8b z4GWDMxEp7kLmeDXtUC34bTQAMEw1Owm9Dt!kslLUkO{8a%pBGxfQ$3|Gj{OT=3C7d zq0`UH2!he1)X~b6heu~pc!-x=-IsGSGP9-y^MfyTucT}q)L;MgQl$3k^O;v)uDtqs Q`_;GFSKn_FK@d3oKmV>8;M1& literal 0 HcmV?d00001 diff --git a/resource/res/detail_category_middle.gif b/resource/res/detail_category_middle.gif new file mode 100755 index 0000000000000000000000000000000000000000..72c898de717d743eeff90d51d0e06fd877f5ad55 GIT binary patch literal 45 xcmZ?wbhEHbWMmLvXkcLQkB$>8 literal 0 HcmV?d00001 diff --git a/resource/res/detail_category_right.gif b/resource/res/detail_category_right.gif new file mode 100755 index 0000000000000000000000000000000000000000..879995784ea7299b51753506abb61cde63f8c5b2 GIT binary patch literal 102 zcmZ?wbhEHbWMvRw*v!BXo|NVv9pBjA8I_t5nUY@D+FskzR^QgKWy_ZT|Nk>!0L7my nj0_B%3_2hgkQodt!Uiph6Q(?8Td@0of=1b$P>+^I7Y1tp{#6|3 literal 0 HcmV?d00001 diff --git a/resource/res/detail_list_bottom.gif b/resource/res/detail_list_bottom.gif new file mode 100755 index 0000000000000000000000000000000000000000..bbc28c5de6961f8ee1529538f5ef792ffc2022f2 GIT binary patch literal 438 zcmV;n0ZINxNk%w1VKD(60K@3T+rKP2zp`oClpp})Cl$4Z{laq*uh=+%VhK7cPg@uHKgo1*C z|Ns900000000000A^8LW000~SEC2ui05Jg_000I5AYeI3X`X1Ru59bRa4gSsZQppV z>y8D8q@8d`EE| z<@UUO&&BiqfPqAQf`x{MErf`RjDm`dkdbtcl9iTal$V;DS3X&sprKNkqNS!dq^GK@ zE~%`quxXxRv9-3Ywz;6Vy1kaXzQK)Q55mTr51tti3dhcp3J@3o0T>Yr&)JL%5gGvk z6cr5&&D!RF3JeVt6aoYY8x;}|4-WSC`1$(#{Qds_00RmfNU)&6g9sBUTsZIn1PK*3 zARusHfPo1YGFaHiv7^V2AVZ2ANwTELlPFU&s$9vkrOTHvRc5#_!N7n6I12~}@S~^C gpFo2O9ZIyQ(W6L{DqYI7sne%WqdNUo0A~mQJ8x3cx&QzG literal 0 HcmV?d00001 diff --git a/resource/res/detail_list_item.gif b/resource/res/detail_list_item.gif new file mode 100644 index 0000000000000000000000000000000000000000..942b5bbe0b517a85a31bd3c0ff088262519ed582 GIT binary patch literal 132 zcmV-~0DJ#ONk%v~VJiU|0Du7iwzjta|Nkri0000h0U7`R0%L@asmtvTqnxzbi?iOm z`wxcVNS5Y_rs~SJ?hD8AOxN~}=lag~{tpZahs2`sh)gP%%%<}RjY_A~s`ZM^YPa03 m_X`e-$K-YS={}0Gf002A2d`OM} literal 0 HcmV?d00001 diff --git a/resource/res/detail_list_middle.gif b/resource/res/detail_list_middle.gif new file mode 100755 index 0000000000000000000000000000000000000000..fc41c977a5ead0fc35f14c62151ae627260c1aeb GIT binary patch literal 243 zcmV}Nk%w1VKD(40HOc@-rnA}wzj9Ir<$6Ym6er@jEsngi2wipA^8LW000L7 zEC2ui05Jg@000BH2qw|~Fv>}*y*TU5yZ>M)ih=%MR-W97Nbc&_h!-`6Og za7Zi~cfi|m$!t2Gfn*9wty-@kDR#^4cD3HHcuWM7&*(JEtZuvC6*hcMSIg`8Jom2e z`8o|c}Wh@hgSex#1HZt*!o$SH#>dFX%FE2n&d<=%($mz`1O)&I06X(}dny0` literal 0 HcmV?d00001 diff --git a/resource/res/detail_list_top.gif b/resource/res/detail_list_top.gif new file mode 100755 index 0000000000000000000000000000000000000000..d259c0cc6aad1cd8abcad41b2c8b4c3ecb36d71b GIT binary patch literal 451 zcmV;!0X+UkNk%w1VKD(80K@rs|1(9KJcw97?q;kn@I-k&}bV{vSuh^`1%k6rxn#6tB8WWMb#Kp$P$jQbF6B#EM63Wuk)YaC<5*W`B*WKRV z;Ng-H+5i~b;_2$^?5E`0?eX&S^Y7;9^!fVx)Ar~500RoN+qc`>+yDRnU-2gkBLf37gAM}_faDpNxTokha%M3u LY6`r@#9$2o7Ml=z literal 0 HcmV?d00001 diff --git a/resource/res/dropdown_disable.png b/resource/res/dropdown_disable.png new file mode 100644 index 0000000000000000000000000000000000000000..8a8a2ae0614c3c37db1a906214ddc8dc1a41942c GIT binary patch literal 2945 zcmV-{3x4#8P)KLZ*U+IBfRsybQWXdwQbLP>6pAqfylh#{fb6;Z(vMMVS~$e@S=j*ftg6;Uhf59&ghTmgWD0l;*T zI709Y^p6lP1rIRMx#05C~cW=H_Aw*bJ-5DT&Z2n+x)QHX^p z00esgV8|mQcmRZ%02D^@S3L16t`O%c004NIvOKvYIYoh62rY33S640`D9%Y2D-rV&neh&#Q1i z007~1e$oCcFS8neI|hJl{-P!B1ZZ9hpmq0)X0i`JwE&>$+E?>%_LC6RbVIkUx0b+_+BaR3cnT7Zv!AJxW zizFb)h!jyGOOZ85F;a?DAXP{m@;!0_IfqH8(HlgRxt7s3}k3K`kFu>>-2Q$QMFfPW!La{h336o>X zu_CMttHv6zR;&ZNiS=X8v3CR#fknUxHUxJ0uoBa_M6WNWeqIg~6QE69c9o#eyhGvpiOA@W-aonk<7r1(?fC{oI5N*U!4 zfg=2N-7=cNnjjOr{yriy6mMFgG#l znCF=fnQv8CDz++o6_Lscl}eQ+l^ZHARH>?_s@|##Rr6KLRFA1%Q+=*RRWnoLsR`7U zt5vFIcfW3@?wFpwUVxrVZ>QdQz32KIeJ}k~{cZZE^+ya? z2D1z#2HOnI7(B%_ac?{wFUQ;QQA1tBKtrWrm0_3Rgps+?Jfqb{jYbcQX~taRB;#$y zZN{S}1|}gUOHJxc?wV3fxu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$3E%e~4LaI(jC-u%2h$&R z9cLXcYC@Xwnns&bn)_Q~Te?roKGD|d-g^8;+aC{{G(1^(O7m37Y1-+6)01cN&y1aw zoqc{T`P^XJqPBbIW6s}d4{z_f5Om?vMgNQEJG?v2T=KYd^0M3I6IZxbny)%vZR&LD zJpPl@Psh8QyPB@KTx+@RdcC!KX7}kEo;S|j^u2lU7XQ}Oo;f|;z4Ll+_r>@1-xl3| zawq-H%e&ckC+@AhPrP6BKT#_XdT7&;F71j}Joy zkC~6lh7E@6o;W@^IpRNZ{ptLtL(gQ-CY~4mqW;US7Zxvm_|@yz&e53Bp_lTPlfP|z zrTyx_>lv@x#=^!PzR7qqF<$gm`|ZJZ+;<)Cqu&ot2z=0000WV@Og>004R=004l4008;_004mL004C`008P>0026e000+nl3&F} z00022Nkl40b>5vO#?5Vo-fZckM9-~Wdp@Seokx(n*@H}I({k#MM z$z@rVTi}E)N#=Pr2|h9m!y}?38OPB?IAofpB+1n%I7>u`2oWJ75D_BcA9O~*t94!9 z?)81|B%-a>dT3ol?37Y=!PHt)N)ZvCh13d2L^MNc1tcPxA-Ur76Cy%HhzJpZi1>mo rNw#f!zL$lgF1`$L)*S!<|NjF3hp86=mH-bZ00000NkvXXu0mjfBwKNA literal 0 HcmV?d00001 diff --git a/resource/res/dropdown_down.png b/resource/res/dropdown_down.png new file mode 100644 index 0000000000000000000000000000000000000000..6da26c67783aaa24f23555777e6cfc808c3c1f97 GIT binary patch literal 2828 zcmV+n3-k1eP)KLZ*U+IBfRsybQWXdwQbLP>6pAqfylh#{fb6;Z(vMMVS~$e@S=j*ftg6;Uhf59&ghTmgWD0l;*T zI709Y^p6lP1rIRMx#05C~cW=H_Aw*bJ-5DT&Z2n+x)QHX^p z00esgV8|mQcmRZ%02D^@S3L16t`O%c004NIvOKvYIYoh62rY33S640`D9%Y2D-rV&neh&#Q1i z007~1e$oCcFS8neI|hJl{-P!B1ZZ9hpmq0)X0i`JwE&>$+E?>%_LC6RbVIkUx0b+_+B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al 0 HcmV?d00001 diff --git a/resource/res/dropdown_normal.png b/resource/res/dropdown_normal.png new file mode 100644 index 0000000000000000000000000000000000000000..053693ff015e45f37a083faeb2faa80f5cb1531a GIT binary patch literal 3011 zcmV;!3q16RP)KLZ*U+IBfRsybQWXdwQbLP>6pAqfylh#{fb6;Z(vMMVS~$e@S=j*ftg6;Uhf59&ghTmgWD0l;*T zI709Y^p6lP1rIRMx#05C~cW=H_Aw*bJ-5DT&Z2n+x)QHX^p z00esgV8|mQcmRZ%02D^@S3L16t`O%c004NIvOKvYIYoh62rY33S640`D9%Y2D-rV&neh&#Q1i z007~1e$oCcFS8neI|hJl{-P!B1ZZ9hpmq0)X0i`JwE&>$+E?>%_LC6RbVIkUx0b+_+BaR3cnT7Zv!AJxW zizFb)h!jyGOOZ85F;a?DAXP{m@;!0_IfqH8(HlgRxt7s3}k3K`kFu>>-2Q$QMFfPW!La{h336o>X zu_CMttHv6zR;&ZNiS=X8v3CR#fknUxHUxJ0uoBa_M6WNWeqIg~6QE69c9o#eyhGvpiOA@W-aonk<7r1(?fC{oI5N*U!4 zfg=2N-7=cNnjjOr{yriy6mMFgG#l znCF=fnQv8CDz++o6_Lscl}eQ+l^ZHARH>?_s@|##Rr6KLRFA1%Q+=*RRWnoLsR`7U zt5vFIcfW3@?wFpwUVxrVZ>QdQz32KIeJ}k~{cZZE^+ya? z2D1z#2HOnI7(B%_ac?{wFUQ;QQA1tBKtrWrm0_3Rgps+?Jfqb{jYbcQX~taRB;#$y zZN{S}1|}gUOHJxc?wV3fxuz+mJ4`!F$IZ;mqRrNsHJd##*D~ju=bP7?-?v~|cv>vB zsJ6IeNwVZxrdjT`yl#bBIa#GxRa#xMMy;K#CDyyGyQdMSxlWT#tDe?p!?5wT$+oGt z8L;Kp2HUQ-ZMJ=3XJQv;x5ci*?vuTfeY$;({XGW_huIFR9a(?@3)XSs8O^N5RyOM=TTmp(3=8^+zpz2r)C z^>JO{deZfso3oq3?Wo(Y?l$ge?uXo;%ru`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+@AhPrP6BKT#_XdT7&;F71j}Joy zkC~6lh7E@6o;W@^IpRNZ{ptLtL(gQ-CY~4mqW;US7Zxvm_|@yz&e53Bp_lTPlfP|z zrTyx_>lv@x#=^!PzR7qqF<$gm`|ZJZ+;<)Cqu&ot2z=0000WV@Og>004R=004l4008;_004mL004C`008P>0026e000+nl3&F} z0002)NklDtHAd7gs8(CT$Tw&z^j^F@R7J>sfiHo>{A4w6&2gI0| zKp=U3<=MSF+?}AiuImm0-msUXwr!aNHi_f-6pt@G@vZY7N3=6Nkmwerm3o`y1TyA2od3inJI*z zx~|V_Aq1J(dPLlba2=BOUQN@;doMG4*atfi?sCp4NfJ5dR@)#VEQ+G&sV+Fq@VQrf zA_5VCi0}gu@hJ$12;YsU?|UYJ&361Ugm)bQ009600{~&LY7e@gXjcFL002ovPDHLk FV1gSsmCgVF literal 0 HcmV?d00001 diff --git a/resource/res/dropdown_push.png b/resource/res/dropdown_push.png new file mode 100644 index 0000000000000000000000000000000000000000..c1f4ffb57b978ba31c628c06a981578476462959 GIT binary patch literal 3008 zcmV;x3qSOUP)KLZ*U+IBfRsybQWXdwQbLP>6pAqfylh#{fb6;Z(vMMVS~$e@S=j*ftg6;Uhf59&ghTmgWD0l;*T zI709Y^p6lP1rIRMx#05C~cW=H_Aw*bJ-5DT&Z2n+x)QHX^p z00esgV8|mQcmRZ%02D^@S3L16t`O%c004NIvOKvYIYoh62rY33S640`D9%Y2D-rV&neh&#Q1i z007~1e$oCcFS8neI|hJl{-P!B1ZZ9hpmq0)X0i`JwE&>$+E?>%_LC6RbVIkUx0b+_+BaR3cnT7Zv!AJxW zizFb)h!jyGOOZ85F;a?DAXP{m@;!0_IfqH8(HlgRxt7s3}k3K`kFu>>-2Q$QMFfPW!La{h336o>X zu_CMttHv6zR;&ZNiS=X8v3CR#fknUxHUxJ0uoBa_M6WNWeqIg~6QE69c9o#eyhGvpiOA@W-aonk<7r1(?fC{oI5N*U!4 zfg=2N-7=cNnjjOr{yriy6mMFg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lKwSq&;{AhBk5xgWNwcR?2AvPsl|G} zNijL2g*Qw$KI6TXS@aZgB0L3nYi6MxVu{1ZWoZOc6}}k^6Z3YnfAuI=YKVIJZ`CLF zE>ji2zIJD8=#3ecrJDV7+!4#~xp!_>t}28_Sy(~yu9|Uwg}txowmFiMNK`~Y{%|8x zzR5-1@K{4ExedhKc@aWug{r^%YTs@6(#g*e4Luh)?v!`m$)i;nKF1wjY}+kJ&#VO9 zfoPwN&Mnlg^Cj41;5?5$=XWZu8~jE;Yoq$FqWWMz=B+C>Ud>zd=O|1Cfa&N$G|KLs zL=m3UVnTnvNw-G%m`!I)4b>_*ulsDM^xNByWVAeZb(CFgk+A9P4Bjr=KeJx)rE?l* zt5Et{EWrAwtJ5ZOt&GwcjF?iFOGeigQ&zXk`g+lM_s28kG28&klK=Ufoc!`KnxEaz zC#L@t$d_zXGVHFL7|^ZLxQWCH!kX2AT>|+1Ye)I z0(%zv_0(4E6x!m@^<&t`!;n#)hTVHt0Yt*}>x-j7-!3nyR~G_JuHSu%k*t*6HQ?!A zYfRD@^jZ92$CJqppVV4Iro8i55%<^yyOk|J5MJHun!7lmARrc+NAbk@2Lr(@msF*l zGcut72kNT{{0c3c6w@ADv2jj4vml9d~mk9jf3J|v!~Dk>553nKY=C?nN`vp-~z)0FM+ zxC&j|A2xg31P%2PCEiK|*>j~YMMQ{cy9|I$=71^>Cf6`055`<_n)9n2-{C2Dq)i%u zN~K|9>^CS0xD-z|^R5_LCs8WExkab=_2fFK``}qvPD|-hj~E)kl(eZCE0nl!KN(f2 Vbyud9A>ovp<>Q0Ykdg$P{13y=X9@rS literal 0 HcmV?d00001 diff --git a/resource/res/emulator_list_image_new_ani.gif b/resource/res/emulator_list_image_new_ani.gif new file mode 100755 index 0000000000000000000000000000000000000000..565af866e9af59bf9d48696420b792e8be7d3350 GIT binary patch literal 25026 zcmeFYX;f3^!}gnDXC%N*2qDZnAwocA5CK7x5Fj98KvYn)0RaI~gQ7*NHY0>d1EK<= z21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@UI=1n(Z5HU>DbTr1sArc@&rY$n^-{Hq#N(^P<0@rKrbs5&NhQ|E zWwa<{wJBt^%BMG}CRfRMN6ULhEBM4J_{3;L<*0|IX@sR~0LhS4oxpf?Q!8~7OKl5V zLwgq^2UjgiJAES~GfPVYLql^53v+XGGcz+&Q&STY6C)!dJv}`wEiDZVjsO4uGYm?g z_>+Z^fx(wS2jn_XoG`HOZg6dCZfR|EvDZ`KXXaJbWprtCvXEn%K7&cd+^N-4c!sH~ z>I@;X7CYG)B25M}B^jFB^k*`u8HjAvadUN7+RDVXbEcxZs|WW?t0vQ}Tpq5TEHgFF zY-RSm$g}m@O!k|e3U^%3&Xm9Dq5b&j46O_9wi2tGtoUY#IvjKJG!dNMqNe9KV`5AA zdIcjr2H^xnH-Y5lKAwk-NzP47942#a7_vkyRQ8;rlju~`IY~u;SJJXcrPEu*orjN$ Hg~1vCf~1-W literal 0 HcmV?d00001 diff --git a/resource/res/info_icon_nml.gif b/resource/res/info_icon_nml.gif new file mode 100755 index 0000000000000000000000000000000000000000..070bea1191eec23e0108360358f624b3cb278639 GIT binary patch literal 605 zcmZ?wbhEHb6k-r!c*el+;>C*x4<6jRckk}qyLax~xp3ja`Sa(`ojZ5t%$d`tPoFw< z>gds73{rdIm)~#E;diAPRt5&XDxqSKZWy_W= zS+ZpD;>C*=En2v6;nb;9ySln+Yinz2YO1TND=RBYOG}H3i;Iei3JVJh3JTKF(h?IB z6A}{QPVY;A3=t*tFBEiEi8%+1Zs%*;$pO-)QpjEsy7 z4Gs15^t80JG&D5+|NqZ0l!4+;7DfgJ2L>IGCqQw+z`m=&ys5dRwav^>QH+g|RaC*i ztj$zQfMNO!27WEmRvn%hn&z@IxV2l1rcLK=Qk%(d*kqwRlR-|6d#jR#xuwKb29}*O z#VyUPIA-cLX>Mh+GPh=$DSu`wqxD73t=DF<-?WyxV}5p~?FMF&;pXP%?Ck91sF2A#2OCT-N4l~n+&>@~ni_IPp!-o+#{>=2XvZ%HB$Jfb`8HJiDd-JM z;u46-?+|2E7j#_K9LR9oz@PciO6lohxrN0aJi4~e*{JN{q9nv@&K{s-XQsmK<)&in a8Ej>vCc?+b!pOqOC!)S^(PDK)25SHpRz!0E literal 0 HcmV?d00001 diff --git a/resource/res/inputbox_off_left.gif b/resource/res/inputbox_off_left.gif new file mode 100755 index 0000000000000000000000000000000000000000..50cbeaf96cdb1558a4c2d04d2c39d9a3185a7b5c GIT binary patch literal 105 zcmZ?wbhEHbWMvRy*v!DNZQHgjTefW4v}yVB<;#{WTexuHf&~la&!7MQ|9=K-K=CIF qBLf2mgAPa%WCjC^m_SQl--_owb9nzJX!NDrtUXd*C{*ggU=09`BO!+X literal 0 HcmV?d00001 diff --git a/resource/res/inputbox_off_middle.gif b/resource/res/inputbox_off_middle.gif new file mode 100755 index 0000000000000000000000000000000000000000..cad89c9789d7becd57c383ca8df8acb24a1ca8ab GIT binary patch literal 45 xcmZ?wbhEHbWMmLxXkcKNKY#xJ|Nj+#vM@3*Ff!;c00Bsbfr+K1zmk=~8UPTC3P%6{ literal 0 HcmV?d00001 diff --git a/resource/res/inputbox_off_right.gif b/resource/res/inputbox_off_right.gif new file mode 100755 index 0000000000000000000000000000000000000000..1409685fdf24e2f549b7b620d72213d746414bac GIT binary patch literal 105 zcmZ?wbhEHbWMvRy*v!DNZQHgjTefW4v}yVB<;#{WTexuHf&~la&!7MQ|9=K-K=CIF qBLf2mgAPa%WCjC^*oP^C2X?yN@&0BQr_q;^+4kUC;;j%@25SJEjUt=? literal 0 HcmV?d00001 diff --git a/resource/res/inputbox_on_left.gif b/resource/res/inputbox_on_left.gif new file mode 100755 index 0000000000000000000000000000000000000000..100f12cdbe26c38593ac5c3296f7b20e6d7fc5f9 GIT binary patch literal 106 zcmZ?wbhEHbWMvRy*v!E2^y$+_j~+dI`0&Al2iLA$yL$ENzJ2@l?%lh4_wH@mw*CMA yp8*vp{$ycfVBliV0SSZ5U|TxHXDPB^hoeyK+=WFKA~j2-<|)pUvSoLiP>ZqDPu-Ljl4tAE1PzRYi RDNKnvmp@xK$Otl60|18rJD&gm literal 0 HcmV?d00001 diff --git a/resource/res/modify_cancel_nml.gif b/resource/res/modify_cancel_nml.gif new file mode 100755 index 0000000000000000000000000000000000000000..74ce57b9313b8e79bacc75b9d3d296ca023ca1f4 GIT binary patch literal 176 zcmZ?wbhEHb6lD-)*v!Ci`0(NS`uduhn##(`va+)L{QR`EwB+RE`1tskn3&+;;Q#;s zGav!QpDc_F4BQMlATf{`3@ot*Cp=g0wRnAYGebi`?LyZERad5#&IOCMDCMe(aLTOl z6ufP5h2iS&$UIAt1v?ytYUeI2x)7;ZA~jEOrj#wab(}P&zd^jY!^LJDC;tjv)NO&dBa9MhSM^+$LAiA+B46; nL0F1~vC*-D`GtjVe75jh8~=l+wmNAug*4gixsjF+u>GUZlY{Hcw5rMTu+P7bod2iOJc~Z30z(d7- ZT4Te61FHn2&nqZMu>5am6cuE!1_02#J*@x$ literal 0 HcmV?d00001 diff --git a/resource/res/reset_icon_hover.gif b/resource/res/reset_icon_hover.gif new file mode 100755 index 0000000000000000000000000000000000000000..d68a5b9b8720ec0d2beaa04e1befc360693039ee GIT binary patch literal 633 zcmZ?wbhEHb6k-r!c*ekBVrr(Lqo-kLs^=bPXl-v|=cJ*l&#>!1!;U|U+kY```^mWN z2h--SOq;(jZT!Tv@gwubPs|%WGH>|6y#77&+P5rgUbC!x%DUzi>x!prOYXBTd&oZb z3dgJq95c^zF1p3J;0EWsYuvNWbM+tKnRSl4Z$Iyh(>%RyI(DMq> z^9WM2a@4YSH+1&WF)`QjjnwiAHE{CKG&0pSFf=qVH8wLhwskPKurN0_H#0LcH8nLc zF)=naHZn3YG&D3YFwoc6*VEI})z#I}(b3k{*3#0_)YR0_(D?uVKLfcy@h1x-149mj z4#)sdoG`FoYlvxTZfR|6?`R9O(vwp*^@wg`ZSphbW}nF}@7Nlv>c*_d&ZA_cBgxKd zKdC96i&KhS#+flA(?_3OJh(YgaF#)MVthg}lM1^@Y}5W(?7E>%u}OC93h`$T%#?MB zY>xA07f3kE%PwNUmK@g{>&`Bbc$QDYCoSUb12cBD&oK!tOB$V8+r^w*)f8R?_H|D; zNaR>!v4P2BvWmHijEADD{B*rohBqrd=uGZXPn;q6$;r*LhnHVx&WS|V9xtcZeLa?o Z)6UK^Nexmv#mS~5p>Hm%$;-lE4FK?lzZd`j literal 0 HcmV?d00001 diff --git a/resource/res/reset_icon_nml.gif b/resource/res/reset_icon_nml.gif new file mode 100755 index 0000000000000000000000000000000000000000..c3c2476ae7d1ec76138cc60f094a675a9d765430 GIT binary patch literal 628 zcmZ?wbhEHb6k-r!c*el+;>C++&z?Pb^5pU3$B!O8x_|%vy?giW-o1P0&Yj!0Z{NCg z>&A^6*REZ=diCnXixEp+bA3b{X@ZrOU4jtOJZ{Oa%dw1>HwQ=Ld4I4JB zU%!6cx^-*Uu3f!)_44J*mn>Pbc=6)-^XJc*GiUbf*)wL$m^N+Nq)C$|OqkHp($dh- zP+eVJRaI49US3>WTv%9`pP!$bo12r9la-Z~nVFfAl9HU9oS2vx7Z(>56%`p785$ZI z6ciK~80hEc=k4w7>FMe2?(XL1=HlYw=;&x~Z*OO3XJKJsZfCo{tD~c%t*x!4rKPECqn}ddwpqPr8Tbpx}tpW?fOa>vnRu6GQTTup9Ni{`*C0di3yqKBz z8AL4tgF{@E8F;OleK=<+`TBTy`*}$*D0wvPo5djQ*yQ1B%pmM_X8%kvlNL{V1`h8t zYz*Am0e+s%9+nJzK4;kFTmwB{H+!lx$b5A7HeJDSb7B*Rq9hm79*J@lPGL1y1BL?^ znvU}d@3&JpSk7|NO^jzw>Mw_ulScXeHB%Ne9B^cp@R~J8rNyOFSTl4@#6qT{DT`)# P%jtO<8Be_Ez+epkJ2lQf literal 0 HcmV?d00001 diff --git a/resource/res/reset_icon_pushed.gif b/resource/res/reset_icon_pushed.gif new file mode 100755 index 0000000000000000000000000000000000000000..b59ed5dce6badb03a3c0a82a5273b97e4e6c9a28 GIT binary patch literal 363 zcmZ?wbhEHb6k-r!xXQqgl9G~~oSc-Dl$e;9kdP1`A0HbV8xs=~9UUDN6%`p786F-U z78Vv78X6K35*!>H6ciK~7#I)`;P3D6?d|R5<>l$=>F)0C=H}+=>gwX+;_U3~FeZnjIB+&3C{{`wnUI^60W)~?{MLE%6XGvy8aW`e2 lW^s90;R?Q0u3{`r5q$GJ_ShX&lg~1vCMr z@bIv(u+Y#@M@L6HJ3Di8^Z)<?$q* literal 0 HcmV?d00001 diff --git a/resource/res/tab_unselected_middle_hover.gif b/resource/res/tab_unselected_middle_hover.gif new file mode 100755 index 0000000000000000000000000000000000000000..1c739d63612cc256721b7162d2ae62a75e49db7b GIT binary patch literal 155 zcmZ?wbhEHbWMq(KIKsg2?c29$)23x+W@cn$q^GB+rKP2&rlzE%Bqt{)B_$;$CMF~# z#K*_S#l^+O#>T|NL`O$QMMXtMMn*(LgolTRg@uKNhW`Kmp8*F@{K>+|z#z_`1Cj^X i$-pX+puoc%C~~Y(p>vZ#?`MYq6<^`dP%!}}25SI8N-B{6 literal 0 HcmV?d00001 diff --git a/resource/res/tab_unselected_right.gif b/resource/res/tab_unselected_right.gif new file mode 100755 index 0000000000000000000000000000000000000000..e5216c31185af52111d2ff3f674434768f10aaba GIT binary patch literal 329 zcmZ?wbhEHbWMzr z@bIv(u+Y#@M@L6HJ3Di8^Z)<FMd{=xA$eYi@3CXlSUd zt*x%EuBxi4tgNi4s3f%F4>j%*@EhNKa2sOG`^lO-)Hj zNls2qN=iyhOiV~fh>wqti;Ihmjg5(kiH?qrii(PijEsng2oDbr3kwSk4fXW&baHYs zH#h(P|33qXK=CIFBLjmzgAPa^$WIJxnFkyWUMz~$;AiGO++#3f#%TrTvm7Q7XBAc} z=Ioozlzzsr platformList = null; + private static ArrayList platformList = null; private static CommandLineParser processor = null; private static boolean isConsoleMode = true; - // for multi touch + // private static boolean isInhoseMode = false; private static RandomAccessFile randomAccessFile; - private static boolean isMac = false; - private static boolean isWin = false; - private static boolean isLinux = false; + private static boolean isMac = false; + private static boolean isWin = false; + private static boolean isLinux = false; static { + if (System.getProperty("os.name").toLowerCase().indexOf("linux") > -1) { isLinux = true; } else if (System.getProperty("os.name").toLowerCase().indexOf("win") > -1) { @@ -92,36 +98,38 @@ public class EmulatorManager { public static boolean isLinux() { return isLinux; } - +/* public static EmulatorManager getInstance() { return instance; } - +*/ + /* private EmulatorManager(ManagerModeType mode) { this.mode = mode; } + */ - public ManagerModeType getManagerMode() { + public static ManagerModeType getManagerMode() { return mode; } - public MainDialog getMainDialog() { + public static MainDialog getMainDialog() { return mainDialog; } - private void preare() { - this.display = Display.getCurrent(); + private static void preare() { + EmulatorManager.display = Display.getCurrent(); mainDialog = new MainDialog(mode); } - private void DrawUI() { + private static void draw() { mainDialog.draw(); mainDialog.open(); display.dispose(); } - private void dispose() { + private static void dispose() { mainDialog.dispose(); } @@ -129,7 +137,7 @@ public class EmulatorManager { return isConsoleMode; } - private void startConsoleProcessor() { + private static void startConsoleProcessor() { Action action = processor.getAction(); if (!action.process()) { exitEmulatorManager(-1); @@ -189,36 +197,37 @@ public class EmulatorManager { } } + mode = isInhoseMode ? ManagerModeType.INHOUSE_MODE + : ManagerModeType.PUBLIC_MODE; + if (!SelectWorkspace.setWorkspace(workspacePath, isSave)) { exitEmulatorManager(-1); } MessageDialog msg = new MessageDialog(new Shell(Display.getCurrent())); if (isArgsError == true) { - msg.openWarningDialog("Used workspace option parameter is not proper. Aborting..." - + StringResource.NEW_LINE + StringResource.NEW_LINE - + "See right examples below." + StringResource.NEW_LINE - + "[--workspace {workspace path},save=true]" + StringResource.NEW_LINE - + "[-w {workspace path},save=true]" + StringResource.NEW_LINE - + "[--workspace {workspace path},save=false]" + StringResource.NEW_LINE - + "[-w {workspace path},save=false]" + StringResource.NEW_LINE + StringResource.NEW_LINE - + "The workspace path must be absolute." + msg.openWarningDialog("Used workspace option parameter is not proper. Aborting...\n" + + "\nSee right examples below.\n" + + "[--workspace {workspace path},save=true]\n" + + "[-w {workspace path},save=true]\n" + + "[--workspace {workspace path},save=false]\n" + + "[-w {workspace path},save=false]\n" + + "\nThe workspace path must be absolute." ); exitEmulatorManager(-1); } } public static void main(String[] args) { - - if (System.getProperty("os.name").toLowerCase().indexOf("mac") > -1) { + if (isMac()) { //TODO: event handling of about menu System.setProperty("apple.laf.useScreenMenuBar", "true"); System.setProperty("com.apple.mrj.application.apple.menu.about.name", "Emulator Manager"); } - - try{ - - checkConsoleMode(args); + + try{ + + checkConsoleMode(args); randomAccessFile = new RandomAccessFile(new File(FilePath.getInstance().getBinPath() + File.separator + "." +System.getProperty("user.name"))+ ".lock", @@ -230,14 +239,14 @@ public class EmulatorManager { FileLock lock = randomAccessFile.getChannel().tryLock(); if (lock == null) { EMLogger.getLogger().log(Level.WARNING, "Can not launch Emulator Manager." - + StringResource.NEW_LINE - + "Another one with the same user name is running now." - + StringResource.NEW_LINE); + + StringResources.NEW_LINE + + "Another one with the same user name is running now." + + StringResources.NEW_LINE); exitEmulatorManager(-1); } } catch (IOException e) { EMLogger.getLogger().log(Level.WARNING, "Can not launch Emulator Manager." - + StringResource.NEW_LINE +e.getMessage() + StringResource.NEW_LINE); + + StringResources.NEW_LINE +e.getMessage() + StringResources.NEW_LINE); exitEmulatorManager(-1); } @@ -253,20 +262,23 @@ public class EmulatorManager { try { FileLock lock = randomAccessFile.getChannel().tryLock(); if (lock == null) { - msg.openInfoDialog("Can not launch Emulator Manager." + StringResource.NEW_LINE + - "Another one with the same user name is running now."); + msg.openInfoDialog("Can not launch Emulator Manager." + StringResources.NEW_LINE + + "Another one with the same user name is running now."); exitEmulatorManager(0); } } catch (IOException e) { - msg.openInfoDialog("Can not launch Emulator Manager." + StringResource.NEW_LINE + e.getMessage()); + msg.openInfoDialog("Can not launch Emulator Manager." + + StringResources.NEW_LINE + e.getMessage()); exitEmulatorManager(-1); } parseArgs(args); } - + + /* instance = new EmulatorManager(isInhoseMode ? ManagerModeType.INHOUSE_MODE : ManagerModeType.PUBLIC_MODE); + */ // check hax or kvm CheckVirtualization.getInstance().check(); @@ -275,18 +287,18 @@ public class EmulatorManager { CheckSDCard.CheckSDCardDir(); CheckSDCard.CheckSwapDir(); - EmulatorVMs.getInstance().loadProperties(); + //EmulatorVMs.getInstance().loadProperties(); - instance.makePlatformList(); + EmulatorManager.makePlatformList(); if (isConsoleMode) { - instance.startConsoleProcessor(); + EmulatorManager.startConsoleProcessor(); } else { - EMLogger.getLogger().log(Level.INFO, "Start Emulator Manager!!" + StringResource.NEW_LINE); + EMLogger.getLogger().log(Level.INFO, "Start Emulator Manager!!"); - instance.preare(); - instance.DrawUI(); - instance.dispose(); + EmulatorManager.preare(); + EmulatorManager.draw(); + EmulatorManager.dispose(); } } catch (Throwable e) { @@ -302,11 +314,17 @@ public class EmulatorManager { System.exit(returnValue); } - public ArrayList getPlatformList() { + public static ArrayList getPlatformList() { return platformList; } - public void makePlatformList() { + private static CustomPlatform custom = new CustomPlatform(); + + public static CustomPlatform getCustomPlatform() { + return custom; + } + + static void makePlatformList() { platformList = new ArrayList(); File platforms = new File(FilePath.getInstance().getPlatformsPath()); @@ -320,6 +338,35 @@ public class EmulatorManager { } } } + settingVMPropertyList(); + } + + public static void settingVMPropertyList() { + EmulatorVMList vms = EmulatorVMList.getInstance(); + vms.refreshProperties(); + + + custom.clearVMs(); + for(Platform p : EmulatorManager.getPlatformList()) { + p.clearVMs(); + } + + for (VMProperty prop : (VMProperty[])vms.getProperties()) { + if (prop.getImageType() == FSImageType.custom) { + custom.addVMsProperty(prop); + } else { + for (Platform p : EmulatorManager.getPlatformList()) { + if (prop.getImageVersion().equals(p.getName())) { + for (BaseImage b : p.getImageList()) { + if (prop.getBaseImageName().equals(b.getName())) { + b.addVMsProperty(prop); + break; + } + } + } + } + } + } } public enum ManagerModeType { diff --git a/src/org/tizen/emulator/manager/console/ActionList.java b/src/org/tizen/emulator/manager/console/ActionList.java index 2eb80e8..3a441ba 100644 --- a/src/org/tizen/emulator/manager/console/ActionList.java +++ b/src/org/tizen/emulator/manager/console/ActionList.java @@ -36,10 +36,10 @@ import java.util.logging.Level; import java.util.logging.Logger; import org.tizen.emulator.manager.EmulatorManager; -import org.tizen.emulator.manager.image.SkinList; -import org.tizen.emulator.manager.image.Skin; import org.tizen.emulator.manager.logging.EMLogger; -import org.tizen.emulator.manager.tool.FilePath; +import org.tizen.emulator.manager.platform.Skin; +import org.tizen.emulator.manager.platform.SkinList; +import org.tizen.emulator.manager.resources.FilePath; import org.tizen.emulator.manager.tool.SelectTemplate; import org.tizen.emulator.manager.tool.SelectWorkspace; import org.tizen.emulator.manager.vms.RAM_SIZE; @@ -343,7 +343,7 @@ class Create extends Action { if (!r.getType().isEmpty()) { resolution += (r.getType() + " | "); } else { - resolution += (r.getValue() + " | "); + resolution += (r.getStrValue() + " | "); } } resolution = resolution.substring(0, resolution.length() - 3); @@ -354,7 +354,7 @@ class Create extends Action { "DPI. (100 ~ 480)", Integer.toString(property.dpi), false, true)); /** TODO : resolution and skin..***********************************************/ - ArrayList skinList = SkinList.getInstance().findSkinList(RESOLUTION.HD.getValue()); + ArrayList skinList = SkinList.getInstance().findSkinList(RESOLUTION.HD); String skinType = ""; int i = 1; for (Skin skin : skinList) { @@ -423,7 +423,7 @@ class Modify extends Action { if (!r.getType().isEmpty()) { resolution += (r.getType() + " | "); } else { - resolution += (r.getValue() + " | "); + resolution += (r.getStrValue() + " | "); } } resolution = resolution.substring(0, resolution.length() - 3); @@ -434,7 +434,7 @@ class Modify extends Action { "DPI. (100 ~ 480)", Integer.toString(property.dpi), false, true)); /** TODO : resolution and skin..***********************************************/ - ArrayList skinList = SkinList.getInstance().findSkinList(RESOLUTION.HD.getValue()); + ArrayList skinList = SkinList.getInstance().findSkinList(RESOLUTION.HD); String skinType = ""; int i = 1; for (Skin skin : skinList) { diff --git a/src/org/tizen/emulator/manager/console/CommandLineParser.java b/src/org/tizen/emulator/manager/console/CommandLineParser.java index f5db1d2..ebad834 100644 --- a/src/org/tizen/emulator/manager/console/CommandLineParser.java +++ b/src/org/tizen/emulator/manager/console/CommandLineParser.java @@ -33,8 +33,7 @@ import java.util.logging.Level; import org.tizen.emulator.manager.EmulatorManager; import org.tizen.emulator.manager.logging.EMLogger; -import org.tizen.emulator.manager.tool.StringResource; - +import org.tizen.emulator.manager.resources.StringResources; public class CommandLineParser { private ActionList actionList = null; private Action mAction = null; @@ -184,13 +183,13 @@ public class CommandLineParser { System.out.println("Error: " + String.format(errorFormat, args)); } - System.out.println(StringResource.NEW_LINE + "Usage:" + StringResource.NEW_LINE +" emulator-manager [global options] " + System.out.println(StringResources.NEW_LINE + "Usage:" + StringResources.NEW_LINE +" emulator-manager [global options] " + (action == null ? "action" : action.getAction()) + " [action options]"); actionList.printGlobaloptions(); if (action == null ) { - System.out.println(StringResource.NEW_LINE + "Valid actions: "); + System.out.println(StringResources.NEW_LINE + "Valid actions: "); actionList.printActions(); } else { actionList.printAction(action); diff --git a/src/org/tizen/emulator/manager/console/ConsoleCreateVM.java b/src/org/tizen/emulator/manager/console/ConsoleCreateVM.java index 24d0323..1a90cec 100644 --- a/src/org/tizen/emulator/manager/console/ConsoleCreateVM.java +++ b/src/org/tizen/emulator/manager/console/ConsoleCreateVM.java @@ -34,19 +34,19 @@ import java.io.IOException; import java.util.ArrayList; import org.tizen.emulator.manager.EmulatorManager; -import org.tizen.emulator.manager.image.BaseImage; -import org.tizen.emulator.manager.image.Platform; -import org.tizen.emulator.manager.image.Skin; -import org.tizen.emulator.manager.image.SkinList; +import org.tizen.emulator.manager.platform.BaseImage; +import org.tizen.emulator.manager.platform.Platform; +import org.tizen.emulator.manager.platform.Skin; +import org.tizen.emulator.manager.platform.SkinList; import org.tizen.emulator.manager.tool.CheckVirtualization; -import org.tizen.emulator.manager.ui.detail.VMPropertyView; import org.tizen.emulator.manager.vms.Creator; -import org.tizen.emulator.manager.vms.EmulatorVMs; +import org.tizen.emulator.manager.vms.EmulatorVMList; +import org.tizen.emulator.manager.vms.HelperClass; import org.tizen.emulator.manager.vms.RAM_SIZE; import org.tizen.emulator.manager.vms.RESOLUTION; -import org.tizen.emulator.manager.vms.VMCreateHelper; +import org.tizen.emulator.manager.vms.VMProperty; import org.tizen.emulator.manager.vms.VMPropertyValue; -import org.tizen.emulator.manager.vms.VMsWorkerException; +import org.tizen.emulator.manager.vms.VMWorkerException; public class ConsoleCreateVM { @@ -94,10 +94,10 @@ public class ConsoleCreateVM { prop.baseImagePath = checkImagePath(c.getCurrentValue()); if (prop.baseImagePath.endsWith(".x86")) { prop.archType = "x86"; - EmulatorVMs.getInstance().CustomArch = "x86"; + EmulatorVMList.getInstance().CustomArch = "x86"; } else if (prop.baseImagePath.endsWith(".arm")) { prop.archType = "arm"; - EmulatorVMs.getInstance().CustomArch = "arm"; + EmulatorVMList.getInstance().CustomArch = "arm"; } else { throw new ConsoleException("Avaliable format of base image is .x86 or .arm."); } @@ -116,7 +116,7 @@ public class ConsoleCreateVM { try { Creator.create(prop); - } catch (VMsWorkerException e) { + } catch (VMWorkerException e) { System.out.println("Error: "); System.out.println(e.getMessage()); return false; @@ -137,7 +137,7 @@ public class ConsoleCreateVM { } else if (c.getShortName() == "b") { boolean check = false; - for (Platform platform : EmulatorManager.getInstance().getPlatformList()) { + for (Platform platform : EmulatorManager.getPlatformList()) { for (BaseImage image : platform.getImageList()) { if (image.getID().equals(c.getCurrentValue())) { check = true; @@ -145,7 +145,7 @@ public class ConsoleCreateVM { prop.version = image.getVersion(); prop.baseName = image.getName(); prop.baseImagePath = image.getPath(); - prop.baseImagePathName = image.getImagePathName(); + prop.baseImagePathName = image.getPathName(); prop.archType = image.getCpu(); break; } @@ -170,7 +170,7 @@ public class ConsoleCreateVM { try { Creator.create(prop); - } catch (VMsWorkerException e) { + } catch (VMWorkerException e) { System.out.println("Error: It is failed to create new Virtual Machine."); System.out.println(e.getMessage()); return false; @@ -192,7 +192,7 @@ public class ConsoleCreateVM { else if (c.getLongName() == Actions.OP_DPI) { check = false; int dpi = Integer.valueOf(c.getCurrentValue()); - if (dpi >= VMPropertyView.MIN_DPI && dpi <= VMPropertyView.MAX_DPI) { + if (dpi >= VMProperty.MIN_DPI && dpi <= VMProperty.MAX_DPI) { prop.dpi = dpi; check = true; } @@ -255,7 +255,7 @@ public class ConsoleCreateVM { RESOLUTION r = checkResolution(resolutionCommand.getCurrentValue()); prop.resolution = r; prop.dpi = r.getDPI(); - ArrayList list = SkinList.getInstance().findSkinList(prop.resolution.getValue()); + ArrayList list = SkinList.getInstance().findSkinList(prop.resolution); if (!list.isEmpty()) { prop.skin = list.get(0); } else { @@ -274,7 +274,7 @@ public class ConsoleCreateVM { ArrayList list = null; int i = 0; i = Integer.parseInt(skinCommand.getCurrentValue()); - list = SkinList.getInstance().findSkinList(prop.resolution.getValue()); + list = SkinList.getInstance().findSkinList(prop.resolution); if (!list.isEmpty()) { if (i <= 0 || i > list.size()) { @@ -350,7 +350,7 @@ public class ConsoleCreateVM { if (r.getType().equals(value)) { return r; } - if (r.getValue().equals(value)) { + if (r.getStrValue().equals(value)) { return r; } } @@ -370,18 +370,17 @@ public class ConsoleCreateVM { } private void checkVMName(String name) throws ConsoleException { - if (name.length() > VMPropertyView.MAX_NAME_LEN) { + if (name.length() > VMProperty.MAX_NAME_LEN) { throw new ConsoleException("Max length of virtual target name is " - + Integer.toString(VMPropertyView.MAX_NAME_LEN) + "."); + + Integer.toString(VMProperty.MAX_NAME_LEN) + "."); } - VMCreateHelper helper = new VMCreateHelper(); - if (!helper.checkString(name)) { + if (!HelperClass.checkString(name)) { throw new ConsoleException("Name has invalid character.\n" + "Valid Charater : a-z, A-Z, 0-9, 0, _"); } - if (helper.checkDupulicateName(name)) { + if (HelperClass.checkDupulicateName(name)) { throw new ConsoleException("The name (" + name + ") already exists!"); } diff --git a/src/org/tizen/emulator/manager/console/ConsoleModifyVM.java b/src/org/tizen/emulator/manager/console/ConsoleModifyVM.java index 6e275ba..78d00e9 100644 --- a/src/org/tizen/emulator/manager/console/ConsoleModifyVM.java +++ b/src/org/tizen/emulator/manager/console/ConsoleModifyVM.java @@ -31,12 +31,12 @@ package org.tizen.emulator.manager.console; import java.util.ArrayList; +import org.tizen.emulator.manager.vms.VMProperty; import org.tizen.emulator.manager.vms.VMPropertyValue; -import org.tizen.emulator.manager.vms.VMsProperty; -import org.tizen.emulator.manager.vms.VMsWorkerException; +import org.tizen.emulator.manager.vms.VMWorkerException; public class ConsoleModifyVM { - VMsProperty prop; + VMProperty prop; VMPropertyValue oldVM; VMPropertyValue newVM; public boolean ModifyVM(ArrayList list) { @@ -87,8 +87,8 @@ public class ConsoleModifyVM { } try { - prop.getWorker().modifyVM(oldVM, newVM); - } catch (VMsWorkerException e) { + prop.getWorker().modifyVM(newVM); + } catch (VMWorkerException e) { System.out.println("Error: It is failed to modify Virtual Machine."); System.out.println(e.getMessage()); return false; diff --git a/src/org/tizen/emulator/manager/console/ConsoleProcessor.java b/src/org/tizen/emulator/manager/console/ConsoleProcessor.java index f682944..dacf8f3 100644 --- a/src/org/tizen/emulator/manager/console/ConsoleProcessor.java +++ b/src/org/tizen/emulator/manager/console/ConsoleProcessor.java @@ -36,21 +36,21 @@ import java.util.List; import java.util.logging.Level; import org.tizen.emulator.manager.EmulatorManager; -import org.tizen.emulator.manager.image.BaseImage; -import org.tizen.emulator.manager.image.Platform; import org.tizen.emulator.manager.logging.EMLogger; +import org.tizen.emulator.manager.platform.BaseImage; +import org.tizen.emulator.manager.platform.Platform; import org.tizen.emulator.manager.tool.About; -import org.tizen.emulator.manager.vms.EmulatorVMs; +import org.tizen.emulator.manager.vms.EmulatorVMList; +import org.tizen.emulator.manager.vms.HelperClass; import org.tizen.emulator.manager.vms.Launcher; -import org.tizen.emulator.manager.vms.VMCreateHelper; -import org.tizen.emulator.manager.vms.VMsProperty; -import org.tizen.emulator.manager.vms.VMsWorkerException; -import org.tizen.emulator.manager.vms.VMsProperty.FSImageType; +import org.tizen.emulator.manager.vms.VMProperty; +import org.tizen.emulator.manager.vms.VMProperty.FSImageType; +import org.tizen.emulator.manager.vms.VMWorkerException; public class ConsoleProcessor { - private EmulatorVMs vms = EmulatorVMs.getInstance(); + private EmulatorVMList vms = EmulatorVMList.getInstance(); - public VMsProperty getProperty(String value) { + public VMProperty getProperty(String value) { return vms.getProperty(value); } @@ -59,7 +59,7 @@ public class ConsoleProcessor { About.getInstance().getContents(); } - public String getDetailInfoOfVM(VMsProperty prop) { + public String getDetailInfoOfVM(VMProperty prop) { String str = new String(); try { str += String.format("%s\n", prop.getName()); @@ -117,7 +117,7 @@ public class ConsoleProcessor { } public String getDetailInfoOfVM(String value) { - VMsProperty prop = vms.getProperty(value); + VMProperty prop = vms.getProperty(value); if (prop == null) { // error return "Error: The name (" + value + ") dose not exist in the VM list."; @@ -128,19 +128,19 @@ public class ConsoleProcessor { public ArrayList getInfoOfVMList(boolean isDetail) { ArrayList message = new ArrayList(); - VMsProperty[] properties = (VMsProperty[])vms.getProperties(); + VMProperty[] properties = (VMProperty[])vms.getProperties(); if (properties.length == 0) { // error message.add("VM list is empty."); } else { if (!isDetail) { - for (VMsProperty prop : properties) { + for (VMProperty prop : properties) { message.add(prop.getName()); } } else { String temp = null; - for (VMsProperty prop : properties) { + for (VMProperty prop : properties) { //temp = getInfoOfVM(prop); temp = getDetailInfoOfVM(prop); if (temp != null) { @@ -153,14 +153,14 @@ public class ConsoleProcessor { } public int getCountOfVMList() { - return ((VMsProperty[])vms.getProperties()).length; + return ((VMProperty[])vms.getProperties()).length; } public ArrayList getInfoOfImageList(boolean isDetail) { ArrayList list = new ArrayList(); list.add("Avaliable Base Image: \n"); - for (Platform platform : EmulatorManager.getInstance().getPlatformList()) { + for (Platform platform : EmulatorManager.getPlatformList()) { for (BaseImage image : platform.getImageList()) { list.add(image.toString()); } @@ -177,7 +177,7 @@ public class ConsoleProcessor { public int getCountOfImageList() { ArrayList list = new ArrayList(); - for (Platform platform : EmulatorManager.getInstance().getPlatformList()) { + for (Platform platform : EmulatorManager.getPlatformList()) { for (BaseImage image : platform.getImageList()) { list.add(image.getName()); } @@ -187,7 +187,7 @@ public class ConsoleProcessor { } public boolean launchEmulator(String name, String path, boolean isTest) { - VMsProperty prop = getProperty(name); + VMProperty prop = getProperty(name); if(prop == null) { System.out.println("Error: There is no Virtual Machine named " + name); @@ -212,7 +212,7 @@ public class ConsoleProcessor { List cmd; try { cmd = launcher.getLaunchCommand(prop, path); - } catch (VMsWorkerException e) { + } catch (VMWorkerException e) { EMLogger.getLogger().log(Level.WARNING, "Failed to launch :" + e.getMessage()); return false; } @@ -246,7 +246,7 @@ public class ConsoleProcessor { } public boolean deleteVM(String name) { - VMsProperty prop = getProperty(name); + VMProperty prop = getProperty(name); if(prop == null) { System.out.println("Error: There is no Virtual Machine named " + name); @@ -261,7 +261,7 @@ public class ConsoleProcessor { try { prop.getWorker().deleteVM(); - } catch (VMsWorkerException e) { + } catch (VMWorkerException e) { System.out.println("Error: " + e.getMessage()); return false; } @@ -271,7 +271,7 @@ public class ConsoleProcessor { } public boolean resetVM(String name) { - VMsProperty prop = getProperty(name); + VMProperty prop = getProperty(name); if(prop == null) { System.out.println("Error: There is no Virtual Machine named " + name); @@ -286,7 +286,7 @@ public class ConsoleProcessor { try { prop.getWorker().resetVM(); - } catch (VMsWorkerException e) { + } catch (VMWorkerException e) { System.out.println("Error: " + e.getMessage()); return false; } @@ -296,7 +296,7 @@ public class ConsoleProcessor { } public boolean createBaseIamge(String name, String path) { - VMsProperty prop = getProperty(name); + VMProperty prop = getProperty(name); if(prop == null) { System.out.println("Error: There is no Virtual Machine named " + name); @@ -321,7 +321,7 @@ public class ConsoleProcessor { path = path + File.separator + "emulimg-" + name + "." + prop.getArch().toString(); } prop.getWorker().createNewBaseImage(prop, path); - } catch (VMsWorkerException e) { + } catch (VMWorkerException e) { System.out.println("Error: " + e.getMessage()); return false; } @@ -331,7 +331,7 @@ public class ConsoleProcessor { } public boolean cloneVM(String name, String target) { - VMsProperty prop = getProperty(name); + VMProperty prop = getProperty(name); if(prop == null) { System.out.println("Error: There is no Virtual Machine named " + name); @@ -344,15 +344,14 @@ public class ConsoleProcessor { return false; } - VMCreateHelper helper = new VMCreateHelper(); - if (helper.checkDupulicateName(target)) { + if (HelperClass.checkDupulicateName(target)) { System.out.println("Error: The target name (" + target + ") already exists!"); return false; } try { prop.getWorker().cloneVM(target); - } catch (VMsWorkerException e) { + } catch (VMWorkerException e) { System.out.println("Error: " + e.getMessage()); return false; } diff --git a/src/org/tizen/emulator/manager/da/widgets/button/DACustomButton.java b/src/org/tizen/emulator/manager/da/widgets/button/DACustomButton.java new file mode 100644 index 0000000..1baf80d --- /dev/null +++ b/src/org/tizen/emulator/manager/da/widgets/button/DACustomButton.java @@ -0,0 +1,277 @@ +/* + * Dynamic Analyzer + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * Jooyoul Lee + * Juyoung Kim + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Contributors: + * - S-Core Co., Ltd + * + */ + +package org.tizen.emulator.manager.da.widgets.button; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.PaintEvent; +import org.eclipse.swt.events.PaintListener; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.Font; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.widgets.Canvas; +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.resources.ColorResources; + +public class DACustomButton extends Canvas { + + public static final int MAX_SIZE = 100; + + public static final int STATE_NORMAL = 0; + public static final int STATE_PUSH = 1; + public static final int STATE_HOVER = 2; + public static final int STATE_DISABLE = 3; + + public static final int TYPE_IMAGE = 0; + public static final int TYPE_COLOR = 1; + public static final int TYPE_GRADATION = 2; + + protected int state = STATE_NORMAL; + protected DACustomButtonAttribute attr; + protected DACustomButtonRenderer buttonRenderer = null; + + public void addListeners() { + this.addListener(SWT.MouseEnter, buttonMouseListener); + this.addListener(SWT.MouseExit, buttonMouseListener); + this.addListener(SWT.MouseDown, buttonMouseListener); + this.addListener(SWT.MouseUp, buttonMouseListener); + } + + public DACustomButton(Composite parent, int style) { + super(parent, style); + + this.setForeground(ColorResources.WHITE.getColor()); + this.addPaintListener(buttonPaintListener); + addListeners(); + buttonRenderer = new DACustomButtonDefaultRenderer(); + attr = new DACustomButtonAttribute(); + setDefaultColors(); + } + + public DACustomButton(Composite parent, int style, String titleText) { + this(parent, style); + attr.setText(titleText); + } + + public DACustomButton(Composite parent, Image normal, Image mouseDown, + Image hover, Image disable) { + this(parent, SWT.TRANSPARENT); + setImages(normal, mouseDown, hover, disable); + attr.setDrawType(TYPE_IMAGE); + } + + public DACustomButton(Composite parent, Color normalStart, Color normalEnd, + Color pushStart, Color pushEnd, Color hoverStart, Color hoverEnd, + Color disableStart, Color disableEnd) { + this(parent, SWT.NONE); + attr.setColor(0, normalStart); + attr.setColor(1, normalEnd); + attr.setColor(2, pushStart); + attr.setColor(3, pushEnd); + attr.setColor(4, hoverStart); + attr.setColor(5, hoverEnd); + attr.setColor(6, disableStart); + attr.setColor(7, disableEnd); + attr.setDrawType(TYPE_GRADATION); + } + + protected void changeButtonState(int s) { + if (s == STATE_DISABLE) { + super.setEnabled(false); + } else { + super.setEnabled(true); + } + + state = s; + this.redraw(); + } + + protected Listener buttonMouseListener = new Listener() { + + @Override + public void handleEvent(Event event) { + if (state == STATE_DISABLE) { + return; + } + + if (event.type == SWT.MouseEnter) { + changeButtonState(STATE_HOVER); + } + + if (event.type == SWT.MouseExit) { + changeButtonState(STATE_NORMAL); + } + + if (event.type == SWT.MouseDown) { + changeButtonState(STATE_PUSH); + } + + if (event.type == SWT.MouseUp) { // FIXME + changeButtonState(STATE_HOVER); + } + } + }; + + private void setDefaultColors() { + attr.setColor(STATE_DISABLE, + new Color(Display.getCurrent(), 48, 48, 48)); + attr.setColor(STATE_PUSH, new Color(Display.getCurrent(), 29, 109, 140)); + attr.setColor(STATE_HOVER, new Color(Display.getCurrent(), 0, 134, 185)); + attr.setColor(STATE_NORMAL, new Color(Display.getCurrent(), 67, 67, 67)); + } + + private PaintListener buttonPaintListener = new PaintListener() { + + @Override + public void paintControl(PaintEvent e) { + buttonRenderer.draw(e.gc, (Canvas) e.widget, state, attr); + } + }; + + public void setTitle(String newTitle) { + attr.setText(newTitle); + } + + public void setText(String newTitle) { + attr.setText(newTitle); + } + + public void setButtonImage(Image img) { + attr.setButtonImage(img); + } + + public void setRenderer(DACustomButtonRenderer newRenderer) { + buttonRenderer = newRenderer; + } +/* + public boolean isEnabled() { + return (state != STATE_DISABLE ? true : false); + } +*/ + public void setEnabled(boolean enabled) { + if (enabled) { + super.setEnabled(true); + changeButtonState(STATE_NORMAL); + } else { + changeButtonState(STATE_DISABLE); + } + } + + public void setImage(int state, Image image) { + attr.setImage(state, image); + } + + public Image getImage(int state) { + return attr.getImage(state); + } + + public void setColor(int state, Color color) { + attr.setColor(state, color); + } + + public void setFont(Font font) { + attr.setFont(font); + } + + public void setFontPoint(Point p) { + attr.setFontPoint(p); + } + + public void setColors(Color normal, Color push, Color hover, Color disable) { + attr.setColor(STATE_NORMAL, normal); + attr.setColor(STATE_PUSH, push); + attr.setColor(STATE_HOVER, hover); + attr.setColor(STATE_DISABLE, disable); + attr.setDrawType(TYPE_COLOR); + } + + public void setImages(Image normal, Image push, Image hover, Image disable) { + attr.setImage(STATE_NORMAL, normal); + attr.setImage(STATE_PUSH, push); + attr.setImage(STATE_HOVER, hover); + attr.setImage(STATE_DISABLE, disable); + attr.setDrawType(TYPE_IMAGE); + } + + public void setOutlineColors(Color normal, Color push, Color hover, + Color disable) { + attr.setOutlineColor(STATE_NORMAL, normal); + attr.setOutlineColor(STATE_PUSH, push); + attr.setOutlineColor(STATE_HOVER, hover); + attr.setOutlineColor(STATE_DISABLE, disable); + } + + public void setOutlineInColors(Color normal, Color push, Color hover, + Color disable) { + attr.setOutlineInColor(STATE_NORMAL, normal); + attr.setOutlineInColor(STATE_PUSH, push); + attr.setOutlineInColor(STATE_HOVER, hover); + attr.setOutlineInColor(STATE_DISABLE, disable); + } + + public void addClickListener(DACustomButtonClickEventListener listener) { + addListener(SWT.MouseUp, listener); + } + + public int getState() { + return state; + } + + public void setGradation(Color normalStart, Color normalEnd, + Color pushStart, Color pushEnd, Color hoverStart, Color hoverEnd, + Color disableStart, Color disableEnd) { + attr.setColor(0, normalStart); + attr.setColor(1, normalEnd); + attr.setColor(2, pushStart); + attr.setColor(3, pushEnd); + attr.setColor(4, hoverStart); + attr.setColor(5, hoverEnd); + attr.setColor(6, disableStart); + attr.setColor(7, disableEnd); + attr.setDrawType(TYPE_GRADATION); + } + + public void setGradationColor(int state, Color start, Color end) { + attr.setColor(state * 2, start); + attr.setColor(state * 2 + 1, end); + } + + public void setFontColors(Color normal, Color push, Color hover, + Color disable) { + attr.setFontColor(STATE_NORMAL, normal); + attr.setFontColor(STATE_PUSH, push); + attr.setFontColor(STATE_HOVER, hover); + attr.setFontColor(STATE_DISABLE, disable); + } + + public void setFontColor(int state, Color color) { + attr.setFontColor(state, color); + } +} diff --git a/src/org/tizen/emulator/manager/da/widgets/button/DACustomButtonAttribute.java b/src/org/tizen/emulator/manager/da/widgets/button/DACustomButtonAttribute.java new file mode 100644 index 0000000..30eb0e2 --- /dev/null +++ b/src/org/tizen/emulator/manager/da/widgets/button/DACustomButtonAttribute.java @@ -0,0 +1,158 @@ +/* + * Dynamic Analyzer + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * Jooyoul Lee + * Juyoung Kim + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Contributors: + * - S-Core Co., Ltd + * + */ + +package org.tizen.emulator.manager.da.widgets.button; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.Font; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.Point; + +public class DACustomButtonAttribute { + private final int MAX_SIZE = 12; + private String text; + private Image buttonImage = null; + private Font font; + private Point fontPoint; + private int drawType = DACustomButton.TYPE_COLOR; + + private List images = new ArrayList(); + private List colors = new ArrayList(); + private List fontColors = new ArrayList(); + private List outlineColors = new ArrayList(); + private List outlineInColors = new ArrayList(); + private boolean enabled; + + public DACustomButtonAttribute() { + enabled = true; + + // init array list + for (int i = 0; i < MAX_SIZE; i++) { + images.add(null); + colors.add(null); + fontColors.add(null); + outlineColors.add(null); + outlineInColors.add(null); + } + } + + public String getText() { + return text; + } + + public void setText(String text) { + this.text = text; + } + + public Image getButtonImage() { + return buttonImage; + } + + public void setButtonImage(Image img) { + buttonImage = img; + } + + public Font getFont() { + return font; + } + + public void setFont(Font font) { + this.font = font; + } + + public Point getFontPoint() { + return fontPoint; + } + + public void setFontPoint(Point fontPoint) { + this.fontPoint = fontPoint; + } + + public int getDrawType() { + return drawType; + } + + public void setDrawType(int type) { + drawType = type; + } + + public boolean isEnabled() { + return enabled; + } + + public void setEnabled(boolean enabled) { + this.enabled = enabled; + } + + public Image getImage(int state) { + if (!images.isEmpty()) { + return images.get(state); + } + return null; + } + + public void setImage(int state, Image img) { + images.set(state, img); + } + + public Color getColor(int state) { + if (!colors.isEmpty()) { + return colors.get(state); + } + return null; + } + + public void setColor(int state, Color color) { + colors.set(state, color); + } + + public void setFontColor(int state, Color color) { + fontColors.set(state, color); + } + + public Color getFontColor(int state) { + return fontColors.get(state); + } + + public void setOutlineColor(int state, Color color) { + outlineColors.set(state, color); + } + + public Color getOutlineColor(int state) { + return outlineColors.get(state); + } + + public void setOutlineInColor(int state, Color color) { + outlineInColors.set(state, color); + } + + public Color getOutlineInColor(int state) { + return outlineInColors.get(state); + } +} diff --git a/src/org/tizen/emulator/manager/da/widgets/button/DACustomButtonClickEventListener.java b/src/org/tizen/emulator/manager/da/widgets/button/DACustomButtonClickEventListener.java new file mode 100644 index 0000000..962166f --- /dev/null +++ b/src/org/tizen/emulator/manager/da/widgets/button/DACustomButtonClickEventListener.java @@ -0,0 +1,54 @@ +/* + * Dynamic Analyzer + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * Jooyoul Lee + * Juyoung Kim + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Contributors: + * - S-Core Co., Ltd + * + */ + +package org.tizen.emulator.manager.da.widgets.button; + +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Listener; + +public abstract class DACustomButtonClickEventListener implements Listener { + + @Override + public void handleEvent(Event event) { + DACustomButton button = (DACustomButton) event.widget; + if (null != button && button.getState() != DACustomButton.STATE_DISABLE) { + Rectangle rectangle = button.getBounds(); + int x = event.x; + int y = event.y; + + if (x < 0 || x > rectangle.width || y < 0 || y > rectangle.height) { + return; + } + } else { + return; + } + + handleClickEvent(button); + } + + public abstract void handleClickEvent(DACustomButton button); +} diff --git a/src/org/tizen/emulator/manager/da/widgets/button/DACustomButtonDefaultRenderer.java b/src/org/tizen/emulator/manager/da/widgets/button/DACustomButtonDefaultRenderer.java new file mode 100644 index 0000000..40581b9 --- /dev/null +++ b/src/org/tizen/emulator/manager/da/widgets/button/DACustomButtonDefaultRenderer.java @@ -0,0 +1,165 @@ +/* + * Dynamic Analyzer + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * Jooyoul Lee + * Juyoung Kim + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Contributors: + * - S-Core Co., Ltd + * + */ + +package org.tizen.emulator.manager.da.widgets.button; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.Font; +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.widgets.Canvas; +import org.eclipse.swt.widgets.Display; +import org.tizen.emulator.manager.resources.ColorResources; + +public class DACustomButtonDefaultRenderer extends DACustomButtonRenderer { + + @Override + public void draw(GC gc, Canvas canvas, int state, + DACustomButtonAttribute attr) { + Rectangle rect = canvas.getClientArea(); + + if (attr.getDrawType() == DACustomButton.TYPE_IMAGE) { + Image image = attr.getImage(state); + if (null == image) { + return; + } + + gc.drawImage(image, rect.x, rect.y); + drawButtonText(gc, rect, attr, state); + } else if (attr.getDrawType() == DACustomButton.TYPE_COLOR + || attr.getDrawType() == DACustomButton.TYPE_GRADATION) { + drawButton(gc, rect, state, attr); + } + drawButtonImage(gc, rect, attr); + } + + public int computeFontSize(Rectangle rect) { + if (rect.height > 20) + return 10; + else + return 8; + } + + public void drawButton(GC gc, Rectangle rect, int state, + DACustomButtonAttribute attr) { + if (attr.getDrawType() == DACustomButton.TYPE_COLOR) { + gc.setBackground(attr.getColor(state)); + gc.fillRectangle(rect); + } else { + int index = state * 2; + gc.setForeground(attr.getColor(index)); + gc.setBackground(attr.getColor(index + 1)); + gc.fillGradientRectangle(rect.x, rect.y, rect.width, rect.height, + true); + } + + Rectangle r = new Rectangle(0, 0, rect.width - 1, rect.height - 1); + if (attr.getButtonImage() == null) { + drawButtonText(gc, r, attr, state); + } + Color c = gc.getForeground(); + if (null != attr.getOutlineColor(state)) { + gc.setForeground(attr.getOutlineColor(state)); + } else { + gc.setForeground(ColorResources.BLACK.getColor()); + } + gc.drawRectangle(r); + Rectangle ir = new Rectangle(r.x + 1, r.y + 1, r.width - 2, + r.height - 2); + if (null != attr.getOutlineInColor(state)) { + gc.setForeground(attr.getOutlineInColor(state)); + } else { + gc.setForeground(c); + return; + } + gc.drawRectangle(ir); + gc.setForeground(c); + } + + protected void drawButtonImage(GC gc, Rectangle rect, + DACustomButtonAttribute attr) { + if (attr != null && attr.getButtonImage() != null) { + Image img = attr.getButtonImage(); + Rectangle imgRect = img.getBounds(); + int width = rect.width - imgRect.width; + int height = rect.height - imgRect.height; + int x = 0, y = 0; + if (width > 0) { + x = width / 2; + } + + if (height > 0) { + y = height / 2; + } + gc.drawImage(img, x, y); + } + } + + protected void drawButtonText(GC gc, Rectangle rect, + DACustomButtonAttribute attr, int state) { + String text = null; + Font font = null; + Point p = null; + if (null != (text = attr.getText())) { + if (null == (font = attr.getFont())) { + font = new Font(Display.getCurrent(), "Arial", + computeFontSize(rect), SWT.BOLD); + attr.setFont(font); + } + gc.setFont(font); + + int x = 0, y = 0; + int offset = 0; + if (null == (p = attr.getFontPoint())) { + p = gc.textExtent(text, SWT.DRAW_MNEMONIC); + x = (rect.width - p.x) / 2; + y = (rect.height - p.y) / 2; + x = (x < 0) ? 0 : x; + // rect size < text length -> insert offset + // offset = ((x - rect.x) < 4) ? 4 : 0; + offset = 0; + } else { + x = p.x; + y = p.y; + } + + if (null != attr.getFontColor(state)) { + gc.setForeground(attr.getFontColor(state)); + } else { + gc.setForeground(ColorResources.BLACK.getColor()); + } + + if (state == DACustomButton.STATE_PUSH) { + x += 1; + y += 1; + } + gc.drawString(text, x + offset, y, true); + } + } +} diff --git a/src/org/tizen/emulator/manager/da/widgets/button/DACustomButtonRenderer.java b/src/org/tizen/emulator/manager/da/widgets/button/DACustomButtonRenderer.java new file mode 100644 index 0000000..e7ce757 --- /dev/null +++ b/src/org/tizen/emulator/manager/da/widgets/button/DACustomButtonRenderer.java @@ -0,0 +1,36 @@ +/* + * Dynamic Analyzer + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * Jooyoul Lee + * Juyoung Kim + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Contributors: + * - S-Core Co., Ltd + * + */ + +package org.tizen.emulator.manager.da.widgets.button; + +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.widgets.Canvas; + +public abstract class DACustomButtonRenderer { + public abstract void draw(GC gc, Canvas canvas, int state, + DACustomButtonAttribute attr); + +} diff --git a/src/org/tizen/emulator/manager/da/widgets/button/toggle/DACustomToggleButton.java b/src/org/tizen/emulator/manager/da/widgets/button/toggle/DACustomToggleButton.java new file mode 100644 index 0000000..fa948e4 --- /dev/null +++ b/src/org/tizen/emulator/manager/da/widgets/button/toggle/DACustomToggleButton.java @@ -0,0 +1,175 @@ +/* + * Dynamic Analyzer + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * Jooyoul Lee + * Juyoung Kim + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Contributors: + * - S-Core Co., Ltd + * + */ + +package org.tizen.emulator.manager.da.widgets.button.toggle; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Listener; +import org.tizen.emulator.manager.da.widgets.button.DACustomButton; +import org.tizen.emulator.manager.resources.ColorResources; + +public class DACustomToggleButton extends DACustomButton { + + public static final int STATE_TOGGLE = 4; + public static final int STATE_TOGGLE_HOVER = 5; + public static final int STATE_TOGGLE_PUSH = 6; + private boolean toggle = false; + private boolean toggleByButton = false; + + public DACustomToggleButton(Composite parent, Image normal, Image push, + Image hover, Image disable, Image toggle, Image toggleHover) { + super(parent, normal, push, hover, disable); + buttonRenderer = new DACustomToggleButtonRenderer(); + + attr.setImage(STATE_TOGGLE, toggle); + attr.setImage(STATE_TOGGLE_HOVER, toggleHover); + addListeners(); + } + + public DACustomToggleButton(Composite parent, Image normal, Image push, + Image hover, Image disable, Image toggle, Image toggleHover, + Image togglePush) { + this(parent, normal, push, hover, disable, toggle, toggleHover); + buttonRenderer = new DACustomToggleButtonRenderer(); + + attr.setImage(STATE_TOGGLE_PUSH, togglePush); + } + + public DACustomToggleButton(Composite parent, int style) { + super(parent, style); + buttonRenderer = new DACustomToggleButtonRenderer(); + attr.setColor(STATE_TOGGLE, ColorResources.BLUE.getColor()); + attr.setColor(STATE_TOGGLE_HOVER, ColorResources.WHITE.getColor()); + addListeners(); + } + + public DACustomToggleButton(Composite parent, Color normalStart, + Color normalEnd, Color pushStart, Color pushEnd, Color hoverStart, + Color hoverEnd, Color disableStart, Color disableEnd, + Color toggleStart, Color toggleEnd, Color toggleHoverStart, + Color toggleHoverEnd) { + this(parent, SWT.NONE); + attr.setColor(0, normalStart); + attr.setColor(1, normalEnd); + attr.setColor(2, pushStart); + attr.setColor(3, pushEnd); + attr.setColor(4, hoverStart); + attr.setColor(5, hoverEnd); + attr.setColor(6, disableStart); + attr.setColor(7, disableEnd); + attr.setColor(8, toggleStart); + attr.setColor(9, toggleEnd); + attr.setColor(10, toggleHoverStart); + attr.setColor(11, toggleHoverEnd); + attr.setDrawType(TYPE_GRADATION); + } + + public void setToggled(boolean toggled) { + toggle = toggled; + if (toggled) { + changeButtonState(STATE_TOGGLE); + } else { + changeButtonState(STATE_NORMAL); + } + } + + public void setToggled2(boolean toggled) { + if (!toggleByButton) { + toggle = toggled; + if (toggled) { + changeButtonState(STATE_TOGGLE); + } else { + changeButtonState(STATE_NORMAL); + } + } + } + + public boolean isToggled() { + return toggle; + } + + @Override + public void addListeners() { + if (null != toggleButtonMouseListener) { + this.addListener(SWT.MouseEnter, toggleButtonMouseListener); + this.addListener(SWT.MouseExit, toggleButtonMouseListener); + this.addListener(SWT.MouseDown, toggleButtonMouseListener); + this.addListener(SWT.MouseUp, toggleButtonMouseListener); + } + } + + private Listener toggleButtonMouseListener = new Listener() { + + @Override + public void handleEvent(Event event) { + if (state == STATE_DISABLE) { + return; + } + + if (event.type == SWT.MouseEnter) { + if (toggle) { + changeButtonState(STATE_TOGGLE_HOVER); + } else { + changeButtonState(STATE_HOVER); + } + } + + if (event.type == SWT.MouseExit) { + if (toggle) { + changeButtonState(STATE_TOGGLE); + } else { + changeButtonState(STATE_NORMAL); + } + } + + if (event.type == SWT.MouseDown) { + if (toggle) { + if (null != attr.getImage(STATE_TOGGLE_PUSH)) { + changeButtonState(STATE_TOGGLE_PUSH); + } else { + changeButtonState(STATE_PUSH); + } + } else { + changeButtonState(STATE_PUSH); + } + } + + if (event.type == SWT.MouseUp) { // FIXME + toggle = !toggle; + toggleByButton = !toggleByButton; + if (toggle) { + changeButtonState(STATE_TOGGLE_HOVER); + } else { + changeButtonState(STATE_HOVER); + } + } + } + }; +} diff --git a/src/org/tizen/emulator/manager/da/widgets/button/toggle/DACustomToggleButtonRenderer.java b/src/org/tizen/emulator/manager/da/widgets/button/toggle/DACustomToggleButtonRenderer.java new file mode 100644 index 0000000..61392cc --- /dev/null +++ b/src/org/tizen/emulator/manager/da/widgets/button/toggle/DACustomToggleButtonRenderer.java @@ -0,0 +1,57 @@ +/* + * Dynamic Analyzer + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * Jooyoul Lee + * Juyoung Kim + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Contributors: + * - S-Core Co., Ltd + * + */ + +package org.tizen.emulator.manager.da.widgets.button.toggle; + +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.tizen.emulator.manager.da.widgets.button.DACustomButton; +import org.tizen.emulator.manager.da.widgets.button.DACustomButtonAttribute; +import org.tizen.emulator.manager.da.widgets.button.DACustomButtonDefaultRenderer; + +public class DACustomToggleButtonRenderer extends DACustomButtonDefaultRenderer { + + @Override + public void draw(GC gc, Canvas canvas, int state, + DACustomButtonAttribute attr) { + Rectangle rect = canvas.getClientArea(); + if (attr.getDrawType() == DACustomButton.TYPE_IMAGE) { + Image image = attr.getImage(state); + if (null == image) { + return; + } + + gc.drawImage(image, rect.x, rect.y); + drawButtonText(gc, rect, attr, state); + } else if (attr.getDrawType() == DACustomButton.TYPE_COLOR + || attr.getDrawType() == DACustomButton.TYPE_GRADATION) { + drawButton(gc, rect, state, attr); + } + } + +} diff --git a/src/org/tizen/emulator/manager/da/widgets/combo/DACustomCombo.java b/src/org/tizen/emulator/manager/da/widgets/combo/DACustomCombo.java new file mode 100644 index 0000000..65d2967 --- /dev/null +++ b/src/org/tizen/emulator/manager/da/widgets/combo/DACustomCombo.java @@ -0,0 +1,757 @@ +/* + * Dynamic Analyzer + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * Jooyoul Lee + * Juyoung Kim + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Contributors: + * - S-Core Co., Ltd + * + */ + +package org.tizen.emulator.manager.da.widgets.combo; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.MouseEvent; +import org.eclipse.swt.events.MouseListener; +import org.eclipse.swt.events.PaintEvent; +import org.eclipse.swt.events.PaintListener; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.layout.FormAttachment; +import org.eclipse.swt.layout.FormData; +import org.eclipse.swt.layout.FormLayout; +import org.eclipse.swt.widgets.Canvas; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Listener; +import org.eclipse.swt.widgets.Shell; +import org.tizen.emulator.manager.da.widgets.button.DACustomButton; +import org.tizen.emulator.manager.da.widgets.button.DACustomButtonRenderer; +import org.tizen.emulator.manager.resources.ColorResources; + +public class DACustomCombo extends Canvas { + public static final int MAX_SIZE = 10; + public static final int STATE_NORMAL = 0; + public static final int STATE_HOVER = 1; + public static final int STATE_PUSH = 2; + public static final int STATE_DISABLE = 3; + + private static final int pageSize = 5; + + Composite parent; + protected Canvas combo = null; + private Canvas popup = null; + private int itemHeight = 0; + private DACustomButton upArrowButton = null; + private DACustomButton downArrowButton = null; + private int itemIndex = 0; + private boolean dirty = false; + + private List items; + private List rects = null; + + private List images = null; + protected Image buttonUp = null; + private Image buttonDown = null; + private boolean enabled = true; + private Shell childShell = null; + private int selection = 0; + private String text = ""; //$NON-NLS-1$ + private boolean imgCombo = false; + protected int state = STATE_NORMAL; // 0 normal 1 hover 2 push 3 disable + protected DACustomComboRenderer comboRenderer = new DACustomComboDefaultRenderer();; + private DACustomComboPopupRenderer popupRenderer = new DACustomComboPopupDefaultRenderer(); + private DACustomButtonRenderer buttonRenderer = null; + + private List arrowColors = null; + private List arrowImages = null; + + public DACustomCombo(Composite parent, int style) { + super(parent, style); + combo = this; + + this.parent = parent; + addPaintListener(comboPaintListener); + setForeground(ColorResources.WHITE.getColor()); + addListeners(); + initCombo(); + } + + public void addListeners() { + addListener(SWT.MouseEnter, comboMouseListener); + addListener(SWT.MouseHover, comboMouseListener); + addListener(SWT.MouseExit, comboMouseListener); + addListener(SWT.MouseDown, comboMouseListener); + addListener(SWT.MouseMove, comboMouseListener); + addListener(SWT.MouseUp, comboMouseListener); + } + + public String getText() { + if (getItems().size() > 0) { + return getItems().get(itemIndex + selection); + } + return null; + } + + public List getItems() { + if (null == items) { + items = new ArrayList(); + } + return items; + } + + private List getRects() { + if (null == rects) { + rects = new ArrayList(); + } + return rects; + } + + private void changeComboState(int s) { + state = s; + redraw(); + } + + private Listener popupSelectionListener = new DACustomComboSelectionListener() { + + @Override + public void selectionEvent(DACustomCombo combo) { + //System.out.println("default selection" + combo.getText()); + } + }; + + public void addSelectionListener(DACustomComboSelectionListener listener) { + popupSelectionListener = listener; + } + + private Listener comboMouseListener = new Listener() { + @Override + public void handleEvent(Event event) { + if (enabled) { + if (event.type == SWT.MouseEnter) { + changeComboState(STATE_HOVER); + } + + if (event.type == SWT.MouseHover) { + if (!isOutOfBounds(event.x, event.y)) { + if (0 != (event.stateMask & SWT.BUTTON1)) { + changeComboState(STATE_PUSH); + } else if (0 == (event.stateMask & SWT.BUTTON1)) { + changeComboState(STATE_HOVER); + } + } + } + + if (event.type == SWT.MouseDown) { + changeComboState(STATE_PUSH); + } + + if (event.type == SWT.MouseUp) { + changeComboState(STATE_HOVER); + if (childShell == null || childShell.isDisposed()) { + openChildShell(); + } else { + childShell.close(); + childShell = null; + } + } + + if (event.type == SWT.MouseMove) { + if (isOutOfBounds(event.x, event.y)) { + changeComboState(STATE_NORMAL); + } else if (isOutOfBounds(event.x, event.y)) { + if (0 != (event.stateMask & SWT.BUTTON1)) { + changeComboState(STATE_PUSH); + } else if (0 == (event.stateMask & SWT.BUTTON1)) { + changeComboState(STATE_HOVER); + } + } + } + + if (event.type == SWT.MouseExit) { + changeComboState(STATE_NORMAL); + } + } + } + }; + + protected boolean isOutOfBounds(int x, int y) { + Rectangle rectangle = combo.getBounds(); + + if (x < 0 || x > rectangle.width || y < 0 || y > rectangle.height) { + return true; + } + + return false; + } + + private int getShellWidth() { + if (getItems().isEmpty()) { + return 0; + } + int max = 0; + int size = items.size(); + GC gc = new GC(parent.getDisplay(), SWT.NONE); + for (int i = 0; i < size; i++) { + Point p = gc.textExtent(items.get(i), SWT.DRAW_MNEMONIC); + if (p.x > max) { + max = p.x; + } + } + max += 10; + gc.dispose(); + return max; + } + + public int getItemHeight() { + return itemHeight; + } + + public void setItemHeight(int height) { + itemHeight = height; + } + + private void openChildShell() { + childShell = new Shell(parent.getShell(), SWT.ON_TOP); + childShell.setLayout(new FormLayout()); + + Point p = combo.toDisplay(0, 0); + Rectangle rect = combo.getBounds(); + int size = getItems().size(); + + int boundSize = (size > MAX_SIZE) ? MAX_SIZE : (size > 0) ? size : 1; + + int textSize = getShellWidth() + 4; + int shellWidth = (textSize > rect.width) ? textSize : rect.width; + int height = 0; + + if (getItemHeight() == 0) { + height = rect.height; + } else { + height = getItemHeight(); + } + int shellHeight = height * boundSize + 5; + + childShell.setSize(shellWidth, shellHeight); + childShell.setLocation(p.x, p.y + rect.height); + // childShell.setBackground(ColorResources.BLUE); + setSelect(text); + + popup = new Canvas(childShell, SWT.DOUBLE_BUFFERED); + popup.setData(this); + popup.setBackground(ColorResources.WHITE.getColor()); + popup.addPaintListener(popupPaintListener); + popup.addListener(SWT.MouseUp, popupMouseEventListener); + popup.addListener(SWT.MouseMove, popupMouseEventListener); + popup.addListener(SWT.FocusOut, popupMouseEventListener); + popup.addListener(SWT.MouseUp, popupSelectionListener); + popup.addListener(SWT.MouseWheel, popupMouseEventListener); + + if (size > MAX_SIZE) { + upArrowButton = makeButton(); + if (buttonUp == null) { + upArrowButton.setText("UP"); + } else { + upArrowButton.setButtonImage(buttonUp); + } + FormData data = new FormData(); + data.top = new FormAttachment(0, 0); + data.left = new FormAttachment(0, 0); + data.right = new FormAttachment(100, 0); + data.height = height; + upArrowButton.setLayoutData(data); + upArrowButton.addMouseListener(upArrowListener); + upArrowButton.addListener(SWT.MouseExit, upButtonMouseExitListener); + shellHeight += height; + if (itemIndex > 0) { + upArrowButton.setEnabled(true); + } else { + upArrowButton.setEnabled(false); + } + + data = new FormData(); + data.top = new FormAttachment(upArrowButton, 0); + data.left = new FormAttachment(0, 0); + data.right = new FormAttachment(100, 0); + data.height = height * boundSize + 5 - 2; + popup.setLayoutData(data); + + // downArrowButton = new DACustomButton(childShell, SWT.NONE); + downArrowButton = makeButton(); + // downArrowButton.setText("down"); //$NON-NLS-1$ + if (null == buttonDown) { + downArrowButton.setText("DOWN"); + } else { + downArrowButton.setButtonImage(buttonDown); + } + data = new FormData(); + data.top = new FormAttachment(popup, 0); + data.left = new FormAttachment(0, 0); + data.right = new FormAttachment(100, 0); + data.height = height; + downArrowButton.setLayoutData(data); + downArrowButton.addMouseListener(downArrowListener); + downArrowButton.addListener(SWT.MouseExit, + downButtonMouseExitListener); + shellHeight += height; + if (itemIndex + MAX_SIZE < size - 1) { + downArrowButton.setEnabled(true); + } else { + downArrowButton.setEnabled(false); + } + + childShell.setSize(shellWidth, shellHeight); + } else { + FormData data = new FormData(); + data.top = new FormAttachment(0, 0); + data.left = new FormAttachment(0, 0); + data.right = new FormAttachment(100, 0); + data.height = shellHeight - 2; + popup.setLayoutData(data); + } + + size = (size > MAX_SIZE) ? MAX_SIZE : size; + getRects().clear(); + for (int i = 0; i < size; i++) { + Rectangle r = new Rectangle(2, 2 + i * height, shellWidth - 2, + height); + getRects().add(r); + } + childShell.open(); + } + + private MouseListener upArrowListener = new MouseListener() { + + @Override + public void mouseUp(MouseEvent event) { + if (!upArrowButton.isEnabled()) { + return; + } + + if (null != upArrowButton) { + Rectangle rectangle = upArrowButton.getBounds(); + int x = event.x; + int y = event.y; + + if (x < 0 || x > rectangle.width || y < 0 + || y > rectangle.height) { + return; + } + } + + int size = getItems().size(); + if (itemIndex - pageSize < 0) { + itemIndex = 0; + upArrowButton.setEnabled(false); + } else { + itemIndex -= pageSize; + } + + if (itemIndex + pageSize < size - 1) { + downArrowButton.setEnabled(true); + } + popup.redraw(); + } + + @Override + public void mouseDown(MouseEvent arg0) { + // TODO Auto-generated method stub + + } + + @Override + public void mouseDoubleClick(MouseEvent arg0) { + // TODO Auto-generated method stub + + } + }; + + private MouseListener downArrowListener = new MouseListener() { + + @Override + public void mouseUp(MouseEvent event) { + + if (!downArrowButton.isEnabled()) { + return; + } + + if (null != downArrowButton) { + Rectangle rectangle = downArrowButton.getBounds(); + int x = event.x; + int y = event.y; + + if (x < 0 || x > rectangle.width || y < 0 + || y > rectangle.height) { + return; + } + } + + int size = getItems().size(); + if (itemIndex + pageSize + MAX_SIZE >= size - 1) { + itemIndex = size - MAX_SIZE; + downArrowButton.setEnabled(false); + } else { + itemIndex += pageSize; + } + + // if (itemIndex - pageSize > 0) { + if (itemIndex > 0) { + upArrowButton.setEnabled(true); + } + popup.redraw(); + } + + @Override + public void mouseDown(MouseEvent arg0) { + // TODO Auto-generated method stub + + } + + @Override + public void mouseDoubleClick(MouseEvent arg0) { + // TODO Auto-generated method stub + } + }; + + private PaintListener popupPaintListener = new PaintListener() { + + @Override + public void paintControl(PaintEvent e) { + List items = getItems(); + List input = new ArrayList(); + int size = (items.size() > MAX_SIZE) ? MAX_SIZE : items.size(); + for (int i = 0; i < size; i++) { + input.add(items.get(itemIndex + i)); + } + popupRenderer + .draw(e.gc, popup, state, getRects(), selection, input); + } + }; + + public void setText(String text) { + if (!setSelect(text)) { + this.text = text; + redraw(); + } + } + + private boolean setSelect(String text) { + if (getItems().isEmpty()) { + return false; + } + + int index = items.indexOf(text); + if (index < 0) { + return false; + } + int size = items.size(); + if (size < MAX_SIZE) { + selection = index; + select(selection); + } else if (index + MAX_SIZE >= size) { + int lower = size - index; + selection = MAX_SIZE - lower; + itemIndex = size - MAX_SIZE; + select(selection); + } else { + selection = index - itemIndex; + select(selection); + } + return true; + } + + public void upEvent() { + if (getItems().size() > 0) { + setText(getItems().get(itemIndex + selection)); + } else { + setText(""); //$NON-NLS-1$ + } + childShell.close(); + childShell = null; + } + + private Listener popupMouseEventListener = new Listener() { + + @Override + public void handleEvent(Event event) { + if (event.type == SWT.MouseMove) { + List rs = getRects(); + int size = rs.size(); + for (int i = 0; i < size; i++) { + if (rs.get(i).contains(event.x, event.y)) { + selection = i; + popup.redraw(); + break; + } + } + } + + if (event.type == SWT.FocusOut) { + childShell.close(); + childShell = null; + } + + if (event.type == SWT.MouseWheel) { + int size = getItems().size(); + if (null != downArrowButton && null != upArrowButton) { + if (event.count < 0) { + if (itemIndex - event.count + MAX_SIZE >= size - 1) { + itemIndex = size - MAX_SIZE; + downArrowButton.setEnabled(false); + } else { + itemIndex -= event.count; + } + + // if (itemIndex - pageSize > 0) { + if (itemIndex > 0) { + upArrowButton.setEnabled(true); + } + } else { + + if (itemIndex - event.count < 0) { + itemIndex = 0; + upArrowButton.setEnabled(false); + } else { + itemIndex -= event.count; + } + + if (itemIndex + event.count < size - 1) { + downArrowButton.setEnabled(true); + } + } + popup.redraw(); + } + } + } + }; + + public void setEnabled(boolean enabled) { + this.enabled = enabled; + if (enabled) { + changeComboState(STATE_NORMAL); + if (isImageCombo()) { + setBackgroundImage(images.get(STATE_NORMAL)); + } + } else { + changeComboState(STATE_DISABLE); + if (isImageCombo()) { + setBackgroundImage(images.get(STATE_DISABLE)); + } + } + } + + private PaintListener comboPaintListener = new PaintListener() { + + @Override + public void paintControl(PaintEvent e) { + if (!isImageCombo()) { + comboRenderer.draw(e.gc, combo, text, state); + } else { + comboRenderer.drawImage(e.gc, combo, images.get(state), text, + state); + } + } + }; + + public void setComboRender(DACustomComboRenderer newRenderer) { + comboRenderer = newRenderer; + } + + public void setComboPopupRender(DACustomComboPopupRenderer newRenderer) { + popupRenderer = newRenderer; + } + + // public void removeAll() { + // getItems().clear(); + // } + + public void add(String item) { + if (dirty) { + getItems().add(item); + } else { + getItems().set(0, item); + dirty = true; + } + } + + public void add(String item, int index) { + getItems().add(index, item); + } + + public void select(int index) { + selection = index; + this.text = items.get(itemIndex + selection); + redraw(); + } + + public String getItem(int index) { + if (getItems().size() > 0) { + return getItems().get(index); + } + return ""; //$NON-NLS-1$ + } + + public void setImages(Image normal, Image hover, Image push, Image disable) { + if (null == normal || null == hover || null == push || null == disable) { + return; + } + List imgs = getImages(); + + imgs.add(normal); + imgs.add(hover); + imgs.add(push); + imgs.add(disable); + setImageCombo(true); + } + + protected List getImages() { + if (null == images) { + images = new ArrayList(); + } + return images; + } + + private void setImageCombo(boolean b) { + this.imgCombo = b; + } + + public boolean isImageCombo() { + return imgCombo; + } + + private Listener upButtonMouseExitListener = new Listener() { + + @Override + public void handleEvent(Event event) { + } + }; + + private Listener downButtonMouseExitListener = new Listener() { + + @Override + public void handleEvent(Event event) { + + } + }; + + public boolean isDirty() { + return dirty; + } + + public void initCombo() { + getItems().clear(); + itemIndex = 0; + selection = 0; + items.add(""); + dirty = false; + } + + public void setComboButtonColor(Color normal, Color push, Color hover, + Color disable) { + arrowColors = new ArrayList(); + arrowColors.add(normal); + arrowColors.add(push); + arrowColors.add(hover); + arrowColors.add(disable); + } + + public void setComboButtonImage(Image normal, Image push, Image hover, + Image disable) { + arrowImages = new ArrayList(); + arrowImages.add(normal); + arrowImages.add(push); + arrowImages.add(hover); + arrowImages.add(disable); + } + + public void setComboButtonGradation(Color normalStart, Color normalEnd, + Color pushStart, Color pushEnd, Color hoverStart, Color hoverEnd, + Color disableStart, Color disableEnd) { + arrowColors = new ArrayList(); + arrowColors.add(normalStart); + arrowColors.add(normalEnd); + arrowColors.add(pushStart); + arrowColors.add(pushEnd); + arrowColors.add(hoverStart); + arrowColors.add(hoverEnd); + arrowColors.add(disableStart); + arrowColors.add(disableEnd); + } + + private DACustomButton makeButton() { + DACustomButton button = null; + if (arrowImages != null) { + button = new DACustomButton(childShell, + arrowImages.get(STATE_NORMAL), arrowImages.get(STATE_PUSH), + arrowImages.get(STATE_HOVER), + arrowImages.get(STATE_DISABLE)); + } else if (arrowColors != null) { + if (arrowColors.size() > 4) { + // gradation + button = new DACustomButton(childShell, + arrowColors.get(STATE_NORMAL), + arrowColors.get(STATE_NORMAL + 1), + arrowColors.get(STATE_PUSH * 2), + arrowColors.get(STATE_PUSH * 2 + 1), + arrowColors.get(STATE_HOVER * 2), + arrowColors.get(STATE_HOVER * 2 + 1), + arrowColors.get(STATE_DISABLE * 2), + arrowColors.get(STATE_DISABLE * 2 + 1)); + } else { + button = new DACustomButton(childShell, SWT.NONE); + button.setColors(arrowColors.get(STATE_NORMAL), + arrowColors.get(STATE_PUSH), + arrowColors.get(STATE_HOVER), + arrowColors.get(STATE_DISABLE)); + } + } else { + button = new DACustomButton(childShell, SWT.NONE); + } + if (null != buttonRenderer) { + button.setRenderer(buttonRenderer); + } + return button; + } + + public void setButtonRenderer(DACustomButtonRenderer renderer) { + buttonRenderer = renderer; + } + + public void setButtonImages(Image up, Image down) { + buttonUp = up; + buttonDown = down; + } + + public int getItemIndex(String text) { + return getItems().indexOf(text); + } + + public boolean isChildShellOpened() { + if (childShell == null || childShell.isDisposed()) { + return false; + } + return true; + } +} diff --git a/src/org/tizen/emulator/manager/da/widgets/combo/DACustomComboDefaultRenderer.java b/src/org/tizen/emulator/manager/da/widgets/combo/DACustomComboDefaultRenderer.java new file mode 100644 index 0000000..bdfd032 --- /dev/null +++ b/src/org/tizen/emulator/manager/da/widgets/combo/DACustomComboDefaultRenderer.java @@ -0,0 +1,76 @@ +/* + * Dynamic Analyzer + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * Jooyoul Lee + * Juyoung Kim + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Contributors: + * - S-Core Co., Ltd + * + */ + +package org.tizen.emulator.manager.da.widgets.combo; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.widgets.Canvas; +import org.tizen.emulator.manager.resources.ColorResources; + + +public class DACustomComboDefaultRenderer extends DACustomComboRenderer { + + @Override + public void draw(GC gc, Canvas canvas, String text, int state) { + Rectangle rect = canvas.getClientArea(); + if (state == DACustomCombo.STATE_NORMAL) { + gc.setBackground(ColorResources.WINDOW_BG_COLOR.getColor()); + } else if (state == DACustomCombo.STATE_HOVER) { + gc.setBackground(ColorResources.ITEM_BLUE_DARK.getColor()); + } else if (state == DACustomCombo.STATE_PUSH) { + gc.setBackground(ColorResources.BLUE.getColor()); + } else if (state == DACustomCombo.STATE_DISABLE) { + gc.setBackground(ColorResources.GRAY1.getColor()); + } + gc.fillRectangle(rect); + gc.drawRectangle(rect.x, rect.y, rect.width - 20, rect.height - 1); + + if (null == text) { + text = ""; //$NON-NLS-1$ + } + Point p = gc.textExtent(text, SWT.DRAW_MNEMONIC); + gc.drawString(text, 5, (rect.height - p.y)/2, true); + gc.fillRectangle(rect.x + rect.width - 20, rect.y, 19, rect.height - 1); + gc.drawRectangle(rect.x + rect.width - 20, rect.y, 19, rect.height - 1); + } + + @Override + public void drawPattern(GC gc, Canvas canvas, Image patternImage, + String text, int state) { + + } + + @Override + public void drawImage(GC gc, Canvas canvas, Image image, String text, + int state) { + + } + +} diff --git a/src/org/tizen/emulator/manager/da/widgets/combo/DACustomComboPopupDefaultRenderer.java b/src/org/tizen/emulator/manager/da/widgets/combo/DACustomComboPopupDefaultRenderer.java new file mode 100644 index 0000000..882bc99 --- /dev/null +++ b/src/org/tizen/emulator/manager/da/widgets/combo/DACustomComboPopupDefaultRenderer.java @@ -0,0 +1,76 @@ +/* + * Dynamic Analyzer + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * Jooyoul Lee + * Juyoung Kim + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Contributors: + * - S-Core Co., Ltd + * + */ + +package org.tizen.emulator.manager.da.widgets.combo; + +import java.util.List; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.widgets.Canvas; +import org.tizen.emulator.manager.resources.ColorResources; + + +public class DACustomComboPopupDefaultRenderer extends DACustomComboPopupRenderer { + + @Override + public void draw(GC gc, Canvas canvas, int state, List rects, + int selection, List items) { + int size = rects.size(); + for (int i = 0; i < size; i++) { + Rectangle r = rects.get(i); + gc.setBackground(ColorResources.WINDOW_BG_COLOR.getColor()); + if (selection == i) { + gc.setBackground(ColorResources.RED.getColor()); + gc.fillRectangle(r); + gc.setBackground(ColorResources.WINDOW_BG_COLOR.getColor()); + } + gc.setForeground(ColorResources.WHITE.getColor()); + gc.drawRectangle(r.x, r.y, r.width - 1, r.height - 1); + Point p = gc.textExtent(items.get(i), SWT.DRAW_MNEMONIC); + gc.drawString(items.get(i), 5, (r.height - p.y) / 2 + i * r.height, + true); + } + } + + @Override + public void drawPattern(GC gc, Canvas canvas, Image patternImage, + int state, List rects, int selection, List items) { + // TODO Auto-generated method stub + + } + + @Override + public void drawImage(GC gc, Canvas canvas, Image image, int state, + List rects, int selection, List items) { + // TODO Auto-generated method stub + + } + +} diff --git a/src/org/tizen/emulator/manager/da/widgets/combo/DACustomComboPopupRenderer.java b/src/org/tizen/emulator/manager/da/widgets/combo/DACustomComboPopupRenderer.java new file mode 100644 index 0000000..2556fad --- /dev/null +++ b/src/org/tizen/emulator/manager/da/widgets/combo/DACustomComboPopupRenderer.java @@ -0,0 +1,45 @@ +/* + * Dynamic Analyzer + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * Jooyoul Lee + * Juyoung Kim + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Contributors: + * - S-Core Co., Ltd + * + */ + +package org.tizen.emulator.manager.da.widgets.combo; + +import java.util.List; + +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.widgets.Canvas; + +public abstract class DACustomComboPopupRenderer { + public abstract void draw(GC gc, Canvas canvas, int state, + List rects, int selection, List items); + + public abstract void drawPattern(GC gc, Canvas canvas, Image patternImage, + int state, List rects, int selection, List items); + + public abstract void drawImage(GC gc, Canvas canvas, Image image, + int state, List rects, int selection, List items); +} diff --git a/src/org/tizen/emulator/manager/da/widgets/combo/DACustomComboRenderer.java b/src/org/tizen/emulator/manager/da/widgets/combo/DACustomComboRenderer.java new file mode 100644 index 0000000..e0366ad --- /dev/null +++ b/src/org/tizen/emulator/manager/da/widgets/combo/DACustomComboRenderer.java @@ -0,0 +1,37 @@ +/* + * Dynamic Analyzer + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * Jooyoul Lee + * Juyoung Kim + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Contributors: + * - S-Core Co., Ltd + * + */ + +package org.tizen.emulator.manager.da.widgets.combo; + +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Canvas; + +public abstract class DACustomComboRenderer { + public abstract void draw(GC gc, Canvas canvas, String text, int state); + public abstract void drawPattern(GC gc, Canvas canvas, Image patternImage, String text, int state); + public abstract void drawImage(GC gc, Canvas canvas, Image image, String text, int state); +} diff --git a/src/org/tizen/emulator/manager/da/widgets/combo/DACustomComboSelectionListener.java b/src/org/tizen/emulator/manager/da/widgets/combo/DACustomComboSelectionListener.java new file mode 100644 index 0000000..0b70388 --- /dev/null +++ b/src/org/tizen/emulator/manager/da/widgets/combo/DACustomComboSelectionListener.java @@ -0,0 +1,46 @@ +/* + * Dynamic Analyzer + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * Jooyoul Lee + * Juyoung Kim + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Contributors: + * - S-Core Co., Ltd + * + */ + +package org.tizen.emulator.manager.da.widgets.combo; + +import org.eclipse.swt.widgets.Canvas; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Listener; + +public abstract class DACustomComboSelectionListener implements Listener { + + @Override + public void handleEvent(Event event) { + Canvas popup = (Canvas) event.widget; + DACustomCombo combo = (DACustomCombo) popup.getData(); + if (null != combo) { + selectionEvent(combo); + combo.upEvent(); + } + } + + public abstract void selectionEvent(DACustomCombo combo); +} diff --git a/src/org/tizen/emulator/manager/da/widgets/combo/TitleComboPopupRenderer.java b/src/org/tizen/emulator/manager/da/widgets/combo/TitleComboPopupRenderer.java new file mode 100644 index 0000000..dd6a9b7 --- /dev/null +++ b/src/org/tizen/emulator/manager/da/widgets/combo/TitleComboPopupRenderer.java @@ -0,0 +1,96 @@ +/* + * Dynamic Analyzer + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * Jooyoul Lee + * Juyoung Kim + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Contributors: + * - S-Core Co., Ltd + * + */ + +package org.tizen.emulator.manager.da.widgets.combo; + +import java.util.List; + +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.tizen.emulator.manager.resources.ColorResources; +import org.tizen.emulator.manager.resources.FontResources; + + +public class TitleComboPopupRenderer extends DACustomComboPopupRenderer { + + @Override + public void draw(GC gc, Canvas canvas, int state, List rects, + int selection, List items) { + int size = rects.size(); + for (int i = 0; i < size; i++) { + Rectangle r = rects.get(i); + if (selection == i) { + gc.setBackground(ColorResources.DEVICE_APPLICATION_ITEM_SELECT_INNER.getColor()); + gc.fillRectangle(r); + + gc.setForeground(ColorResources.DEVICE_APPLICATION_ITEM_SELECT_TOP.getColor()); + gc.drawLine(r.x, r.y, r.x + r.width, r.y); + gc.setForeground(ColorResources.DEVICE_APPLICATION_ITEM_SELECT_BOTTOM.getColor()); + gc.drawLine(r.x, r.y + r.height - 1, r.x + r.width, r.y + + r.height - 1); + } else { + gc.setBackground(ColorResources.DEVICE_APPLICATION_ITEM_NORMAL_INNER.getColor()); + gc.fillRectangle(r); + gc.setForeground(ColorResources.DEVICE_APPLICATION_ITEM_NORMAL_TOP.getColor()); + gc.drawLine(r.x, r.y, r.x + r.width, r.y); + gc.setForeground(ColorResources.DEVICE_APPLICATION_ITEM_NORMAL_BOTTOM.getColor()); + gc.drawLine(r.x, r.y + r.height - 1, r.x + r.width, r.y + + r.height - 1); + } + gc.setForeground(ColorResources.DEVICE_APPLICATION_DROPDOWN_TEXT.getColor()); + gc.setFont(FontResources.DROPDOWN.getFont()); + // Point p = gc.textExtent(items.get(i), SWT.DRAW_MNEMONIC); + // gc.drawString(items.get(i), 5, (r.height - p.y) / 2 + i * + // r.height, + // true); + gc.drawString(items.get(i), 5, 6 + i * r.height, true); + + Rectangle rect = canvas.getClientArea(); + gc.setForeground(ColorResources.DEVICE_APPLICATION_POPUP_OUTER_1.getColor()); + gc.drawRectangle(rect); + gc.setForeground(ColorResources.DEVICE_APPLICATION_POPUP_OUTER_2.getColor()); + gc.drawRectangle(rect.x + 1, rect.y + 1, rect.width - 2, + rect.height - 2); + } + } + + @Override + public void drawPattern(GC gc, Canvas canvas, Image patternImage, + int state, List rects, int selection, List items) { + // TODO Auto-generated method stub + + } + + @Override + public void drawImage(GC gc, Canvas canvas, Image image, int state, + List rects, int selection, List items) { + // TODO Auto-generated method stub + + } + +} diff --git a/src/org/tizen/emulator/manager/da/widgets/combo/TitleComboRenderer.java b/src/org/tizen/emulator/manager/da/widgets/combo/TitleComboRenderer.java new file mode 100644 index 0000000..c3943cd --- /dev/null +++ b/src/org/tizen/emulator/manager/da/widgets/combo/TitleComboRenderer.java @@ -0,0 +1,100 @@ +/* + * Dynamic Analyzer + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * Jooyoul Lee + * Juyoung Kim + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Contributors: + * - S-Core Co., Ltd + * + */ + +package org.tizen.emulator.manager.da.widgets.combo; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.widgets.Canvas; +import org.tizen.emulator.manager.resources.ColorResources; +import org.tizen.emulator.manager.resources.FontResources; + +public class TitleComboRenderer extends DACustomComboRenderer { + + @Override + public void draw(GC gc, Canvas canvas, String text, int state) { + Rectangle rect = canvas.getClientArea(); + setColors(state, gc); + gc.fillGradientRectangle(rect.x, rect.y, rect.width, rect.height, true); + gc.setForeground(ColorResources.BLACK.getColor()); + gc.drawRectangle(rect.x, rect.y, rect.width - 20, rect.height - 1); + + if (null == text) { + text = ""; + } + gc.setFont(FontResources.COMBO.getFont()); + Point p = gc.textExtent(text, SWT.DRAW_MNEMONIC); + gc.setForeground(ColorResources.DEVICE_APPLICATION_ENABLE.getColor()); + gc.drawString(text, 5, (rect.height - p.y) / 2, true); + + setColors(state, gc); + gc.fillGradientRectangle(rect.x + rect.width - 20, rect.y, 19, + rect.height - 1, true); + gc.setForeground(ColorResources.BLACK.getColor()); + gc.drawRectangle(rect.x + rect.width - 20, rect.y, 19, rect.height - 1); + } + + @Override + public void drawPattern(GC gc, Canvas canvas, Image patternImage, + String text, int state) { + + } + + @Override + public void drawImage(GC gc, Canvas canvas, Image image, String text, + int state) { + Rectangle rect = canvas.getClientArea(); + gc.drawImage(image, rect.x, rect.y); + Point p = gc.textExtent(text, SWT.DRAW_MNEMONIC); + gc.setFont(FontResources.COMBO.getFont()); + gc.setForeground(ColorResources.DEVICE_APPLICATION_ENABLE.getColor()); + gc.drawString(text, 5, (rect.height - p.y) / 2, true); + Rectangle clipping = new Rectangle(rect.x + rect.width - 19, rect.y, + 19, rect.height); + gc.setClipping(clipping); + gc.drawImage(image, rect.x, rect.y); + } + + private void setColors(int state, GC gc) { + if (state == DACustomCombo.STATE_NORMAL) { + gc.setForeground(ColorResources.GRAY2.getColor()); + gc.setBackground(ColorResources.WINDOW_BG_COLOR.getColor()); + } else if (state == DACustomCombo.STATE_HOVER) { + gc.setForeground(ColorResources.GRAY2.getColor()); + gc.setBackground(ColorResources.ITEM_BLUE_DARK.getColor()); + } else if (state == DACustomCombo.STATE_PUSH) { + gc.setForeground(ColorResources.GRAY2.getColor()); + gc.setBackground(ColorResources.BLUE.getColor()); + } else if (state == DACustomCombo.STATE_DISABLE) { + gc.setForeground(ColorResources.GRAY2.getColor()); + gc.setBackground(ColorResources.GRAY1.getColor()); + } + } + +} diff --git a/src/org/tizen/emulator/manager/image/Skins.java b/src/org/tizen/emulator/manager/image/Skins.java deleted file mode 100644 index d56f3b3..0000000 --- a/src/org/tizen/emulator/manager/image/Skins.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Emulator Manager - * - * Copyright (C) 2011 - 2012 Samsung Electronics Co., Ltd. All rights reserved. - * - * Contact: - * SeokYeon Hwang - * JiHye Kim - * YeongKyoon Lee - * - * 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.image; - -import java.io.File; -import java.io.FileFilter; -import java.io.IOException; -import java.util.ArrayList; -import org.tizen.emulator.manager.logging.EMLogger; - -public class Skins { - private ArrayList skins = null; - private String path = null; - - public Skins(File dir) throws IOException { - if (dir.exists()) { - this.path = dir.getAbsolutePath(); - skins = new ArrayList(); - for (File skin : dir.listFiles(new FileFilter() { - public boolean accept(File pathname) { - if (!pathname.isDirectory()) { - return false; - } - return true; - } - })) { - Skin s = null; - try { - s = new Skin(skin); - } catch(IOException e) { - EMLogger.getLogger().warning("Error while skin information: " + e.getMessage()); - continue; - } - skins.add(s); - } - } else { - throw new IOException("This directory does not exist (" + path + ")"); - } - } - - public String getSkinsPath() { - return path; - } - - public ArrayList getSkinList() { - return skins; - } -} diff --git a/src/org/tizen/emulator/manager/logging/EMLogger.java b/src/org/tizen/emulator/manager/logging/EMLogger.java index 7f78839..560a2a1 100644 --- a/src/org/tizen/emulator/manager/logging/EMLogger.java +++ b/src/org/tizen/emulator/manager/logging/EMLogger.java @@ -40,7 +40,7 @@ import java.util.logging.Level; import java.util.logging.LogRecord; import java.util.logging.Logger; -import org.tizen.emulator.manager.tool.FilePath; +import org.tizen.emulator.manager.resources.FilePath; public class EMLogger { private static EMLogger instance; diff --git a/src/org/tizen/emulator/manager/image/BaseImage.java b/src/org/tizen/emulator/manager/platform/BaseImage.java similarity index 57% rename from src/org/tizen/emulator/manager/image/BaseImage.java rename to src/org/tizen/emulator/manager/platform/BaseImage.java index fcad6bd..11004a8 100644 --- a/src/org/tizen/emulator/manager/image/BaseImage.java +++ b/src/org/tizen/emulator/manager/platform/BaseImage.java @@ -27,32 +27,40 @@ * */ -package org.tizen.emulator.manager.image; +package org.tizen.emulator.manager.platform; import java.io.File; import java.io.FileInputStream; import java.io.IOException; +import java.util.ArrayList; import java.util.Properties; import java.util.logging.Level; import org.tizen.emulator.manager.logging.EMLogger; -import org.tizen.emulator.manager.tool.StringResource; +import org.tizen.emulator.manager.resources.StringResources; +import org.tizen.emulator.manager.vms.VMProperty; public class BaseImage { - private Platform platform; - private String id = "0"; - private String platformName; - private String type; - private String name; - private String imageName; - private String version; - private String release; - - private String domain; - private String cpu; - private String path; + protected Platform platform; + protected String platformName; + protected String type; + + protected String path; + protected String pathName; + + protected String id = "0"; + protected String name; + protected String version; + protected String releaseVersion; + protected String domain; + protected String cpu; + private String information; + protected BaseImage() { + + } + public BaseImage(Platform platform, File path) throws IOException { this.platform = platform; loadProperty(path); @@ -60,24 +68,24 @@ public class BaseImage { } private void loadProperty(File path) throws IOException { - File f = new File(path + File.separator + StringResource.IMAGE_INFO_FILENAME); + File f = new File(path + File.separator + StringResources.IMAGE_INFO_FILENAME); FileInputStream inputStream = null; try { if (f.exists()) { inputStream = new FileInputStream(f); Properties prop = new Properties(); prop.load(inputStream); - platformName = prop.getProperty(StringResource.IMAGE_PLATFORM, platform.getVersion()); - type = prop.getProperty(StringResource.IMAGE_TYPE, "default"); - name = prop.getProperty(StringResource.IMAGE_NAME).toLowerCase(); + platformName = prop.getProperty(StringResources.IMAGE_PLATFORM, platform.getName()); + type = prop.getProperty(StringResources.IMAGE_TYPE, "default"); + name = prop.getProperty(StringResources.IMAGE_NAME).toLowerCase(); if (name == null) { throw new IOException("Image name is null. This image can not add."); } - version = prop.getProperty(StringResource.IMAGE_VERSION, platform.getVersion()); - domain = prop.getProperty(StringResource.PRODUCT_DOMAIN, "Phone"); - cpu = prop.getProperty(StringResource.TARGET_CPU, "x86"); + version = prop.getProperty(StringResources.IMAGE_VERSION, platform.getName()); + releaseVersion = prop.getProperty(StringResources.RELEASE_VERSION, "Not identified"); + domain = prop.getProperty(StringResources.PRODUCT_DOMAIN, "Phone"); + cpu = prop.getProperty(StringResources.TARGET_CPU, "x86"); cpu = cpu.toLowerCase(); - release = prop.getProperty(StringResource.RELEASE_VERSION, "Not identified"); } else { throw new IOException("This file does not exist (" + path + ")"); } @@ -97,7 +105,7 @@ public class BaseImage { for (File f : path.listFiles()) { if (f.isFile() && f.getName().endsWith(cpu.toLowerCase())) { this.path = f.getCanonicalPath(); - this.imageName = f.getName(); + this.pathName = f.getName(); } } if (this.path == null) { @@ -108,35 +116,40 @@ public class BaseImage { void setID(int id) { this.id = Integer.toString(id); // - information = getName() + StringResource.NEW_LINE + - " ID : " + getID() + StringResource.NEW_LINE + - " Platform : " + getPlatformName() + StringResource.NEW_LINE + - " Type : " + getType() + StringResource.NEW_LINE + - " Version : " + getVersion() + StringResource.NEW_LINE + - " Release Version : " + getRelease() + StringResource.NEW_LINE + - " Target CPU : " + getCpu().toUpperCase() + StringResource.NEW_LINE + - " Product Domain : " + getDomain() + StringResource.NEW_LINE + - " Base Disk Image Path : " + getPath() + StringResource.NEW_LINE; + information = getName() + StringResources.NEW_LINE + + " ID : " + getID() + StringResources.NEW_LINE + + " Platform : " + getPlatformName() + StringResources.NEW_LINE + + " Type : " + getType() + StringResources.NEW_LINE + + " Version : " + getVersion() + StringResources.NEW_LINE + + " Release Version : " + getRelease() + StringResources.NEW_LINE + + " Target CPU : " + getCpu() + StringResources.NEW_LINE + + " Product Domain : " + getDomain() + StringResources.NEW_LINE + + " Base Disk Image Path : " + getPath() + StringResources.NEW_LINE; // } - public String getID() { - return id; - } - - public String getVersion() { - return version; - } - public String getPath() { return path; } + public String getPathName() { + return pathName; + } + public String toString() { return information; } + public String getID() { + return id; + } + + // Platform name + public String getVersion() { + return version; + } + public String getCpu() { return cpu; } @@ -146,21 +159,13 @@ public class BaseImage { } public String getRelease() { - return release; - } - - public String getImagePathName() { - return imageName; + return releaseVersion; } public String getName() { return name; } - public String getDirName() { - return name; - } - public String getType() { return type; } @@ -172,4 +177,22 @@ public class BaseImage { public Platform getPlatform() { return platform; } + + protected ArrayList vmsList = new ArrayList(); + + public ArrayList getVmsList() { + return vmsList; + } + + public void addVMsProperty(VMProperty property) { + vmsList.add(property); + } + + public void removeVMsProerty(VMProperty property) { + vmsList.remove(property); + } + + public void clearVMsList() { + vmsList.clear(); + } } diff --git a/src/org/tizen/emulator/manager/platform/CustomBaseImage.java b/src/org/tizen/emulator/manager/platform/CustomBaseImage.java new file mode 100644 index 0000000..f553377 --- /dev/null +++ b/src/org/tizen/emulator/manager/platform/CustomBaseImage.java @@ -0,0 +1,14 @@ +package org.tizen.emulator.manager.platform; + +import java.io.IOException; + +public class CustomBaseImage extends BaseImage { + + public CustomBaseImage(Platform platform, String name, String cpu) throws IOException { + this.platform = platform; + this.platformName = platform.getName(); + + this.name = name; + this.cpu = cpu; + } +} diff --git a/src/org/tizen/emulator/manager/platform/CustomPlatform.java b/src/org/tizen/emulator/manager/platform/CustomPlatform.java new file mode 100644 index 0000000..a3d8696 --- /dev/null +++ b/src/org/tizen/emulator/manager/platform/CustomPlatform.java @@ -0,0 +1,65 @@ +package org.tizen.emulator.manager.platform; + +import java.io.IOException; + +import org.tizen.emulator.manager.EmulatorManager; +import org.tizen.emulator.manager.EmulatorManager.ManagerModeType; +import org.tizen.emulator.manager.vms.VMProperty; + +public class CustomPlatform extends Platform { + + public CustomPlatform() { + this.platformName = "custom"; + this.platformPath = ""; + //this.version = name; + try { + imageList.add(new CustomBaseImage(this, "x86-custom", "x86")); + if (EmulatorManager.getManagerMode() == ManagerModeType.INHOUSE_MODE) { + imageList.add(new CustomBaseImage(this, "arm-custom", "arm")); + } + } catch (IOException e) { + // TODO + } + + } + + public void clearImageList() { + imageList.clear(); + } + + //private boolean isX86 = false; + //private boolean isArm = false; + public void addVMsProperty(VMProperty prop) { + /* + if (prop.getArch() == Architecture.x86) { + if (!isX86) { + try { + imageList.add(new CustomBaseImage(this, "x86-custom", "x86")); + } catch (IOException e) { + // TODO + } + isX86 = true; + } + + } else { + if (!isArm) { + try { + imageList.add(new CustomBaseImage(this, "arm-custom", "arm")); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + isArm = true; + } + } + */ + + for (BaseImage b : getImageList()) { + if (prop.getArch().toString().equals(b.getCpu())) { + b.addVMsProperty(prop); + break; + } + } + } + +} diff --git a/src/org/tizen/emulator/manager/image/Platform.java b/src/org/tizen/emulator/manager/platform/Platform.java similarity index 84% rename from src/org/tizen/emulator/manager/image/Platform.java rename to src/org/tizen/emulator/manager/platform/Platform.java index d252a1e..573be5d 100644 --- a/src/org/tizen/emulator/manager/image/Platform.java +++ b/src/org/tizen/emulator/manager/platform/Platform.java @@ -1,7 +1,7 @@ /* * Emulator Manager * - * Copyright (C) 2011 - 2012 Samsung Electronics Co., Ltd. All rights reserved. + * Copyright (C) 2011 - 2013 Samsung Electronics Co., Ltd. All rights reserved. * * Contact: * SeokYeon Hwang @@ -27,20 +27,20 @@ * */ -package org.tizen.emulator.manager.image; +package org.tizen.emulator.manager.platform; import java.io.File; import java.io.IOException; import java.util.ArrayList; import org.tizen.emulator.manager.logging.EMLogger; -import org.tizen.emulator.manager.tool.FilePath; +import org.tizen.emulator.manager.resources.FilePath; public class Platform { - private String platform_name = null; - private String platform_path = null; - private String version = null; - private static int id = 1; + protected String platformName = null; + protected String platformPath = null; + //protected String version = null; + protected static int id = 1; // TODO : for skins //private String skins_path = null; @@ -50,13 +50,17 @@ public class Platform { //private String template_path = null; //private ArrayList templateList = new ArrayList(); - private ArrayList imageList = new ArrayList(); + protected ArrayList imageList = new ArrayList(); + + protected Platform() { + + } public Platform(String name) { - this.platform_name = name; - this.platform_path = FilePath.getInstance().getPlatformsPath() - + File.separator + platform_name; - this.version = name; + this.platformName = name; + this.platformPath = FilePath.getInstance().getPlatformsPath() + + File.separator + platformName; + //this.version = name; //loadSkins(); //loadTemplate(); @@ -64,6 +68,91 @@ public class Platform { //versionCheck(); } + private void loadProperties() { + if (platformPath == null) { + return; + } + File dir = new File(platformPath); + if (!dir.isDirectory()) { + // TODO + EMLogger.getLogger().info("This path is not directory." + platformPath); + return; + } + + File defaultImages = new File(platformPath + FilePath.getInstance().getDefaultImagePath()); + File addonsImages = new File(platformPath + FilePath.getInstance().getAddonsImagePath()); + + //boolean isDuplicate = false; + if(defaultImages.exists() && defaultImages.isDirectory()) { + BaseImage image; + for (File f : defaultImages.listFiles()) { + if (f.isDirectory()) { + try { + image = new BaseImage(this, f); + for (BaseImage i : imageList) { + if (i.getName().equals(image.getName())){ + // TODO: duplicate name + EMLogger.getLogger().warning("The same name of the base disk image already exist.(name : " + image.getName() + " )"); + throw new IOException(); + } + } + imageList.add(image); + } catch (IOException e) { + EMLogger.getLogger().warning("Failed adding base image..\n" + "Base Disk Image Path: " + f.getAbsolutePath()); + } + } + } + } + + if (addonsImages.exists() && addonsImages.isDirectory()) { + BaseImage image; + for (File f : addonsImages.listFiles()) { + if (f.isDirectory()) { + try { + image = new BaseImage(this, f); + for (BaseImage i : imageList) { + if (i.getName().equals(image.getName())){ + // TODO: duplicate name + EMLogger.getLogger().warning("The same name of the base disk image already exist.(name : " + image.getName() + " )"); + throw new IOException(); + } + } + imageList.add(image); + } catch (IOException e) { + EMLogger.getLogger().warning("Failed adding base image..\n" + "Base Disk Image Path: " + f.getAbsolutePath()); + } + } + } + } + + // set image id + for (BaseImage i : imageList) { + if (i.getCpu().equals("x86")) { + i.setID(id++); + break; + } + } + for (BaseImage i : imageList) { + if (!i.getID().equals("1")) { + i.setID(id++); + } + } + } + + public ArrayList getImageList() { + return imageList; + } + + public String getName() { + return platformName; + } + + public void clearVMs() { + for (BaseImage base : imageList) { + base.clearVMsList(); + } + } + /* private void loadTemplate() { // Common Template Path @@ -142,83 +231,11 @@ public class Platform { } */ - private void loadProperties() { - File dir = new File(platform_path); - if (!dir.isDirectory()) { - // TODO - EMLogger.getLogger().info("This path is not directory." + platform_path); - return; - } - - File defaultImages = new File(platform_path + FilePath.getInstance().getDefaultImagePath()); - File addonsImages = new File(platform_path + FilePath.getInstance().getAddonsImagePath()); - - //boolean isDuplicate = false; - if(defaultImages.exists() && defaultImages.isDirectory()) { - BaseImage image; - for (File f : defaultImages.listFiles()) { - if (f.isDirectory()) { - try { - image = new BaseImage(this, f); - for (BaseImage i : imageList) { - if (i.getName().equals(image.getName())){ - // TODO: duplicate name - EMLogger.getLogger().warning("The same name of the base disk image already exist.(name : " + image.getName() + " )"); - throw new IOException(); - } - } - imageList.add(image); - } catch (IOException e) { - EMLogger.getLogger().warning("Failed adding base image..\n" + "Base Disk Image Path: " + f.getAbsolutePath()); - } - } - } - } - - if (addonsImages.exists() && addonsImages.isDirectory()) { - BaseImage image; - for (File f : addonsImages.listFiles()) { - if (f.isDirectory()) { - try { - image = new BaseImage(this, f); - for (BaseImage i : imageList) { - if (i.getName().equals(image.getName())){ - // TODO: duplicate name - EMLogger.getLogger().warning("The same name of the base disk image already exist.(name : " + image.getName() + " )"); - throw new IOException(); - } - } - imageList.add(image); - } catch (IOException e) { - EMLogger.getLogger().warning("Failed adding base image..\n" + "Base Disk Image Path: " + f.getAbsolutePath()); - } - } - } - } - - // set image id - for (BaseImage i : imageList) { - if (i.getCpu().equals("x86")) { - i.setID(id++); - break; - } - } - for (BaseImage i : imageList) { - if (!i.getID().equals("1")) { - i.setID(id++); - } - } - } - - - public ArrayList getImageList() { - return imageList; - } - +/* public String getVersion() { return version; } - +*/ // TODO /* public Skins getSkin() { diff --git a/src/org/tizen/emulator/manager/image/Skin.java b/src/org/tizen/emulator/manager/platform/Skin.java similarity index 68% rename from src/org/tizen/emulator/manager/image/Skin.java rename to src/org/tizen/emulator/manager/platform/Skin.java index 559a8d2..3f67351 100644 --- a/src/org/tizen/emulator/manager/image/Skin.java +++ b/src/org/tizen/emulator/manager/platform/Skin.java @@ -27,7 +27,7 @@ * */ -package org.tizen.emulator.manager.image; +package org.tizen.emulator.manager.platform; import java.io.File; import java.io.FileInputStream; @@ -36,41 +36,53 @@ import java.util.Properties; import java.util.logging.Level; import org.tizen.emulator.manager.logging.EMLogger; -import org.tizen.emulator.manager.tool.StringResource; +import org.tizen.emulator.manager.resources.StringResources; import org.tizen.emulator.manager.vms.RESOLUTION; +import org.tizen.emulator.manager.vms.SKIN_TYPE; public class Skin { private String name; - private String type; - private String resolution; + private RESOLUTION resolution = null; private String path; + private SKIN_TYPE type; + public Skin(File path) throws IOException { loadProperty(path); - for (RESOLUTION r : RESOLUTION.values()) { - if(r.getValue().equals(resolution)) { - this.type = r.getType(); - } - } } private void loadProperty(File path) throws IOException { this.path = path.getCanonicalPath(); - File f = new File(path + File.separator + StringResource.SKIN_INFO_FILENAME); + File f = new File(path + File.separator + StringResources.SKIN_INFO_FILENAME); FileInputStream inputStream = null; try { if (f.exists()) { inputStream = new FileInputStream(f); Properties prop = new Properties(); prop.load(inputStream); - name = prop.getProperty(StringResource.SKIN_NAME); - String width = prop.getProperty(StringResource.SKIN_WIDTH); - String height = prop.getProperty(StringResource.SKIN_HEIGHT); + name = prop.getProperty(StringResources.SKIN_NAME); + String width = prop.getProperty(StringResources.SKIN_WIDTH); + String height = prop.getProperty(StringResources.SKIN_HEIGHT); - if(width.equals(StringResource.SKIN_GENERAL) && height.equals(StringResource.SKIN_GENERAL)) { - resolution = StringResource.SKIN_GENERAL; + String re = ""; + if(width.equals(StringResources.SKIN_GENERAL) && height.equals(StringResources.SKIN_GENERAL)) { + type = SKIN_TYPE.GENERAL; } else { - resolution = width + "x" + height; + type = SKIN_TYPE.PHONE_SHAPE; + re = width + "x" + height; } + + if (type == SKIN_TYPE.PHONE_SHAPE) { + for (RESOLUTION r : RESOLUTION.values()) { + if(r.getStrValue().equals(re)) { + this.resolution = r; + } + } + if (this.resolution == null) { + throw new IOException("This resolution is not supported ( + " + + re + ")"); + } + } + } else { throw new IOException("This file does not exist (" + path + ")"); } @@ -94,22 +106,14 @@ public class Skin { this.name = name; } - public String getResolution() { + public RESOLUTION getResolution() { return resolution; } - public void setResolution(String resolution) { + public void setResolution(RESOLUTION resolution) { this.resolution = resolution; } - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - public String getPath() { return path; } @@ -118,10 +122,12 @@ public class Skin { this.path = path; } + @ Override public String toString() { return name; } + @ Override public boolean equals(Object obj) { if (!(obj instanceof Skin)) { return false; @@ -134,4 +140,7 @@ public class Skin { return false; } + public SKIN_TYPE getType() { + return type; + } } diff --git a/src/org/tizen/emulator/manager/image/SkinList.java b/src/org/tizen/emulator/manager/platform/SkinList.java similarity index 70% rename from src/org/tizen/emulator/manager/image/SkinList.java rename to src/org/tizen/emulator/manager/platform/SkinList.java index c17d06f..59f9589 100644 --- a/src/org/tizen/emulator/manager/image/SkinList.java +++ b/src/org/tizen/emulator/manager/platform/SkinList.java @@ -27,18 +27,19 @@ * */ -package org.tizen.emulator.manager.image; +package org.tizen.emulator.manager.platform; import java.io.File; +import java.io.FileFilter; import java.io.IOException; import java.util.ArrayList; import org.tizen.emulator.manager.logging.EMLogger; -import org.tizen.emulator.manager.tool.FilePath; -import org.tizen.emulator.manager.tool.StringResource; +import org.tizen.emulator.manager.resources.FilePath; +import org.tizen.emulator.manager.vms.RESOLUTION; +import org.tizen.emulator.manager.vms.SKIN_TYPE; public class SkinList { - private ArrayList skinsList = new ArrayList(); private ArrayList skinList = new ArrayList(); //private Skins defaultSkin = null; @@ -53,31 +54,46 @@ public class SkinList { private SkinList() { try { - skinsList.add(new Skins(new File(FilePath.getInstance().getSkinPath()))); + makeSkinList(new File(FilePath.getInstance().getSkinPath())); //defaultSkin = skinsList.get(0); } catch (IOException e) { EMLogger.getLogger().warning(e.getMessage()); } + /* try { - skinsList.add(new Skins(new File(FilePath.getInstance().getDataSkinPath()))); + makeSkinList(new File(FilePath.getInstance().getDataSkinPath())); } catch (IOException e) { EMLogger.getLogger().warning(e.getMessage()); } + */ - for (Skins skins : skinsList) { - for (Skin s : skins.getSkinList()) { - if (!skinList.contains(s)) { - skinList.add(s); + } + + private void makeSkinList(File dir) throws IOException { + if (dir.exists()) { + for (File skin : dir.listFiles(new FileFilter() { + public boolean accept(File pathname) { + if (!pathname.isDirectory()) { + return false; + } + return true; } + })) { + Skin s = null; + try { + s = new Skin(skin); + } catch(IOException e) { + EMLogger.getLogger().warning("Error while skin information: " + e.getMessage()); + continue; + } + skinList.add(s); } + } else { + throw new IOException("This directory does not exist (" + dir.getPath() + ")"); } } - public ArrayList getSkinsList() { - return skinsList; - } - public ArrayList getSkinList() { return skinList; } @@ -105,15 +121,16 @@ public class SkinList { } private ArrayList returnSkins = new ArrayList(); - public ArrayList findSkinList(String resolution) { + public ArrayList findSkinList(RESOLUTION resolution) { boolean isGeneral = false; returnSkins.clear(); if (skinList != null) { for (Skin skin : skinList) { - if (skin.getResolution().equals(resolution)) { - returnSkins.add(skin); - } - if (skin.getResolution().equals(StringResource.SKIN_GENERAL)) { + if (skin.getType() == SKIN_TYPE.PHONE_SHAPE) { + if (skin.getResolution().equals(resolution)) { + returnSkins.add(skin); + } + } else { if (!isGeneral) { returnSkins.add(0, skin); isGeneral = true; @@ -130,7 +147,7 @@ public class SkinList { returnSkins.clear(); if (skinList != null) { for (Skin skin : skinList) { - if (skin.getResolution().equals(StringResource.SKIN_GENERAL)) { + if (skin.getType() == SKIN_TYPE.GENERAL) { returnSkins.add(skin); } } @@ -147,3 +164,4 @@ public class SkinList { } */ } + diff --git a/src/org/tizen/emulator/manager/resources/ColorResources.java b/src/org/tizen/emulator/manager/resources/ColorResources.java new file mode 100644 index 0000000..44c79e4 --- /dev/null +++ b/src/org/tizen/emulator/manager/resources/ColorResources.java @@ -0,0 +1,195 @@ +/* + * Dynamic Analyzer + * + * Copyright(c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * Jooyoul Lee + * Juyoung Kim + * + * Licensed under the Apache License, Version 2.0(the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Contributors: + * - S-Core Co., Ltd + * + */ + +package org.tizen.emulator.manager.resources; + +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.RGB; + +public enum ColorResources { + WHITE("white", null), + BLACK("black", null), + BLUE("blue", null), + RED("red", null), + YELLOW("yellow", null), + PURPLE("purple", null), + + GREEN("green", null), + BROWN("brown", null), + NAVY("navy", null), + DARKVIOLET("darkviolet", null), + MAROON("maroon", null), + TEAL("teal", null), + INDIGO("indigo", null), + DARKGOLDENROD("darkgoldenrod", null), + CHOCOLATE("chocolate", null), + MAGNETA("magneta", null), + + GOLDENROD("goldenrod", null), + TURQUOISE("turquoise", null), + VIOLET("violet", null), + SLATEBLUE("slateblue", null), + ORANGE("orange", null), + YELLOWGREEN("yellowgreen", null), + SKYBLUE("skyblue", null), + ORCHID("orchid", null), + SANDYBROWN("sandybrown", null), + MEDIUMPURPLE("mediumpurple", null), + GRAY1("gray1", null), + GRAY2("gray2", null), + GRAY3("gray3", null), + + // shell window background color + WINDOW_BG_COLOR("window_bg_color", null), + + DIALOG_BG_UPPER("dialg_bg_upper", null), + DIALOG_BG_LOWER("dialg_bg_lower", null), + DIALOG_SUNKEN_1("dialg_sunken_1", null), + DIALOG_SUNKEN_2("dialg_sunken_2", null), + + EDIT_CHART_DIALOG_UPPER("edit_chart_dialog_upper", null), + EDIT_CHART_DIALOG_LOWER("edit_chart_dialog_lower", null), + + VIEW_BORDER("view_border", null), + VIEW_BG_COLOR("view_bg_color", null), + VIEW_TITLE_FONT_COLOR("view_title_font_color", null), + + /** title bar colors **/ + TITLEBAR_TEXT_COLOR("titlebar_text_color", null), + TITLEBAR_BG_COLOR("titlebar_bg", null), + TITLEBAR_START_COLOR("titlebar_start_color", null), + TITLEBAR_END_COLOR("titlebar_end_color", null), + TITLEBAR_BOTTOM_STROKE_1("titlebar_bottom_stroke_1", null), + TITLEBAR_BOTTOM_STROKE_2("titlebar_bottom_stroke_2", null), + + /** Coolbar bg color **/ + COOLBAR_BG_COLOR("coolbar_bg_color", null), + DEFAULT_FONT_COLOR("default_font_color", null), + + /** device and application combo specific colors start **/ + DEVICE_APPLICATION_ENABLE("device_application_enable_font", null), + DEVICE_APPLICATION_DISABLE("device_application_disable", null), + DEVICE_APPLICATION_POPUP_OUTER_1("device_application_popup_outer_1", null), + DEVICE_APPLICATION_POPUP_OUTER_2("device_application_popup_outer_2", null), + DEVICE_APPLICATION_DROPDOWN_TEXT("device_application_enable_font", null), + DEVICE_APPLICATION_ITEM_NORMAL_TOP("device_application_item_normal_top", null), + DEVICE_APPLICATION_ITEM_NORMAL_INNER("device_application_item_normal_inner", null), + DEVICE_APPLICATION_ITEM_NORMAL_BOTTOM("device_application_item_normal_bottom", null), + DEVICE_APPLICATION_ITEM_SELECT_TOP("device_application_item_select_top", new RGB(76, 76, 77)), + DEVICE_APPLICATION_ITEM_SELECT_INNER("device_application_item_select_inner", null), + DEVICE_APPLICATION_ITEM_SELECT_BOTTOM("device_application_item_select_bottom", null), + + /*** combo button color ***/ + DEVICE_APPLICATION_BUTTON_NORMAL_START("device_application_button_normal_start", null), + DEVICE_APPLICATION_BUTTON_NORMAL_END("device_application_button_normal_end", null), + DEVICE_APPLICATION_BUTTON_PUSH_START("device_application_button_push_start", null), + DEVICE_APPLICATION_BUTTON_PUSH_END("device_application_button_push_end", null), + DEVICE_APPLICATION_BUTTON_HOVER_START("device_application_button_hover_start", null), + DEVICE_APPLICATION_BUTTON_HOVER_END("device_application_button_hover_end", null), + DEVICE_APPLICATION_BUTTON_DISABLE_START("device_application_button_disable_start", null), + DEVICE_APPLICATION_BUTTON_DISABLE_END("device_application_button_disable_end", null), + DEVICE_APPLICATION_BUTTON_OUTLINE("device_application_button_outline", null), + + /*** common button colors ***/ + BUTTON_NORMAL_FONT_COLOR("button_normal_font_color", null), + BUTTON_PUSH_FONT_COLOR("button_push_font_color", null), + BUTTON_HOVER_FONT_COLOR("button_hover_font_color", null), + BUTTON_DISABLE_FONT_COLOR("button_disable_font_color", null), + + /** normal view layout colors start **/ + NORMAL_VIEW_LAYOUT_OUTER("normal_view_layout_outer", null), + NORMAL_VIEW_LAYOUT_MIDDLE("normal_view_layout_middle", null), + NORMAL_VIEW_LAYOUT_INNER("normal_view_layout_inner", null), + /** normal view layout colors end **/ + + /** tab widget colors start **/ + TAB_SELECTED_FONT_COLOR("tab_selected_font_color", null), + TAB_NORMAL_FONT_COLOR("tab_normal_font_color", null), + TAB_HOVER_FONT_COLOR("tab_hover_font_color", null), + TAB_PUSH_FONT_COLOR("tab_push_font_color", null), + + TAB_BG_COLOR("tab_bg_color", null), + TAB_CONTENTS_BG_COLOR("tab_contents_bg_color", null), + /** tab widget colors end **/ + + /** list view colors start **/ + LIST_BG_COLOR("list_bg_color", null), + VM_BUTTON_FONT_COLOR("vm_button_font_color", null), + /** list view colors end **/ + + /** detail view colors start **/ + DETAIL_VIEW_PAGE_COLOR("detail_view_page_color", null), + DETAIL_TOP_FONT_COLOR("detail_top_font_color", null), + DETAIL_TITILE_FONT_COLOR("detail_title_font_color", null), + DETAIL_ENABLE_FONT_COLOR("detail_enable_font_color", null), + DETAIL_DISABLE_FONT_COLOR("detail_disable_font_color", null), + DETAIL_CATEGORY_FONT_COLOR("detail_category_font_color", null), + DETAIL_TOP_COLOR("detail_top_color", null), + DETAIL_MIDDLE_COLOR("detail_middle_color", null), + DETAIL_INPUT_BOX_COLOR("detail_input_box_color", null), + /** detail view colors end **/ + + TOOLTIP("tooltip", null), + + /** status bar **/ + STATUS_BAR_COLOR("status_bar_color", null), + STATUS_BAR_FONT_COLOR("status_bar_font_color", null), + + ITEM_BLUE_RIGHT("item_blue_right", null), + ITEM_BLUE_DARK("item_blue_dark", null); + + String name; + Color color; + RGB rgb; + + ColorResources(String name, RGB rgb) { + this.name = name; + this.rgb = rgb; + } + + public Color getColor() { + if (this.color == null) { + if (rgb != null) { + this.color = DAThemeWhite.getInstance().getColor(name, rgb); + } else { + this.color = DAThemeWhite.getInstance().getColor(name); + } + } + return color; + } + + @Override + public String toString() { + return name; + } + + public static void dispose() { + for (ColorResources c : ColorResources.values()) { + c.color = null; + } + // TODO + } +} diff --git a/src/org/tizen/emulator/manager/resources/DATheme.java b/src/org/tizen/emulator/manager/resources/DATheme.java new file mode 100644 index 0000000..4d15cc7 --- /dev/null +++ b/src/org/tizen/emulator/manager/resources/DATheme.java @@ -0,0 +1,152 @@ +/* + * Dynamic Analyzer + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * Jooyoul Lee + * Juyoung Kim + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Contributors: + * - S-Core Co., Ltd + * + */ + +package org.tizen.emulator.manager.resources; + +import java.io.File; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; + +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.RGB; +import org.eclipse.swt.widgets.Display; + +class ColorRegistry { + private Map stringToColor = new HashMap(7); + private Map stringToRGB = new HashMap(7); + private Display display = null; + private final boolean cleanOnDisplayDisposal = true; + + public ColorRegistry() { + this.display = Display.getCurrent(); + } + + private Color createColor(RGB rgb) { + if (this.display == null) { + Display display = Display.getCurrent(); + if (display == null) { + throw new IllegalStateException(); + } + this.display = display; + if (cleanOnDisplayDisposal) { + hookDisplayDispose(); + } + } + return new Color(display, rgb); + } + + private void disposeColors(Iterator iterator) { + while (iterator.hasNext()) { + Color next = iterator.next(); + next.dispose(); + } + } + + public Color get(String symbolicName) { + + assert symbolicName == null; + + Color result = stringToColor.get(symbolicName); + if (result != null) { + return (Color) result; + } + + Color color = null; + + RGB rgb = stringToRGB.get(symbolicName); + if (rgb == null) { + return null; + } + + color = createColor(rgb); + + stringToColor.put(symbolicName, color); + + return color; + } + + public boolean hasValueFor(String colorKey) { + return stringToRGB.containsKey(colorKey); + } + + private void hookDisplayDispose() { + display.disposeExec(displayRunnable); + } + + public void put(String symbolicName, RGB colorData) { + + assert symbolicName == null; + assert colorData == null; + + RGB existing = (RGB) stringToRGB.get(symbolicName); + if (colorData.equals(existing)) { + return; + } + + stringToRGB.put(symbolicName, colorData); + } + + protected Runnable displayRunnable = new Runnable() { + public void run() { + clearCaches(); + } + }; + + protected void clearCaches() { + disposeColors(stringToColor.values().iterator()); + stringToColor.clear(); + display = null; + } +} + +public abstract class DATheme { + protected String name = "black";//$NON-NLS-1$ + protected static ColorRegistry colorRegistry = new ColorRegistry(); + + public DATheme() { + setColor("white", new RGB(255, 255, 255)); //$NON-NLS-1$ + setColor("black", new RGB(0, 0, 0)); //$NON-NLS-1$ + setColor("blue", new RGB(0, 0, 255)); //$NON-NLS-1$ + setColor("red", new RGB(255, 0, 0)); //$NON-NLS-1$ + setColor("purple", new RGB(226, 101, 225)); //$NON-NLS-1$ + } + + public abstract Color getColor(String colorName, RGB rgb); + + public abstract Color getColor(String colorName); + + public abstract void setColor(String colorName, RGB rgb); + + public String getThemePath() { + return "theme" + File.separator + name + File.separator;//$NON-NLS-1$ + } + + public String getImagePath() { + String path = getThemePath() + "img" + File.separator;//$NON-NLS-1$ + return path; + } +} diff --git a/src/org/tizen/emulator/manager/resources/DAThemeWhite.java b/src/org/tizen/emulator/manager/resources/DAThemeWhite.java new file mode 100644 index 0000000..005752e --- /dev/null +++ b/src/org/tizen/emulator/manager/resources/DAThemeWhite.java @@ -0,0 +1,186 @@ +/* + * Dynamic Analyzer + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * Jooyoul Lee + * Juyoung Kim + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Contributors: + * - S-Core Co., Ltd + * + */ + +package org.tizen.emulator.manager.resources; + +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.RGB; + +public class DAThemeWhite extends DATheme { + private static DAThemeWhite instance; + + public static DAThemeWhite getInstance() { + if (instance == null) { + instance = new DAThemeWhite(); + } + return instance; + } + + DAThemeWhite() { + super(); + name = "white"; + + // defaule + setColor("blue", new RGB(0, 102, 134)); + setColor("green", new RGB(68, 98, 12)); + setColor("yellow", new RGB(255, 210, 10)); + setColor("purple", new RGB(139, 42, 118)); + setColor("brown", new RGB(138, 83, 0)); + setColor("navy", new RGB(57, 66, 161)); + setColor("darkviolet", new RGB(105, 2, 126)); + setColor("maroon", new RGB(126, 41, 2)); + setColor("teal", new RGB(27, 110, 92)); + setColor("indigo", new RGB(80, 26, 146)); + setColor("goldenrod", new RGB(212, 150, 57)); + setColor("turquoise", new RGB(72, 194, 168)); + setColor("violet", new RGB(226, 109, 201)); + setColor("slateblue", new RGB(122, 132, 238)); + setColor("orange", new RGB(236, 107, 47)); + setColor("yellowgreen", new RGB(129, 172, 50)); + setColor("skyblue", new RGB(72, 185, 221)); + setColor("orchid", new RGB(175, 49, 200)); + setColor("sandybrown", new RGB(201, 168, 58)); + setColor("mediumpurple", new RGB(160, 108, 224)); + setColor("chocolate", new RGB(151, 124, 39)); + setColor("magneta", new RGB(155, 20, 184)); + setColor("GRAY1", new RGB(177, 177, 177)); //$NON-NLS-1$ + setColor("GRAY2", new RGB(153, 153, 153)); //$NON-NLS-1$ + setColor("GRAY3", new RGB(216, 216, 216)); //$NON-NLS-1$ + + // shell window background color + setColor("window_bg_color", new RGB(160, 160, 160)); //$NON-NLS-1$ + setColor("dialg_bg_upper", new RGB(206, 206, 206)); + setColor("dialg_bg_lower", new RGB(240, 240, 240)); + setColor("dialg_sunken_1", new RGB(160, 160, 160)); + setColor("dialg_sunken_2", new RGB(255, 255, 255)); + setColor("edit_chart_dialog_upper", new RGB(255, 255, 255)); + setColor("edit_chart_dialog_lower", new RGB(240, 240, 240)); + + setColor("view_border", new RGB(206, 206, 206)); //$NON-NLS-1$ + setColor("view_bg_color", new RGB(230, 230, 230)); //$NON-NLS-1$ + getColor("view_title_font_color", new RGB(0, 0, 0)); + + setColor("coolbar_bg_color", new RGB(228, 228, 228)); //$NON-NLS-1$ + setColor("default_font_color", new RGB(0, 0, 0));//$NON-NLS-1$ + + /** title bar colors **/ + setColor("titlebar_text_color", new RGB(64, 208, 255)); //$NON-NLS-1$ + setColor("titlebar_bg", new RGB(78, 79, 81)); //$NON-NLS-1$ + setColor("titlebar_start_color", new RGB(240, 240, 240)); //$NON-NLS-1$ + setColor("titlebar_end_color", new RGB(165, 165, 165)); //$NON-NLS-1$ + setColor("titlebar_bottom_stroke_1", new RGB(115, 115, 115)); + setColor("titlebar_bottom_stroke_2", new RGB(160, 160, 160)); + + /** device and application combo specific colors start **/ + setColor("device_application_enable_font", new RGB(0, 0, 0)); //$NON-NLS-1$ + setColor("device_application_disable_font", new RGB(160, 160, 160)); //$NON-NLS-1$ + setColor("device_application_popup_outer_1", new RGB(120, 120, 120)); //$NON-NLS-1$ + setColor("device_application_popup_outer_2", new RGB(50, 185, 231)); //$NON-NLS-1$ + setColor("device_application_item_normal_top", new RGB(255, 255, 255)); //$NON-NLS-1$ + setColor("device_application_item_normal_inner", new RGB(230, 230, 230)); //$NON-NLS-1$ + setColor( + "device_application_item_normal_bottom", new RGB(189, 189, 189)); //$NON-NLS-1$ + setColor("device_application_item_select_top", new RGB(255, 255, 255)); //$NON-NLS-1$ + setColor("device_application_item_select_inner", new RGB(50, 185, 231)); //$NON-NLS-1$ + setColor( + "device_application_item_select_bottom", new RGB(189, 189, 189)); //$NON-NLS-1$ + /** device and application combo specific colors end **/ + + /*** combo button gradation ***/ + setColor("device_application_button_normal_start", new RGB(221, 221, 221)); //$NON-NLS-1$ + setColor("device_application_button_normal_end", new RGB(157, 157, 157)); //$NON-NLS-1$ + setColor("device_application_button_push_start", new RGB(24, 147, 189)); //$NON-NLS-1$ + setColor("device_application_button_push_end", new RGB(24, 147, 189)); //$NON-NLS-1$ + setColor("device_application_button_hover_start", new RGB(50, 185, 231)); //$NON-NLS-1$ + setColor("device_application_button_hover_end", new RGB(50, 185, 231)); //$NON-NLS-1$ + setColor("device_application_button_disable_start", new RGB(157, 157, 157)); //$NON-NLS-1$ + setColor("device_application_button_disable_end", new RGB(78, 79, 81)); //$NON-NLS-1$ + setColor("device_application_button_outline", new RGB(31, 31, 31)); + + /*** common button colors ***/ + setColor("button_normal_font_color", new RGB(0, 0, 0)); + setColor("button_push_font_color", new RGB(91, 91, 91)); + setColor("button_hover_font_color", new RGB(91, 91, 91)); + setColor("button_disable_font_color", new RGB(140, 140, 140)); + + /** normal view layout colors start **/ + setColor("normal_view_layout_outer", new RGB(160, 160, 160)); //$NON-NLS-1$ + setColor("normal_view_layout_middle", new RGB(74, 74, 74)); //$NON-NLS-1$ + setColor("normal_view_layout_inner", new RGB(66, 66, 68)); //$NON-NLS-1$ + /** normal view layout colors end **/ + + /** tab widget colors **/ + setColor("tab_selected_font_color", new RGB(48, 48, 48)); + setColor("tab_normal_font_color", new RGB(205, 205, 205)); + setColor("tab_hover_font_color", new RGB(205, 205, 205)); + setColor("tab_push_font_color", new RGB(205, 205, 205)); + + setColor("tab_bg_color", new RGB(55, 55, 55)); + setColor("tab_contents_bg_color", new RGB(209, 209, 209)); + + /** list view colors **/ + setColor("list_bg_color", new RGB(226, 226, 226)); + setColor("vm_button_font_color", new RGB(240, 240, 240)); + /**********************/ + + /** detail view colors **/ + setColor("detail_view_page_color", new RGB(209, 209, 209)); //tab_contents_bg_color + setColor("detail_top_font_color", new RGB(255, 255, 255)); + setColor("detail_title_font_color", new RGB(0, 0, 0)); + setColor("detail_enable_font_color", new RGB(38, 38, 38)); + setColor("detail_disable_font_color", new RGB(153, 153, 153)); + setColor("detail_category_font_color", new RGB(255, 255, 255)); + setColor("detail_top_color", new RGB(0x7F, 0x7F, 0x7F)); + setColor("detail_middle_color", new RGB(0xB6, 0xB6, 0xB6)); + setColor("detail_input_box_color", new RGB(229, 229, 229)); + /************************/ + setColor("tooltip", new RGB(255, 255, 225)); //$NON-NLS-1$ + + /** status bar **/ + setColor("status_bar_color", new RGB(174, 174, 174)); + setColor("status_bar_font_color", new RGB(0, 0, 0)); + + setColor("item_blue_right", new RGB(131, 196, 218)); + setColor("item_blue_dark", new RGB(38, 104, 138)); + } + + public Color getColor(String colorName, RGB rgb) { + if (!colorRegistry.hasValueFor(colorName)) { + colorRegistry.put(colorName, rgb); + } + return colorRegistry.get(colorName); + } + + public void setColor(String colorName, RGB rgb) { + colorRegistry.put(colorName, rgb); + } + + @Override + public Color getColor(String colorName) { + return colorRegistry.get(colorName); + } + +} diff --git a/src/org/tizen/emulator/manager/tool/FilePath.java b/src/org/tizen/emulator/manager/resources/FilePath.java similarity index 91% rename from src/org/tizen/emulator/manager/tool/FilePath.java rename to src/org/tizen/emulator/manager/resources/FilePath.java index 648ac90..1d1d3ea 100644 --- a/src/org/tizen/emulator/manager/tool/FilePath.java +++ b/src/org/tizen/emulator/manager/resources/FilePath.java @@ -28,7 +28,7 @@ * */ -package org.tizen.emulator.manager.tool; +package org.tizen.emulator.manager.resources; import java.io.BufferedReader; import java.io.File; @@ -38,7 +38,7 @@ import java.io.IOException; import java.net.URISyntaxException; import org.tizen.emulator.manager.EmulatorManager; -import org.tizen.emulator.manager.vms.EmulatorVMs; +import org.tizen.emulator.manager.vms.EmulatorVMList; public class FilePath { private final static String bin_suffix = File.separator + "tools" + File.separator + "emulator" + File.separator + "bin"; @@ -59,14 +59,14 @@ public class FilePath { private final static String swap_suffix = File.separator + "swap"; private final static String data_suffix = File.separator +"data"; - private final static String sdkpath_suffix = File.separator + "tizensdkpath"; - private final static String sdkdata_suffix = File.separator + "tizen-sdk-data"; - private final static String win_sdb_exec = File.separator + "sdb.exe"; - private final static String sdb_exec = File.separator + "sdb"; + final static String sdkpath_suffix = File.separator + "tizensdkpath"; + final static String sdkdata_suffix = File.separator + "tizen-sdk-data"; + final static String win_sdb_exec = File.separator + "sdb.exe"; + final static String sdb_exec = File.separator + "sdb"; - private final static String storages_suffix = File.separator + "storages"; - private final static String sdcard_suffix = File.separator + "sdcard"; - private final static String template_suffix = File.separator + "templates"; + final static String storages_suffix = File.separator + "storages"; + final static String sdcard_suffix = File.separator + "sdcard"; + final static String template_suffix = File.separator + "templates"; private static String currentPath; private static String sdkPath = null; @@ -227,19 +227,19 @@ public class FilePath { skinPath = emulatorPath + skin_suffix; templatePath = emulatorPath + template_suffix; - workspacePath = EmulatorVMs.getInstance().getVMsBaseDirectory(); - vmsPath = EmulatorVMs.getInstance().getVMsConfigDirectory(); + workspacePath = EmulatorVMList.getInstance().getVMsBaseDirectory(); + vmsPath = EmulatorVMList.getInstance().getVMsConfigDirectory(); swapPath = workspacePath + swap_suffix; dataSkinPath = workspacePath + skin_suffix; - EmulatorVMs.makeSDKDataPath(tizenSDKDataPath); + EmulatorVMList.makeSDKDataPath(tizenSDKDataPath); setVMSPath(); //testPrintPath(); } public static void setVMSPath() { - workspacePath = EmulatorVMs.getInstance().getVMsBaseDirectory(); - vmsPath = EmulatorVMs.getInstance().getVMsConfigDirectory(); + workspacePath = EmulatorVMList.getInstance().getVMsBaseDirectory(); + vmsPath = EmulatorVMList.getInstance().getVMsConfigDirectory(); swapPath = workspacePath + swap_suffix; dataSkinPath = workspacePath + skin_suffix; //testPrintPath(); diff --git a/src/org/tizen/emulator/manager/resources/FontResources.java b/src/org/tizen/emulator/manager/resources/FontResources.java new file mode 100644 index 0000000..8cde158 --- /dev/null +++ b/src/org/tizen/emulator/manager/resources/FontResources.java @@ -0,0 +1,169 @@ +/* + * Dynamic Analyzer + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * Jooyoul Lee + * Juyoung Kim + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Contributors: + * - S-Core Co., Ltd + * + */ +package org.tizen.emulator.manager.resources; + +import java.util.HashMap; +import java.util.Map; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Font; +import org.eclipse.swt.graphics.FontData; +import org.eclipse.swt.widgets.Display; +import org.tizen.emulator.manager.EmulatorManager; + +public enum FontResources { + // * Toolbal Layout + // Main Title + TITLEBAR("titlebar", resizeDefaultFont(10)), + // Device Name + COMBO("combo", resizeDefaultFont(9)), + // Application Name + DROPDOWN("dropdown", resizeDefaultFont(9)), + // Timer + TIMER("timer", resizeDefaultFont(12)), + + // * Tab Layout + TAB_BUTTON_FONT("tab_button_font", setDefaultFontStyleAndSize(SWT.BOLD, 9)), + + // * List Layout + VM_BUTTON_TITLE_FONT("vm_button_title_font", setDefaultFontStyleAndSize(SWT.BOLD, 8)), + VM_BUTTON_FONT("vm_button_font", resizeDefaultFont(8)), + + // * Detail Layout + DETAIL_TOP_FONT("detail_top_font", setDefaultFontStyleAndSize(SWT.BOLD, 10)), + DETAIL_TITLE_FONT("detail_title_font", resizeDefaultFont(9)), + DETAIL_LABEL_FONT("datail_label_font", resizeDefaultFont(8)), + + // * Nomal button + BUTTON_FONT("button_font", resizeDefaultFont(9)), + + // * Combo button + COMBO_BUTTON_FONT("combo_button_font", resizeDefaultFont(8)), + + // * About Dlg. + ABOUT_TITLE("about_title", resizeDefaultFont(12)), + ABOUT_TEXT("about_text", resizeDefaultFont(9)), + DIALOG_BUTTON_FONT("dialog_button_font", resizeDefaultFont(10)), + + // * Status bar + STATUS_BAR_FONT("status_bar_font", resizeDefaultFont(9)), + + // * not support + TOOLTIP("tooltip", resizeDefaultFont(9)); + + String name; + Font font; + FontData[] data; + FontResources(String name, FontData[] data) { + this.name = name; + this.data = data; + } + + public Font getFont() { + return getFont(name, data); + } + + public Font getFont(String fontName, FontData[] fontData) { + if (this.font == null) { + this.font = FontRegistry.getFont(name, data); + } + return font; + } + + //private static FontRegistry fontRegistry = new FontRegistry(); + private static Font defaultFont = null; + static { + defaultFont = getDADefaultFont(); + } + + public static FontData[] resizeDefaultFont(int size) { + if (defaultFont == null) { + defaultFont = getDADefaultFont(); + } + FontData[] fontData = defaultFont.getFontData(); + for (int i = 0; i < fontData.length; i++) { + fontData[i].setHeight(size); + } + return fontData; + } + + public static FontData[] setDefaultFontStyle(int style) { + if (defaultFont == null) { + defaultFont = getDADefaultFont(); + } + FontData[] fontData = defaultFont.getFontData(); + for (int i = 0; i < fontData.length; i++) { + fontData[i].setStyle(style); + } + return fontData; + } + + public static FontData[] setDefaultFontStyleAndSize(int style, int size) { + if (defaultFont == null) { + defaultFont = getDADefaultFont(); + } + FontData[] fontData = defaultFont.getFontData(); + for (int i = 0; i < fontData.length; i++) { + fontData[i].setStyle(style); + fontData[i].setHeight(size); + } + return fontData; + } + + public static Font getDADefaultFont() { + String fontName = null; + if (EmulatorManager.isLinux()) { + fontName = "Dejavu Sans"; + } else if (EmulatorManager.isWin()) { + fontName = "Verdana"; + } else { + return Display.getCurrent().getSystemFont(); + } + return FontRegistry.getFont( + "ex_font", new FontData[] { new FontData(fontName, 9, SWT.NORMAL) }); + } +} + +class FontRegistry { + private static Map stringToFontData = null; + static { + if (stringToFontData == null) { + stringToFontData = new HashMap(7); + } + } + + public static Font getFont(String fontName, FontData[] fontData) { + if (stringToFontData == null) { + stringToFontData = new HashMap(7); + } + if (!stringToFontData.containsKey(fontName)) { + stringToFontData.put(fontName, fontData); + } + + return new Font(Display.getCurrent(), fontData); + } + +} diff --git a/src/org/tizen/emulator/manager/resources/ImageResources.java b/src/org/tizen/emulator/manager/resources/ImageResources.java new file mode 100644 index 0000000..3180aa1 --- /dev/null +++ b/src/org/tizen/emulator/manager/resources/ImageResources.java @@ -0,0 +1,242 @@ +/* + * Emulator Manager + * + * Copyright (C) 2011 - 2012 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * MunKyu Im + * SeokYeon Hwang + * JiHye Kim + * YeongKyoon Lee + * + * 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.resources; + +import java.io.InputStream; +import java.util.HashMap; +import java.util.Map; + +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Display; + +enum ImageType { + PNG,GIF; +} + +public enum ImageResources { + // PNG TYPE + CANCEL("cancel", ImageType.PNG), + CONFIRM("confirm", ImageType.PNG), + CREATE("create", ImageType.PNG), + DELETE("delete", ImageType.PNG), + DETAILS("details", ImageType.PNG), + FOLDER("folder", ImageType.PNG), + MODIFY("modify", ImageType.PNG), + REFRESH("refresh", ImageType.PNG), + RESET("reset", ImageType.PNG), + LAUNCH("launch", ImageType.PNG), + CREATEIMAGE("createimage", ImageType.PNG), + ABOUT("about", ImageType.PNG), + CLONE("clone", ImageType.PNG), + ARM("arm", ImageType.PNG), + X86("x86", ImageType.PNG), + ABOUTSDK("aboutSDK", ImageType.PNG), + COMBO_NORMAL("dropdown_normal", ImageType.PNG), + COMBO_HOVER("dropdown_hover", ImageType.PNG), + COMBO_PUSH("dropdown_push", ImageType.PNG), + COMBO_DISABLE("dropdown_disable", ImageType.PNG), + COMBO_DROPDOWN_UP("dropdown_up", ImageType.PNG), + COMBO_DROPDOWN_DOWN("dropdown_down", ImageType.PNG), + + // GIF TYPE + TAB_SELECTED_LEFT("tab_selected_left"), + TAB_SELECTED_MIDDLE("tab_selected_middle"), + TAB_SELECTED_RIGHT("tab_selected_right"), + TAB_UNSELECTED_LEFT("tab_unselected_left"), + TAB_UNSELECTED_MIDDLE("tab_unselected_middle"), + TAB_UNSELECTED_RIGHT("tab_unselected_right"), + TAB_UNSELECTED_LEFT_HOVER("tab_unselected_left_hover"), + TAB_UNSELECTED_MIDDLE_HOVER("tab_unselected_middle_hover"), + TAB_UNSELECTED_RIGHT_HOVER("tab_unselected_right_hover"), + + RESET_ICON_NOMAL("reset_icon_nml"), + RESET_ICON_HOVER("reset_icon_hover"), + RESET_ICON_PUSH("reset_icon_pushed"), + INFO_ICON_NOMAL("info_icon_nml"), + INFO_ICON_HOVER("info_icon_hover"), + INFO_ICON_PUSH("info_icon_pushed"), + + DETAIL_LIST_TOP("detail_list_top"), + DETAIL_LIST_MIDDLE("detail_list_middle"), + DETAIL_LIST_BOTTOM("detail_list_bottom"), + DETAIL_LIST_ITEM("detail_list_item"), + + CREATE_NEW_NOMAL("create_new_nml"), + CREATE_NEW_PUSH("create_new_pushed"), + CREATE_NEW_HOVER("create_new_hover"), + + VM_IMAGE_NOMAL("emulator_list_image_nml"), + VM_IMAGE_HOVER("emulator_list_image_hover"), + VM_IMAGE_CREATE("emulator_list_image_new_ani"), + VM_IMAGE_SELECTED("emulator_list_selected"), + + ADD_NEW_NOMAL("add_new_nml"), + ADD_NEW_HOVER("add_new_hover"), + ADD_NEW_PUSH("add_new_pushed"), + + BUTTON_LAUNCH_NOMAL("button_launch_nml"), + BUTTON_LAUNCH_HOVER("button_launch_hover"), + BUTTON_LAUNCH_PUSH("button_launch_pushed"), + + INPUTBOX_OFF_LEFT("inputbox_off_left"), + INPUTBOX_OFF_MIDDLE("inputbox_off_middle"), + INPUTBOX_OFF_RIGHT("inputbox_off_right"), + INPUTBOX_ON_LEFT("inputbox_on_left"), + INPUTBOX_ON_MIDDLE("inputbox_on_middle"), + INPUTBOX_ON_RIGHT("inputbox_on_right"), + CATEGORYBOX_RIGHT("detail_category_right"), + CATEGORYBOX_MIDDLE("detail_category_middle"), + CATEGORYBOX_LEFT("detail_category_left"), + + MODIFY_BUTTON_HOVER("modify_hover"), + MODIFY_BUTTON_NOMAL("modify_nml"), + MODIFY_BUTTON_PUSH("modify_pushed"), + + CANCEL_BUTTON_HOVER("modify_cancel_hover"), + CANCEL_BUTTON_NOMAL("modify_cancel_nml"), + CANCEL_BUTTON_PUSH("modify_cancel_pushed"), + + BUTTON_FILE_NOMAL("button_file_nml"), + BUTTON_FILE_HOVER("button_file_hover"), + BUTTON_FILE_PUSH("button_file_pushed"), + BUTTON_FILE_DISABLE("button_file_dis"), + + ARROW_DOWN("arrow_down"), + ARROW_UP("arrow_up"), + + ARROW_DROPDOWN("dropdown_arrow"), + + TOGGLE_ON_NOMAL("button_on_nml"), + TOGGLE_ON_HOVER("button_on_hover"), + TOGGLE_ON_PUSH("button_on_pushed"), + + TOGGLE_OFF_NOMAL("button_off_nml"), + TOGGLE_OFF_HOVER("button_off_hover"), + TOGGLE_OFF_PUSH("button_off_pushed"), + + BUTTON_NOMAL_LEFT("button_nml_left"), + BUTTON_NOMAL_MIDDLE("button_nml_middle"), + BUTTON_NOMAL_RIGHT("button_nml_right"), + + BUTTON_HOVER_LEFT("button_hover_left"), + BUTTON_HOVER_MIDDLE("button_hover_middle"), + BUTTON_HOVEr_RIGHT("button_hover_right"); + + String name; + Image image; + ImageType type; + + ImageResources(String name) { + this.name = name; + this.type = ImageType.GIF; + } + + ImageResources(String name, ImageType type) { + this.name = name; + this.type = type; + } + + public Image getImage() { + if (this.image == null) { + switch(this.type) { + case GIF: + this.image = ImageRegistry.getGifImage(name); + break; + case PNG: + this.image = ImageRegistry.getPngImage(name); + } + } + return image; + } + + @Override + public String toString() { + return name; + } + + public static void dispose() { + for (ImageResources r : ImageResources.values()) { + r.image = null; + } + ImageRegistry.dispose(); + } +} + +class ImageRegistry { + //private static final String ID = "org.tizen.dynamicanalyzer"; + private static Map map = new HashMap(); + + public static Image getImage(String key, String folderName, String extension) { + return null; + } + + public static void dispose() { + for (Image i : map.values()) { + i.dispose(); + } + } + + /* + private static DATheme getTheme() { + return AnalyzerManager.getTheme(); + } + + private static Image getImage(String imageName, String extension) { + return getImage(ID, getTheme().getImagePath(), imageName, extension); + } + */ + + public static Image getPngImage(String name) { + Image i = map.get(name); + if (i == null) { + ClassLoader loader = ImageRegistry.class.getClassLoader(); + InputStream is = loader.getResourceAsStream("res/" + name + ".png"); + if (is != null) { + i = new Image(Display.getCurrent(), is); + map.put(name, i); + } + } + return i; + } + + public static Image getGifImage(String name) { + Image i = map.get(name); + if (i == null) { + ClassLoader loader = ImageRegistry.class.getClassLoader(); + InputStream is = loader.getResourceAsStream("res/" + name + ".gif"); + if (is != null) { + i = new Image(Display.getCurrent(), is); + map.put(name, i); + } + } + return i; + } +} diff --git a/src/org/tizen/emulator/manager/resources/PatchImageResources.java b/src/org/tizen/emulator/manager/resources/PatchImageResources.java new file mode 100644 index 0000000..4ccf1e3 --- /dev/null +++ b/src/org/tizen/emulator/manager/resources/PatchImageResources.java @@ -0,0 +1,262 @@ +package org.tizen.emulator.manager.resources; + +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Display; + +public class PatchImageResources { + public static Image getNomalButton(int width) { + Image left = ImageResources.BUTTON_NOMAL_LEFT.getImage(); + Image middle = ImageResources.BUTTON_NOMAL_MIDDLE.getImage(); + Image right = ImageResources.BUTTON_NOMAL_RIGHT.getImage(); + + int height = left.getImageData().height; + Image image = new Image(Display.getCurrent(), width, height); + + GC gc = new GC(image); + gc.fillRectangle(0, 0, width, height); + + gc.drawImage(left, 0, 0); + gc.drawImage(middle, 0, 0, + middle.getImageData().width, middle.getImageData().height, + left.getImageData().width, 0, + width - left.getImageData().width + right.getImageData().width, height); + gc.drawImage(right, width - right.getImageData().width, 0); + return image; + } + + public static Image getHoverButton(int width) { + Image left = ImageResources.BUTTON_HOVER_LEFT.getImage(); + Image middle = ImageResources.BUTTON_HOVER_MIDDLE.getImage(); + Image right = ImageResources.BUTTON_HOVEr_RIGHT.getImage(); + + int height = left.getImageData().height; + Image image = new Image(Display.getCurrent(), width, height); + + GC gc = new GC(image); + gc.fillRectangle(0, 0, width, height); + + gc.drawImage(left, 0, 0); + gc.drawImage(middle, 0, 0, + middle.getImageData().width, middle.getImageData().height, + left.getImageData().width, 0, + width - left.getImageData().width + right.getImageData().width, height); + gc.drawImage(right, width - right.getImageData().width, 0); + return image; + } + + public static Image getCategoryBox(int width) { + Image left = ImageResources.CATEGORYBOX_LEFT.getImage(); + Image middle = ImageResources.CATEGORYBOX_MIDDLE.getImage(); + + int height = middle.getImageData().height; + Image image = new Image(Display.getCurrent(), width, height); + GC gc = new GC(image); + gc.fillRectangle(0, 0, width, height); + + // left + gc.drawImage(left, 0, 0); + + // middle + gc.drawImage(middle, 0, 0, + middle.getImageData().width, middle.getImageData().height, + left.getImageData().width, 0, + width - left.getImageData().width * 2, height); + + // right + gc.drawImage(ImageResources.CATEGORYBOX_RIGHT.getImage(), + width - left.getImageData().width, 0); + + gc.dispose(); + return image; + } + + public static Image getInputBoxON(int width) { + Image left = ImageResources.INPUTBOX_ON_LEFT.getImage(); + Image middle = ImageResources.INPUTBOX_ON_MIDDLE.getImage(); + + int height = middle.getImageData().height; + Image image = new Image(Display.getCurrent(), width, height); + + GC gc = new GC(image); + gc.fillRectangle(0, 0, width, height); + + // left + gc.drawImage(left, 0, 0); + + // middle + gc.drawImage(middle, 0, 0, + middle.getImageData().width, middle.getImageData().height, + left.getImageData().width, 0, + width - left.getImageData().width * 2, height); + + // right + gc.drawImage(ImageResources.INPUTBOX_ON_RIGHT.getImage(), + width - left.getImageData().width, 0); + + gc.dispose(); + return image; + } + + public static Image getInputBoxOff(int width) { + Image left = ImageResources.INPUTBOX_OFF_LEFT.getImage(); + Image middle = ImageResources.INPUTBOX_OFF_MIDDLE.getImage(); + + int height = middle.getImageData().height; + Image image = new Image(Display.getCurrent(), width, height); + + GC gc = new GC(image); + gc.fillRectangle(0, 0, width, height); + + // left + gc.drawImage(left, 0, 0); + + // middle + gc.drawImage(middle, 0, 0, + middle.getImageData().width, middle.getImageData().height, + left.getImageData().width, 0, + width - left.getImageData().width * 2, height); + + // right + gc.drawImage(ImageResources.INPUTBOX_OFF_RIGHT.getImage(), + width - left.getImageData().width, 0); + + gc.dispose(); + return image; + } + + public static Image getSelectTabFolder(int width, int height) { + Image image = new Image(Display.getCurrent(), width, height); + + GC gc = new GC(image); + gc.fillRectangle(0, 0, width, height); + + // left + Image left = ImageResources.TAB_SELECTED_LEFT.getImage(); + gc.drawImage(left, 0, 0); + + // middle + Image middle = ImageResources.TAB_SELECTED_MIDDLE.getImage(); + gc.drawImage(middle, 0, 0, + middle.getImageData().width, middle.getImageData().height, + left.getImageData().width, 0, + width - left.getImageData().width * 2, height); + + // right + gc.drawImage(ImageResources.TAB_SELECTED_RIGHT.getImage(), + width - left.getImageData().width , 0); + + gc.dispose(); + + return image; + } + + public static Image getUnselectedTabFolder(int width, int height) { + + Image left = ImageResources.TAB_UNSELECTED_LEFT.getImage(); + Image middle = ImageResources.TAB_UNSELECTED_MIDDLE.getImage(); + Image right = ImageResources.TAB_UNSELECTED_RIGHT.getImage(); + + int leftWidth = left.getImageData().width; + int rightWidth = right.getImageData().width; + + Image image = new Image(Display.getCurrent(), + width + leftWidth + rightWidth, height); + + GC gc = new GC(image); + gc.fillRectangle(0, 0, image.getImageData().width, image.getImageData().height); + + gc.drawImage(left, 0, 0); + + gc.drawImage(middle, 0, 0, + middle.getImageData().width, middle.getImageData().height, + leftWidth, 0, + width - (leftWidth + rightWidth), height); + + // right + gc.drawImage(right, width - leftWidth , 0); + + gc.dispose(); + + return image; + } + + public static Image getUnselectedTabFolderHover(int width, int height) { + Image left = ImageResources.TAB_UNSELECTED_LEFT_HOVER.getImage(); + Image middle = ImageResources.TAB_UNSELECTED_MIDDLE_HOVER.getImage(); + Image right = ImageResources.TAB_UNSELECTED_RIGHT_HOVER.getImage(); + + int leftWidth = left.getImageData().width; + int rightWidth = right.getImageData().width; + + Image image = new Image(Display.getCurrent(), width, height); + + GC gc = new GC(image); + gc.fillRectangle(0, 0, image.getImageData().width, image.getImageData().height); + + gc.drawImage(left, 0, 0); + + gc.drawImage(middle, 0, 0, + middle.getImageData().width, middle.getImageData().height, + leftWidth, 0, + width - (leftWidth + rightWidth), height); + + // right + gc.drawImage(right, width - leftWidth , 0); + + gc.dispose(); + + return image; + } + + public static Image getDetailListView2(int count) { + Image top = ImageResources.DETAIL_LIST_TOP.getImage(); + Image middle = ImageResources.DETAIL_LIST_MIDDLE.getImage(); + Image bottom = ImageResources.DETAIL_LIST_BOTTOM.getImage(); + + Image image = new Image(Display.getCurrent(), + top.getImageData().width, + top.getImageData().height + middle.getImageData().height * (count-1) + + bottom.getImageData().height); + + GC gc = new GC(image); + gc.fillRectangle(0, 0, image.getImageData().width, image.getImageData().height); + + gc.drawImage(top, 0, 0); + + for (int i = 0; i < (count-1); i++) { + gc.drawImage(middle, 0, + top.getImageData().height + (middle.getImageData().height * i)); + } + + gc.drawImage(bottom, 0, image.getImageData().height - bottom.getImageData().height); + + gc.dispose(); + + return image; + } + + public static Image getDetailListView(int count) { + Image middle = ImageResources.DETAIL_LIST_MIDDLE.getImage(); + Image bottom = ImageResources.DETAIL_LIST_BOTTOM.getImage(); + + Image image = new Image(Display.getCurrent(), + middle.getImageData().width, + middle.getImageData().height * (count-1) + + bottom.getImageData().height); + + GC gc = new GC(image); + gc.fillRectangle(0, 0, image.getImageData().width, image.getImageData().height); + + for (int i = 0; i < (count-1); i++) { + gc.drawImage(middle, 0, + (middle.getImageData().height * i)); + } + + gc.drawImage(bottom, 0, image.getImageData().height - bottom.getImageData().height); + + gc.dispose(); + + return image; + } +} diff --git a/src/org/tizen/emulator/manager/tool/StringResource.java b/src/org/tizen/emulator/manager/resources/StringResources.java similarity index 92% rename from src/org/tizen/emulator/manager/tool/StringResource.java rename to src/org/tizen/emulator/manager/resources/StringResources.java index 6e920f1..9994429 100644 --- a/src/org/tizen/emulator/manager/tool/StringResource.java +++ b/src/org/tizen/emulator/manager/resources/StringResources.java @@ -28,15 +28,15 @@ * */ -package org.tizen.emulator.manager.tool; +package org.tizen.emulator.manager.resources; -public class StringResource { +public class StringResources { // VMsProperty View - public final static String SUPPORTED = "Enabled"; - public final static String NOT_SUPPORTED = "Disabled"; + public final static String SUPPORTED = "ON"; + public final static String NOT_SUPPORTED = "OFF"; public final static String MANUAL_SUPPORT = "Manual support"; - public final static String None = "( None )"; + public final static String None = ""; // key type public final static String ONE_KEY = "1key"; public final static String THREE_KEYS = "3keys"; @@ -58,7 +58,7 @@ public class StringResource { public static final String DELETE = "Delete"; public static final String RESET = "Reset"; public static final String CLONE = "Clone"; - public static final String CREATE_IMAGE = "Create Base Image"; + public static final String CREATE_IMAGE = "Create Image"; // Select Workspace and Dialog public static final String WORKSPACE_NAME = ".tizen-vms-path"; @@ -78,6 +78,7 @@ public class StringResource { public static final String ARM = "ARM"; //About Dialog + public static final String UNDEFINED = "undefined"; public static final String ABOUT_PROP_FILENAME = "about.properties"; public static final String PROP_KEY_VERSION = "version"; public static final String PROP_KEY_BUILD_TIME = "build_time"; @@ -98,7 +99,7 @@ public class StringResource { public static final String SKIN_WIDTH = "resolution.width"; public static final String SKIN_HEIGHT = "resolution.height"; public static final String SKIN_GENERAL = "all"; - + public static final String SKIN_PHONE_SHAPE = "shape"; // SD card public static final String SD_CARD_DIR = "sdcard"; public static final String[] SD_CARD = {"sdcard_ext4_4G.img", "sdcard_ext4_8G.img", "sdcard_ext4_16G.img","sdcard_ext4_32G.img"}; diff --git a/src/org/tizen/emulator/manager/tool/About.java b/src/org/tizen/emulator/manager/tool/About.java index 2c7936a..411f620 100644 --- a/src/org/tizen/emulator/manager/tool/About.java +++ b/src/org/tizen/emulator/manager/tool/About.java @@ -39,7 +39,9 @@ import java.util.Properties; import java.util.logging.Level; import org.tizen.emulator.manager.logging.EMLogger; -import org.tizen.emulator.manager.vms.EmulatorVMs; +import org.tizen.emulator.manager.resources.FilePath; +import org.tizen.emulator.manager.resources.StringResources; +import org.tizen.emulator.manager.vms.EmulatorVMList; public class About { private static About about = null; @@ -67,24 +69,23 @@ public class About { } private About() { - workspace = EmulatorVMs.getInstance().getVMsBaseDirectory(); + workspace = EmulatorVMList.getInstance().getVMsBaseDirectory(); - InputStream in = this.getClass().getClassLoader().getResourceAsStream(StringResource.ABOUT_PROP_FILENAME ); + InputStream in = this.getClass().getClassLoader().getResourceAsStream(StringResources.ABOUT_PROP_FILENAME ); Properties properties = new Properties(); String ver = null; if(in != null) { try { properties.load(in); - //ver = properties.getProperty(StringResource.PROP_KEY_VERSION); - time = properties.getProperty(StringResource.PROP_KEY_BUILD_TIME); - gitVersion = properties.getProperty(StringResource.PROP_KEY_GIT_VERSION); + //ver = properties.getProperty(StringResources.PROP_KEY_VERSION); + time = properties.getProperty(StringResources.PROP_KEY_BUILD_TIME); + gitVersion = properties.getProperty(StringResources.PROP_KEY_GIT_VERSION); } catch (IOException e1) { EMLogger.getLogger().log(Level.SEVERE, e1.getMessage()); } finally { try { in.close(); } catch (IOException e) { - // TODO Auto-generated catch block EMLogger.getLogger().log(Level.SEVERE, e.getMessage()); } } @@ -119,8 +120,8 @@ public class About { //BaseImage image = Platforms.getInstance().getImageList().get(0); //about_version = image.getRelease(); //version = image.getVersion(); - about_version = "undefined"; - version = "standard"; + about_version = StringResources.UNDEFINED; + version = StringResources.UNDEFINED; } else { if (ver.indexOf('(') == -1) { about_version = version = ver; @@ -131,16 +132,16 @@ public class About { about_version = ver.substring(start+1, end); } } - if(time.isEmpty() || time.contains(StringResource.PROP_KEY_BUILD_TIME)) { - time = "undefined"; + if(time.isEmpty() || time.contains(StringResources.PROP_KEY_BUILD_TIME)) { + time = StringResources.UNDEFINED; } - if(gitVersion.isEmpty() || gitVersion.contains(StringResource.PROP_KEY_GIT_VERSION)) { - gitVersion = "undefined"; + if(gitVersion.isEmpty() || gitVersion.contains(StringResources.PROP_KEY_GIT_VERSION)) { + gitVersion = StringResources.UNDEFINED; } if(workspace.isEmpty()) { - workspace = "undefined"; + workspace = StringResources.UNDEFINED; } contents = String.format("%-12s : %s\n%-12s : %s\n%-12s : %s\n%-12s : %s", diff --git a/src/org/tizen/emulator/manager/tool/CheckSDCard.java b/src/org/tizen/emulator/manager/tool/CheckSDCard.java index 1175a1f..06571a0 100644 --- a/src/org/tizen/emulator/manager/tool/CheckSDCard.java +++ b/src/org/tizen/emulator/manager/tool/CheckSDCard.java @@ -38,6 +38,8 @@ import java.nio.channels.FileChannel; import java.util.logging.Level; import org.tizen.emulator.manager.logging.EMLogger; +import org.tizen.emulator.manager.resources.FilePath; +import org.tizen.emulator.manager.resources.StringResources; public class CheckSDCard { private CheckSDCard() { @@ -53,13 +55,13 @@ public class CheckSDCard { File dest = null; File src = null; dest = new File(FilePath.getInstance().getSwapPath() - + File.separator + StringResource.SWAP_IMAGE); + + File.separator + StringResources.SWAP_IMAGE); if (!dest.exists()) { src = new File(FilePath.getInstance().getbaseSwapPath() - + File.separator + StringResource.SWAP_IMAGE); + + File.separator + StringResources.SWAP_IMAGE); if (!src.exists()) { EMLogger.getLogger().log(Level.WARNING, - "Failed to create swap image.!" + StringResource.NEW_LINE + "Failed to create swap image.!" + StringResources.NEW_LINE + "File does not exist :" + src.getPath()); return; } @@ -68,7 +70,8 @@ public class CheckSDCard { dest.createNewFile(); } catch (IOException e1) { EMLogger.getLogger().log(Level.WARNING, - "Failed to create swap image!" + StringResource.NEW_LINE + e1.getMessage()); + "Failed to create swap image!" + StringResources.NEW_LINE + + e1.getMessage()); return; } @@ -85,11 +88,11 @@ public class CheckSDCard { fcin.transferTo(0, size, fcout); } catch (FileNotFoundException e) { EMLogger.getLogger().log(Level.WARNING, "Failed to create SD card image!" - + StringResource.NEW_LINE + e.getMessage()); + + StringResources.NEW_LINE + e.getMessage()); dest.delete(); } catch (IOException e) { EMLogger.getLogger().log(Level.WARNING, "Failed to create SD card image!" - + StringResource.NEW_LINE + e.getMessage()); + + StringResources.NEW_LINE + e.getMessage()); dest.delete(); }finally { try { @@ -114,7 +117,7 @@ public class CheckSDCard { public static void CheckSDCardDir() { File dir = new File(FilePath.getInstance().getTizenWorkspacePath() - + File.separator + StringResource.SD_CARD_DIR); + + File.separator + StringResources.SD_CARD_DIR); if (!dir.exists()) { dir.mkdir(); @@ -122,16 +125,17 @@ public class CheckSDCard { File dest = null; File src = null; - for (String s : StringResource.SD_CARD) { + for (String s : StringResources.SD_CARD) { dest = new File(FilePath.getInstance().getTizenWorkspacePath() - + File.separator + StringResource.SD_CARD_DIR + + File.separator + StringResources.SD_CARD_DIR + File.separator + s); if (!dest.exists()) { src = new File(FilePath.getInstance().getSDCardPath() + File.separator +s); if (!src.exists()) { EMLogger.getLogger().log(Level.WARNING, - "Failed to create SD card image.!" + StringResource.NEW_LINE +"File does not exist :" + src.getPath()); + "Failed to create SD card image.! + StringResources.NEW_LINE" + + "File does not exist :" + src.getPath()); continue; } @@ -139,7 +143,7 @@ public class CheckSDCard { dest.createNewFile(); } catch (IOException e1) { EMLogger.getLogger().log(Level.WARNING, - "Failed to create SD card image!" + StringResource.NEW_LINE + e1.getMessage()); + "Failed to create SD card image!" + StringResources.NEW_LINE + e1.getMessage()); continue; } @@ -155,13 +159,13 @@ public class CheckSDCard { long size = fcin.size(); fcin.transferTo(0, size, fcout); } catch (FileNotFoundException e) { - EMLogger.getLogger().log(Level.WARNING, "Failed to create SD card image!" - + StringResource.NEW_LINE + e.getMessage()); + EMLogger.getLogger().log(Level.WARNING, "Failed to create SD card image!" + + StringResources.NEW_LINE + e.getMessage()); dest.delete(); continue; } catch (IOException e) { - EMLogger.getLogger().log(Level.WARNING, "Failed to create SD card image!" - + StringResource.NEW_LINE + e.getMessage()); + EMLogger.getLogger().log(Level.WARNING, "Failed to create SD card image!" + + StringResources.NEW_LINE + e.getMessage()); dest.delete(); continue; }finally { diff --git a/src/org/tizen/emulator/manager/tool/CheckVirtualization.java b/src/org/tizen/emulator/manager/tool/CheckVirtualization.java index 3b3c320..3aebbd5 100644 --- a/src/org/tizen/emulator/manager/tool/CheckVirtualization.java +++ b/src/org/tizen/emulator/manager/tool/CheckVirtualization.java @@ -42,6 +42,8 @@ import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Shell; import org.tizen.emulator.manager.logging.EMLogger; +import org.tizen.emulator.manager.resources.FilePath; +import org.tizen.emulator.manager.resources.StringResources; public class CheckVirtualization { private static CheckVirtualization instance = new CheckVirtualization(); @@ -194,7 +196,7 @@ public class CheckVirtualization { process = pb.start(); process.waitFor(); exitValue = process.exitValue(); - EMLogger.getLogger().log(Level.WARNING, "'check-gl's exit value : " + exitValue); + EMLogger.getLogger().log(Level.INFO, "'check-gl's exit value : " + exitValue); } catch (IOException e) { EMLogger.getLogger().log(Level.WARNING, "IOException" + e.getMessage()); } catch (InterruptedException e) { @@ -224,7 +226,7 @@ class CheckDialog { Label label = new Label(dialog, SWT.NONE); label.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, true)); - label.setText("Please wait !!\nCheck whether virtualization is supported."); + label.setText("Please wait !!" + StringResources.NEW_LINE + "Check whether virtualization is supported."); } public void open() { @@ -234,4 +236,4 @@ class CheckDialog { public void close() { dialog.close(); } -} +} \ No newline at end of file diff --git a/src/org/tizen/emulator/manager/tool/SelectTemplate.java b/src/org/tizen/emulator/manager/tool/SelectTemplate.java index 1697dec..2b4b79f 100644 --- a/src/org/tizen/emulator/manager/tool/SelectTemplate.java +++ b/src/org/tizen/emulator/manager/tool/SelectTemplate.java @@ -40,13 +40,14 @@ import javax.xml.bind.Unmarshaller; import javax.xml.transform.stream.StreamSource; import org.tizen.emulator.manager.logging.EMLogger; -import org.tizen.emulator.manager.vms.VMsProperty; +import org.tizen.emulator.manager.resources.FilePath; +import org.tizen.emulator.manager.vms.VMProperty; import org.tizen.emulator.manager.vms.xml.EmulatorConfiguration; // TOOD public class SelectTemplate { - private VMsProperty defaultTemplate = null; - private ArrayList templateList; + private VMProperty defaultTemplate = null; + private ArrayList templateList; private static SelectTemplate instance = null; static { @@ -61,7 +62,7 @@ public class SelectTemplate { // Common Template Path File dir = new File(FilePath.getInstance().getTemplatePath()); if (dir.exists()) { - templateList = new ArrayList(); + templateList = new ArrayList(); for (File config : dir.listFiles(new FileFilter() { public boolean accept(File pathname) { if (!pathname.isFile()) { @@ -72,7 +73,7 @@ public class SelectTemplate { return true; } })) { - VMsProperty property = parseXML(config); + VMProperty property = parseXML(config); if (property != null) { templateList.add(property); } @@ -87,7 +88,7 @@ public class SelectTemplate { } } - private VMsProperty parseXML(File configFile) { + private VMProperty parseXML(File configFile) { JAXBContext context = null; JAXBElement element = null; @@ -103,14 +104,14 @@ public class SelectTemplate { return null; } - return new VMsProperty(configFile, element.getValue()); + return new VMProperty(configFile, element.getValue()); } - public VMsProperty getDefaultTemplate() { + public VMProperty getDefaultTemplate() { return defaultTemplate; } - public void setDefaultTemplate(VMsProperty defaultTemplate) { + public void setDefaultTemplate(VMProperty defaultTemplate) { this.defaultTemplate = defaultTemplate; } } diff --git a/src/org/tizen/emulator/manager/tool/SelectWorkspace.java b/src/org/tizen/emulator/manager/tool/SelectWorkspace.java index 35fff3b..6e07c02 100644 --- a/src/org/tizen/emulator/manager/tool/SelectWorkspace.java +++ b/src/org/tizen/emulator/manager/tool/SelectWorkspace.java @@ -50,9 +50,10 @@ import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; import org.tizen.emulator.manager.EmulatorManager; import org.tizen.emulator.manager.logging.EMLogger; -import org.tizen.emulator.manager.ui.MessageDialog; -import org.tizen.emulator.manager.ui.SelectWorkspaceDialog; -import org.tizen.emulator.manager.vms.EmulatorVMs; +import org.tizen.emulator.manager.resources.StringResources; +import org.tizen.emulator.manager.ui.dialog.MessageDialog; +import org.tizen.emulator.manager.ui.dialog.SelectWorkspaceDialog; +import org.tizen.emulator.manager.vms.EmulatorVMList; public class SelectWorkspace { private static Properties prop = null; @@ -69,8 +70,8 @@ public class SelectWorkspace { prop = new Properties(); } - String workspaceConfPath = EmulatorVMs.getInstance().getTizenSdkDataPath() - + File.separator + StringResource.WORKSPACE_NAME; + String workspaceConfPath = EmulatorVMList.getInstance().getTizenSdkDataPath() + + File.separator + StringResources.WORKSPACE_NAME; FileInputStream inputStream = null; try { @@ -89,9 +90,9 @@ public class SelectWorkspace { } if (result) { - String path = prop.getProperty(StringResource.RECENT_VMS_PATH); + String path = prop.getProperty(StringResources.RECENT_VMS_PATH); if (!path.isEmpty()) { - EmulatorVMs.getInstance().setVMsBaseDirectory(path); + EmulatorVMList.getInstance().setVMsBaseDirectory(path); } } @@ -127,9 +128,9 @@ public class SelectWorkspace { out = new BufferedWriter(writer); try { - out.write(StringResource.SHOW_SELECTION_DIAGLOG + "=false\n"); - out.write(StringResource.RECENT_VMS_PATH + "=\n"); - out.write(StringResource.MAC_ADDRESS + "=\n"); + out.write(StringResources.SHOW_SELECTION_DIAGLOG + "=false\n"); + out.write(StringResources.RECENT_VMS_PATH + "=\n"); + out.write(StringResources.MAC_ADDRESS + "=\n"); } catch (IOException e1) { prop = null; return; @@ -184,7 +185,7 @@ public class SelectWorkspace { } return dialog.getSelectedPath(); } else if (show.equals("false")) { - return prop.getProperty(StringResource.RECENT_VMS_PATH); + return prop.getProperty(StringResources.RECENT_VMS_PATH); } } return null; @@ -192,8 +193,8 @@ public class SelectWorkspace { public static String getWorkspaceConfPath() { String workspaceConfPath = null; - workspaceConfPath = EmulatorVMs.getInstance().getTizenSdkDataPath() - + File.separator + StringResource.WORKSPACE_NAME; + workspaceConfPath = EmulatorVMList.getInstance().getTizenSdkDataPath() + + File.separator + StringResources.WORKSPACE_NAME; return workspaceConfPath; } @@ -262,18 +263,12 @@ public class SelectWorkspace { } private static String getMACaddrFromHost() { - int isLinux = System.getProperty("os.name").toLowerCase() - .indexOf("linux"); - int isWindows = System.getProperty("os.name").toLowerCase() - .indexOf("windows"); - int isMac = System.getProperty("os.name").toLowerCase() - .indexOf("mac"); try { - if (isLinux > -1) { + if (EmulatorManager.isLinux()) { getMACaddrFromLinuxHost(); - } else if (isWindows > -1) { + } else if (EmulatorManager.isWin()) { getMACaddrFromWindowsHost(); - }else if (isMac > -1) { + }else if (EmulatorManager.isMac()) { getMACaddrFromMacHost(); } } catch (SocketException e) { @@ -295,8 +290,8 @@ public class SelectWorkspace { boolean isModify = false; String workspaceConfPath = null; if (isSave) { - workspaceConfPath = EmulatorVMs.getInstance().getTizenSdkDataPath() - + File.separator + StringResource.WORKSPACE_NAME; + workspaceConfPath = EmulatorVMList.getInstance().getTizenSdkDataPath() + + File.separator + StringResources.WORKSPACE_NAME; if (prop == null) { prop = new Properties(); } @@ -325,9 +320,9 @@ public class SelectWorkspace { String show = "false"; if (prop != null) { - oldShow = prop.getProperty(StringResource.SHOW_SELECTION_DIAGLOG); - oldPath = prop.getProperty(StringResource.RECENT_VMS_PATH); - macAddr = prop.getProperty(StringResource.MAC_ADDRESS); + oldShow = prop.getProperty(StringResources.SHOW_SELECTION_DIAGLOG); + oldPath = prop.getProperty(StringResources.RECENT_VMS_PATH); + macAddr = prop.getProperty(StringResources.MAC_ADDRESS); if (! EmulatorManager.isConsoleMode()) { show = oldShow; @@ -337,7 +332,7 @@ public class SelectWorkspace { macAddr = ""; macAddr = getMACaddrFromHost(); if(macAddr != null) { - prop.setProperty(StringResource.MAC_ADDRESS, macAddr); + prop.setProperty(StringResources.MAC_ADDRESS, macAddr); FileOutputStream outputStream = null; try { outputStream = new FileOutputStream(workspaceConfPath); @@ -364,7 +359,7 @@ public class SelectWorkspace { } else if (macAddr.isEmpty()) { macAddr = getMACaddrFromHost(); if(macAddr != null) { - prop.setProperty(StringResource.MAC_ADDRESS, macAddr); + prop.setProperty(StringResources.MAC_ADDRESS, macAddr); FileOutputStream outputStream = null; try { outputStream = new FileOutputStream(workspaceConfPath); @@ -406,12 +401,12 @@ public class SelectWorkspace { if (workspacePath != null && !workspacePath.isEmpty()) { if (prop != null) { if (show != oldShow) { - prop.setProperty(StringResource.SHOW_SELECTION_DIAGLOG, show); + prop.setProperty(StringResources.SHOW_SELECTION_DIAGLOG, show); isModify = true; } if (!workspacePath.equals(oldPath)) { - prop.setProperty(StringResource.RECENT_VMS_PATH, workspacePath); + prop.setProperty(StringResources.RECENT_VMS_PATH, workspacePath); isModify = true; } } @@ -446,7 +441,7 @@ public class SelectWorkspace { } } - EmulatorVMs.getInstance().setVMsBaseDirectory(workspacePath); + EmulatorVMList.getInstance().setVMsBaseDirectory(workspacePath); //FilePath.setVMSPath(); } diff --git a/src/org/tizen/emulator/manager/ui/ArchitectureGroup.java b/src/org/tizen/emulator/manager/ui/ArchitectureGroup.java deleted file mode 100644 index d39f6b9..0000000 --- a/src/org/tizen/emulator/manager/ui/ArchitectureGroup.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Emulator Manager - * - * Copyright (C) 2011 - 2012 Samsung Electronics Co., Ltd. All rights reserved. - * - * Contact: - * MunKyu Im - * SeokYeon Hwang - * JiHye Kim - * YeongKyoon Lee - * - * 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; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Group; -import org.tizen.emulator.manager.tool.StringResource; -import org.tizen.emulator.manager.vms.VMsProperty.Architecture; - -public class ArchitectureGroup { - //MainDialog dialog; - Group group; - Button x86RadioButton; - Button armRadioButton; - - - public ArchitectureGroup(final MainDialog dialog, Composite archComposite) { - //this.dialog = dialog; - - group = new Group(archComposite, SWT.NONE); - - group.setText(StringResource.GROUP_TITLE); - group.setLayout(new GridLayout(2, false)); - - x86RadioButton = new Button(group, SWT.RADIO); - x86RadioButton.setData(Architecture.x86); - x86RadioButton.setText(StringResource.X86); - x86RadioButton.setSelection(true); - - armRadioButton = new Button(group, SWT.RADIO); - armRadioButton.setData(Architecture.ARM); - armRadioButton.setText(StringResource.ARM); - armRadioButton.setSelection(false); - // TODO : not support ARM - armRadioButton.setEnabled(false); - - SelectionListener archSelectionListener = new SelectionListener() { - @Override - public void widgetSelected(SelectionEvent e) { - dialog.refreshVMsTable(); - } - @Override - public void widgetDefaultSelected(SelectionEvent e) { - dialog.refreshVMsTable(); - } - - }; - - x86RadioButton.addSelectionListener(archSelectionListener); - armRadioButton.addSelectionListener(archSelectionListener); - } - - public void setLayoutData(Object data) { - group.setLayoutData(data); - } -} diff --git a/src/org/tizen/emulator/manager/ui/MainDialog.java b/src/org/tizen/emulator/manager/ui/MainDialog.java index 2f3e029..22f0c98 100644 --- a/src/org/tizen/emulator/manager/ui/MainDialog.java +++ b/src/org/tizen/emulator/manager/ui/MainDialog.java @@ -31,77 +31,73 @@ package org.tizen.emulator.manager.ui; import java.io.InputStream; - +import java.util.ArrayList; import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.SashForm; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; +import org.eclipse.swt.events.ShellEvent; +import org.eclipse.swt.events.ShellListener; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.layout.FillLayout; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.layout.FormAttachment; +import org.eclipse.swt.layout.FormData; +import org.eclipse.swt.layout.FormLayout; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Menu; import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.ToolBar; -import org.eclipse.swt.widgets.ToolItem; import org.tizen.emulator.manager.EmulatorManager; import org.tizen.emulator.manager.EmulatorManager.ManagerModeType; -import org.tizen.emulator.manager.image.BaseImage; -import org.tizen.emulator.manager.tool.StringResource; -import org.tizen.emulator.manager.ui.ResourceRegistry.ImageName; -import org.tizen.emulator.manager.ui.detail.DetailTableView; -import org.tizen.emulator.manager.ui.vmstree.VMsTree; -import org.tizen.emulator.manager.vms.EmulatorVMs; -import org.tizen.emulator.manager.vms.VMsProperty; -import org.tizen.emulator.manager.vms.VMsWorkerException; +import org.tizen.emulator.manager.da.widgets.button.DACustomButton; +import org.tizen.emulator.manager.da.widgets.button.DACustomButtonClickEventListener; +import org.tizen.emulator.manager.platform.Platform; +import org.tizen.emulator.manager.resources.ColorResources; +import org.tizen.emulator.manager.resources.ImageResources; +import org.tizen.emulator.manager.resources.StringResources; +import org.tizen.emulator.manager.ui.dialog.AboutDialog; +import org.tizen.emulator.manager.ui.tabfolder.PlatformTabFolder; +import org.tizen.emulator.manager.ui.tabfolder.PlatformTabItem; public class MainDialog { private static final String ICON_FILE_NAME = "res/em.ico"; - SashForm sashForm; - //ArchitectureGroup archGroup; - - // ToolItems... - ToolItem aboutItem; - ToolItem refreshItem; - ToolItem resetItem; - ToolItem deleteItem; - ToolItem cloneItem; - ToolItem createImageItem; -// ToolItem modifyItem; - - - ToolItem x86ToggleItem; - ToolItem armToggleItem; - - // LEFT VIEW - VMsTree vmsTree; - - // RIGHT VIEW - DetailTableView detailView; - // Launch, Confirm - Button leftButton; - // Create, Modify, Cancel - Button rightButton; + public static final int WIDTH = 840; + public static final int HEIGHT = 482; - MenuHandling handling; - - Shell shell; + static Shell shell = null; Image icon; public MainDialog(ManagerModeType mode) { Display.setAppName("Emulator Manager"); - shell = new Shell(Display.getCurrent()); - shell.setSize(700, 500); + shell = new Shell(Display.getCurrent(), SWT.CLOSE | SWT.TITLE | SWT.MIN); + // + shell.setBackground(ColorResources.TAB_BG_COLOR.getColor()); + // + shell.setLayout(new FillLayout()); + + final Menu bar = new Menu(shell, SWT.BAR); + shell.setMenuBar(bar); + + shell.addShellListener(new ShellListener() { + public void shellIconified(ShellEvent e) { + } + public void shellDeiconified(ShellEvent e) { + } + public void shellDeactivated(ShellEvent e) { + } + public void shellClosed(ShellEvent e) { + } + public void shellActivated(ShellEvent e) { + int frameX = shell.getSize().x - shell.getClientArea().width; + int frameY = shell.getSize().y - shell.getClientArea().height; + shell.setSize(WIDTH + frameX, HEIGHT + frameY); + } + }); + if (mode.equals(ManagerModeType.INHOUSE_MODE)) { - shell.setText(StringResource.MAIN_TITLE_INHOUSE); + shell.setText(StringResources.MAIN_TITLE_INHOUSE); } else { - shell.setText(StringResource.MAIN_TITLE); + shell.setText(StringResources.MAIN_TITLE); } - shell.setLayout(new FillLayout()); InputStream is = this.getClass().getClassLoader().getResourceAsStream(ICON_FILE_NAME); if(is != null) { @@ -110,138 +106,64 @@ public class MainDialog { } } + private ArrayList platformItems = new ArrayList(10); + private static PlatformTabFolder tabFolder = null; + private DACustomButton resetButton = null; + private DACustomButton infoButton = null; + private static StatusBar statusBar = null; public void draw() { Composite mainComposite = new Composite(shell, SWT.NONE); - mainComposite.setLayout(getNopaddedGridLayout(1, false)); - - { - // Architecture selection group and main SashForm... - - Composite archComposite = new Composite(mainComposite, SWT.NONE); - GridLayout upperLayout = new GridLayout(1, false); - upperLayout.marginWidth = 0; - archComposite.setLayout(upperLayout); - archComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); - - // Top ToolBar - ToolBar leftToolBar = new ToolBar(archComposite, SWT.NONE | SWT.RIGHT); - leftToolBar.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, true, false)); - aboutItem = new ToolItem(leftToolBar, SWT.PUSH); - ToolItem separator = new ToolItem(leftToolBar, SWT.SEPARATOR); - separator.setWidth(10); - refreshItem = new ToolItem(leftToolBar, SWT.PUSH); - separator = new ToolItem(leftToolBar, SWT.SEPARATOR); - separator.setWidth(10); -// modifyItem = new ToolItem(leftToolBar, SWT.PUSH); - resetItem = new ToolItem(leftToolBar, SWT.PUSH); - deleteItem = new ToolItem(leftToolBar, SWT.PUSH); - - cloneItem = new ToolItem(leftToolBar, SWT.PUSH); - createImageItem = new ToolItem(leftToolBar, SWT.PUSH); - - decorateLeftSideToolItems(); - - /* - ToolBar toolBar = new ToolBar(archComposite, SWT.RIGHT); - toolBar.setLayoutData(new GridData(SWT.END, SWT.CENTER, true, false)); - x86ToggleItem = new ToolItem(toolBar, SWT.CHECK); - armToggleItem = new ToolItem(toolBar, SWT.CHECK); - - decorateRightSideToolItems(); - */ - - // Main SashForm - sashForm = new SashForm(mainComposite, SWT.HORIZONTAL); - sashForm.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); - sashForm.setLayout(new FillLayout()); - // Left : VMs tree - { - final Composite leftView = new Composite(sashForm, SWT.FILL); - GridLayout layout = getNopaddedGridLayout(1, false); - leftView.setLayout(layout); - - vmsTree = new VMsTree(this, leftView); - vmsTree.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); - } - - // Right : detail table - { - final Composite rightView = new Composite(sashForm, SWT.FILL); - GridLayout layout = getNopaddedGridLayout(1, false); - rightView.setLayout(layout); - - detailView = new DetailTableView(this); - detailView.createDetailView(shell, rightView); - detailView.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, true)); - - - Composite bottomComposite = new Composite(rightView, SWT.NONE); - GridLayout bottomLayout = getNopaddedGridLayout(2, false); - bottomComposite.setLayout(bottomLayout); - bottomComposite.setLayoutData(new GridData(SWT.FILL, SWT.BOTTOM, true, false)); - - leftButton = new Button(bottomComposite, SWT.PUSH); - - // Launch, Cancel - leftButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); - leftButton.setText(StringResource.MODIFY); - leftButton.addSelectionListener(new SelectionListener() { - @Override - public void widgetSelected(SelectionEvent e) { - String type = leftButton.getText(); - if (type.equals(StringResource.MODIFY)) { - VMsProperty property = detailView.getCurrentPoperty(); - openModifyView(property); - } else if (type.equals(StringResource.CREATE)) { - openCreateView(); - } else if (type.equals(StringResource.CANCEL)) { - if (detailView.getCurrentPoperty() == null) { - openCreateDetailView(); - } else { - openDetailView(detailView.getCurrentPoperty()); - vmsTree.setSelectProperty(detailView.getCurrentPoperty()); - } - } - } - @Override - public void widgetDefaultSelected(SelectionEvent e) { - } - }); + // TODO + mainComposite.setBackground(ColorResources.TAB_BG_COLOR.getColor()); + mainComposite.setLayout(new FormLayout()); + + tabFolder = new PlatformTabFolder(mainComposite); + statusBar = new StatusBar(mainComposite); + + Composite tabComposite = tabFolder.getComposite(); + Composite barComposite = statusBar.getBarComposite(); + + FormData data = new FormData(); + data.top = new FormAttachment(0, 0); + data.left = new FormAttachment(0, 0); + data.right = new FormAttachment(100, 0); + data.height = 460; + //data.bottom = new FormAttachment(barComposite, 0); + tabComposite.setLayoutData(data); + + data = new FormData(); + data.top = new FormAttachment(tabComposite, 0); + data.left = new FormAttachment(0, 2); + data.right = new FormAttachment(100, -2); + data.height = 20; + barComposite.setLayoutData(data); + + + // add platform tab item + for (Platform p : EmulatorManager.getPlatformList()) { + platformItems.add(new PlatformTabItem(p, tabFolder, SWT.CENTER)); + } + // add custom tab + platformItems.add(new PlatformTabItem(EmulatorManager.getCustomPlatform(), + tabFolder, SWT.CENTER)); - // Modify, Confirm - rightButton = new Button(bottomComposite, SWT.PUSH); - rightButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); - rightButton.setText(StringResource.LAUNCH); - rightButton.addSelectionListener(new SelectionListener() { - @Override - public void widgetSelected(SelectionEvent event) { - String type = rightButton.getText(); - if (type.equals(StringResource.LAUNCH)) { - try { - detailView.getCurrentPoperty().getWorker().launchVM(); - } catch (VMsWorkerException e) { - new MessageDialog().openInfoDialog(e.getMessage()); - } - } else if (type.equals(StringResource.CONFIRM)) { - VMsProperty pro = detailView.confirm(); - if (pro != null) { // success - refreshProperties(); - vmsTree.setSelectProperty(pro); - openDetailView(pro); - } - } - } - @Override - public void widgetDefaultSelected(SelectionEvent event) { - } - }); + resetButton = new DACustomButton(tabFolder.getTabComposite(), + ImageResources.RESET_ICON_NOMAL.getImage(), + ImageResources.RESET_ICON_PUSH.getImage(), + ImageResources.RESET_ICON_HOVER.getImage(), + ImageResources.RESET_ICON_NOMAL.getImage()); - } + infoButton = new DACustomButton(tabFolder.getTabComposite(), + ImageResources.INFO_ICON_NOMAL.getImage(), + ImageResources.INFO_ICON_PUSH.getImage(), + ImageResources.INFO_ICON_HOVER.getImage(), + ImageResources.INFO_ICON_NOMAL.getImage()); - sashForm.setWeights(new int[] { 100, 0 }); - } + tabFolder.addTabRightButton(resetButton); + tabFolder.addTabRightButton(infoButton); + decorateRightSideToolItems(); - handling = new MenuHandling(shell, vmsTree); + tabFolder.draw(); } public void open() { @@ -251,317 +173,45 @@ public class MainDialog { Display.getCurrent().sleep(); } } - } - public Shell getShell() { + public static Shell getShell() { return shell; } - public void resetVM() { - handling.resetVirtualMachine(detailView.getCurrentPoperty()); - vmsTree.setSelectProperty(detailView.getCurrentPoperty()); - } - - public void cloneVM() { - handling.cloneVirtualMachine(detailView.getCurrentPoperty()); - } - - // TOOD : error checking - public void deleteVM() { - if (handling.deleteVirtualMachine(detailView.getCurrentPoperty())) { - refreshProperties(); - closeDetailView(); - } else { - vmsTree.setSelectProperty(detailView.getCurrentPoperty()); - } - } - - public void createBaseImage() { - handling.createBaseImage(detailView.getCurrentPoperty()); - vmsTree.setSelectProperty(detailView.getCurrentPoperty()); - } - - public void refreshVMsTable() { - vmsTree.refreshContents(); - } - - public void refreshProperties() { - EmulatorVMs.getInstance().refreshProperties(); - vmsTree.refreshContents(); - } - - public int[] getSashFormWeight() { - return sashForm.getWeights(); - } - - public void setDetailViewWeights(int[] weight) { - sashForm.setWeights(weight); - } - - public void openDetailView(VMsProperty property) { - if (vmsTree.getSelectionContentCount() == 1) { - setToolBarState(State.TRUE); - } else { - setToolBarState(State.FALSE); - } - - leftButton.setText(StringResource.MODIFY); - leftButton.setImage(ResourceRegistry.getImage(ImageName.MODIFY)); - rightButton.setText(StringResource.LAUNCH); - rightButton.setImage(ResourceRegistry.getImage(ImageName.LAUNCH)); - leftButton.setEnabled(true); - rightButton.setEnabled(true); - - detailView.openDetailView(property); - } - - public void closeDetailView() { - if(vmsTree == null) { - return; - } - else if (vmsTree.getSelectionContentCount() > 1) { - setToolBarState(State.CLOSE_DETAIL); - } - else { - setToolBarState(State.FALSE); - } - detailView.closeDetailView(); - } - - public void openModifyView(VMsProperty property) { - MessageDialog msg = new MessageDialog(); - if(property.getWorker().isRunningNow()) { - msg.openInfoDialog("Not allowed to modify active VMs\n" + "[" + property.getName() + "] is running now..."); - return; - } - - setToolBarState(State.FALSE); - - leftButton.setText(StringResource.CANCEL); - leftButton.setImage(ResourceRegistry.getImage(ImageName.CANCEL)); - rightButton.setText(StringResource.CONFIRM); - rightButton.setImage(ResourceRegistry.getImage(ImageName.CONFIRM)); - leftButton.setEnabled(true); - rightButton.setEnabled(false); - - detailView.openModifyView(property, rightButton); - } - - public void openCreateDetailView(BaseImage image, VMsProperty template) { - setToolBarState(State.FALSE); - - leftButton.setText(StringResource.CREATE); - leftButton.setImage(ResourceRegistry.getImage(ImageName.CREATE)); - rightButton.setText(StringResource.LAUNCH); - rightButton.setImage(ResourceRegistry.getImage(ImageName.LAUNCH)); - - leftButton.setEnabled(true); - rightButton.setEnabled(false); - - this.image = image; - this.template = template; - detailView.openCreateDetailView(image, template); - - } - - private BaseImage image; - private VMsProperty template; - public void openCreateDetailView() { - setToolBarState(State.FALSE); - - leftButton.setText(StringResource.CREATE); - leftButton.setImage(ResourceRegistry.getImage(ImageName.CREATE)); - rightButton.setText(StringResource.LAUNCH); - rightButton.setImage(ResourceRegistry.getImage(ImageName.LAUNCH)); - - leftButton.setEnabled(true); - rightButton.setEnabled(false); - - detailView.openCreateDetailView(image, template); + public static StatusBar getStatusBar() { + return statusBar; } - public void openCreateView() { - setToolBarState(State.FALSE); - - leftButton.setText(StringResource.CANCEL); - leftButton.setImage(ResourceRegistry.getImage(ImageName.CANCEL)); - rightButton.setText(StringResource.CONFIRM); - rightButton.setImage(ResourceRegistry.getImage(ImageName.CONFIRM)); - - leftButton.setEnabled(true); - rightButton.setEnabled(false); - - detailView.openCreateView(rightButton); + public static void refreshVMPropertyList() { + EmulatorManager.settingVMPropertyList(); + tabFolder.getSelection().redraw(); } public void dispose() { - ResourceRegistry.dispose(); - + ImageResources.dispose(); + ColorResources.dispose(); if(icon != null) { icon.dispose(); } } -enum State { - FALSE, TRUE, CLOSE_DETAIL; -} - private void setToolBarState(State state) { - switch(state) { - case FALSE: - deleteItem.setEnabled(false); - resetItem.setEnabled(false); - cloneItem.setEnabled(false); - createImageItem.setEnabled(false); - break; - case TRUE: - deleteItem.setEnabled(true); - resetItem.setEnabled(true); - cloneItem.setEnabled(true); - createImageItem.setEnabled(true); - break; - case CLOSE_DETAIL: - deleteItem.setEnabled(true); - resetItem.setEnabled(true); - cloneItem.setEnabled(false); - createImageItem.setEnabled(false); - break; - } - } - private GridLayout getNopaddedGridLayout(int numColumns, boolean makeColumnEqualWidth) { - GridLayout layout = new GridLayout(numColumns, makeColumnEqualWidth); - layout.horizontalSpacing = 0; - layout.verticalSpacing = 0; - layout.marginBottom = 0; - layout.marginHeight = 0; - layout.marginLeft = 0; - layout.marginRight = 0; - layout.marginTop = 0; - layout.marginWidth = 0; - - return layout; - } - private void decorateLeftSideToolItems() { - aboutItem.setImage(ResourceRegistry.getImage(ImageName.ABOUT)); - aboutItem.setToolTipText("About Emulator Manager"); - aboutItem.addSelectionListener(new SelectionListener() { + private void decorateRightSideToolItems() { + infoButton.setToolTipText("About Emulator Manager"); + infoButton.addClickListener(new DACustomButtonClickEventListener() { @Override - public void widgetSelected(SelectionEvent e) { - /* - new MessageDialog().openInfoDialog("About Emulator Manager", - About.getInstance().getContents()); - */ + public void handleClickEvent(DACustomButton button) { AboutDialog.open(); } - @Override - public void widgetDefaultSelected(SelectionEvent e) {} }); - refreshItem.setImage(ResourceRegistry.getImage(ImageName.REFRESH)); - refreshItem.setToolTipText("refresh list of VM"); - refreshItem.addSelectionListener(new SelectionListener() { + resetButton.setToolTipText("Refresh list of VM"); + resetButton.addClickListener(new DACustomButtonClickEventListener() { @Override - public void widgetSelected(SelectionEvent e) { - // reload platform - EmulatorManager.getInstance().makePlatformList(); - refreshProperties(); - closeDetailView(); + public void handleClickEvent(DACustomButton button) { + // reload vm list + refreshVMPropertyList(); } - @Override - public void widgetDefaultSelected(SelectionEvent e) {} - }); - - cloneItem.setText(StringResource.CLONE); - cloneItem.setImage(ResourceRegistry.getImage(ImageName.CLONE)); - cloneItem.setToolTipText("Clone from selected VM"); - cloneItem.setEnabled(false); - cloneItem.addSelectionListener(new SelectionListener() { - @Override - public void widgetSelected(SelectionEvent e) { - cloneVM(); - } - @Override - public void widgetDefaultSelected(SelectionEvent e) {} - }); - -// modifyItem.setText("Modify"); -// modifyItem.setImage(ResourceRegistry.getImage(ImageName.MODIFY)); -// modifyItem.setToolTipText("Modify selected VM"); -// modifyItem.addSelectionListener(new SelectionListener() { -// @Override -// public void widgetSelected(SelectionEvent e) { -// modifyVM(vmsTree.getSelectionItem()); -// } -// @Override -// public void widgetDefaultSelected(SelectionEvent e) { -// } -// }); - - resetItem.setText(StringResource.RESET); - resetItem.setImage(ResourceRegistry.getImage(ImageName.RESET)); - resetItem.setToolTipText("Format OS of selected VM"); - resetItem.setEnabled(false); - resetItem.addSelectionListener(new SelectionListener() { - @Override - public void widgetSelected(SelectionEvent e) { - resetVM(); - } - @Override - public void widgetDefaultSelected(SelectionEvent e) { - } - }); - - deleteItem.setText(StringResource.DELETE); - deleteItem.setImage(ResourceRegistry.getImage(ImageName.DELETE)); - deleteItem.setToolTipText("Delete selected VM"); - deleteItem.setEnabled(false); - deleteItem.addSelectionListener(new SelectionListener() { - @Override - public void widgetSelected(SelectionEvent e) { - deleteVM(); - } - @Override - public void widgetDefaultSelected(SelectionEvent e) { - } - }); - - createImageItem.setText(StringResource.CREATE_IMAGE); - createImageItem.setImage(ResourceRegistry.getImage(ImageName.CREATEIMAGE)); - createImageItem.setToolTipText("Create new base image from selected VM"); - createImageItem.setEnabled(false); - createImageItem.addSelectionListener(new SelectionListener() { - @Override - public void widgetSelected(SelectionEvent e) { - createBaseImage(); - } - @Override - public void widgetDefaultSelected(SelectionEvent e) { - } - }); - - } - /* - private void decorateRightSideToolItems() { - x86ToggleItem.setText(StringResource.x86); - x86ToggleItem.setImage(ResourceRegistry.getImage(ImageName.X86)); - x86ToggleItem.setToolTipText("x86 Architecture"); - x86ToggleItem.setSelection(true); - x86ToggleItem.addSelectionListener(new SelectionListener() { - @Override - public void widgetSelected(SelectionEvent e) { - x86ToggleItem.setSelection(true); - refreshProperties(); - } - @Override - public void widgetDefaultSelected(SelectionEvent e) {} - }); - - armToggleItem.setText(StringResource.ARM); - armToggleItem.setImage(ResourceRegistry.getImage(ImageName.ARM)); - armToggleItem.setToolTipText("ARM Architecture"); - armToggleItem.setSelection(false); - armToggleItem.setEnabled(false); } - */ } diff --git a/src/org/tizen/emulator/manager/ui/MenuHandling.java b/src/org/tizen/emulator/manager/ui/MenuHandling.java index d3d10ee..812784e 100644 --- a/src/org/tizen/emulator/manager/ui/MenuHandling.java +++ b/src/org/tizen/emulator/manager/ui/MenuHandling.java @@ -35,94 +35,75 @@ import java.util.ArrayList; import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.FileDialog; import org.eclipse.swt.widgets.Shell; -import org.tizen.emulator.manager.EmulatorManager; -import org.tizen.emulator.manager.tool.FilePath; -import org.tizen.emulator.manager.ui.vmstree.VMsTree; -import org.tizen.emulator.manager.vms.VMsProperty; -import org.tizen.emulator.manager.vms.VMsWorkerException; +import org.tizen.emulator.manager.resources.FilePath; +import org.tizen.emulator.manager.resources.StringResources; +import org.tizen.emulator.manager.ui.dialog.CloneDialog; +import org.tizen.emulator.manager.ui.dialog.MessageDialog; +import org.tizen.emulator.manager.vms.VMProperty; +import org.tizen.emulator.manager.vms.VMWorkerException; public class MenuHandling { private Shell shell; - private VMsTree vmsTree; private static ArrayList baseImagePaths = new ArrayList(); - public MenuHandling(Shell shell, VMsTree vmsTree) { - this.shell = shell; - this.vmsTree = vmsTree; + public MenuHandling() { + this.shell = MainDialog.getShell(); } - public void resetVirtualMachine(VMsProperty prop) { + public void resetVirtualMachine(VMProperty property) { MessageDialog msg = new MessageDialog(); int response = msg.openSelectionDialog("This VM will be formatted.\nAre you sure you want to continue?"); - + if (response != SWT.OK) { return; } - VMsProperty[] properties = vmsTree.getSelectionItems(); - if (properties.length == 0) { - properties = new VMsProperty[1]; - properties[0] = prop; - } - for (VMsProperty property : properties) { - if(property.getWorker().isRunningNow()) { - msg.openInfoDialog("Not allowed to reset active VMs.\n" + "[" + property.getName() + "] is running now..."); - return; - } + if(property.getWorker().isRunningNow()) { + msg.openInfoDialog("Not allowed to reset active VMs." + + StringResources.NEW_LINE + + "[" + property.getName() + "] is running now..."); + return; } - for (VMsProperty property : properties) { - try { - property.getWorker().resetVM(); - } catch (VMsWorkerException e) { - msg.openInfoDialog(" Reset [" + property.getName() + "] failed...\n" - + e.getMessage()); - return; - } + try { + property.getWorker().resetVM(); + } catch (VMWorkerException e) { + msg.openInfoDialog(" Reset [" + property.getName() + "] failed..." + + e.getMessage()); + return; } - - //msg.openInfoDialog("Completed reset process!"); } - public boolean deleteVirtualMachine(VMsProperty prop) { + public boolean deleteVirtualMachine(VMProperty property) { MessageDialog msg = new MessageDialog(); int response = msg.openSelectionDialog("Are you sure you want to delete selected VM?"); if (response != SWT.OK) { return false; } - VMsProperty[] properties = vmsTree.getSelectionItems(); - if (properties.length == 0) { - properties = new VMsProperty[1]; - properties[0] = prop; - } - for (VMsProperty property : properties) { - if(property.getWorker().isRunningNow()) { - msg.openInfoDialog("Not allowed to delete active VMs.\n" + "[" + property.getName() + "] is running now..."); - return false; - } + if(property.getWorker().isRunningNow()) { + msg.openInfoDialog("Not allowed to delete active VMs." + + StringResources.NEW_LINE + + "[" + property.getName() + "] is running now..."); + return false; } - for(VMsProperty property : properties) { - try { - property.getWorker().deleteVM(); - } catch (VMsWorkerException e) { - msg.openInfoDialog(" Delete [" + property.getName() + "] failed...\n" - + e.getMessage()); - return false; - } + try { + property.getWorker().deleteVM(); + } catch (VMWorkerException e) { + msg.openInfoDialog(" Delete [" + property.getName() + "] failed..." + + e.getMessage()); + return false; } - - //msg.openInfoDialog("Completed delete process!"); - return true; } - public void createBaseImage(VMsProperty prop) { + public void createBaseImage(VMProperty property) { MessageDialog msg = new MessageDialog(); - VMsProperty property = prop; - if(prop.getWorker().isRunningNow()) { - msg.openWarningDialog("Not allowed to 'Create Base Image' while source VM is running."); + if(property.getWorker().isRunningNow()) { + msg.openWarningDialog("Not allowed to 'Create Base Image'" + + StringResources.NEW_LINE + + "while source VM is running."); return ; } @@ -145,22 +126,21 @@ public class MenuHandling { try { MenuHandling.addBaseImagePath(path); property.getWorker().createNewBaseImage(property, path); - //returnMSG = "Succeeded to create 'Base Image'!\nPath: " + path; - } catch (VMsWorkerException e) { + } catch (VMWorkerException e) { returnMSG =e.getMessage(); msg.openInfoDialog(returnMSG); } } - public void cloneVirtualMachine(VMsProperty currentPoperty) { + public void cloneVirtualMachine(VMProperty property) { MessageDialog msg = new MessageDialog(); - if(currentPoperty.getWorker().isRunningNow()) { + if(property.getWorker().isRunningNow()) { msg.openWarningDialog("Not allowed to 'Clone' while source VM is running."); return ; } - CloneDialog cloneDialog = new CloneDialog(EmulatorManager.getInstance().getMainDialog(), currentPoperty); + CloneDialog cloneDialog = new CloneDialog(property); cloneDialog.open(); } diff --git a/src/org/tizen/emulator/manager/ui/ResourceRegistry.java b/src/org/tizen/emulator/manager/ui/ResourceRegistry.java deleted file mode 100644 index 8fb2e8c..0000000 --- a/src/org/tizen/emulator/manager/ui/ResourceRegistry.java +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Emulator Manager - * - * Copyright (C) 2011 - 2012 Samsung Electronics Co., Ltd. All rights reserved. - * - * Contact: - * MunKyu Im - * SeokYeon Hwang - * JiHye Kim - * YeongKyoon Lee - * - * 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; - -import java.io.InputStream; -import java.util.HashMap; -import java.util.Map; - -import org.eclipse.swt.graphics.Font; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.widgets.Display; - -public class ResourceRegistry { - public enum ImageName { - CANCEL("cancel"), CONFIRM("confirm"), CREATE("create"), DELETE("delete"), DETAILS("details"), - FOLDER("folder"), MODIFY("modify"), REFRESH("refresh"), RESET("reset"), LAUNCH("launch"), CREATEIMAGE("createimage"), - ABOUT("about"), CLONE("clone"), ARM("arm"), X86("x86"), ABOUTSDK("aboutSDK"); - - String name; - - ImageName(String name) { - this.name = name; - } - - @Override - public String toString() { - return name; - } - } - - public enum FontType { - BOLD("bold"); - - String name; - - FontType(String name) { - this.name = name; - } - - @Override - public String toString() { - return name; - } - } - - private static ResourceRegistry instance; - - Map imagesMap = new HashMap(); - - static { - synchronized(ResourceRegistry.class) { - instance = new ResourceRegistry(); - - ClassLoader loader = ResourceRegistry.class.getClassLoader(); - - InputStream is = null; - - for(ImageName imageName : ImageName.values()) { - is = loader.getResourceAsStream("res/" + imageName.toString() + ".png"); - if(is != null) { - instance.imagesMap.put(imageName, new Image(Display.getCurrent(), is)); - } - } - } - } - - Map fontsMap = new HashMap(); - - public static Image getImage(ImageName imagename) { - return instance.imagesMap.get(imagename); - } - - public static void addFont(int fontStyle, Font font) { - instance.fontsMap.put(fontStyle, font); - } - - public static Font getFont(int fonttype) { - return instance.fontsMap.get(fonttype); - } - - public static void dispose() { - for(Image image : instance.imagesMap.values()) { - image.dispose(); - } - - for(Font font : instance.fontsMap.values()) { - font.dispose(); - } - } - - private ResourceRegistry() {} -} diff --git a/src/org/tizen/emulator/manager/ui/StatusBar.java b/src/org/tizen/emulator/manager/ui/StatusBar.java new file mode 100644 index 0000000..a1f7b6d --- /dev/null +++ b/src/org/tizen/emulator/manager/ui/StatusBar.java @@ -0,0 +1,62 @@ +package org.tizen.emulator.manager.ui; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.layout.FormAttachment; +import org.eclipse.swt.layout.FormData; +import org.eclipse.swt.layout.FormLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Label; +import org.tizen.emulator.manager.resources.ColorResources; +import org.tizen.emulator.manager.resources.FontResources; + +public class StatusBar { + private Composite bar = null; + private Label msgLabel = null; + + public StatusBar(Composite parent) { + bar = new Composite(parent, SWT.NONE); + bar.setLayout(new FormLayout()); + bar.setBackground(ColorResources.STATUS_BAR_COLOR.getColor()); + + msgLabel = new Label(bar, SWT.NONE); + FormData data = new FormData(); + data.top = new FormAttachment(0, 0); + data.left = new FormAttachment(0, 10); + data.right = new FormAttachment(100, -10); + data.bottom = new FormAttachment(100, 0); + msgLabel.setLayoutData(data); + msgLabel.setFont(FontResources.STATUS_BAR_FONT.getFont()); + msgLabel.setForeground(ColorResources.STATUS_BAR_FONT_COLOR.getColor()); + msgLabel.setBackground(ColorResources.STATUS_BAR_COLOR.getColor()); + } + + private boolean isError = false; + private String message; + public void info(String msg) { + if (isError) { + return; + } + message = msg; + msgLabel.setText(message); + } + + public void error(String msg) { + if (isError) { + return; + } + isError = true; + message = msg; + msgLabel.setText(message); + + } + + public void reset() { + isError = false; + message = ""; + msgLabel.setText(message); + } + + public Composite getBarComposite() { + return bar; + } +} diff --git a/src/org/tizen/emulator/manager/ui/VMButtonFactory.java b/src/org/tizen/emulator/manager/ui/VMButtonFactory.java new file mode 100644 index 0000000..12cdc3f --- /dev/null +++ b/src/org/tizen/emulator/manager/ui/VMButtonFactory.java @@ -0,0 +1,86 @@ +package org.tizen.emulator.manager.ui; + +import java.util.ArrayList; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.widgets.Composite; +import org.tizen.emulator.manager.da.widgets.button.DACustomButton; +import org.tizen.emulator.manager.resources.ImageResources; +import org.tizen.emulator.manager.ui.widgets.VMButton; +import org.tizen.emulator.manager.ui.widgets.VMButtonClickEventListener; + +class VMCreateButton extends VMButton { + public VMCreateButton(Composite parent, int style) { + super(parent, style); + // delete launchButton + launchButton.dispose(); + launchButton = null; + // set Image + setImages(ImageResources.ADD_NEW_NOMAL.getImage(), + ImageResources.ADD_NEW_PUSH.getImage(), + ImageResources.ADD_NEW_HOVER.getImage(), + ImageResources.VM_IMAGE_CREATE.getImage()); + } +} + +public class VMButtonFactory { + private static ArrayList buttons = new ArrayList (); + private static int selectedIndex = 0; + + public static VMButton getButton(Composite parent) { + VMButton b = new VMButton(parent, SWT.NONE); + b.addClickListener(new VMButtonClickEventListener() { + @Override + public void handleClickEvent(DACustomButton button) { + VMButtonFactory.clickVMButton(button); + } + }); + buttons.add(b); + return b; + } + + public static VMButton getCreateButton(Composite parent) { + VMCreateButton b = new VMCreateButton(parent, SWT.NONE); + buttons.add(b); + return b; + } + + public static ArrayList getButtonList() { + return buttons; + } + + public static void clear() { + for(VMButton b : buttons) { + b.dispose(); + } + buttons.clear(); + selectedIndex = 0; + } + + public static void clickVMButton(DACustomButton button) { + VMButton b = null; + for(int i = 0; i < buttons.size(); i++) { + b = buttons.get(i); + if (button == b) { + b.setSelected(true); + b.redraw(); + selectedIndex= i; + } else { + b.setSelected(false); + b.redraw(); + } + } + } + + public static void clickVMButton(int index) { + clickVMButton(buttons.get(index)); + } + + public static int getSelectedButtonIndex() { + return selectedIndex; + } + + public static VMButton getSelectedButton() { + return buttons.get(selectedIndex); + } +} diff --git a/src/org/tizen/emulator/manager/ui/VMsDetailView.java b/src/org/tizen/emulator/manager/ui/VMsDetailView.java new file mode 100644 index 0000000..6792a76 --- /dev/null +++ b/src/org/tizen/emulator/manager/ui/VMsDetailView.java @@ -0,0 +1,95 @@ +package org.tizen.emulator.manager.ui; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.StackLayout; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.widgets.Composite; +import org.tizen.emulator.manager.resources.ColorResources; +import org.tizen.emulator.manager.ui.detail.PInfoViewPage; +import org.tizen.emulator.manager.ui.detail.PEmptyViewPage; +import org.tizen.emulator.manager.ui.detail.PModifyViewPage; +import org.tizen.emulator.manager.ui.detail.DetailViewPage; +import org.tizen.emulator.manager.vms.VMProperty; +import org.tizen.emulator.manager.vms.VMPropertyValue; + +public class VMsDetailView { + private Composite parent = null; + private Composite mainView = null; + private int WIDTH = 328; + private int HEIGHT = 430; + + public VMsDetailView(Composite parent) { + this.parent = parent; + } + + public void setSize(int width, int height) { + this.WIDTH = width; + this.HEIGHT = height; + } + + public Point getSize() { + return new Point(WIDTH, HEIGHT); + } + + public Composite getComposite() { + if (mainView == null) { + init(); + } + return mainView; + } + + private DetailViewPage emptyView = null; + private DetailViewPage detailView = null; + private DetailViewPage modifyView = null; + + private final StackLayout stackLayout = new StackLayout(); + public void init(int width, int height) { + mainView = new Composite(parent, SWT.NONE); + mainView.setLayout(stackLayout); + mainView.setSize(width, height); + mainView.setBackground(ColorResources.DETAIL_VIEW_PAGE_COLOR.getColor()); + + emptyView = new PEmptyViewPage(this, SWT.NONE); + + detailView = new PInfoViewPage(this, SWT.NONE); + + modifyView = new PModifyViewPage(this, SWT.NONE); + + stackLayout.topControl = detailView.getComposite(); + mainView.layout(); + } + + public void init() { + init(WIDTH, HEIGHT); + } + + public void drawEmptyVM() { + stackLayout.topControl = emptyView.getComposite(); + mainView.layout(); + } + + public void drawDetailVM(VMProperty property) { + detailView.drawPropertyView(property.getPropertyValue(), false); + stackLayout.topControl = detailView.getComposite(); + mainView.layout(); + } + + public void drawModifyVM(VMProperty property, boolean isCreate) { + modifyView.drawPropertyView(property.getPropertyValue(), false); + stackLayout.topControl = modifyView.getComposite(); + mainView.layout(); + } + + public void drawCreateVM(VMPropertyValue value) { + stackLayout.topControl = modifyView.getComposite(); + mainView.layout(); + modifyView.drawPropertyView(value, true); + } + + public void close() { + emptyView.close(); + detailView.close(); + modifyView.close(); + mainView.dispose(); + } +} diff --git a/src/org/tizen/emulator/manager/ui/VMsListView.java b/src/org/tizen/emulator/manager/ui/VMsListView.java new file mode 100644 index 0000000..cd7600a --- /dev/null +++ b/src/org/tizen/emulator/manager/ui/VMsListView.java @@ -0,0 +1,367 @@ +package org.tizen.emulator.manager.ui; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.KeyEvent; +import org.eclipse.swt.events.KeyAdapter; +import org.eclipse.swt.custom.ScrolledComposite; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.layout.FormAttachment; +import org.eclipse.swt.layout.FormData; +import org.eclipse.swt.layout.FormLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Text; +import org.tizen.emulator.manager.da.widgets.button.DACustomButton; +import org.tizen.emulator.manager.da.widgets.button.DACustomButtonClickEventListener; +import org.tizen.emulator.manager.da.widgets.combo.DACustomCombo; +import org.tizen.emulator.manager.da.widgets.combo.DACustomComboSelectionListener; +import org.tizen.emulator.manager.da.widgets.combo.TitleComboPopupRenderer; +import org.tizen.emulator.manager.da.widgets.combo.TitleComboRenderer; +import org.tizen.emulator.manager.platform.BaseImage; +import org.tizen.emulator.manager.platform.Platform; +import org.tizen.emulator.manager.resources.ColorResources; +import org.tizen.emulator.manager.resources.ImageResources; +import org.tizen.emulator.manager.ui.widgets.VMButton; + +public class VMsListView { + private Composite parent = null; + private Composite listView = null; + private int WIDTH = 510; + private int HEIGHT = 430; + + public VMsListView(Composite parent) { + this.parent = parent; + } + + public void setSize(int width, int height) { + this.WIDTH = width; + this.HEIGHT = height; + } + + public Point getSize() { + return new Point(WIDTH, HEIGHT); + } + + public Composite getComposite() { + if (listView == null) { + init(); + } + return listView; + } + + private DACustomCombo imageCombo = null; + private ScrolledComposite scrolledList = null; + private Composite vmList = null; + + public void init(int width, int height) { + listView = new Composite(parent, SWT.NONE); + listView.setLayout(new FormLayout()); + listView.setSize(width, height); + // + listView.setBackground(ColorResources.TAB_CONTENTS_BG_COLOR.getColor()); + // + makeComboButton(); + makeVMList(); + } + + public void init() { + init(WIDTH, HEIGHT); + } + + private static int COMBO_WIDTH = 145; + private static int COMBO_HEIGHT = 24; + private void makeComboButton() { + imageCombo = new DACustomCombo(listView, SWT.NONE); + imageCombo.setImages(ImageResources.COMBO_NORMAL.getImage(), + ImageResources.COMBO_HOVER.getImage(), + ImageResources.COMBO_PUSH.getImage(), + ImageResources.COMBO_DISABLE.getImage()); + imageCombo.setEnabled(true); + + imageCombo.setItemHeight(COMBO_HEIGHT); + imageCombo.setComboRender(new TitleComboRenderer()); + imageCombo.setComboPopupRender(new TitleComboPopupRenderer()); + FormData data = new FormData(); + data.left = new FormAttachment(0, 10); + data.top = new FormAttachment(0, 10); + data.width = COMBO_WIDTH; + data.height = COMBO_HEIGHT; + imageCombo.setLayoutData(data); + + imageCombo.addSelectionListener(new DACustomComboSelectionListener() { + @Override + public void selectionEvent(DACustomCombo combo) { + int index = combo.getItemIndex(combo.getText()); + VMsMainView.getInstance().drawVMList(index); + } + }); + } + + private Text dumyText = null; + private void makeVMList() { + scrolledList = new ScrolledComposite(listView, SWT.V_SCROLL); + FormData data = new FormData(); + data.left = new FormAttachment(0, 10); + data.top = new FormAttachment(0, 40); + data.right = new FormAttachment(100, 0); + data.bottom = new FormAttachment(100, -10); + scrolledList.setLayoutData(data); + scrolledList.setBackground(ColorResources.LIST_BG_COLOR.getColor()); + + vmList = new Composite(scrolledList, SWT.BORDER); + // TODO + vmList.setBackground(ColorResources.LIST_BG_COLOR.getColor()); + data = new FormData(); + data.left = new FormAttachment(0, 0); + data.top = new FormAttachment(0, 0); + data.right = new FormAttachment(100); + data.bottom = new FormAttachment(100); + vmList.setLayoutData(data); + vmList.setLayout(new FormLayout()); + + scrolledList.setContent(vmList); + scrolledList.setExpandHorizontal(true); + + + dumyText = new Text(listView, SWT.NONE); + dumyText.setText(""); + data = new FormData(); + data.left = new FormAttachment(0, -100); + data.top = new FormAttachment(0, 0); + data.width = 0; + data.height = 0; + dumyText.setLayoutData(data); + dumyText.addKeyListener(new KeyAdapter() { + public void keyPressed(KeyEvent event) { + controlKeyEvent(event); + } + }); + } + + public void drawPlatform(Platform platform, int imageIndex) { + imageCombo.setEnabled(true); + imageCombo.initCombo(); + for (BaseImage image : platform.getImageList()) { + imageCombo.add(image.getName()); + } + + imageCombo.select(imageIndex); + VMsMainView.getInstance().drawVMList(imageIndex); + } + + // TODO + private int LIST_HEIGHT = 379; + private int LIST_WIDTH = 484; + private int WIDTH_GAP = 10; + private int HEIGHT_GAP = 12; + private int BUTTON_WIDTH = 106 + 4; + private int BUTTON_HEIGHT = 146 + 4; + + private int WIDTH_COUNT = 0; + private int HEIGHT_COUNT = 0; + + private DACustomButton createButton = null; // for empty list + private VMButton addNewButton = null; + + + private int CREATE_BUTTON_WIDTH = 190; + private int CREATE_BUTTON_HEIGHT = 190; + public void drawEmptyVMList() { + if (createButton != null) { + return; + } + + // clear + VMButtonFactory.clear(); + + int leftOffset = (LIST_WIDTH - CREATE_BUTTON_WIDTH) / 2; + int topOffset = (LIST_HEIGHT - CREATE_BUTTON_HEIGHT) / 2; + FormData data = new FormData(); + data.left = new FormAttachment(0, leftOffset); + data.top = new FormAttachment(0, topOffset); + data.width = CREATE_BUTTON_WIDTH; + data.height = CREATE_BUTTON_HEIGHT; + createButton = new DACustomButton(vmList, + ImageResources.CREATE_NEW_NOMAL.getImage(), + ImageResources.CREATE_NEW_PUSH.getImage(), + ImageResources.CREATE_NEW_HOVER.getImage(), + ImageResources.CREATE_NEW_NOMAL.getImage()); + createButton.setLayoutData(data); + + createButton.addClickListener(new DACustomButtonClickEventListener(){ + @Override + public void handleClickEvent(DACustomButton button) { + VMsMainView.getInstance().drawCreateVM(); + } + }); + + vmList.setSize(LIST_WIDTH, LIST_HEIGHT); + vmList.layout(true, true); + scrolledList.layout(true, true); + } + + public void drawVMList(BaseImage base, int select, boolean isCreate) { + if (createButton != null) { + createButton.dispose(); + createButton = null; + } + + if (select == -1) { + select = 0; + } + + WIDTH_COUNT = LIST_WIDTH / (BUTTON_WIDTH + WIDTH_GAP); + + int wIndex = 0; + int hIndex = 0; + VMButtonFactory.clear(); + if (base.getVmsList().size() != 0) { + HEIGHT_COUNT = (base.getVmsList().size() + 1) / WIDTH_COUNT; + if ((base.getVmsList().size() + 1) % WIDTH_COUNT != 0) { + HEIGHT_COUNT++; + } + + if (((BUTTON_HEIGHT + HEIGHT_GAP) * HEIGHT_COUNT) > LIST_HEIGHT) { + vmList.setSize(LIST_WIDTH, ((BUTTON_HEIGHT + HEIGHT_GAP) * HEIGHT_COUNT) + HEIGHT_GAP); + } else { + vmList.setSize(LIST_WIDTH, LIST_HEIGHT); + } + + FormData data = null; + VMButton button = null; + for (int i = 0; i < base.getVmsList().size(); i++) { + data = new FormData(); + data.left = new FormAttachment(0, WIDTH_GAP + (BUTTON_WIDTH + WIDTH_GAP) * wIndex); + data.top = new FormAttachment(0, HEIGHT_GAP + (BUTTON_HEIGHT + HEIGHT_GAP) * hIndex); + data.width = BUTTON_WIDTH; + data.height = BUTTON_HEIGHT; + button = VMButtonFactory.getButton(vmList); + button.setProperty(base.getVmsList().get(i)); + button.setLayoutData(data); + if (i == select) { + VMButtonFactory.clickVMButton(button); + } + + button.redraw(); + ++wIndex; + if (wIndex == WIDTH_COUNT) { + wIndex = 0; + hIndex++; + } + } + } + + // add create button + addNewButton = VMButtonFactory.getCreateButton(vmList); + if (isCreate) { + addNewButton.setEnabled(false); + } else { + addNewButton.setEnabled(true); + } + addNewButton.addClickListener(new DACustomButtonClickEventListener(){ + @Override + public void handleClickEvent(DACustomButton button) { + clickCreateButton(); + } + }); + + FormData data = new FormData(); + data.left = new FormAttachment(0, WIDTH_GAP + (BUTTON_WIDTH + WIDTH_GAP) * wIndex); + data.top = new FormAttachment(0, HEIGHT_GAP + (BUTTON_HEIGHT + HEIGHT_GAP) * hIndex); + data.width = BUTTON_WIDTH; + data.height = BUTTON_HEIGHT; + addNewButton.setLayoutData(data); + + vmList.layout(true, true); + scrolledList.layout(true, true); + } + + private void clickCreateButton() { + VMButtonFactory.clickVMButton(addNewButton); + addNewButton.setEnabled(false); + VMsMainView.getInstance().drawCreateVM(); + } + + public void controlKeyEvent(KeyEvent event) { + switch (event.keyCode) { + case SWT.CR: + case SWT.KEYPAD_CR: + if (VMButtonFactory.getSelectedButton() instanceof VMCreateButton) { + clickCreateButton(); + } else { + VMsMainView.getInstance().launchEmulator(null); + } + break; + case SWT.ARROW_UP: + int size = VMButtonFactory.getButtonList().size(); + int index = VMButtonFactory.getSelectedButtonIndex() - WIDTH_COUNT; + if (index >= 0) { + VMButtonFactory.clickVMButton(index); + } + break; + case SWT.ARROW_DOWN: + size = VMButtonFactory.getButtonList().size(); + index = VMButtonFactory.getSelectedButtonIndex() + WIDTH_COUNT; + if (index < size) { + VMButtonFactory.clickVMButton(index); + } else { + VMButtonFactory.clickVMButton(VMButtonFactory.getButtonList().size() - 1); + } + break; + case SWT.ARROW_LEFT: + size = VMButtonFactory.getButtonList().size(); + index = VMButtonFactory.getSelectedButtonIndex() - 1; + if (index >= 0) { + VMButtonFactory.clickVMButton(index); + } + break; + case SWT.ARROW_RIGHT: + size = VMButtonFactory.getButtonList().size(); + index = VMButtonFactory.getSelectedButtonIndex() + 1; + if (index < size) { + VMButtonFactory.clickVMButton(index); + } + break; + case SWT.DEL: + if (VMButtonFactory.getSelectedButton() instanceof VMCreateButton) { + // nothing + } else { + VMsMainView.getInstance().deleteEmulator(); + } + break; + case SWT.ESC: + if (!VMsMainView.getInstance().isCreateMode()) { + VMsMainView.getInstance().drawDetailVM(); + } + } + scrolledList.showControl(VMButtonFactory.getSelectedButton()); + } + + public void cancelModify(int index) { + if (addNewButton != null && !addNewButton.isDisposed()) { + addNewButton.setEnabled(true); + } + if (index >= 0) { + VMButtonFactory.clickVMButton(index); + } + MainDialog.getStatusBar().reset(); + dumyText.setFocus(); + } + + public void cancelModify() { + cancelModify(-1); + } + + public void draw() { + vmList.layout(true, true); + scrolledList.layout(true, true); + } + + public void close() { + imageCombo.dispose(); + VMButtonFactory.clear(); + + vmList.dispose(); + scrolledList.dispose(); + listView.dispose(); + } +} diff --git a/src/org/tizen/emulator/manager/ui/VMsMainView.java b/src/org/tizen/emulator/manager/ui/VMsMainView.java new file mode 100644 index 0000000..85e4352 --- /dev/null +++ b/src/org/tizen/emulator/manager/ui/VMsMainView.java @@ -0,0 +1,294 @@ +package org.tizen.emulator.manager.ui; +import org.eclipse.swt.SWT; +import org.eclipse.swt.layout.FormAttachment; +import org.eclipse.swt.layout.FormData; +import org.eclipse.swt.layout.FormLayout; +import org.eclipse.swt.widgets.Composite; +import org.tizen.emulator.manager.logging.EMLogger; +import org.tizen.emulator.manager.platform.BaseImage; +import org.tizen.emulator.manager.platform.Platform; +import org.tizen.emulator.manager.resources.StringResources; +import org.tizen.emulator.manager.tool.SelectTemplate; +import org.tizen.emulator.manager.ui.dialog.MessageDialog; +import org.tizen.emulator.manager.vms.Creator; +import org.tizen.emulator.manager.vms.VMProperty; +import org.tizen.emulator.manager.vms.VMPropertyValue; +import org.tizen.emulator.manager.vms.VMWorkerException; + +public class VMsMainView { + private Composite mainView; + private VMsListView listView; + private VMsDetailView detailView; + + private boolean isInitialize = false; + private boolean isCreateMode = false; + + private static VMsMainView view = new VMsMainView(); + public static VMsMainView getInstance() { + return view; + } + + private VMsMainView() {} + + public Composite getComposite() { + return mainView; + } + /** + * parent를 이용해서 VMsMainView를 initialize 한다. + * if 이미 초기화 된 경우에는 ??? 현재는 기존 view 삭제 후에 다시 그린다??? + * @param parent + */ + public void setInit(Composite parent) { + if (isInitialize) { + // TODO + // dispose + } + isInitialize = true; + + mainView = new Composite(parent, SWT.NONE); + mainView.setLayout(new FormLayout()); +/* + mainView.addControlListener(new ControlListener() { + + @Override + public void controlMoved(ControlEvent e) { + } + + @Override + public void controlResized(ControlEvent e) { + Composite c = (Composite)e.widget; + Rectangle rect = c.getBounds(); + listView.getControl().setSize(rect.x - 325, rect.y); + listView.getControl().update(); + } + + }); +*/ + + listView = new VMsListView(mainView); + detailView = new VMsDetailView(mainView); + + FormData data = new FormData(); + data.left = new FormAttachment(0, 0); + data.top = new FormAttachment(0, 0); + data.bottom = new FormAttachment(100, 0); + data.width = listView.getSize().x; + listView.getComposite().setLayoutData(data); + + data = new FormData(); + data.left = new FormAttachment(listView.getComposite(), 0); + data.top = new FormAttachment(0, 0); + //data.right = new FormAttachment(100, 0); + data.bottom = new FormAttachment(100, 0); + data.width = detailView.getSize().x; + detailView.getComposite().setLayoutData(data); + } + + public void dispose() { + //TODO + listView.close(); + detailView.close(); + + mainView.dispose(); + } + + private Platform currentPlatform = null; + private BaseImage currentImage = null; + private VMProperty currentProperty = null; + + public void setPlatform(Platform platform, int index) { + this.currentPlatform = platform; + if (platform == null) { + // TODO + } + + if (platform.getImageList().isEmpty()) { + // TODO + } else { + listView.drawPlatform(platform, index); + } + } + + public void setPlatform(Platform platform) { + setPlatform(platform, 0); + } + + public void resetPlatform() { + setPlatform(currentPlatform, + currentPlatform.getImageList().indexOf(currentImage)); + } + + public Platform getPlatform() { + return currentPlatform; + } + + public void setCurrentImage(BaseImage image) { + this.currentImage = image; + } + + public BaseImage getCurrentImage() { + return currentImage; + } + + public VMProperty getCurrentProperty() { + return currentProperty; + } + + public void setCurrentProperty(VMProperty currentProperty) { + this.currentProperty = currentProperty; + } + + public void drawVMList(BaseImage image) { + currentImage = image; + if (image.getVmsList().isEmpty()) { + drawEmptyVMList(); + } else { + listView.drawVMList(image, + currentImage.getVmsList().indexOf(currentProperty), false); + } + } + + public void drawVMList(int index) { + if (currentPlatform == null) { + return; + } else { + drawVMList(currentPlatform.getImageList().get(index)); + } + } + + public void drawEmptyVMList() { + listView.drawEmptyVMList(); + detailView.drawEmptyVM(); + } + + public void drawDetailVM(VMProperty property) { + currentProperty = property; + isCreateMode = false; + listView.cancelModify(); + detailView.drawDetailVM(property); + } + + public void drawDetailVM() { + drawDetailVM(currentProperty); + } + + public void drawModifyVM(VMProperty property) { + currentProperty = property; + isCreateMode = false; + detailView.drawModifyVM(property, false); + } + + public void drawModifyVM() { + MessageDialog msg = new MessageDialog(); + if(currentProperty.getWorker().isRunningNow()) { + msg.openInfoDialog("Not allowed to modify active VMs" + + StringResources.NEW_LINE + + "[" + currentProperty.getName() + "] is running now..."); + return; + } + drawModifyVM(currentProperty); + } + + public void drawCreateVM() { + isCreateMode = true; + + if (currentImage.getVmsList().isEmpty()) { + listView.drawVMList(currentImage, -1, true); + } + + BaseImage image = (currentPlatform.getName().equals("custom")) ? null : currentImage; + detailView.drawCreateVM( + new VMPropertyValue(image, SelectTemplate.getInstance().getDefaultTemplate())); + } + + public void drawCancelCreaetVM() { + isCreateMode = false; + + if (currentImage.getVmsList().isEmpty()) { + drawEmptyVMList(); + } else { + int i = currentImage.getVmsList().indexOf(currentProperty); + listView.cancelModify(i); + detailView.drawDetailVM(currentProperty); + } + } + + public void launchEmulator(VMProperty property) { + if (property == null) { + property = getCurrentProperty(); + } + + if (property != null) { + try { + property.getWorker().launchVM(); + } catch (VMWorkerException e) { + String msg = "Failed to launch Emulator (" + + property.getPropertyValue().vmsName + + ") " + StringResources.NEW_LINE + + e.getMessage(); + EMLogger.getLogger().warning(msg); + new MessageDialog().openWarningDialog(msg); + return; + } + } + } + + public boolean createEmualtor(VMPropertyValue newValue) { + VMProperty prop = null; + try { + prop = Creator.create(newValue); + } catch (VMWorkerException e) { + String msg = "Failed to create Emulator (" + + newValue.vmsName + + ") " + StringResources.NEW_LINE + + e.getMessage(); + EMLogger.getLogger().warning(msg); + new MessageDialog().openWarningDialog(msg); + return false; + } + + setCurrentProperty(prop); + return true; + } + + public boolean modifyEmulator(VMPropertyValue newValue) { + try { + getCurrentProperty().getWorker() + .modifyVM(newValue); + } catch (VMWorkerException e) { + String msg = "Failed to modify Emulator (" + + newValue.vmsName + + ") " + StringResources.NEW_LINE + + e.getMessage(); + EMLogger.getLogger().warning(msg); + new MessageDialog().openWarningDialog(msg); + return false; + } + return true; + } + + private MenuHandling handling = new MenuHandling(); + public boolean createBaseImage() { + handling.createBaseImage(currentProperty); + return true; + } + + public boolean deleteEmulator() { + handling.deleteVirtualMachine(currentProperty); + MainDialog.refreshVMPropertyList(); + return true; + } + + public boolean resetEmulator() { + handling.resetVirtualMachine(currentProperty); + return true; + } + + public boolean isCreateMode() { + return isCreateMode; + } + + public void setCreateMode(boolean isCreateMode) { + this.isCreateMode = isCreateMode; + } +} diff --git a/src/org/tizen/emulator/manager/ui/detail/DetailTableView.java b/src/org/tizen/emulator/manager/ui/detail/DetailTableView.java deleted file mode 100644 index d2149c5..0000000 --- a/src/org/tizen/emulator/manager/ui/detail/DetailTableView.java +++ /dev/null @@ -1,282 +0,0 @@ -/* - * Emulator Manager - * - * Copyright (C) 2011 - 2012 Samsung Electronics Co., Ltd. All rights reserved. - * - * Contact: - * MunKyu Im - * SeokYeon Hwang - * JiHye Kim - * YeongKyoon Lee - * - * 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.detail; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Point; -import org.eclipse.swt.layout.FillLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Event; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Listener; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Table; -import org.eclipse.swt.widgets.TableColumn; -import org.eclipse.swt.widgets.TableItem; -import org.tizen.emulator.manager.image.BaseImage; -import org.tizen.emulator.manager.tool.StringResource; -import org.tizen.emulator.manager.ui.MainDialog; -import org.tizen.emulator.manager.vms.VMsProperty; - -public class DetailTableView { - static final int[] DEFAULT_WEIGHT = new int[] { 60, 40 }; - static final int[] STATUS_CLOSE_WEIGHT = new int[] { 100, 0 }; - - private MainDialog mainDialog; - private Table detailTable; - private TableColumn tableColumn; - - private boolean isDetailOpened = false; - - private boolean isCreateState = false; - private boolean isModifyState = false; - - private VMsProperty currentProperty; - private VMPropertyView vmView = null; - private int[] weight = new int[] { 60, 40 }; - - // Implement a "fake" tooltip - final Listener labelListener = new Listener() { - public void handleEvent(Event event) { - Label label = (Label) event.widget; - Shell shell = label.getShell(); - switch (event.type) { - case SWT.MouseDown: - Event e = new Event(); - e.item = (TableItem) label.getData("_TABLEITEM"); - // Assuming table is single select, set the selection as if - // the mouse down event went through to the table - detailTable.setSelection(new TableItem[] { (TableItem) e.item }); - detailTable.notifyListeners(SWT.Selection, e); - // fall through - case SWT.MouseExit: - shell.dispose(); - break; - } - } - }; - - Listener tableListener = new Listener() { - Shell tip = null; - - Label label = null; - - public void handleEvent(Event event) { - switch (event.type) { - case SWT.Dispose: - case SWT.KeyDown: - case SWT.MouseMove: { - if (tip == null) - break; - tip.dispose(); - tip = null; - label = null; - break; - } - case SWT.MouseHover: { - TableItem item = detailTable.getItem(new Point(event.x, event.y)); - if (item != null) { - String tooltip = vmView.getToolTipText(item.getText(0)); - if (tooltip != null && !tooltip.isEmpty()) { - if (tip != null && !tip.isDisposed()) - tip.dispose(); - tip = new Shell(mainDialog.getShell(), SWT.ON_TOP | SWT.TOOL); - tip.setLayout(new FillLayout()); - label = new Label(tip, SWT.NONE); - label.setForeground(Display.getCurrent() - .getSystemColor(SWT.COLOR_INFO_FOREGROUND)); - label.setBackground(Display.getCurrent() - .getSystemColor(SWT.COLOR_INFO_BACKGROUND)); - label.setData("_TABLEITEM", item); - label.setText(tooltip); - label.addListener(SWT.MouseExit, labelListener); - label.addListener(SWT.MouseDown, labelListener); - Point size = tip.computeSize(SWT.DEFAULT, SWT.DEFAULT); - //Rectangle rect = item.getBounds(0); - Point pt = detailTable.toDisplay(event.x, event.y); - tip.setBounds(pt.x + 8, pt.y + 8, size.x, size.y); - tip.setVisible(true); - } - } - } - } - } - }; - - public DetailTableView(MainDialog mainDialog) { - this.mainDialog = mainDialog; - } - - public void createDetailView(Shell shell, Composite rightView) { - detailTable = new Table(rightView, SWT.BORDER); - detailTable.setHeaderVisible(true); - detailTable.setLinesVisible(false); - detailTable.addListener(SWT.MeasureItem, new Listener() { - @Override - public void handleEvent(Event event) { - // TODO - event.height = 25; - } - }); - - detailTable.addListener(SWT.Dispose, tableListener); - detailTable.addListener(SWT.KeyDown, tableListener); - detailTable.addListener(SWT.MouseMove, tableListener); - detailTable.addListener(SWT.MouseHover, tableListener); - - tableColumn = new TableColumn(detailTable, SWT.NONE); - tableColumn.setText(StringResource.DETAIL); - TableColumn tableColumn2 = new TableColumn(detailTable, SWT.NONE); - tableColumn2.setText(""); - //TableColumn tableColumn3 = new TableColumn(detailTable, SWT.NONE); - //tableColumn3.setText(""); - vmView = new VMPropertyView(detailTable); - } - - public VMsProperty getCurrentPoperty() { - return currentProperty; - } - - public void openDetailView(VMsProperty property) - { - if (isModifyState) { - closeModifyView(); - } else if (isCreateState) { - closeCreateView(); - } - - currentProperty = property; - detailTable.setEnabled(true); - tableColumn.setText(StringResource.DETAIL); - - vmView.detailView(property); - - detailTable.getColumn(0).pack(); - detailTable.getColumn(1).pack(); - - if(!isDetailOpened) { - mainDialog.setDetailViewWeights(weight); - isDetailOpened = true; - } - } - - public void closeDetailView() - { - if (isModifyState) { - closeModifyView(); - } else if (isCreateState) { - closeCreateView(); - } - - if(isDetailOpened) { - weight = mainDialog.getSashFormWeight(); - mainDialog.setDetailViewWeights(STATUS_CLOSE_WEIGHT); - isDetailOpened = false; - } - } - - public void openModifyView(VMsProperty property, Button confirmButton) - { - isModifyState = true; - tableColumn.setText(StringResource.MODIFY); - - // TODO : error - if (vmView == null) { - return; - } - vmView.modifyView(confirmButton); - } - - public void closeModifyView() - { - isModifyState = false; - - if (vmView != null) { - vmView.close(); - } - } - - public void openCreateDetailView(BaseImage image, VMsProperty template) { - if (isModifyState) { - closeModifyView(); - } else if (isCreateState) { - closeCreateView(); - } - - currentProperty = null; - tableColumn.setText(StringResource.DETAIL); - - vmView.createDetailView(image, template); - - detailTable.getColumn(0).pack(); - detailTable.getColumn(1).pack(); - - detailTable.setEnabled(false); - if (!isDetailOpened) { - mainDialog.setDetailViewWeights(weight); - isDetailOpened = true; - } - } - - - public void openCreateView(Button confirmButton) { - isCreateState = true; - - tableColumn.setText(StringResource.CREATE); - detailTable.setEnabled(true); - - // TODO : error - if (vmView == null) { - return; - } - - vmView.createView(confirmButton); - } - - public void closeCreateView() - { - isCreateState = false; - - if (vmView != null) { - vmView.close(); - } - } - - public VMsProperty confirm() { - return vmView.confirm(); - } - - public void setLayoutData(Object data) { - detailTable.setLayoutData(data); - } -} diff --git a/src/org/tizen/emulator/manager/ui/detail/DetailViewItem.java b/src/org/tizen/emulator/manager/ui/detail/DetailViewItem.java new file mode 100644 index 0000000..d81ad42 --- /dev/null +++ b/src/org/tizen/emulator/manager/ui/detail/DetailViewItem.java @@ -0,0 +1,330 @@ +package org.tizen.emulator.manager.ui.detail; + +import java.util.ArrayList; + +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.FormAttachment; +import org.eclipse.swt.layout.FormData; +import org.eclipse.swt.layout.FormLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Label; +import org.tizen.emulator.manager.da.widgets.button.DACustomButton; +import org.tizen.emulator.manager.da.widgets.button.DACustomButtonClickEventListener; +import org.tizen.emulator.manager.da.widgets.button.toggle.DACustomToggleButton; +import org.tizen.emulator.manager.resources.ColorResources; +import org.tizen.emulator.manager.resources.FontResources; +import org.tizen.emulator.manager.resources.ImageResources; +import org.tizen.emulator.manager.vms.VMPropertyValue; + +class DetailItemList { + private static ArrayList list = null; + public static ArrayList getItemList() { + //if (list == null) { + makeList(); + //} + return list; + } + + private static void makeList() { + list = new ArrayList(); + + list.add(new TNameTextItem()); + list.add(new TDisplayItem()); + list.add(new TRAMItem()); + list.add(new TTouchPointItem()); + list.add(new TFileShareItem()); + list.add(new THWSupportItem()); + } +} + +public abstract class DetailViewItem { + protected Composite comp = null; + protected DetailViewItem upperItem = null; + protected DetailViewItem downItem = null; + protected Label titleLabel; + protected String title; + private boolean isCreateMode; + private boolean isMinMode = false; + + private DACustomToggleButton arrowButton; + protected int count; + + protected DetailViewItem item; + + // for modify + private DetailViewItemChangeListener listener; + + public DetailViewItemChangeListener getListener() { + return listener; + } + + public void setListener(DetailViewItemChangeListener listener) { + this.listener = listener; + } + + public DetailViewItem() { + this.item = this; + } + + public DetailViewItem getThis() { + return item; + } + + public void setDownItem(DetailViewItem down) { + this.downItem = down; + } + + protected ArrayList compList = new ArrayList(); + protected static int ITEM_HEIGHT = 20; + protected static int TITILE_WIDTH = 100; + + protected static int FILE_SELECT_BUTTON_WIDTH = 38; + protected static int FILE_SELECT_BUTTON_HEIGHT = 20; + protected static int TOGGLE_BUTTON_WIDTH = 38; + protected static int TOGGLE_BUTTON_HEIGHT = 20; + + protected static int INPUTBOX_OFFSET = 118; + protected static int INPUTBOX_TOP_GAP = 1; + + protected static int TITLE_TOP_GAP = 2; + protected static int TITLE_LEFT_GAP = 10; + protected static int TOP_ITEM_TOP_GAP = 3; + protected static int MIDDLE_ITEM_TOP_GAP = 7; + protected static int ITEM_LEFT_GAP = 3; + protected static int ITEM_RIGHT_GAP = -3; + + public void initItem(Composite parent, DetailViewItem upperItem) { + this.upperItem = upperItem; + Composite up; + if (upperItem != null) { + upperItem.setDownItem(this); + up = upperItem.getBottomComposite(); + } else { + up = null; + } + + init(); + + for (int i = 0; i < count; i++) { + comp = new Composite(parent, SWT.NONE); + FormData data = new FormData(); + data.left = new FormAttachment(0, ITEM_LEFT_GAP); + if(up == null) { + data.top = new FormAttachment(0, TOP_ITEM_TOP_GAP); + } else { + data.top = new FormAttachment(up, MIDDLE_ITEM_TOP_GAP); + } + data.right = new FormAttachment(100, ITEM_RIGHT_GAP); + data.height = ITEM_HEIGHT; + comp.setLayoutData(data); + comp.setLayout(new FormLayout()); + comp.setBackgroundImage(ImageResources.DETAIL_LIST_ITEM.getImage()); + + compList.add(comp); + up = comp; + } + + //comp = new Composite(parent, SWT.NONE); + /* + FormData data = new FormData(); + data.left = new FormAttachment(0, 0); + if(up == null) { + data.top = new FormAttachment(0, 0); + } else { + data.top = new FormAttachment(up, 0); + } + data.right = new FormAttachment(100, 0); + data.height =ImageResources.DETAIL_LIST_ITEM.getImage().getImageData().height * count; + comp.setLayoutData(data); + comp.setLayout(new FormLayout()); + comp.setBackgroundImage(ImageResources.DETAIL_LIST_ITEM.getImage()); + */ + + initTitle(true); + } + + private static int ARROW_BUTTON_WIDTH = 7; + private static int ARROW_BUTTON_HEIGHT = 7; + protected void initTitle(boolean supportMinMode) { + if (supportMinMode && count > 1) { + arrowButton = new DACustomToggleButton(compList.get(0), + ImageResources.ARROW_DOWN.getImage(), + ImageResources.ARROW_DOWN.getImage(), + ImageResources.ARROW_DOWN.getImage(), + null, + ImageResources.ARROW_UP.getImage(), + ImageResources.ARROW_UP.getImage()); + + FormData data = new FormData(); + data.left = new FormAttachment(0, 2); + data.top = new FormAttachment(0, 6); + data.height = ARROW_BUTTON_WIDTH; + data.width = ARROW_BUTTON_HEIGHT; + arrowButton.setLayoutData(data); + arrowButton.addClickListener(new DACustomButtonClickEventListener() { + @Override + public void handleClickEvent(DACustomButton button) { + if (arrowButton.isToggled()) { + /* + FormData data = new FormData(); + data.left = new FormAttachment(0, 0); + data.top = new FormAttachment(up, 0); + data.right = new FormAttachment(100, 0); + data.height =ImageResources.DETAIL_LIST_ITEM.getImage().getImageData().height; + compList.get(0).setLayoutData(data); + compList.get(0).getParent().layout(true, true); + */ + for (int i = 1; i < count; i++) { + FormData data = new FormData(); + data.height = 0; + compList.get(i).setLayoutData(data); + compList.get(i).getParent().layout(true, true); + } + + if (downItem != null) { + downItem.changeUpComposite(compList.get(0)); + } + } else { + /* + FormData data = new FormData(); + data.left = new FormAttachment(0, 0); + data.top = new FormAttachment(up, 0); + data.right = new FormAttachment(100, 0); + data.height =ImageResources.DETAIL_LIST_ITEM.getImage().getImageData().height * count; + compList.get(0).setLayoutData(data); + compList.get(0).getParent().layout(true, true); + */ + for (int i = 1; i < count; i++) { + FormData data = new FormData(); + data.left = new FormAttachment(0, ITEM_LEFT_GAP); + data.top = new FormAttachment(compList.get(i-1), MIDDLE_ITEM_TOP_GAP); + data.right = new FormAttachment(100, ITEM_RIGHT_GAP); + data.height = ITEM_HEIGHT; + compList.get(i).setLayoutData(data); + compList.get(i).getParent().layout(true, true); + } + if (downItem != null) { + downItem.changeUpComposite(compList.get(count-1)); + } + } + } + + }); + } + + titleLabel = new Label(compList.get(0), SWT.NONE); + titleLabel.setFont(FontResources.DETAIL_TITLE_FONT.getFont()); + titleLabel.setForeground(ColorResources.DETAIL_TITILE_FONT_COLOR.getColor()); + + FormData data = new FormData(); + data.left = new FormAttachment(0, TITLE_LEFT_GAP); + data.top = new FormAttachment(0, TITLE_TOP_GAP); + data.height = ITEM_HEIGHT; + data.width = TITILE_WIDTH; + titleLabel.setLayoutData(data); + titleLabel.setBackground(ColorResources.DETAIL_MIDDLE_COLOR.getColor()); + titleLabel.addPaintListener(new PaintListener() { + @Override + public void paintControl(PaintEvent e) { + drawTitle(e, title); + } + }); + } + + protected void drawTitle(PaintEvent e, String title) { + String text = title; + if (!titleLabel.isEnabled() || text == null) { + return; + } + + Point p = null; + + GC gc = e.gc; + gc.setFont(FontResources.DETAIL_TITLE_FONT.getFont()); + + int x = 0, y = 0; + int offset = 0; + p = gc.textExtent(text, SWT.DRAW_MNEMONIC); + x = 0; + y = (e.height - p.y) / 2; + + gc.setForeground(ColorResources.DETAIL_TITILE_FONT_COLOR.getColor()); + gc.drawText(text, x + offset , y, true); + } + + public ArrayList getCompositeList() { + return compList; + } + + public Composite getTopComposite() { + return compList.get(0); + } + + public Composite getBottomComposite() { + return compList.get(compList.size()-1); + } + + protected void changeUpComposite(Composite up) { + Composite comp = compList.get(0); + FormData data = new FormData(); + data.left = new FormAttachment(0, ITEM_LEFT_GAP); + if(up == null) { + data.top = new FormAttachment(0, TOP_ITEM_TOP_GAP); + } else { + data.top = new FormAttachment(up, MIDDLE_ITEM_TOP_GAP); + } + data.right = new FormAttachment(100, ITEM_RIGHT_GAP); + data.height = ITEM_HEIGHT; + comp.setLayoutData(data); + comp.getParent().layout(true, true); + } + + + /* + public void setEnabled(boolean enable) { + titleLabel.setEnabled(enable); + } + */ + + public boolean isCreateMode() { + return isCreateMode; + } + + public void setCreateMode(boolean isCreateMode) { + this.isCreateMode = isCreateMode; + } + + public boolean isMinMode() { + return isMinMode; + } + + public void setMinMode(boolean isMinMode) { + this.isMinMode = isMinMode; + } + + public int getCount() { + if (isMinMode) { + return 1; + } else { + return count; + } + } + + public void close() { + titleLabel.dispose(); + + closeItem(); + } + + protected abstract void init(); + public abstract void setValue(VMPropertyValue value); + public abstract void drawDetail(); + public abstract void drawModify(); + public abstract boolean settingDetailItem(VMPropertyValue value); + public abstract boolean settingModifyItem(VMPropertyValue value); + public abstract void closeItem(); +} diff --git a/src/org/tizen/emulator/manager/ui/detail/DetailViewItemChangeListener.java b/src/org/tizen/emulator/manager/ui/detail/DetailViewItemChangeListener.java new file mode 100644 index 0000000..89670c0 --- /dev/null +++ b/src/org/tizen/emulator/manager/ui/detail/DetailViewItemChangeListener.java @@ -0,0 +1,12 @@ +package org.tizen.emulator.manager.ui.detail; + +// TODO: need new name +enum State { + CREATE, MODIFY, CANCEL; +} + +public interface DetailViewItemChangeListener { + public void ChangeValue(DetailViewItem item); + public void ChangeValue(boolean isChange); + public void ChangeState(State state); +} diff --git a/src/org/tizen/emulator/manager/ui/detail/DetailViewPage.java b/src/org/tizen/emulator/manager/ui/detail/DetailViewPage.java new file mode 100644 index 0000000..250224e --- /dev/null +++ b/src/org/tizen/emulator/manager/ui/detail/DetailViewPage.java @@ -0,0 +1,116 @@ +package org.tizen.emulator.manager.ui.detail; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Font; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.FormAttachment; +import org.eclipse.swt.layout.FormData; +import org.eclipse.swt.layout.FormLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Label; +import org.tizen.emulator.manager.da.widgets.button.DACustomButton; +import org.tizen.emulator.manager.resources.ColorResources; +import org.tizen.emulator.manager.resources.FontResources; +import org.tizen.emulator.manager.resources.ImageResources; +import org.tizen.emulator.manager.resources.PatchImageResources; +import org.tizen.emulator.manager.ui.VMsDetailView; +import org.tizen.emulator.manager.vms.VMPropertyValue; + +public abstract class DetailViewPage { + protected VMsDetailView parent = null; + protected Composite view = null; + protected Composite itemListTop = null; + protected Composite itemList = null; + protected Composite buttonComp = null; + + protected int ITEM_COUNT = 11; + public DetailViewPage(VMsDetailView parent, int style) { + this.parent = parent; + view = new Composite((Composite)parent.getComposite(), style); + view.setLayout(new FormLayout()); + view.setBackground(ColorResources.DETAIL_VIEW_PAGE_COLOR.getColor()); + + itemListTop = new Composite(view, SWT.NONE); + Image topImage = ImageResources.DETAIL_LIST_TOP.getImage(); + itemListTop.setBackgroundImage(topImage); + itemListTop.setBackground(ColorResources.DETAIL_VIEW_PAGE_COLOR.getColor()); + + itemList = new Composite(view, SWT.NONE); + // TODO + Image image = PatchImageResources.getDetailListView(ITEM_COUNT); + itemList.setBackgroundImage(image); + itemList.setBackground(ColorResources.DETAIL_VIEW_PAGE_COLOR.getColor()); + + FormData data = new FormData(); + data.left = new FormAttachment(0, 10); + data.top = new FormAttachment(0, 40); + data.height = topImage.getImageData().height; + data.width = topImage.getImageData().width; + itemListTop.setLayoutData(data); + itemListTop.setLayout(new FormLayout()); + + data = new FormData(); + data.left = new FormAttachment(0, 10); + data.top = new FormAttachment(itemListTop, 0); + data.height = image.getImageData().height; + data.width = image.getImageData().width; + itemList.setSize(data.width, data.height); + itemList.setLayoutData(data); + itemList.setLayout(new FormLayout()); + + buttonComp = new Composite(view, SWT.NONE); + data = new FormData(); + data.left = new FormAttachment(0, 10); + data.top = new FormAttachment(itemList, 10); + data.right = new FormAttachment(100, -10); + data.bottom = new FormAttachment(100, -10); + buttonComp.setLayoutData(data); + buttonComp.setLayout(new FormLayout()); + // TODO + buttonComp.setBackground(ColorResources.DETAIL_VIEW_PAGE_COLOR.getColor()); + + // draw child + drawInitView(); + // + } + + public Composite getComposite() { + return view; + } + + private static int TOP_BUTTON_WIDTH = 21; + private static int TOP_BUTTON_HEIGHT = 21; + protected void makeListTop(DACustomButton button) { + Label title = new Label(itemListTop, SWT.NONE); + title.setBackground(ColorResources.DETAIL_TOP_COLOR.getColor()); + title.setForeground(ColorResources.DETAIL_TOP_FONT_COLOR.getColor()); + Font font = FontResources.DETAIL_TOP_FONT.getFont(); + title.setFont(font); + title.setText("Detail"); + + FormData data = new FormData(); + data.left = new FormAttachment(45, 0); + data.top = new FormAttachment(0, 9); + title.setLayoutData(data); + + if (null != button) { + data = new FormData(); + data.top = new FormAttachment(0, 5); + data.right = new FormAttachment(100, -6); + data.width = TOP_BUTTON_WIDTH; + data.height = TOP_BUTTON_HEIGHT; + button.setLayoutData(data); + } + } + + public void close() { + itemListTop.dispose(); + itemList.dispose(); + buttonComp.dispose(); + + view.dispose(); + } + + protected abstract void drawInitView(); + public abstract void drawPropertyView(VMPropertyValue propertyValue, boolean isCreate); +} diff --git a/src/org/tizen/emulator/manager/ui/detail/EMComboButtonRenderer.java b/src/org/tizen/emulator/manager/ui/detail/EMComboButtonRenderer.java new file mode 100644 index 0000000..8bea1d6 --- /dev/null +++ b/src/org/tizen/emulator/manager/ui/detail/EMComboButtonRenderer.java @@ -0,0 +1,29 @@ +package org.tizen.emulator.manager.ui.detail; + +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.Rectangle; +import org.tizen.emulator.manager.da.widgets.button.DACustomButtonAttribute; +import org.tizen.emulator.manager.da.widgets.button.DACustomButtonDefaultRenderer; + +public class EMComboButtonRenderer extends DACustomButtonDefaultRenderer { + + protected void drawButtonImage(GC gc, Rectangle rect, + DACustomButtonAttribute attr) { + if (attr != null && attr.getButtonImage() != null) { + Image img = attr.getButtonImage(); + Rectangle imgRect = img.getBounds(); + int width = rect.width - imgRect.width; + int height = rect.height - imgRect.height; + int x = 0, y = 0; + if (width > 0) { + x = width / 2; + } + + if (height > 0) { + y = height / 2; + } + gc.drawImage(img, x, y); + } + } +} diff --git a/src/org/tizen/emulator/manager/ui/detail/PEmptyViewPage.java b/src/org/tizen/emulator/manager/ui/detail/PEmptyViewPage.java new file mode 100644 index 0000000..9a3e72e --- /dev/null +++ b/src/org/tizen/emulator/manager/ui/detail/PEmptyViewPage.java @@ -0,0 +1,44 @@ +package org.tizen.emulator.manager.ui.detail; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.layout.FormAttachment; +import org.eclipse.swt.layout.FormData; +import org.eclipse.swt.widgets.Label; +import org.tizen.emulator.manager.resources.ColorResources; +import org.tizen.emulator.manager.resources.FontResources; +import org.tizen.emulator.manager.ui.VMsDetailView; +import org.tizen.emulator.manager.vms.VMPropertyValue; + +public class PEmptyViewPage extends DetailViewPage { + public static String NO_ITEM = "No items selected"; + + public PEmptyViewPage(VMsDetailView parent, int style) { + super(parent, style); + } + + @Override + protected void drawInitView() { + makeListTop(null); + + // write message + Label title = new Label(itemList, SWT.NONE); + title.setBackground(ColorResources.DETAIL_MIDDLE_COLOR.getColor()); + title.setForeground(ColorResources.DETAIL_ENABLE_FONT_COLOR.getColor()); + title.setFont(FontResources.DETAIL_LABEL_FONT.getFont()); + title.setText(NO_ITEM); + + Point p = itemList.getSize(); + int h = (int)FontResources.DETAIL_LABEL_FONT.getFont().getFontData()[0].getHeight(); + FormData data = new FormData(); + // TODO + data.left = new FormAttachment(0, (p.x - 5 * NO_ITEM.length()) / 2); + data.top = new FormAttachment(0, (p.y - h * 2) / 2); + title.setLayoutData(data); + } + + @Override + public void drawPropertyView(VMPropertyValue propertyValue, boolean isCreate) { + // empty function + } +} diff --git a/src/org/tizen/emulator/manager/ui/detail/PInfoViewPage.java b/src/org/tizen/emulator/manager/ui/detail/PInfoViewPage.java new file mode 100644 index 0000000..318bb1e --- /dev/null +++ b/src/org/tizen/emulator/manager/ui/detail/PInfoViewPage.java @@ -0,0 +1,149 @@ +package org.tizen.emulator.manager.ui.detail; + +import java.util.ArrayList; + +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.FormAttachment; +import org.eclipse.swt.layout.FormData; +import org.tizen.emulator.manager.da.widgets.button.DACustomButton; +import org.tizen.emulator.manager.da.widgets.button.DACustomButtonClickEventListener; +import org.tizen.emulator.manager.resources.ImageResources; +import org.tizen.emulator.manager.resources.PatchImageResources; +import org.tizen.emulator.manager.resources.StringResources; +import org.tizen.emulator.manager.ui.VMsDetailView; +import org.tizen.emulator.manager.ui.VMsMainView; +import org.tizen.emulator.manager.vms.VMPropertyValue; + +public class PInfoViewPage extends DetailViewPage { + + public PInfoViewPage(VMsDetailView parent, int style) { + super(parent, style); + } + + private DACustomButton modifyButton; + @Override + protected void drawInitView() { + modifyButton = new DACustomButton(itemListTop, + ImageResources.MODIFY_BUTTON_NOMAL.getImage(), + ImageResources.MODIFY_BUTTON_PUSH.getImage(), + ImageResources.MODIFY_BUTTON_HOVER.getImage(), + null); + modifyButton.addClickListener(new DACustomButtonClickEventListener() { + @Override + public void handleClickEvent(DACustomButton button) { + VMsMainView.getInstance().drawModifyVM(); + } + }); + + makeListTop(modifyButton); + + makeDetailView(); + makeButton(); + } + + private ArrayList list; + private void makeDetailView() { + list = DetailItemList.getItemList(); + + DetailViewItem item = null; + DetailViewItem up = null; + for (int i = 0; i < list.size(); i++) { + item = list.get(i); + item.initItem(itemList, up); + item.drawDetail(); + up = item; + } + itemList.layout(true, true); + } + + private DACustomButton createButton; + private DACustomButton deleteButton; + private DACustomButton resetButton; + private static int BUTTON_WIDTH = 92; + private static int BUTTON_HEIGHT = 36; + private static Image BUTTON_IMAGE = null; + private void makeButton() { + if (BUTTON_IMAGE == null) { + BUTTON_IMAGE = PatchImageResources.getNomalButton(BUTTON_WIDTH); + } + createButton = new DACustomButton(buttonComp, + BUTTON_IMAGE, + BUTTON_IMAGE, + BUTTON_IMAGE, + null); + createButton.setText(StringResources.CREATE_IMAGE); + createButton.setEnabled(true); + + deleteButton = new DACustomButton(buttonComp, + BUTTON_IMAGE, + BUTTON_IMAGE, + BUTTON_IMAGE, + null); + deleteButton.setText(StringResources.DELETE); + deleteButton.setEnabled(true); + + resetButton = new DACustomButton(buttonComp, + BUTTON_IMAGE, + BUTTON_IMAGE, + BUTTON_IMAGE, + null); + resetButton.setText(StringResources.RESET); + resetButton.setEnabled(true); + + FormData data = new FormData(); + data.left = new FormAttachment(0, 0); + data.top = new FormAttachment(0, 0); + data.width = 92; + data.height = BUTTON_HEIGHT; + createButton.setLayoutData(data); + + data = new FormData(); + data.left = new FormAttachment(createButton, 14); + data.top = new FormAttachment(0, 0); + data.width = BUTTON_WIDTH; + data.height = BUTTON_HEIGHT; + deleteButton.setLayoutData(data); + + data = new FormData(); + data.left = new FormAttachment(deleteButton, 14); + data.top = new FormAttachment(0, 0); + data.width = BUTTON_WIDTH; + data.height = BUTTON_HEIGHT; + resetButton.setLayoutData(data); + + addButtonListener(); + } + + private void addButtonListener() { + createButton.addClickListener(new DACustomButtonClickEventListener() { + @Override + public void handleClickEvent(DACustomButton button) { + VMsMainView.getInstance().createBaseImage(); + } + }); + + deleteButton.addClickListener(new DACustomButtonClickEventListener() { + @Override + public void handleClickEvent(DACustomButton button) { + VMsMainView.getInstance().deleteEmulator(); + } + }); + + resetButton.addClickListener(new DACustomButtonClickEventListener() { + @Override + public void handleClickEvent(DACustomButton button) { + VMsMainView.getInstance().resetEmulator(); + } + }); + } + + @Override + public void drawPropertyView(VMPropertyValue propertyValue, boolean isCreate) { + assert propertyValue == null; + + for (DetailViewItem item : list) { + item.settingDetailItem(propertyValue); + } + } + +} diff --git a/src/org/tizen/emulator/manager/ui/detail/PModifyViewPage.java b/src/org/tizen/emulator/manager/ui/detail/PModifyViewPage.java new file mode 100644 index 0000000..27e7714 --- /dev/null +++ b/src/org/tizen/emulator/manager/ui/detail/PModifyViewPage.java @@ -0,0 +1,184 @@ +package org.tizen.emulator.manager.ui.detail; + +import java.util.ArrayList; + +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.FormAttachment; +import org.eclipse.swt.layout.FormData; +import org.tizen.emulator.manager.da.widgets.button.DACustomButton; +import org.tizen.emulator.manager.da.widgets.button.DACustomButtonClickEventListener; +import org.tizen.emulator.manager.logging.EMLogger; +import org.tizen.emulator.manager.resources.ColorResources; +import org.tizen.emulator.manager.resources.ImageResources; +import org.tizen.emulator.manager.resources.PatchImageResources; +import org.tizen.emulator.manager.resources.StringResources; +import org.tizen.emulator.manager.ui.MainDialog; +import org.tizen.emulator.manager.ui.VMsDetailView; +import org.tizen.emulator.manager.ui.VMsMainView; +import org.tizen.emulator.manager.ui.dialog.MessageDialog; +import org.tizen.emulator.manager.vms.VMProperty; +import org.tizen.emulator.manager.vms.VMPropertyValue; + +public class PModifyViewPage extends DetailViewPage + implements DetailViewItemChangeListener { + + public PModifyViewPage(VMsDetailView parent, int style) { + super(parent, style); + } + + private DACustomButton cancelButton; + private boolean isCreateMode = false; + + @Override + protected void drawInitView() { + cancelButton = new DACustomButton(itemListTop, + ImageResources.CANCEL_BUTTON_NOMAL.getImage(), + ImageResources.CANCEL_BUTTON_PUSH.getImage(), + ImageResources.CANCEL_BUTTON_HOVER.getImage(), + null); + cancelButton.addClickListener(new DACustomButtonClickEventListener() { + @Override + public void handleClickEvent(DACustomButton button) { + cancelModify(); + } + }); + + makeListTop(cancelButton); + + makeModifyView(); + makeButton(); + } + + protected void cancelModify() { + if (isCreateMode) { + VMsMainView.getInstance().drawCancelCreaetVM(); + isCreateMode = false; + } else { + VMsMainView.getInstance().drawDetailVM(); + } + } + + private ArrayList list; + private void makeModifyView() { + list = DetailItemList.getItemList(); + + DetailViewItem item = null; + DetailViewItem up = null; + for (int i = 0; i < list.size(); i++) { + item = list.get(i); + item.initItem(itemList, up); + item.drawModify(); + item.setListener(this); + up = item; + } + + itemList.layout(true, true); + } + + private static int CONFIRM_BUTTON_WIDTH = 303; + private static int CONFIRM_BUTTON_HEIGHT = 36; + private static Image CONFIRM_BUTTON_IMAGE = null; + private DACustomButton confirmButton; + + private void makeButton() { + if (CONFIRM_BUTTON_IMAGE == null) { + CONFIRM_BUTTON_IMAGE = PatchImageResources.getNomalButton(CONFIRM_BUTTON_WIDTH); + } + confirmButton = new DACustomButton(buttonComp, + CONFIRM_BUTTON_IMAGE, + CONFIRM_BUTTON_IMAGE, + CONFIRM_BUTTON_IMAGE, + CONFIRM_BUTTON_IMAGE); + confirmButton.setText(StringResources.CONFIRM); + confirmButton.setEnabled(false); + confirmButton.setFontColor(DACustomButton.STATE_DISABLE, + ColorResources.BUTTON_DISABLE_FONT_COLOR.getColor()); + + FormData data = new FormData(); + data.left = new FormAttachment(0, 0); + data.top = new FormAttachment(0, 0); + data.height = CONFIRM_BUTTON_HEIGHT; + data.width = CONFIRM_BUTTON_WIDTH; + confirmButton.setLayoutData(data); + + confirmButton.addClickListener(new DACustomButtonClickEventListener() { + @Override + public void handleClickEvent(DACustomButton button) { + modifyVMProperty(); + } + }); + } + + private void modifyVMProperty() { + for (DetailViewItem item : list) { + item.setValue(newValue); + } + // dpi check + if (newValue.dpi < VMProperty.MIN_DPI + || newValue.dpi > VMProperty.MAX_DPI) { + String msg = "Invalid value." + + StringResources.NEW_LINE + "Display Density should be from 100 to 480"; + EMLogger.getLogger().warning(msg); + new MessageDialog().openWarningDialog(msg); + return; + } + + if (isCreateMode) { + if (!VMsMainView.getInstance().createEmualtor(newValue)) { + return; + } + } else { + if (!VMsMainView.getInstance().modifyEmulator(newValue)) { + return; + } + } + + MainDialog.refreshVMPropertyList(); + } + + VMPropertyValue oldValue; + VMPropertyValue newValue; + @Override + public void drawPropertyView(VMPropertyValue propertyValue, boolean isCreate) { + assert propertyValue == null; + + confirmButton.setEnabled(false); + buttonComp.layout(true, true); + + isCreateMode = isCreate; + oldValue = propertyValue; + newValue = oldValue.clone(); + for (DetailViewItem item : list) { + item.setCreateMode(isCreate); + item.settingModifyItem(propertyValue); + } + } + + // DetailViewItemChangeListner + @Override + public void ChangeValue(DetailViewItem item) { + item.setValue(newValue); + if (!oldValue.equals(newValue)) { + confirmButton.setEnabled(true); + } else { + confirmButton.setEnabled(false); + } + } + + @Override + public void ChangeValue(boolean isChange) { + confirmButton.setEnabled(isChange); + } + + @Override + public void ChangeState(State state) { + if (state == State.CREATE) { + if (confirmButton.isEnabled()) { + modifyVMProperty(); + } + } else if (state == State.CANCEL) { + cancelModify(); + } + } + // +} diff --git a/src/org/tizen/emulator/manager/ui/detail/TDisplayItem.java b/src/org/tizen/emulator/manager/ui/detail/TDisplayItem.java new file mode 100644 index 0000000..aa190cc --- /dev/null +++ b/src/org/tizen/emulator/manager/ui/detail/TDisplayItem.java @@ -0,0 +1,412 @@ +package org.tizen.emulator.manager.ui.detail; + +import java.util.ArrayList; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.ModifyEvent; +import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.FormAttachment; +import org.eclipse.swt.layout.FormData; +import org.eclipse.swt.layout.FormLayout; +import org.eclipse.swt.widgets.Spinner; +import org.tizen.emulator.manager.EmulatorManager; +import org.tizen.emulator.manager.EmulatorManager.ManagerModeType; +import org.tizen.emulator.manager.da.widgets.combo.DACustomCombo; +import org.tizen.emulator.manager.da.widgets.combo.DACustomComboSelectionListener; +import org.tizen.emulator.manager.da.widgets.combo.TitleComboPopupRenderer; +import org.tizen.emulator.manager.platform.Skin; +import org.tizen.emulator.manager.platform.SkinList; +import org.tizen.emulator.manager.resources.ColorResources; +import org.tizen.emulator.manager.resources.FontResources; +import org.tizen.emulator.manager.resources.ImageResources; +import org.tizen.emulator.manager.resources.PatchImageResources; +import org.tizen.emulator.manager.ui.widgets.ImageLabel; +import org.tizen.emulator.manager.ui.widgets.ModifyViewCombo; +import org.tizen.emulator.manager.ui.widgets.ModifyViewComboRenderer; +import org.tizen.emulator.manager.vms.RESOLUTION; +import org.tizen.emulator.manager.vms.SKIN_TYPE; +import org.tizen.emulator.manager.vms.VMPropertyValue; + +public class TDisplayItem extends DetailViewItem { + private RESOLUTION oldResolution; + private RESOLUTION newResolution; + private int oldDPI; + private int newDPI; + private Skin oldSkin; + private Skin newSkin; + + @Override + public void init() { + title = "Display"; + count = 3; + } + + @Override + public void setValue(VMPropertyValue value) { + value.resolution = newResolution; + value.dpi = newDPI; + value.skin = newSkin; + if (newSkin != null) { + value.skinPath = newSkin.getPath(); + } else { + value.skinPath = null; + } + } + + private ImageLabel reCategory; + private ImageLabel dpiCategory; + private ImageLabel skinCategory; + private ImageLabel resolution; + private ImageLabel dpi; + private ImageLabel skin; + + private static int CATEGORY_WIDTH = 66; + private static int INPUTBOX_WIDTH = 110; + private static Image CATEGORY_IMAGE = null; + private static Image INPUTBOX_ON_IMAGE = null; + private static Image INPUTBOX_OFF_IMAGE = null; + + private void drawCategory() { + if (CATEGORY_IMAGE == null) { + CATEGORY_IMAGE = PatchImageResources.getCategoryBox(CATEGORY_WIDTH); + } + + reCategory = new ImageLabel(compList.get(0), SWT.NONE); + reCategory.setText("Resolution"); + reCategory.setImage(ImageLabel.STATE_ENABLE, CATEGORY_IMAGE); + reCategory.setFont(FontResources.DETAIL_LABEL_FONT.getFont()); + reCategory.setForeground(ColorResources.DETAIL_CATEGORY_FONT_COLOR.getColor()); + FormData data = new FormData(); + data.left = new FormAttachment(0, INPUTBOX_OFFSET); + data.top = new FormAttachment(0, INPUTBOX_TOP_GAP + 1); + data.width = reCategory.getSize().x; + data.height = reCategory.getSize().y; + reCategory.setLayoutData(data); + + dpiCategory = new ImageLabel(compList.get(1), SWT.NONE); + dpiCategory.setText("Density"); + dpiCategory.setImage(ImageLabel.STATE_ENABLE, CATEGORY_IMAGE); + dpiCategory.setFont(FontResources.DETAIL_LABEL_FONT.getFont()); + dpiCategory.setForeground(ColorResources.DETAIL_CATEGORY_FONT_COLOR.getColor()); + data = new FormData(); + data.left = new FormAttachment(0, INPUTBOX_OFFSET); + data.top = new FormAttachment(0, INPUTBOX_TOP_GAP + 1); + data.width = dpiCategory.getSize().x; + data.height = dpiCategory.getSize().y; + dpiCategory.setLayoutData(data); + + skinCategory = new ImageLabel(compList.get(2), SWT.NONE); + skinCategory.setText("Skin"); + skinCategory.setImage(ImageLabel.STATE_ENABLE, CATEGORY_IMAGE); + skinCategory.setFont(FontResources.DETAIL_LABEL_FONT.getFont()); + skinCategory.setForeground(ColorResources.DETAIL_CATEGORY_FONT_COLOR.getColor()); + + data = new FormData(); + data.left = new FormAttachment(0, INPUTBOX_OFFSET); + data.top = new FormAttachment(0, INPUTBOX_TOP_GAP + 1); + data.width = skinCategory.getSize().x; + data.height = skinCategory.getSize().y; + skinCategory.setLayoutData(data); + } + + @Override + public void drawDetail() { + drawCategory(); + + if (INPUTBOX_OFF_IMAGE == null) { + INPUTBOX_OFF_IMAGE = PatchImageResources.getInputBoxOff(INPUTBOX_WIDTH); + } + + resolution = new ImageLabel(compList.get(0), SWT.NONE); + resolution.setImage(ImageLabel.STATE_ENABLE, INPUTBOX_OFF_IMAGE); + + FormData data = new FormData(); + data.left = new FormAttachment(reCategory, 4); + data.top = new FormAttachment(0, INPUTBOX_TOP_GAP); + data.width = resolution.getSize().x; + data.height = resolution.getSize().y; + resolution.setLayoutData(data); + + dpi = new ImageLabel(compList.get(1), SWT.NONE); + dpi.setImage(ImageLabel.STATE_ENABLE, INPUTBOX_OFF_IMAGE); + + data = new FormData(); + data.left = new FormAttachment(dpiCategory, 4); + data.top = new FormAttachment(0, INPUTBOX_TOP_GAP); + data.width = dpi.getSize().x; + data.height = dpi.getSize().y; + dpi.setLayoutData(data); + + skin = new ImageLabel(compList.get(2), SWT.NONE); + skin.setImage(ImageLabel.STATE_ENABLE, INPUTBOX_OFF_IMAGE); + + data = new FormData(); + data.left = new FormAttachment(skinCategory, 4); + data.top = new FormAttachment(0, INPUTBOX_TOP_GAP); + data.width = skin.getSize().x; + data.height = skin.getSize().y; + skin.setLayoutData(data); + } + + private DACustomCombo reCombo = null; + private Spinner dpiSpinner = null; + private DACustomCombo skinCombo = null; + @Override + public void drawModify() { + drawCategory(); + + if (INPUTBOX_ON_IMAGE == null) { + INPUTBOX_ON_IMAGE = PatchImageResources.getInputBoxON(INPUTBOX_WIDTH); + } + + reCombo = new ModifyViewCombo(compList.get(0), SWT.NONE); + reCombo.setImages(INPUTBOX_ON_IMAGE, + INPUTBOX_ON_IMAGE, + INPUTBOX_ON_IMAGE, + INPUTBOX_ON_IMAGE); + reCombo.setButtonImages(ImageResources.ARROW_DROPDOWN.getImage(), null); + reCombo.setEnabled(true); + + // TODO + reCombo.setComboRender(new ModifyViewComboRenderer()); + reCombo.setComboPopupRender(new TitleComboPopupRenderer()); + reCombo.setItemHeight(INPUTBOX_ON_IMAGE.getImageData().height); + // + + FormData data = new FormData(); + data.left = new FormAttachment(reCategory, 4); + data.top = new FormAttachment(0, INPUTBOX_TOP_GAP); + data.width = INPUTBOX_ON_IMAGE.getImageData().width; + data.height = INPUTBOX_ON_IMAGE.getImageData().height; + reCombo.setLayoutData(data); + + dpi = new ImageLabel(compList.get(1), SWT.NONE); + dpi.setImage(ImageLabel.STATE_ENABLE, INPUTBOX_ON_IMAGE); + + data = new FormData(); + data.left = new FormAttachment(dpiCategory, 4); + data.top = new FormAttachment(0, INPUTBOX_TOP_GAP); + data.width = dpi.getSize().x; + data.height = dpi.getSize().y; + dpi.setLayoutData(data); + + dpi.setLayout(new FormLayout()); + + dpiSpinner = new Spinner(dpi, SWT.NONE); + dpiSpinner.setValues(0, 0, 999, 0, 1, 1); + dpiSpinner.setTextLimit(3); + + dpiSpinner.setBackground(ColorResources.DETAIL_INPUT_BOX_COLOR.getColor()); + dpiSpinner.setFont(FontResources.DETAIL_LABEL_FONT.getFont()); + dpiSpinner.setForeground(ColorResources.DETAIL_ENABLE_FONT_COLOR.getColor()); + + data = new FormData(); + data.left = new FormAttachment(0, 5); + data.top = new FormAttachment(0, 1); + data.right = new FormAttachment(100, -2); + data.bottom = new FormAttachment(100, -2); + dpiSpinner.setLayoutData(data); + + + skinCombo = new ModifyViewCombo(compList.get(2), SWT.NONE); + skinCombo.setImages(INPUTBOX_ON_IMAGE, + INPUTBOX_ON_IMAGE, + INPUTBOX_ON_IMAGE, + INPUTBOX_ON_IMAGE); + skinCombo.setButtonImages(ImageResources.ARROW_DROPDOWN.getImage(), null); + skinCombo.setEnabled(true); + + skinCombo.setComboRender(new ModifyViewComboRenderer()); + skinCombo.setComboPopupRender(new TitleComboPopupRenderer()); + skinCombo.setItemHeight(INPUTBOX_ON_IMAGE.getImageData().height); + // + + data = new FormData(); + data.left = new FormAttachment(skinCategory, 4); + data.top = new FormAttachment(0, INPUTBOX_TOP_GAP); + data.width = INPUTBOX_ON_IMAGE.getImageData().width; + data.height = INPUTBOX_ON_IMAGE.getImageData().height; + skinCombo.setLayoutData(data); + + addWidgetListener(); + } + + private void addWidgetListener() { + reCombo.addSelectionListener(new DACustomComboSelectionListener() { + @Override + public void selectionEvent(DACustomCombo combo) { + String re = combo.getText(); + reCombo.setToolTipText(combo.getText()); + + RESOLUTION d = DisplayResolution.getInstance().findResolution(re); + if (d != null) { + newResolution = d; + changeResolution(d); + } + + if (!isCreateMode()) { + getListener().ChangeValue(getThis()); + } + } + }); + + dpiSpinner.addModifyListener(new ModifyListener() { + @Override + public void modifyText(ModifyEvent e) { + newDPI = dpiSpinner.getSelection(); + if (!isCreateMode()) { + getListener().ChangeValue(getThis()); + } + } + }); + + skinCombo.addSelectionListener(new DACustomComboSelectionListener() { + @Override + public void selectionEvent(DACustomCombo combo) { + String name = combo.getText(); + skinCombo.setToolTipText(combo.getText()); + + newSkin = SkinList.getInstance().findSkinUseName(name); + if (newSkin == null && name.equals(oldSkin)) { + newSkin = oldSkin; + } + + if (!isCreateMode()) { + getListener().ChangeValue(getThis()); + } + } + }); + } + + @Override + public void closeItem() { + reCategory.dispose(); + dpiCategory.dispose(); + skinCategory.dispose(); + if (resolution != null) { + resolution.dispose(); + } + if (dpi != null) { + dpi.dispose(); + } + if (skin != null) { + skin.dispose(); + } + + if (reCombo != null) { + reCombo.dispose(); + } + + if (dpiSpinner != null) { + dpiSpinner.dispose(); + } + + if (skinCombo != null) { + skinCombo.dispose(); + } + } + + @Override + public boolean settingDetailItem(VMPropertyValue value) { + resolution.setText(value.resolution.getStrTypeValue()); + resolution.setToolTipText(value.resolution.getStrTypeValue()); + + dpi.setText(Integer.toString(value.dpi)); + + skin.setText(value.skin.getName()); + skin.setToolTipText(value.skin.getName()); + + return false; + } + + @Override + public boolean settingModifyItem(VMPropertyValue value) { + oldResolution = newResolution = value.resolution; + newDPI = oldDPI = value.dpi; + newSkin = oldSkin = value.skin; + + //RESOLUTION + DisplayResolution.getInstance().initialize(oldResolution); + reCombo.initCombo(); + + String r = null; + int f = -1; + for (int i = 0; i < DisplayResolution.getInstance().getList().length; i++) { + r = DisplayResolution.getInstance().get(i); + if (r.equals(oldResolution.toString())) { + f = i; + } + reCombo.add(r); + } + + if (f == -1) { + reCombo.add(oldResolution.toString(), 0); + f = 0; + } + reCombo.select(f); + reCombo.setToolTipText(reCombo.getText()); + + // DPI + dpiSpinner.setSelection(value.dpi); + + // SKIN + settingSkinList(value.resolution); + + return true; + } + + private void settingSkinList(RESOLUTION re) { + skinCombo.initCombo(); + + int find = -1; + ArrayList skinList = null; + + if (!isCreateMode() + && !DisplayResolution.getInstance().isMinResoluion(re) + && EmulatorManager.getManagerMode() != ManagerModeType.INHOUSE_MODE) { + skinCombo.add(oldSkin.toString()); + find = 0; + } else { + skinList + = SkinList.getInstance().findSkinList(re); + + Skin s = null; + for (int i = 0; i < skinList.size(); i++) { + s = skinList.get(i); + if (newSkin != null && newSkin.equals(s)) { + find = i; + } + skinCombo.add(s.toString()); + } + + if (find == -1) { + if (newSkin != null + && newSkin.getType() == SKIN_TYPE.GENERAL) { + skinList.add(0, newSkin); + skinCombo.add(newSkin.toString(), 0); + } + find = 0; + } + } + + if (find >= 0) { + skinCombo.select(find); + skinCombo.setToolTipText(skinCombo.getText()); + newSkin = skinList == null ? oldSkin : skinList.get(find); + } + } + + private void changeResolution(RESOLUTION re) { + // DPI + if (!DisplayResolution.getInstance().isMinResoluion(re) + && EmulatorManager.getManagerMode() != ManagerModeType.INHOUSE_MODE) { + dpiSpinner.setSelection(oldDPI); + } else { + dpiSpinner.setSelection(re.getDPI()); + } + + // SKIN + settingSkinList(re); + } +} diff --git a/src/org/tizen/emulator/manager/ui/detail/TFileShareItem.java b/src/org/tizen/emulator/manager/ui/detail/TFileShareItem.java new file mode 100644 index 0000000..001494e --- /dev/null +++ b/src/org/tizen/emulator/manager/ui/detail/TFileShareItem.java @@ -0,0 +1,279 @@ +package org.tizen.emulator.manager.ui.detail; + +import java.io.File; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.layout.FormAttachment; +import org.eclipse.swt.layout.FormData; +import org.eclipse.swt.widgets.DirectoryDialog; +import org.eclipse.swt.widgets.Label; +import org.tizen.emulator.manager.EmulatorManager; +import org.tizen.emulator.manager.da.widgets.button.DACustomButton; +import org.tizen.emulator.manager.da.widgets.button.DACustomButtonClickEventListener; +import org.tizen.emulator.manager.da.widgets.button.toggle.DACustomToggleButton; +import org.tizen.emulator.manager.resources.ColorResources; +import org.tizen.emulator.manager.resources.FontResources; +import org.tizen.emulator.manager.resources.ImageResources; +import org.tizen.emulator.manager.resources.PatchImageResources; +import org.tizen.emulator.manager.resources.StringResources; +import org.tizen.emulator.manager.ui.MainDialog; +import org.tizen.emulator.manager.ui.widgets.ImageLabel; +import org.tizen.emulator.manager.vms.VMPropertyValue; + +public class TFileShareItem extends DetailViewItem { + private boolean oldSupport; + private boolean newSupport; + + private String newPath; + private String oldPathName; + private String newPathName; + private DirectoryDialog sharedFD; + + @Override + protected void init() { + title = "File Sharing"; + count = 2; + } + + @Override + public void setValue(VMPropertyValue value) { + value.isFileShareSupport = newSupport; + + value.fileSharePath = newPath; + value.fileSharePathName = newPathName; + } + + + private ImageLabel supportLabel; + private ImageLabel dirCategory; + private ImageLabel directoryLabel; + + private static int INPUTBOX_WIDTH = 180; + private static int DIR_CATEGORY_WIDTH = 66; + private static int DIR_INPUTBOX_OFF_WIDTH = 110; + // for modify + private static int DIR_INPUTBOX_ON_WIDTH = 140; + + @Override + public void drawDetail() { + supportLabel = new ImageLabel(compList.get(0), SWT.NONE); + supportLabel.setImage(ImageLabel.STATE_ENABLE, + PatchImageResources.getInputBoxOff(INPUTBOX_WIDTH)); + + dirCategory = new ImageLabel(compList.get(1), SWT.NONE); + dirCategory.setText("Directory"); + dirCategory.setImage(ImageLabel.STATE_ENABLE, + PatchImageResources.getCategoryBox(DIR_CATEGORY_WIDTH)); + dirCategory.setFontColor(ImageLabel.STATE_ENABLE, + ColorResources.DETAIL_CATEGORY_FONT_COLOR.getColor()); + + directoryLabel = new ImageLabel(compList.get(1), SWT.NONE); + directoryLabel.setImage(ImageLabel.STATE_ENABLE, + PatchImageResources.getInputBoxOff(DIR_INPUTBOX_OFF_WIDTH)); + + FormData data = new FormData(); + data.left = new FormAttachment(0, INPUTBOX_OFFSET); + data.top = new FormAttachment(0, INPUTBOX_TOP_GAP); + data.width = supportLabel.getSize().x; + data.height = supportLabel.getSize().y; + supportLabel.setLayoutData(data); + + data = new FormData(); + data.left = new FormAttachment(0, INPUTBOX_OFFSET); + data.top = new FormAttachment(0, INPUTBOX_TOP_GAP + 1); + data.width = dirCategory.getSize().x; + data.height = dirCategory.getSize().y; + dirCategory.setLayoutData(data); + + data = new FormData(); + data.left = new FormAttachment(dirCategory, 4); + data.top = new FormAttachment(0, INPUTBOX_TOP_GAP); + data.width = directoryLabel.getSize().x; + data.height = directoryLabel.getSize().y; + directoryLabel.setLayoutData(data); + + comp.layout(true, true); + } + + private Label stateLabel; + private DACustomToggleButton selectSupport; + private DACustomButton selectDirButton; + + private static String toolTipforMac = "Please refer to file sharing section in SDK documentation."; + @Override + public void drawModify() { + if (EmulatorManager.isMac()) { + drawDetail(); + } else { + makeModifyWidget(); + + FormData data = new FormData(); + data.left = new FormAttachment(0, INPUTBOX_OFFSET); + data.top = new FormAttachment(0, 0); + data.width = TOGGLE_BUTTON_WIDTH; + data.height = TOGGLE_BUTTON_HEIGHT; + selectSupport.setLayoutData(data); + + data = new FormData(); + data.left = new FormAttachment(selectSupport, 10); + data.top = new FormAttachment(0, INPUTBOX_TOP_GAP + 1); + data.width = TOGGLE_BUTTON_WIDTH; + stateLabel.setLayoutData(data); + + data = new FormData(); + data.left = new FormAttachment(0,INPUTBOX_OFFSET); + data.top = new FormAttachment(0, INPUTBOX_TOP_GAP); + data.width = directoryLabel.getSize().x; + data.height = directoryLabel.getSize().y; + directoryLabel.setLayoutData(data); + + data = new FormData(); + data.left = new FormAttachment(directoryLabel, 5); + data.top = new FormAttachment(0, 0); + data.width = FILE_SELECT_BUTTON_WIDTH; + data.height = FILE_SELECT_BUTTON_HEIGHT; + selectDirButton.setLayoutData(data); + } + } + + private void makeModifyWidget() { + selectSupport = new DACustomToggleButton(compList.get(0), + ImageResources.TOGGLE_ON_NOMAL.getImage(), + ImageResources.TOGGLE_OFF_PUSH.getImage(), + ImageResources.TOGGLE_ON_HOVER.getImage(), + null, + ImageResources.TOGGLE_OFF_NOMAL.getImage(), + ImageResources.TOGGLE_OFF_HOVER.getImage()); + + selectSupport.addClickListener(new DACustomButtonClickEventListener() { + @Override + public void handleClickEvent(DACustomButton button) { + if (selectSupport.isToggled()) { // NOT SUPPORT + newSupport = false; + stateLabel.setText(StringResources.NOT_SUPPORTED); + directoryLabel.setText(""); + selectDirButton.setEnabled(false); + } else { // SUPPORT + newSupport = true; + stateLabel.setText(StringResources.SUPPORTED); + directoryLabel.setText(newPathName); + selectDirButton.setEnabled(true); + } + if (!isCreateMode()) { + getListener().ChangeValue(getThis()); + } + } + }); + + stateLabel = new Label(compList.get(0), SWT.NONE); + stateLabel.setFont(FontResources.DETAIL_LABEL_FONT.getFont()); + stateLabel.setForeground(ColorResources.DETAIL_ENABLE_FONT_COLOR.getColor()); + stateLabel.setBackground(ColorResources.DETAIL_MIDDLE_COLOR.getColor()); + + directoryLabel = new ImageLabel(compList.get(1), SWT.NONE); + directoryLabel.setImage(ImageLabel.STATE_DISABLE, + PatchImageResources.getInputBoxON(DIR_INPUTBOX_ON_WIDTH)); + directoryLabel.setEnabled(false); + + selectDirButton = new DACustomButton(compList.get(1), + ImageResources.BUTTON_FILE_NOMAL.getImage(), + ImageResources.BUTTON_FILE_PUSH.getImage(), + ImageResources.BUTTON_FILE_HOVER.getImage(), + ImageResources.BUTTON_FILE_DISABLE.getImage()); + + selectDirButton.addClickListener(new DACustomButtonClickEventListener() { + @Override + public void handleClickEvent(DACustomButton button) { + if(sharedFD == null) { + sharedFD = new DirectoryDialog( + MainDialog.getShell(), SWT.OPEN); + sharedFD.setText("Select directory"); + } + + String path = sharedFD.open(); + if (path != null) { + newPath = path; + newPath = path; + newPathName = path.substring(path + .lastIndexOf(File.separator) + 1, path.length()); + directoryLabel.setText(newPathName); + directoryLabel.setToolTipText(newPath); + + if (!isCreateMode()) { + getListener().ChangeValue(getThis()); + } + } + } + }); + } + + @Override + public boolean settingDetailItem(VMPropertyValue value) { + supportLabel.setText(value.isFileShareSupport + ? StringResources.SUPPORTED + : StringResources.NOT_SUPPORTED); + + directoryLabel.setText(value.isFileShareSupport + ? value.fileSharePathName + : ""); + directoryLabel.setToolTipText(value.fileSharePath); + + return true; + } + + @Override + public boolean settingModifyItem(VMPropertyValue value) { + newSupport = oldSupport = value.isFileShareSupport; + newPath = value.fileSharePath; + newPathName = oldPathName = value.fileSharePathName; + + if (EmulatorManager.isMac()) { + supportLabel.setText(StringResources.MANUAL_SUPPORT); + supportLabel.setToolTipText(toolTipforMac); + directoryLabel.setText(""); + directoryLabel.setToolTipText(toolTipforMac); + } else { + if (oldSupport) { + selectSupport.setToggled(false); + stateLabel.setText(StringResources.SUPPORTED); + directoryLabel.setText(oldPathName); + directoryLabel.setToolTipText(newPath); + selectDirButton.setEnabled(true); + } else { + selectSupport.setToggled(true); + stateLabel.setText(StringResources.NOT_SUPPORTED); + directoryLabel.setText(oldPathName); + selectDirButton.setEnabled(false); + } + } + return true; + } + + @Override + public void closeItem() { + if (supportLabel != null) { + supportLabel.dispose(); + } + + if (dirCategory != null) { + dirCategory.dispose(); + } + + if (directoryLabel != null) { + directoryLabel.dispose(); + } + + if (stateLabel != null) { + stateLabel.dispose(); + } + + if (selectSupport != null) { + selectSupport.dispose(); + } + + if (selectDirButton != null) { + selectDirButton.dispose(); + } + } + +} diff --git a/src/org/tizen/emulator/manager/ui/detail/THWSupportItem.java b/src/org/tizen/emulator/manager/ui/detail/THWSupportItem.java new file mode 100644 index 0000000..3ba8db6 --- /dev/null +++ b/src/org/tizen/emulator/manager/ui/detail/THWSupportItem.java @@ -0,0 +1,304 @@ +package org.tizen.emulator.manager.ui.detail; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.layout.FormAttachment; +import org.eclipse.swt.layout.FormData; +import org.eclipse.swt.widgets.Label; +import org.tizen.emulator.manager.da.widgets.button.DACustomButton; +import org.tizen.emulator.manager.da.widgets.button.DACustomButtonClickEventListener; +import org.tizen.emulator.manager.da.widgets.button.toggle.DACustomToggleButton; +import org.tizen.emulator.manager.resources.ColorResources; +import org.tizen.emulator.manager.resources.FontResources; +import org.tizen.emulator.manager.resources.ImageResources; +import org.tizen.emulator.manager.resources.PatchImageResources; +import org.tizen.emulator.manager.resources.StringResources; +import org.tizen.emulator.manager.tool.CheckVirtualization; +import org.tizen.emulator.manager.ui.widgets.ImageLabel; +import org.tizen.emulator.manager.vms.VMPropertyValue; + +public class THWSupportItem extends DetailViewItem { + private boolean oldHWSupport; + private boolean newHWSupport; + private boolean oldGPUSupport; + private boolean newGPUSupport; + + @Override + protected void init() { + title = "HW Support"; + count = 2; + } + + @Override + public void setValue(VMPropertyValue value) { + value.isHWVirtualization = newHWSupport; + value.isGLAcceleration = newGPUSupport; + } + + private ImageLabel virtualCategory; + private ImageLabel GPUCategory; + + private ImageLabel virtualLabel; + private ImageLabel GPULabel; + + private static int INPUTBOX_WIDTH = 100; + private static int CATEGORY_WIDTH = 76; + + private static String GPUToolTipText = "If you enable the GPU option," + + StringResources.NEW_LINE + + "the rendering performance of video player or camera may degrade."; + + private void makeCategory() { + virtualCategory = new ImageLabel(compList.get(0), SWT.NONE); + virtualCategory.setImage(ImageLabel.STATE_ENABLE, + PatchImageResources.getCategoryBox(CATEGORY_WIDTH)); + virtualCategory.setFontColor(ImageLabel.STATE_ENABLE, + ColorResources.DETAIL_CATEGORY_FONT_COLOR.getColor()); + virtualCategory.setText("Virtualization"); + + GPUCategory = new ImageLabel(compList.get(1), SWT.NONE); + GPUCategory.setImage(ImageLabel.STATE_ENABLE, + PatchImageResources.getCategoryBox(CATEGORY_WIDTH)); + GPUCategory.setFontColor(ImageLabel.STATE_ENABLE, + ColorResources.DETAIL_CATEGORY_FONT_COLOR.getColor()); + GPUCategory.setText("GPU"); + GPUCategory.setToolTipText(GPUToolTipText); + + FormData data = new FormData(); + data.left = new FormAttachment(0, INPUTBOX_OFFSET); + data.top = new FormAttachment(0, INPUTBOX_TOP_GAP + 1); + data.width = virtualCategory.getSize().x; + data.height = virtualCategory.getSize().y; + virtualCategory.setLayoutData(data); + + data = new FormData(); + data.left = new FormAttachment(0, INPUTBOX_OFFSET); + data.top = new FormAttachment(0, INPUTBOX_TOP_GAP + 1); + data.width = GPUCategory.getSize().x; + data.height = GPUCategory.getSize().y; + GPUCategory.setLayoutData(data); + } + + @Override + public void drawDetail() { + makeCategory(); + + virtualLabel = new ImageLabel(compList.get(0), SWT.NONE); + virtualLabel.setImage(ImageLabel.STATE_ENABLE, + PatchImageResources.getInputBoxOff(INPUTBOX_WIDTH)); + + GPULabel = new ImageLabel(compList.get(1), SWT.NONE); + GPULabel.setImage(ImageLabel.STATE_ENABLE, + PatchImageResources.getInputBoxOff(INPUTBOX_WIDTH)); + GPULabel.setToolTipText(GPUToolTipText); + + FormData data = new FormData(); + data.left = new FormAttachment(virtualCategory, 4); + data.top = new FormAttachment(0, INPUTBOX_TOP_GAP); + data.width = virtualLabel.getSize().x; + data.height = virtualLabel.getSize().y; + virtualLabel.setLayoutData(data); + + data = new FormData(); + data.left = new FormAttachment(GPUCategory, 4); + data.top = new FormAttachment(0, INPUTBOX_TOP_GAP); + data.width = GPULabel.getSize().x; + data.height = GPULabel.getSize().y; + GPULabel.setLayoutData(data); + } + + private DACustomToggleButton virtualButton; + private DACustomToggleButton GPUButton; + private Label virtualState; + private Label GPUState; + @Override + public void drawModify() { + makeCategory(); + makeModifyWidget(); + + FormData data = new FormData(); + data.left = new FormAttachment(virtualCategory, 4); + data.top = new FormAttachment(0, 0); + data.width = TOGGLE_BUTTON_WIDTH; + data.height = TOGGLE_BUTTON_HEIGHT; + virtualButton.setLayoutData(data); + + data = new FormData(); + data.left = new FormAttachment(virtualButton, 10); + data.top = new FormAttachment(0, INPUTBOX_TOP_GAP + 1); + data.width = TOGGLE_BUTTON_WIDTH; + virtualState.setLayoutData(data); + + data = new FormData(); + data.left = new FormAttachment(GPUCategory, 4); + data.top = new FormAttachment(0, 0); + data.width = TOGGLE_BUTTON_WIDTH; + data.height = TOGGLE_BUTTON_HEIGHT; + GPUButton.setLayoutData(data); + + data = new FormData(); + data.left = new FormAttachment(GPUButton, 10); + data.top = new FormAttachment(0, INPUTBOX_TOP_GAP + 1); + data.width = TOGGLE_BUTTON_WIDTH; + GPUState.setLayoutData(data); + } + + private void makeModifyWidget() { + virtualButton = new DACustomToggleButton(compList.get(0), + ImageResources.TOGGLE_ON_NOMAL.getImage(), + ImageResources.TOGGLE_OFF_PUSH.getImage(), + ImageResources.TOGGLE_ON_HOVER.getImage(), + ImageResources.TOGGLE_OFF_PUSH.getImage(), + ImageResources.TOGGLE_OFF_NOMAL.getImage(), + ImageResources.TOGGLE_OFF_HOVER.getImage()); + + virtualButton.addClickListener(new DACustomButtonClickEventListener() { + @Override + public void handleClickEvent(DACustomButton button) { + if (virtualButton.isToggled()) { // NOT SUPPORT + newHWSupport = false; + virtualState.setText(StringResources.NOT_SUPPORTED); + } else { // SUPPORT + newHWSupport = true; + virtualState.setText(StringResources.SUPPORTED); + } + if (!isCreateMode()) { + getListener().ChangeValue(getThis()); + } + } + }); + + virtualState = new Label(compList.get(0), SWT.NONE); + virtualState.setFont(FontResources.DETAIL_LABEL_FONT.getFont()); + virtualState.setForeground(ColorResources.DETAIL_ENABLE_FONT_COLOR.getColor()); + virtualState.setBackground(ColorResources.DETAIL_MIDDLE_COLOR.getColor()); + + GPUButton = new DACustomToggleButton(compList.get(1), + ImageResources.TOGGLE_ON_NOMAL.getImage(), + ImageResources.TOGGLE_OFF_PUSH.getImage(), + ImageResources.TOGGLE_ON_HOVER.getImage(), + ImageResources.TOGGLE_OFF_PUSH.getImage(), + ImageResources.TOGGLE_OFF_NOMAL.getImage(), + ImageResources.TOGGLE_OFF_HOVER.getImage()); + + GPUButton.addClickListener(new DACustomButtonClickEventListener() { + @Override + public void handleClickEvent(DACustomButton button) { + if (GPUButton.isToggled()) { // NOT SUPPORT + newGPUSupport = false; + GPUState.setText(StringResources.NOT_SUPPORTED); + } else { // SUPPORT + newGPUSupport = true; + GPUState.setText(StringResources.SUPPORTED); + } + + if (!isCreateMode()) { + getListener().ChangeValue(getThis()); + } + } + }); + + GPUButton.setToolTipText(GPUToolTipText); + + GPUState = new Label(compList.get(1), SWT.NONE); + GPUState.setFont(FontResources.DETAIL_LABEL_FONT.getFont()); + GPUState.setForeground(ColorResources.DETAIL_ENABLE_FONT_COLOR.getColor()); + GPUState.setBackground(ColorResources.DETAIL_MIDDLE_COLOR.getColor()); + } + + private boolean isArm = false; + + @Override + public boolean settingDetailItem(VMPropertyValue value) { + isArm = value.archType.equals("arm"); + + virtualLabel.setText(value.isHWVirtualization + && CheckVirtualization.getInstance().isSupportVirtualization() + && !isArm + ? StringResources.SUPPORTED + : StringResources.NOT_SUPPORTED); + + GPULabel.setText(value.isGLAcceleration + && CheckVirtualization.getInstance().isSupportGPU() + && !isArm + ? StringResources.SUPPORTED + : StringResources.NOT_SUPPORTED); + + return false; + } + + @Override + public boolean settingModifyItem(VMPropertyValue value) { + isArm = value.archType.equals("arm"); + if (isCreateMode() && isArm) { + newHWSupport = oldHWSupport = false; + newGPUSupport = oldGPUSupport = false; + } else { + newHWSupport = oldHWSupport = value.isHWVirtualization; + newGPUSupport = oldGPUSupport = value.isGLAcceleration; + } + + if (oldHWSupport && !isArm + && CheckVirtualization.getInstance().isSupportVirtualization()) { + virtualButton.setToggled(false); + virtualState.setText(StringResources.SUPPORTED); + } else { + virtualButton.setToggled(true); + virtualState.setText(StringResources.NOT_SUPPORTED); + } + + if (!CheckVirtualization.getInstance().isSupportVirtualization() + || isArm) { + virtualButton.setEnabled(false); + } + + if (oldGPUSupport && !isArm + && CheckVirtualization.getInstance().isSupportGPU()) { + GPUButton.setToggled(false); + GPUState.setText(StringResources.SUPPORTED); + } else { + GPUButton.setToggled(true); + GPUState.setText(StringResources.NOT_SUPPORTED); + } + + if (!CheckVirtualization.getInstance().isSupportGPU() || isArm) { + GPUButton.setEnabled(false); + } + return false; + } + + @Override + public void closeItem() { + if (virtualCategory != null) { + virtualCategory.dispose(); + } + + if (GPUCategory != null) { + GPUCategory.dispose(); + } + + if (virtualLabel != null) { + virtualLabel.dispose(); + } + + if (GPULabel != null) { + GPULabel.dispose(); + } + + if (virtualButton != null) { + virtualButton.dispose(); + } + + if (GPUButton != null) { + GPUButton.dispose(); + } + + if (virtualState != null) { + virtualState.dispose(); + } + + if (GPUState != null) { + GPUState.dispose(); + } + } + +} diff --git a/src/org/tizen/emulator/manager/ui/detail/TNameTextItem.java b/src/org/tizen/emulator/manager/ui/detail/TNameTextItem.java new file mode 100644 index 0000000..d48a67d --- /dev/null +++ b/src/org/tizen/emulator/manager/ui/detail/TNameTextItem.java @@ -0,0 +1,363 @@ +package org.tizen.emulator.manager.ui.detail; + +import java.io.File; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.KeyAdapter; +import org.eclipse.swt.events.KeyEvent; +import org.eclipse.swt.events.ModifyEvent; +import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.events.PaintEvent; +import org.eclipse.swt.events.PaintListener; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.FormAttachment; +import org.eclipse.swt.layout.FormData; +import org.eclipse.swt.layout.FormLayout; +import org.eclipse.swt.widgets.FileDialog; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Text; +import org.tizen.emulator.manager.EmulatorManager; +import org.tizen.emulator.manager.EmulatorManager.ManagerModeType; +import org.tizen.emulator.manager.da.widgets.button.DACustomButton; +import org.tizen.emulator.manager.da.widgets.button.DACustomButtonClickEventListener; +import org.tizen.emulator.manager.resources.ColorResources; +import org.tizen.emulator.manager.resources.FontResources; +import org.tizen.emulator.manager.resources.ImageResources; +import org.tizen.emulator.manager.resources.PatchImageResources; +import org.tizen.emulator.manager.ui.MainDialog; +import org.tizen.emulator.manager.ui.MenuHandling; +import org.tizen.emulator.manager.ui.dialog.MessageDialog; +import org.tizen.emulator.manager.ui.widgets.ImageLabel; +import org.tizen.emulator.manager.vms.EmulatorVMList; +import org.tizen.emulator.manager.vms.HelperClass; +import org.tizen.emulator.manager.vms.VMProperty; +import org.tizen.emulator.manager.vms.VMPropertyValue; + +public class TNameTextItem extends DetailViewItem { + private boolean isStandard; + + // for vm name + private String oldName = ""; + private String newName = ""; + + // for base image + private String subTitle; + private Label subTitleLabel; + + private String newPath; + private String newPathName; + private FileDialog baseImageFD; + private boolean isSelected; + + @Override + public void setValue(VMPropertyValue value) { + value.vmsName = newName; + + value.baseImagePath = newPath; + value.baseImagePathName = newPathName; + } + + @Override + public void init() { + title = "Name"; + subTitle = "Base Image"; + count = 2; + } + + @Override + protected void initTitle(boolean supportMinMode) { + super.initTitle(false); + + subTitleLabel = new Label(compList.get(1), SWT.NONE); + + subTitleLabel.setFont(FontResources.DETAIL_TITLE_FONT.getFont()); + subTitleLabel.setForeground(ColorResources.DETAIL_TITILE_FONT_COLOR.getColor()); + FormData data = new FormData(); + data.left = new FormAttachment(0, TITLE_LEFT_GAP); + data.top = new FormAttachment(0, TITLE_TOP_GAP); + data.height = ITEM_HEIGHT; + data.width = TITILE_WIDTH; + subTitleLabel.setLayoutData(data); + subTitleLabel.setBackground(ColorResources.DETAIL_MIDDLE_COLOR.getColor()); + subTitleLabel.addPaintListener(new PaintListener() { + @Override + public void paintControl(PaintEvent e) { + drawTitle(e, subTitle); + } + }); + } + + private ImageLabel nameLabel; + private ImageLabel baseImageLabel; + + private static int INPUTBOX_WIDTH = 180; + private static Image INPUTBOX_ON_IMAGE = null; + private static Image INPUTBOX_OFF_IMAGE = null; + + // for modify (base image) + private static int IMAGE_INPUTBOX_WIDTH = 140; + private static Image IMAGE_INPUTBOX_IMAGE = null; + + @Override + public void drawDetail() { + if (INPUTBOX_OFF_IMAGE == null) { + INPUTBOX_OFF_IMAGE = PatchImageResources.getInputBoxOff(INPUTBOX_WIDTH); + } + + nameLabel = new ImageLabel(compList.get(0), SWT.NONE); + nameLabel.setImage(ImageLabel.STATE_ENABLE, INPUTBOX_OFF_IMAGE); + nameLabel.setImage(ImageLabel.STATE_DISABLE, INPUTBOX_OFF_IMAGE); + + FormData data = new FormData(); + data.left = new FormAttachment(0, INPUTBOX_OFFSET); + data.top = new FormAttachment(0, INPUTBOX_TOP_GAP); + data.width = nameLabel.getSize().x; + data.height = nameLabel.getSize().y; + nameLabel.setLayoutData(data); + + baseImageLabel = new ImageLabel(compList.get(1), SWT.NONE); + baseImageLabel.setImage(ImageLabel.STATE_ENABLE, INPUTBOX_OFF_IMAGE); + baseImageLabel.setImage(ImageLabel.STATE_DISABLE, INPUTBOX_OFF_IMAGE); + + data = new FormData(); + data.left = new FormAttachment(0, INPUTBOX_OFFSET); + data.top = new FormAttachment(0, INPUTBOX_TOP_GAP); + data.width = baseImageLabel.getSize().x; + data.height = baseImageLabel.getSize().y; + baseImageLabel.setLayoutData(data); + + comp.layout(true, true); + } + + private Text nameText; + private DACustomButton selectImageButton; + @Override + public void drawModify() { + if (INPUTBOX_ON_IMAGE == null) { + INPUTBOX_ON_IMAGE = PatchImageResources.getInputBoxON(INPUTBOX_WIDTH); + } + if (IMAGE_INPUTBOX_IMAGE == null) { + IMAGE_INPUTBOX_IMAGE = PatchImageResources.getInputBoxON(IMAGE_INPUTBOX_WIDTH); + } + + makeModifyNameLabel(); + + FormData data = new FormData(); + data.left = new FormAttachment(0, INPUTBOX_OFFSET); + data.top = new FormAttachment(0, INPUTBOX_TOP_GAP); + data.width = nameLabel.getSize().x; + data.height = nameLabel.getSize().y; + nameLabel.setLayoutData(data); + + makeModifyBaseImage(); + + data = new FormData(); + data.left = new FormAttachment(0, INPUTBOX_OFFSET); + data.top = new FormAttachment(0, INPUTBOX_TOP_GAP); + data.width = baseImageLabel.getSize().x; + data.height = baseImageLabel.getSize().y; + baseImageLabel.setLayoutData(data); + + data = new FormData(); + data.left = new FormAttachment(baseImageLabel, 5); + data.top = new FormAttachment(0, 0); + data.width = FILE_SELECT_BUTTON_WIDTH; + data.height = FILE_SELECT_BUTTON_HEIGHT; + selectImageButton.setLayoutData(data); + } + + private void makeModifyNameLabel() { + nameLabel = new ImageLabel(compList.get(0), SWT.NONE); + nameLabel.setImage(ImageLabel.STATE_ENABLE, INPUTBOX_ON_IMAGE); + nameLabel.setImage(ImageLabel.STATE_DISABLE, INPUTBOX_ON_IMAGE); + nameLabel.setLayout(new FormLayout()); + + nameText = new Text(nameLabel, SWT.NONE); + nameText.setBackground(ColorResources.DETAIL_INPUT_BOX_COLOR.getColor()); + nameText.setFont(FontResources.DETAIL_LABEL_FONT.getFont()); + nameText.setForeground(ColorResources.DETAIL_ENABLE_FONT_COLOR.getColor()); + nameText.setTextLimit(VMProperty.MAX_NAME_LEN); + + FormData data = new FormData(); + data.left = new FormAttachment(0, 5); + data.top = new FormAttachment(0, 2); + data.right = new FormAttachment(100, -5); + data.bottom = new FormAttachment(100, -2); + nameText.setLayoutData(data); + + nameText.addModifyListener(new ModifyListener() { + @Override + public void modifyText(ModifyEvent e) { + if (isCreateMode()) { + newName = nameText.getText(); + checkVMName(); + } + } + }); + + nameText.addKeyListener(new KeyAdapter() { + public void keyPressed(KeyEvent event) { + switch (event.keyCode) { + case SWT.CR: + case SWT.KEYPAD_CR: + //TODO + //System.out.println("Enter"); + getListener().ChangeState(State.CREATE); + break; + case SWT.ESC: + getListener().ChangeState(State.CANCEL); + break; + case SWT.TAB: + System.out.println("tab"); + break; + } + } + }); + } + + private void checkVMName() { + if (HelperClass.checkImageName(newName, true)) { + if (isStandard) { + getListener().ChangeValue(true); + } else { + if (isSelected) { + getListener().ChangeValue(true); + } else { + getListener().ChangeValue(false); + } + } + } else { + getListener().ChangeValue(false); + } + } + + private void makeModifyBaseImage() { + baseImageLabel = new ImageLabel(compList.get(1), SWT.NONE); + baseImageLabel.setImage(ImageLabel.STATE_ENABLE, IMAGE_INPUTBOX_IMAGE); + baseImageLabel.setImage(ImageLabel.STATE_DISABLE, IMAGE_INPUTBOX_IMAGE); + + selectImageButton = new DACustomButton(compList.get(1), + ImageResources.BUTTON_FILE_NOMAL.getImage(), + ImageResources.BUTTON_FILE_PUSH.getImage(), + ImageResources.BUTTON_FILE_HOVER.getImage(), + ImageResources.BUTTON_FILE_DISABLE.getImage()); + selectImageButton.addClickListener(new DACustomButtonClickEventListener() { + @Override + public void handleClickEvent(DACustomButton button) { + if (baseImageFD == null) { + baseImageFD = new FileDialog(MainDialog.getShell(), SWT.OPEN); + baseImageFD.setText(String.format("Select existing Base Image")); + String[] filter = null; + String[] filterName = null; + if (EmulatorManager.getManagerMode() == ManagerModeType.INHOUSE_MODE) { + filter = new String[]{"*.x86", "*.arm"}; + filterName = new String[]{"Disk Image Files(*.x86)", "Disk Image Files(*.arm)"}; + } else { + filter = new String[]{"*.x86"}; + filterName = new String[]{"Disk Image Files(*.x86)"}; + } + baseImageFD.setFilterExtensions(filter); + baseImageFD.setFilterNames(filterName); + } + + String path = baseImageFD.open(); + if (path != null) { + if (!MenuHandling.isPathAvaliable(path)) { + new MessageDialog().openWarningDialog("This base image not ready yet.\n" + + "Please select again in a few seconds."); + return; + } + newPath = path; + newPathName = path.substring(path.lastIndexOf(File.separator) + 1, path.length()); + + // for arm emulator + boolean isArm = newPathName.endsWith("arm"); + EmulatorVMList.getInstance().CustomArch = !isArm ? "x86" : "arm"; + + baseImageLabel.setText(newPathName); + baseImageLabel.redraw(); + isSelected = true; + checkVMName(); + + // TODO + //arm image + //false hw virtualization + //false gl accelertaion + } + } + }); + } + + protected boolean checkImageName() { + return true; + } + + @Override + public void closeItem() { + subTitleLabel.dispose(); + + nameLabel.dispose(); + baseImageLabel.dispose(); + + if (nameText != null) { + nameText.dispose(); + } + if (selectImageButton != null) { + selectImageButton.dispose(); + } + } + + @Override + public boolean settingDetailItem(VMPropertyValue value) { + if (nameLabel != null) { + nameLabel.setText(value.vmsName); + } + + if (baseImageLabel != null) { + baseImageLabel.setText(value.baseImagePathName); + } + return true; + } + + @Override + public boolean settingModifyItem(VMPropertyValue value) { + newName = oldName = value.vmsName; + isStandard = value.isStandard; + + newPath = value.baseImagePath; + newPathName = value.baseImagePathName; + isSelected = false; + + if (isCreateMode()) { + nameText.setText(oldName); + nameText.setEnabled(true); + + if (value.isStandard) { + baseImageLabel.setText(value.image == null + ? value.baseImagePathName + : value.image.getPathName()); + baseImageLabel.setEnabled(false); + selectImageButton.setEnabled(false); + } else { + baseImageLabel.setEnabled(true); + baseImageLabel.setText(""); + selectImageButton.setEnabled(true); + } + } else { + nameText.setText(oldName); + nameText.setEnabled(false); + + baseImageLabel.setText(value.baseImagePathName); + baseImageLabel.setEnabled(false); + selectImageButton.setEnabled(false); + } + + setFocus(); + return false; + } + + public void setFocus() { + nameLabel.setFocus(); + nameText.setFocus(); + } +} diff --git a/src/org/tizen/emulator/manager/ui/detail/TRAMItem.java b/src/org/tizen/emulator/manager/ui/detail/TRAMItem.java new file mode 100644 index 0000000..a58abc8 --- /dev/null +++ b/src/org/tizen/emulator/manager/ui/detail/TRAMItem.java @@ -0,0 +1,136 @@ +package org.tizen.emulator.manager.ui.detail; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.FormAttachment; +import org.eclipse.swt.layout.FormData; +import org.eclipse.swt.widgets.Label; +import org.tizen.emulator.manager.da.widgets.combo.DACustomCombo; +import org.tizen.emulator.manager.da.widgets.combo.DACustomComboSelectionListener; +import org.tizen.emulator.manager.da.widgets.combo.TitleComboPopupRenderer; +import org.tizen.emulator.manager.resources.ColorResources; +import org.tizen.emulator.manager.resources.FontResources; +import org.tizen.emulator.manager.resources.ImageResources; +import org.tizen.emulator.manager.resources.PatchImageResources; +import org.tizen.emulator.manager.ui.widgets.ImageLabel; +import org.tizen.emulator.manager.ui.widgets.ModifyViewCombo; +import org.tizen.emulator.manager.ui.widgets.ModifyViewComboRenderer; +import org.tizen.emulator.manager.vms.VMPropertyValue; + +public class TRAMItem extends DetailViewItem { + private int oldSize; + private int newSize; + + @Override + protected void init() { + title = "RAM Size"; + count = 1; + } + + @Override + public void setValue(VMPropertyValue value) { + value.ramSize = newSize; + } + + private ImageLabel ramSize; + private DACustomCombo ramSizeCombo; + private Label stateLabel; + + private static int INPUTBOX_WIDTH = 180; + private static Image INPUTBOX_ON_IMAGE = null; + @Override + public void drawDetail() { + ramSize = new ImageLabel(compList.get(0), SWT.NONE); + ramSize.setImage(ImageLabel.STATE_ENABLE, + PatchImageResources.getInputBoxOff(INPUTBOX_WIDTH)); + + FormData data = new FormData(); + data.left = new FormAttachment(0, INPUTBOX_OFFSET); + data.top = new FormAttachment(0, INPUTBOX_TOP_GAP); + data.width = ramSize.getSize().x; + data.height = ramSize.getSize().y; + ramSize.setLayoutData(data); + } + + + @Override + public void drawModify() { + if (INPUTBOX_ON_IMAGE == null) { + INPUTBOX_ON_IMAGE = PatchImageResources.getInputBoxON(INPUTBOX_WIDTH - 40); + } + + ramSizeCombo = new ModifyViewCombo(compList.get(0), SWT.NONE); + ramSizeCombo.setImages(INPUTBOX_ON_IMAGE, + INPUTBOX_ON_IMAGE, + INPUTBOX_ON_IMAGE, + INPUTBOX_ON_IMAGE); + + ramSizeCombo.setButtonImages(ImageResources.ARROW_DROPDOWN.getImage(), null); + ramSizeCombo.setEnabled(true); + + ramSizeCombo.setComboRender(new ModifyViewComboRenderer()); + ramSizeCombo.setComboPopupRender(new TitleComboPopupRenderer()); + ramSizeCombo.setItemHeight(INPUTBOX_ON_IMAGE.getImageData().height); + // + + stateLabel = new Label(compList.get(0), SWT.NONE); + stateLabel.setFont(FontResources.DETAIL_LABEL_FONT.getFont()); + stateLabel.setForeground(ColorResources.DETAIL_ENABLE_FONT_COLOR.getColor()); + stateLabel.setBackground(ColorResources.DETAIL_MIDDLE_COLOR.getColor()); + stateLabel.setText("MB"); + + FormData data = new FormData(); + data.left = new FormAttachment(0, INPUTBOX_OFFSET); + data.top = new FormAttachment(0, INPUTBOX_TOP_GAP); + data.width = INPUTBOX_ON_IMAGE.getImageData().width; + data.height = INPUTBOX_ON_IMAGE.getImageData().height; + ramSizeCombo.setLayoutData(data); + + data = new FormData(); + data.left = new FormAttachment(ramSizeCombo, 10); + data.top = new FormAttachment(0, INPUTBOX_TOP_GAP + 1); + data.width = 30; + stateLabel.setLayoutData(data); + + for (String s : RamSize.getInstance().getList()) { + ramSizeCombo.add(s); + } + + ramSizeCombo.addSelectionListener(new DACustomComboSelectionListener() { + @Override + public void selectionEvent(DACustomCombo combo) { + String size = combo.getText(); + newSize = Integer.valueOf(size); + + if (!isCreateMode()) { + getListener().ChangeValue(getThis()); + } + } + }); + } + + @Override + public boolean settingDetailItem(VMPropertyValue value) { + ramSize.setText(value.ramSize + " MB"); + return false; + } + + @Override + public boolean settingModifyItem(VMPropertyValue value) { + newSize = oldSize = value.ramSize; + String s = Integer.toString(oldSize); + ramSizeCombo.select(RamSize.getInstance().findIndex(s)); + return false; + } + + @Override + public void closeItem() { + if (ramSize != null) { + ramSize.dispose(); + } + + if (ramSizeCombo != null) { + ramSizeCombo.dispose(); + } + } +} diff --git a/src/org/tizen/emulator/manager/ui/detail/TTouchPointItem.java b/src/org/tizen/emulator/manager/ui/detail/TTouchPointItem.java new file mode 100644 index 0000000..9762dd5 --- /dev/null +++ b/src/org/tizen/emulator/manager/ui/detail/TTouchPointItem.java @@ -0,0 +1,73 @@ +package org.tizen.emulator.manager.ui.detail; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.layout.FormAttachment; +import org.eclipse.swt.layout.FormData; +import org.tizen.emulator.manager.resources.PatchImageResources; +import org.tizen.emulator.manager.ui.widgets.ImageLabel; +import org.tizen.emulator.manager.vms.VMPropertyValue; + +public class TTouchPointItem extends DetailViewItem { + private int touchPointValue; + @Override + protected void init() { + title = "Max Touch Point"; + count = 1; + } + + @Override + public void setValue(VMPropertyValue value) { + value.maxTouchCount = touchPointValue; + } + + private ImageLabel touchPoint; + private static int INPUTBOX_WIDTH = 180; + @Override + public void drawDetail() { + touchPoint = new ImageLabel(compList.get(0), SWT.NONE); + touchPoint.setImage(ImageLabel.STATE_ENABLE, + PatchImageResources.getInputBoxOff(INPUTBOX_WIDTH)); + + FormData data = new FormData(); + data.left = new FormAttachment(0, INPUTBOX_OFFSET); + data.top = new FormAttachment(0, INPUTBOX_TOP_GAP); + data.width = touchPoint.getSize().x; + data.height = touchPoint.getSize().y; + touchPoint.setLayoutData(data); + touchPoint.redraw(); + } + + @Override + public void drawModify() { + touchPoint = new ImageLabel(compList.get(0), SWT.NONE); + touchPoint.setImage(ImageLabel.STATE_DISABLE, + PatchImageResources.getInputBoxON(INPUTBOX_WIDTH)); + + FormData data = new FormData(); + data.left = new FormAttachment(0, INPUTBOX_OFFSET); + data.top = new FormAttachment(0, INPUTBOX_TOP_GAP); + data.width = touchPoint.getSize().x; + data.height = touchPoint.getSize().y; + touchPoint.setLayoutData(data); + touchPoint.setEnabled(false); + } + + @Override + public boolean settingDetailItem(VMPropertyValue value) { + touchPointValue = value.maxTouchCount; + touchPoint.setText(Integer.toString(touchPointValue)); + return false; + } + + @Override + public boolean settingModifyItem(VMPropertyValue value) { + touchPointValue = value.maxTouchCount; + touchPoint.setText(Integer.toString(touchPointValue)); + return false; + } + + @Override + public void closeItem() { + touchPoint.dispose(); + } +} diff --git a/src/org/tizen/emulator/manager/ui/detail/TableWidget.java b/src/org/tizen/emulator/manager/ui/detail/TableWidget.java deleted file mode 100644 index 0acb833..0000000 --- a/src/org/tizen/emulator/manager/ui/detail/TableWidget.java +++ /dev/null @@ -1,1107 +0,0 @@ -/* - * Emulator Manager - * - * Copyright (C) 2011 - 2012 Samsung Electronics Co., Ltd. All rights reserved. - * - * Contact: - * SeokYeon Hwang - * JiHye Kim - * YeongKyoon Lee - * - * 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.detail; - -import java.io.File; -import java.util.ArrayList; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Combo; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.DirectoryDialog; -import org.eclipse.swt.widgets.FileDialog; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Spinner; -import org.eclipse.swt.widgets.Table; -import org.eclipse.swt.widgets.Text; -import org.tizen.emulator.manager.EmulatorManager; -import org.tizen.emulator.manager.EmulatorManager.ManagerModeType; -import org.tizen.emulator.manager.image.SkinList; -import org.tizen.emulator.manager.image.Skin; -import org.tizen.emulator.manager.tool.CheckVirtualization; -import org.tizen.emulator.manager.tool.StringResource; -import org.tizen.emulator.manager.ui.MenuHandling; -import org.tizen.emulator.manager.ui.MessageDialog; -import org.tizen.emulator.manager.ui.ResourceRegistry; -import org.tizen.emulator.manager.ui.ResourceRegistry.ImageName; -import org.tizen.emulator.manager.vms.EmulatorVMs; -import org.tizen.emulator.manager.vms.RESOLUTION; -import org.tizen.emulator.manager.vms.VMCreateHelper; -import org.tizen.emulator.manager.vms.VMPropertyValue; - -public abstract class TableWidget { - private String id; - private String title; - private boolean isCreateMode; - private TableWidgetChangeListener listener; - private TableWidget widget; - private String tooltip = ""; - - public TableWidget(String id, boolean isCreate) { - this.id = id; - this.isCreateMode = isCreate; - widget = this; - } - - public abstract Control getWidget(); - public abstract String getValue(VMPropertyValue value); - public abstract void setValue(VMPropertyValue value); - public abstract boolean settingWidget(Table table, VMPropertyValue value); // oldValue - public abstract boolean settingWidgetListener(TableWidgetChangeListener listener); // newValue - public abstract void closeWidget(); - - public String getId() { - return id; - } - - public String getTitle() { - return title; - } - - public void setTitle(String title) { - this.title = title; - } - - public String getToolTip() { - return tooltip; - } - - public void setToolTip(String tooltip) { - this.tooltip = tooltip; - } - - public boolean isCreateMode() { - return isCreateMode; - } - - public void setCreateMode(boolean isCreateMode) { - this.isCreateMode = isCreateMode; - } - - public void setListener (TableWidgetChangeListener listener) { - this.listener = listener; - } - - public TableWidgetChangeListener getListener() { - return this.listener; - } - - protected TableWidget getThis() { - return widget; - } -} - -class NameText extends TableWidget { - private Text vmsNameText; - private String newName; - private String oldName; - private boolean isStandard; - - // for create - private Label infoLabel; - private BaseImageButton baseimage; - private VMCreateHelper helper; - - public NameText(boolean isCreate) { - super("name", isCreate); - setTitle("Name"); - } - - public Control getWidget() { - return vmsNameText; - } - - public String getValue(VMPropertyValue value) { - return value.vmsName; - } - - public void setValue(VMPropertyValue value) { - value.vmsName = newName; - } - - public boolean settingWidget(Table table, VMPropertyValue value) { - oldName = newName = value.vmsName; - isStandard = value.isStandard; - vmsNameText = new Text(table, SWT.BORDER); - vmsNameText.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false)); - vmsNameText.setText(oldName); - vmsNameText.setTextLimit(VMPropertyView.MAX_NAME_LEN); - vmsNameText.setEnabled(isCreateMode()); - - if (isCreateMode()) { - helper = new VMCreateHelper(); - } - return true; - } - - public boolean settingWidgetListener(TableWidgetChangeListener listener) { - setListener(listener); - TableWidget widget = TableWidgetList.getInstance().findVMWidget("info", isCreateMode()); - if (widget != null) { - infoLabel = (Label)widget.getWidget(); - } - baseimage = (BaseImageButton)TableWidgetList.getInstance().findVMWidget("image", isCreateMode()); - - vmsNameText.addModifyListener(new ModifyListener() { - public void modifyText(ModifyEvent e) { - newName = vmsNameText.getText(); - checkImageName(); - } - }); - - return false; - } - - public void checkImageName() { - if (newName.length() > VMPropertyView.MAX_NAME_LEN) { - infoLabel.setText("Max length is 20."); - getListener().ChangeValue(false); - return; - } - - if (!helper.checkString(newName)) { - infoLabel.setText("Name is invalid!"); - getListener().ChangeValue(false); - return; - } - - if (!oldName.equals(newName) - && helper.checkDupulicateName(newName)) { - infoLabel.setText("Same name exists!"); - getListener().ChangeValue(false); - return; - } - - if (newName.length() == VMPropertyView.MAX_NAME_LEN) { - infoLabel.setText("Max length is 20."); - } else { - infoLabel.setText(""); - } - if (newName.isEmpty()) { - getListener().ChangeValue(false); - } else { - if (isStandard) { - getListener().ChangeValue(true); - } else { - if (baseimage.isSelected()) { - getListener().ChangeValue(true); - } else { - getListener().ChangeValue(false); - } - } - } - } - - public void closeWidget() { - if (vmsNameText != null) { - vmsNameText.dispose(); - } - } -} - -class NameInfoLabel extends TableWidget { - private Label nameInfoLabel; - - public NameInfoLabel( boolean isCreate) { - super("info", isCreate); - setTitle(""); - } - - public Control getWidget() { - return nameInfoLabel; - } - - public String getValue(VMPropertyValue value) { - return ""; - } - - public void setValue(VMPropertyValue value) { - } - - public boolean settingWidget(Table table, VMPropertyValue value) { - if (isCreateMode()) { - //add vm name info - nameInfoLabel = new Label(table, SWT.WRAP); - nameInfoLabel.setText(""); - } - return true; - } - - public boolean settingWidgetListener(TableWidgetChangeListener listener) { - setListener(listener); - return false; - } - - public void closeWidget() { - if (nameInfoLabel != null) { - nameInfoLabel.dispose(); - } - } -} - -class BaseImageButton extends TableWidget { - private Button baseImageButton; - private String newPath; - private String newPathName; - private Image image; - private FileDialog baseImageFD; - private boolean isSelected; - - public BaseImageButton(boolean isCreate) { - super("image", isCreate); - setTitle("Base Image"); - this.image = ResourceRegistry.getImage(ImageName.FOLDER); - isSelected = false; - } - - public Control getWidget() { - return baseImageButton; - } - - public String getValue(VMPropertyValue value) { - return value.baseImagePathName; - } - - public void setValue(VMPropertyValue value) { - value.baseImagePath = newPath; - value.baseImagePathName = newPathName; - } - - public boolean settingWidget(Table table, VMPropertyValue value) { - newPath = value.baseImagePath; - newPathName = value.baseImagePathName; - baseImageButton = new Button(table, SWT.PUSH); - - if (isCreateMode()) { - if (value.isStandard) { - baseImageButton.setText(value.image == null - ? value.baseImagePathName - : value.image.getImagePathName()); - baseImageButton.setEnabled(false); - } else { - baseImageButton.setImage(image); - baseImageButton.setText(""); - } - } else { - baseImageButton.setText(value.baseImagePathName); - baseImageButton.setEnabled(false); - } - return true; - } - - public boolean settingWidgetListener(TableWidgetChangeListener listener) { - setListener(listener); - baseImageButton.addSelectionListener(new SelectionListener() { - public void widgetSelected(SelectionEvent e) { - if (baseImageFD == null) { - baseImageFD = new FileDialog( - EmulatorManager.getInstance().getMainDialog().getShell(), - SWT.OPEN); - baseImageFD.setText(String.format("Select existing Base Image")); - String[] filter = {"*.x86", "*.arm"}; - String[] filterName = {"Disk Image Files(*.x86)", "Disk Image Files(*.arm)"}; - baseImageFD.setFilterExtensions(filter); - baseImageFD.setFilterNames(filterName); - } - - String path = baseImageFD.open(); - if(path != null) { - if (!MenuHandling.isPathAvaliable(path)) { - new MessageDialog().openWarningDialog("This base image not ready yet.\n" + - "Please select again in a few seconds."); - return; - } - newPath = path; - newPathName = path.substring(path.lastIndexOf(File.separator) + 1, path.length()); - - boolean isArm = newPathName.endsWith("arm"); - EmulatorVMs.getInstance().CustomArch = !isArm ? "x86" : "arm"; - - baseImageButton.setText(newPathName); - isSelected = true; - ((NameText)TableWidgetList.getInstance().findVMWidget("name", isCreateMode())).checkImageName(); - ((HWVirtualizationCombo)TableWidgetList.getInstance() - .findVMWidget("hw", isCreateMode())).settingWidgetState(isArm); - ((GLAccelerationCombo)TableWidgetList.getInstance() - .findVMWidget("gl", isCreateMode())).settingWidgetState(isArm); - } - } - public void widgetDefaultSelected(SelectionEvent e) { - } - }); - return true; - } - - public void closeWidget() { - baseImageButton.dispose(); - } - - public boolean isSelected() { - return isSelected; - } -} - -class ResolutionCombo extends TableWidget { - Combo resolutionCombo; - RESOLUTION oldResolution; - RESOLUTION newResolution; - - public ResolutionCombo( boolean isCreate) { - super("resolution", isCreate); - setTitle("Display Resolution"); - } - - public Control getWidget() { - return resolutionCombo; - } - - public String getValue(VMPropertyValue value) { - return value.resolution.toString(); - } - - public void setValue(VMPropertyValue value) { - value.resolution = newResolution; - } - - public boolean settingWidget(Table table, VMPropertyValue value) { - oldResolution = newResolution = value.resolution; - - VMCreateHelper helper = new VMCreateHelper(); - resolutionCombo = helper.makeCombo(table); - - DisplayResolution.getInstance().initialize(oldResolution); - - helper.addComboItem(resolutionCombo, DisplayResolution.getInstance().getList(), - DisplayResolution.getInstance().findIndex(oldResolution.toString())); - - resolutionCombo.setToolTipText(resolutionCombo.getItem(resolutionCombo.getSelectionIndex())); - return true; - } - - public boolean settingWidgetListener(TableWidgetChangeListener listener) { - setListener(listener); - resolutionCombo.addSelectionListener(new SelectionListener() { - public void widgetSelected(SelectionEvent e) { - String re = resolutionCombo.getItem(resolutionCombo.getSelectionIndex()); - resolutionCombo.setToolTipText(re); - - RESOLUTION d = DisplayResolution.getInstance().findResolution(re); - if (d != null) { - newResolution = d; - DPISpinner dpi = (DPISpinner)TableWidgetList.getInstance() - .findVMWidget("dpi", isCreateMode()); - dpi.selectDPI(d); - - SkinCombo skin = (SkinCombo)TableWidgetList.getInstance().findVMWidget("skin", isCreateMode()); - skin.selectResolution(d); - } - - if (!isCreateMode()) { - getListener().ChangeValue(getThis()); - } - } - - public void widgetDefaultSelected(SelectionEvent e) { - - } - }); - return true; - } - - public void closeWidget() { - resolutionCombo.dispose(); - } -} - -class DPISpinner extends TableWidget { - private Spinner dpiSpinner; - private int oldDPI; - private int newDPI; - - public DPISpinner(boolean isCreate) { - super("dpi", isCreate); - setTitle("Display Density"); - } - - public Control getWidget() { - return dpiSpinner; - } - - public String getValue(VMPropertyValue value) { - return String.valueOf(value.dpi); - } - - public void setValue(VMPropertyValue value) { - value.dpi = newDPI; - } - - public boolean settingWidget(Table table, VMPropertyValue value) { - oldDPI = newDPI = value.dpi; - dpiSpinner = new Spinner(table, SWT.BORDER); - dpiSpinner.setValues(oldDPI, - /*VMPropertyView.MIN_DPI*/0, /*VMPropertyView.MAX_DPI*/999, 0, 1, 1); - dpiSpinner.setTextLimit(3); - - return true; - } - - public boolean settingWidgetListener(TableWidgetChangeListener listener) { - setListener(listener); - dpiSpinner.addModifyListener(new ModifyListener() { - public void modifyText(ModifyEvent e) { - newDPI = dpiSpinner.getSelection(); - - if (!isCreateMode()) { - getListener().ChangeValue(getThis()); - } - } - }); - - return true; - } - - public void closeWidget() { - dpiSpinner.dispose(); - } - - public void selectDPI(RESOLUTION resolution) { - if (!DisplayResolution.getInstance().isMinResoluion(resolution) - && EmulatorManager.getInstance().getManagerMode() != ManagerModeType.INHOUSE_MODE) { - dpiSpinner.setSelection(oldDPI); - } else { - dpiSpinner.setSelection(resolution.getDPI()); - } - } -} - -class SkinCombo extends TableWidget { - Combo skinCombo; - Skin oldSkin; - Skin newSkin; - VMCreateHelper helper; - private Skin selectSkin = null; - - public SkinCombo(boolean isCreate) { - super("skin", isCreate); - setTitle("Skin"); - } - - public Control getWidget() { - return skinCombo; - } - - public String getValue(VMPropertyValue value) { - if (value.skin != null) { - return value.skin.getName(); - } else { - return ""; - } - } - - public void setValue(VMPropertyValue value) { - value.skin = newSkin; - if (newSkin != null) { - value.skinPath = newSkin.getPath(); - } else { - value.skinPath = null; - } - } - - public boolean settingWidget(Table table, VMPropertyValue value) { - oldSkin = newSkin = value.skin; - - ArrayList skinList = SkinList.getInstance() - .findSkinList(value.resolution.getValue()); - - helper = new VMCreateHelper(); - skinCombo = helper.makeCombo(table); - helper.addComboItem(skinCombo, skinList.toArray(), 0); - skinCombo.setToolTipText(skinCombo.getItem(0)); - - if (!isCreateMode() && oldSkin != null) { - boolean find = false; - if (!DisplayResolution.getInstance().isMinResoluion(value.resolution) - && EmulatorManager.getInstance().getManagerMode() != ManagerModeType.INHOUSE_MODE) { - skinCombo.removeAll(); - } else { - for (int i = 0; i < skinCombo.getItemCount(); i++) { - if (skinCombo.getItem(i).equals(oldSkin.toString())) { - skinCombo.select(i); - skinCombo.setToolTipText(skinCombo.getItem(i)); - find = true; - break; - } - } - } - - if (!find) { - skinCombo.add(oldSkin.toString(), 0); - skinCombo.select(0); - skinCombo.setToolTipText(skinCombo.getItem(0)); - } - } - return true; - } - - public boolean settingWidgetListener(TableWidgetChangeListener listener) { - setListener(listener); - skinCombo.addSelectionListener(new SelectionListener() { - public void widgetSelected(SelectionEvent e) { - String name = skinCombo.getItem(skinCombo.getSelectionIndex()); - skinCombo.setToolTipText(name); - - newSkin = SkinList.getInstance().findSkinUseName(name); - if (newSkin == null && name.equals(oldSkin)){ - newSkin = oldSkin; - } - selectSkin = newSkin; - - if (!isCreateMode()) { - getListener().ChangeValue(getThis()); - } - } - - public void widgetDefaultSelected(SelectionEvent e) { - } - }); - return true; - } - - public void selectResolution(RESOLUTION resolution) { - skinCombo.removeAll(); - ArrayList skinList = null; - skinList = SkinList.getInstance().findSkinList(resolution.getValue()); - helper.addComboItem(skinCombo, skinList.toArray(), 0); - - int selection = 0; - if (selectSkin != null - && selectSkin.getResolution().equals(StringResource.SKIN_GENERAL)) { - boolean find = false; - for (int i = 0; i < skinCombo.getItemCount(); i++) { - if (skinCombo.getItem(i).equals(selectSkin.toString())) { - selection = i; - find = true; - break; - } - } - - if (!find) { - skinList.add(0, selectSkin); - skinCombo.add(selectSkin.toString(), 0); - } - } - - if (!isCreateMode() - && !DisplayResolution.getInstance().isMinResoluion(resolution) - && EmulatorManager.getInstance().getManagerMode() != ManagerModeType.INHOUSE_MODE) { - selection = 0; - skinCombo.removeAll(); - skinCombo.add(oldSkin.toString()); - } - - if (!skinList.isEmpty()) { - skinCombo.select(selection); - skinCombo.setToolTipText(skinCombo.getItem(selection)); - newSkin = skinList.get(selection); - } else { - newSkin = null; - } - } - - public void closeWidget() { - skinCombo.dispose(); - } -} - -class RAMSizeCombo extends TableWidget { - Combo ramSizeCombo; - int oldSize; - int newSize; - - public RAMSizeCombo(boolean isCreate) { - super("ram", isCreate); - setTitle("RAM Size"); - } - - public Control getWidget() { - return ramSizeCombo; - } - - public String getValue(VMPropertyValue value) { - return String.valueOf(value.ramSize); - } - - public void setValue(VMPropertyValue value) { - value.ramSize = newSize; - } - - public boolean settingWidget(Table table, VMPropertyValue value) { - oldSize = newSize = value.ramSize; - VMCreateHelper helper = new VMCreateHelper(); - ramSizeCombo = helper.makeCombo(table); - helper.addComboItem(ramSizeCombo, RamSize.getInstance().getList(), - RamSize.getInstance().findIndex(String.valueOf(value.ramSize))); - return true; - } - - public boolean settingWidgetListener(TableWidgetChangeListener listener) { - setListener(listener); - ramSizeCombo.addSelectionListener(new SelectionListener() { - public void widgetSelected(SelectionEvent e) { - String str = ramSizeCombo.getItem(ramSizeCombo.getSelectionIndex()); - newSize = Integer.valueOf(str.substring(0, str.length() - 3)); - - if (!isCreateMode()) { - getListener().ChangeValue(getThis()); - } - } - - public void widgetDefaultSelected(SelectionEvent e) { - } - }); - - return true; - } - - public void closeWidget() { - ramSizeCombo.dispose(); - } -} - -class FileShareTypeCombo extends TableWidget { - private Combo shareTypeCombo; - private Label shareTypeLabel; // for Mac os - - private boolean oldIsSupport; - private boolean newIsSupport; - static String toolTipforMac = "Please refer to file sharing section in SDK documentation."; - public FileShareTypeCombo(boolean isCreate) { - super("filesharetype", isCreate); - setTitle("File Sharing"); - } - - public Control getWidget() { - if (EmulatorManager.isMac()) { - return shareTypeLabel; - } else { - return shareTypeCombo; - } - } - - public String getValue(VMPropertyValue value) { - return value.isFileShareSupport && !EmulatorManager.isMac() - ? StringResource.SUPPORTED + " ": StringResource.NOT_SUPPORTED + " "; - } - - public void setValue(VMPropertyValue value) { - value.isFileShareSupport = newIsSupport; - } - - public boolean settingWidget(Table table, VMPropertyValue value) { - newIsSupport = oldIsSupport = value.isFileShareSupport; - - if (EmulatorManager.isMac()) { - shareTypeLabel = new Label(table, SWT.WRAP); - shareTypeLabel.setText(StringResource.MANUAL_SUPPORT); - shareTypeLabel.setToolTipText(FileShareTypeCombo.toolTipforMac); - } else { - VMCreateHelper helper = new VMCreateHelper(); - shareTypeCombo = helper.makeCombo(table); - helper.addComboItem(shareTypeCombo, SupportType.getInstance().getList()); - shareTypeCombo.select(oldIsSupport == true ? 0 : 1); - } - - return true; - } - - public boolean settingWidgetListener(TableWidgetChangeListener listener) { - setListener(listener); - if (EmulatorManager.isMac()) { - return true; - } else { - shareTypeCombo.addSelectionListener(new SelectionListener() { - public void widgetSelected(SelectionEvent e) { - int index = shareTypeCombo.getSelectionIndex(); - Button button = (Button)TableWidgetList.getInstance() - .findVMWidget("filesharefolder", isCreateMode()).getWidget(); - - newIsSupport = index == 0 ? true : false; - button.setEnabled(newIsSupport); - - if (!isCreateMode()) { - getListener().ChangeValue(getThis()); - } - } - - public void widgetDefaultSelected(SelectionEvent e) { - } - }); - return true; - } - } - - public void closeWidget() { - if (EmulatorManager.isMac()) { - shareTypeLabel.dispose(); - } else { - shareTypeCombo.dispose(); - } - } -} - -class FileShareFolderButton extends TableWidget { - private Button shareFolderButton; - private Label shareFolderLabel; // for Mac os - - private String newPath; - private String oldPathName; - private String newPathName; - private Image image; - private DirectoryDialog shareFileDD; - - public FileShareFolderButton(boolean isCreate) { - super("filesharefolder", isCreate); - setTitle("File Sharing Path"); - this.image = ResourceRegistry.getImage(ImageName.FOLDER); - } - - public Control getWidget() { - if (EmulatorManager.isMac()) { - return shareFolderLabel; - } else { - return shareFolderButton; - } - } - - public String getValue(VMPropertyValue value) { - if (EmulatorManager.isMac()) { - return StringResource.None; - } else { - return value.fileSharePathName; - } - } - - public void setValue(VMPropertyValue value) { - value.fileSharePath = newPath; - value.fileSharePathName = newPathName; - } - - public boolean settingWidget(Table table, VMPropertyValue value) { - newPath = value.fileSharePath; - oldPathName = newPathName = value.fileSharePathName; - - if (EmulatorManager.isMac()) { - shareFolderLabel = new Label(table, SWT.WRAP); - shareFolderLabel.setText(StringResource.None); - shareFolderLabel.setToolTipText(FileShareTypeCombo.toolTipforMac); - } else { - shareFolderButton = new Button(table, SWT.PUSH); - shareFolderButton.setImage(image); - shareFolderButton.setText(oldPathName); - shareFolderButton.setEnabled(value.isFileShareSupport); - - } - - return true; - } - - public boolean settingWidgetListener(TableWidgetChangeListener listener) { - setListener(listener); - if (EmulatorManager.isMac()) { - return true; - } else { - shareFolderButton.addSelectionListener(new SelectionListener() { - public void widgetSelected(SelectionEvent e) { - if (shareFileDD == null) { - shareFileDD = new DirectoryDialog( - EmulatorManager.getInstance().getMainDialog().getShell(), SWT.OPEN); - shareFileDD.setText("Select a Direcory"); - } - - String path = shareFileDD.open(); - if(path != null) { - newPath = path; - newPathName = path.substring(path.lastIndexOf(File.separator) + 1, path.length()); - shareFolderButton.setText(newPathName); - } - - if (!isCreateMode()) { - getListener().ChangeValue(getThis()); - } - } - - public void widgetDefaultSelected(SelectionEvent e) { - } - }); - return true; - } - } - - public void closeWidget() { - if (EmulatorManager.isMac()) { - shareFolderLabel.dispose(); - } else { - shareFolderButton.dispose(); - } - } -} - -class HWVirtualizationCombo extends TableWidget { - private Combo HWVirtualCombo; - private boolean oldIsSupport; - private boolean newIsSupport; - private boolean isSelectedArm; - - public HWVirtualizationCombo(boolean isCreate) { - super("hw", isCreate); - setTitle("HW Virtualization"); - } - - public Control getWidget() { - return HWVirtualCombo; - } - - public String getValue(VMPropertyValue value) { - if (value.archType.equals("arm")) { - return StringResource.NOT_SUPPORTED; - } else { - return value.isHWVirtualization - ? StringResource.SUPPORTED : StringResource.NOT_SUPPORTED; - } - } - - public void setValue(VMPropertyValue value) { - value.isHWVirtualization = newIsSupport; - } - - public boolean settingWidget(Table table, VMPropertyValue value) { - isSelectedArm = false; - - boolean isArm = value.archType.equals("arm"); - - if (isCreateMode() && isArm) { - oldIsSupport = newIsSupport = false; - } else { - oldIsSupport = newIsSupport = value.isHWVirtualization; - } - - VMCreateHelper helper = new VMCreateHelper(); - HWVirtualCombo = helper.makeCombo(table); - helper.addComboItem(HWVirtualCombo, SupportType.getInstance().getList()); - HWVirtualCombo.select(oldIsSupport - && CheckVirtualization.getInstance().isSupportVirtualization() && !isArm - ? 0 : 1); - - if (!CheckVirtualization.getInstance().isSupportVirtualization() || isArm) { - HWVirtualCombo.setEnabled(false); - } - - return true; - } - - public boolean settingWidgetListener(TableWidgetChangeListener listener) { - setListener(listener); - HWVirtualCombo.addSelectionListener(new SelectionListener() { - @Override - public void widgetSelected(SelectionEvent e) { - int i = HWVirtualCombo.getSelectionIndex(); - newIsSupport = i == 0 ? true : false; - - if (!isCreateMode()) { - getListener().ChangeValue(getThis()); - } - } - public void widgetDefaultSelected(SelectionEvent e) { - } - - }); - return true; - } - - public void closeWidget() { - HWVirtualCombo.dispose(); - } - - public void settingWidgetState(boolean isArm) { - if (isArm) { - if (!isSelectedArm) { - oldIsSupport = newIsSupport; - newIsSupport = false; - } - isSelectedArm = true; - HWVirtualCombo.select(1); - HWVirtualCombo.setEnabled(false); - } else { - if (isSelectedArm) { - newIsSupport = oldIsSupport; - } - isSelectedArm = false; - HWVirtualCombo.select(newIsSupport ? 0 : 1); - HWVirtualCombo.setEnabled(true); - } - } -} - -class GLAccelerationCombo extends TableWidget { - private Combo GLAcceleCombo; - private boolean oldIsSupport; - private boolean newIsSupport; - private boolean isSelectedArm; - - public GLAccelerationCombo(boolean isCreate) { - super("gl", isCreate); - setTitle("GPU "); - setToolTip(String.format("%s\n%s", "If you enable the GPU option,", - "the rendering performance of video player or camera may degrade.")); - } - - public Control getWidget() { - return GLAcceleCombo; - } - - public String getValue(VMPropertyValue value) { - if (value.archType.equals("arm")) { - return StringResource.NOT_SUPPORTED; - } else { - return value.isGLAcceleration - ? StringResource.SUPPORTED : StringResource.NOT_SUPPORTED; - } - } - - public void setValue(VMPropertyValue value) { - value.isGLAcceleration = newIsSupport; - } - - public boolean settingWidget(Table table, VMPropertyValue value) { - isSelectedArm = false; - boolean isArm = value.archType.equals("arm"); - - if (isCreateMode() && isArm) { - oldIsSupport = newIsSupport = false; - } else { - oldIsSupport = newIsSupport = value.isGLAcceleration; - } - - VMCreateHelper helper = new VMCreateHelper(); - GLAcceleCombo = helper.makeCombo(table); - helper.addComboItem(GLAcceleCombo, SupportType.getInstance().getList()); - GLAcceleCombo.select(oldIsSupport - && CheckVirtualization.getInstance().isSupportGPU() && !isArm ? 0 : 1); - - if (!CheckVirtualization.getInstance().isSupportGPU() || isArm) { - GLAcceleCombo.setEnabled(false); - } - - return true; - } - - public boolean settingWidgetListener(TableWidgetChangeListener listener) { - setListener(listener); - GLAcceleCombo.addSelectionListener(new SelectionListener() { - public void widgetSelected(SelectionEvent e) { - int i = GLAcceleCombo.getSelectionIndex(); - newIsSupport = i == 0 ? true : false; - - if (!isCreateMode()) { - getListener().ChangeValue(getThis()); - } - } - public void widgetDefaultSelected(SelectionEvent e) { - } - }); - return true; - } - - public void closeWidget() { - GLAcceleCombo.dispose(); - } - - public void settingWidgetState(boolean isArm) { - if (isArm) { - if (!isSelectedArm) { - oldIsSupport = newIsSupport; - newIsSupport = false; - } - isSelectedArm = true; - GLAcceleCombo.select(1); - GLAcceleCombo.setEnabled(false); - } else { - if (isSelectedArm) { - newIsSupport = oldIsSupport; - } - isSelectedArm = false; - GLAcceleCombo.select(newIsSupport ? 0 : 1); - GLAcceleCombo.setEnabled(true); - } - } -} - -class TouchPointLabel extends TableWidget { - private Label touchPoint; - - public TouchPointLabel(boolean isCreate) { - super("touch", isCreate); - setTitle("Max Touch Point"); - } - - public Control getWidget() { - return touchPoint; - } - - public String getValue(VMPropertyValue value) { - return String.valueOf(value.maxTouchCount); - } - - public void setValue(VMPropertyValue value) { - // fixed value - value.maxTouchCount = VMPropertyValue.maxTouch; - } - - public boolean settingWidget(Table table, VMPropertyValue value) { - touchPoint = new Label(table, SWT.WRAP); - touchPoint.setText(String.valueOf(value.maxTouchCount)); - return true; - } - - public boolean settingWidgetListener(TableWidgetChangeListener listener) { - return true; - } - - public void closeWidget() { - touchPoint.dispose(); - } -} \ No newline at end of file diff --git a/src/org/tizen/emulator/manager/ui/detail/TableWidgetChangeListener.java b/src/org/tizen/emulator/manager/ui/detail/TableWidgetChangeListener.java deleted file mode 100644 index d17e437..0000000 --- a/src/org/tizen/emulator/manager/ui/detail/TableWidgetChangeListener.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Emulator Manager - * - * Copyright (C) 2011 - 2012 Samsung Electronics Co., Ltd. All rights reserved. - * - * Contact: - * SeokYeon Hwang - * JiHye Kim - * YeongKyoon Lee - * - * 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.detail; - -public interface TableWidgetChangeListener { - public void ChangeValue(TableWidget widget); - public void ChangeValue(boolean isState); -} diff --git a/src/org/tizen/emulator/manager/ui/detail/TableWidgetList.java b/src/org/tizen/emulator/manager/ui/detail/TableWidgetList.java deleted file mode 100644 index efea0c1..0000000 --- a/src/org/tizen/emulator/manager/ui/detail/TableWidgetList.java +++ /dev/null @@ -1,88 +0,0 @@ -package org.tizen.emulator.manager.ui.detail; - -import java.util.ArrayList; - -public class TableWidgetList { - ArrayList createList; - ArrayList modifyList; - private static TableWidgetList instance; - static { - instance = new TableWidgetList(); - } - - public static TableWidgetList getInstance() { - assert instance == null; - - return instance; - } - - private TableWidgetList() { - createList = new ArrayList(); - modifyList = new ArrayList(); - makeCreateList(); - makeModifyList(); - } - - public ArrayList getCreateList() { - return createList; - } - - public ArrayList getModifyList() { - return modifyList; - } - - private void makeCreateList() { - createList.add(new NameText(true)); - createList.add(new NameInfoLabel(true)); - createList.add(new BaseImageButton(true)); - createList.add(new ResolutionCombo(true)); - createList.add(new DPISpinner(true)); - createList.add(new SkinCombo(true)); - createList.add(new RAMSizeCombo(true)); - createList.add(new FileShareTypeCombo(true)); - createList.add(new FileShareFolderButton(true)); - createList.add(new HWVirtualizationCombo(true)); - createList.add(new GLAccelerationCombo(true)); - createList.add(new TouchPointLabel(true)); - } - - private void makeModifyList() { - modifyList.add(new NameText(false)); - modifyList.add(new BaseImageButton(false)); - modifyList.add(new ResolutionCombo(false)); - modifyList.add(new DPISpinner(false)); - modifyList.add(new SkinCombo(false)); - modifyList.add(new RAMSizeCombo(false)); - modifyList.add(new FileShareTypeCombo(false)); - modifyList.add(new FileShareFolderButton(false)); - modifyList.add(new HWVirtualizationCombo(false)); - modifyList.add(new GLAccelerationCombo(false)); - modifyList.add(new TouchPointLabel(false)); - } - - public TableWidget findVMWidget(String id, boolean isCreate) { - if (isCreate) { - return findInCreateList(id); - } else { - return findInModifyList(id); - } - } - - private TableWidget findInModifyList(String id) { - for (TableWidget widget : modifyList) { - if (widget.getId().equals(id)) { - return widget; - } - } - return null; - } - - private TableWidget findInCreateList(String id) { - for (TableWidget widget : createList) { - if (widget.getId().equals(id)) { - return widget; - } - } - return null; - } -} diff --git a/src/org/tizen/emulator/manager/ui/detail/VMPropertyView.java b/src/org/tizen/emulator/manager/ui/detail/VMPropertyView.java deleted file mode 100644 index d366088..0000000 --- a/src/org/tizen/emulator/manager/ui/detail/VMPropertyView.java +++ /dev/null @@ -1,227 +0,0 @@ -/* - * Emulator Manager - * - * Copyright (C) 2011 - 2012 Samsung Electronics Co., Ltd. All rights reserved. - * - * Contact: - * MunKyu Im - * SeokYeon Hwang - * JiHye Kim - * YeongKyoon Lee - * - * 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.detail; - -import java.util.ArrayList; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.TableEditor; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Table; -import org.eclipse.swt.widgets.TableItem; -import org.tizen.emulator.manager.image.BaseImage; -import org.tizen.emulator.manager.ui.MessageDialog; -import org.tizen.emulator.manager.vms.Creator; -import org.tizen.emulator.manager.vms.VMPropertyValue; -import org.tizen.emulator.manager.vms.VMsProperty; -import org.tizen.emulator.manager.vms.VMsWorkerException; - -public class VMPropertyView implements TableWidgetChangeListener { - public static final int MAX_NAME_LEN = 20; - public static final int MIN_DPI = 100; - public static final int MAX_DPI = 480; - - private Table table; - private VMsProperty property; - private VMPropertyValue oldValue; - private VMPropertyValue newValue; - - private Button confirmButton; - - private boolean isCreateMode = true; - - ArrayList itemList; - ArrayList createList; - ArrayList modifyList; - - public VMPropertyView(Table table) { - this.table = table; - makeItemList(); - } - - private void makeItemList() { - itemList = new ArrayList(); - createList = TableWidgetList.getInstance().getCreateList(); - modifyList = TableWidgetList.getInstance().getModifyList(); - for (int i = 0; i < createList.size(); i++) { - TableItem item = new TableItem(table, SWT.NONE); - itemList.add(i, item); - } - } - - private void settingDetailColumn(ArrayList list) { - // settingDetailColumn - table.deselectAll(); - table.clearAll(); - TableWidget widget = null; - for (int i = 0; i < list.size(); i++) { - widget = list.get(i); - itemList.get(i).setText(0, widget.getTitle()); - itemList.get(i).setText(1, widget.getValue(oldValue)); - //itemList.get(i).setText(2, widget.getToolTip()); - } - } - public void detailView(VMsProperty property) { - this.property = property; - oldValue = property.getPropertyValue(); - this.isCreateMode = false; - - settingDetailColumn(modifyList); - } - - public void createDetailView(BaseImage image, VMsProperty template) { - oldValue = new VMPropertyValue(image, template); - this.isCreateMode = true; - - settingDetailColumn(createList); - } - - private void settingMoidfyColumn(ArrayList list) { - TableWidget widget = null; - TableEditor editor = null; - for (int i = 0; i < list.size(); i++) { - // clear table item.. - itemList.get(i).setText(1,""); - widget = list.get(i); - widget.settingWidget(table, oldValue); - - // setting table editor - editor = new TableEditor(table); - editor.grabHorizontal = true; - editor.setEditor(widget.getWidget(), itemList.get(i), 1); - } - - // add listener - for (TableWidget w : list) { - w.settingWidgetListener(this); - } - - // NameText widget - list.get(0).getWidget().setFocus(); - } - - public void modifyView(Button confirm) { - //need select Skins. - //oldValue.setSkin(SelectSkin.getInstance().getDefaultSkin()); - newValue = oldValue.clone(); - confirmButton = confirm; - - settingMoidfyColumn(modifyList); - } - - public void createView(Button confirm) { - //need select Skins. - //oldValue.setSkin(SelectSkin.getInstance().getDefaultSkin()); - newValue = oldValue.clone(); - confirmButton = confirm; - - settingMoidfyColumn(createList); - } - - public void close() { - if (isCreateMode) { - for (TableWidget widget : createList) { - widget.closeWidget(); - } - } else { - for (TableWidget widget : modifyList) { - widget.closeWidget(); - } - } - } - - public VMsProperty confirm() { - VMsProperty p = null; - MessageDialog msg = new MessageDialog(); - String message = ""; - try { - if (isCreateMode) { - for (TableWidget widget : createList) { - widget.setValue(newValue); - } - } - else { - for (TableWidget widget : modifyList) { - widget.setValue(newValue); - } - } - // dpi check - if (newValue.dpi < VMPropertyView.MIN_DPI || newValue.dpi > VMPropertyView.MAX_DPI) { - throw new VMsWorkerException("Invalid value.\nDisplay Density should be from 100 to 480"); - } - - if (isCreateMode) { - p = Creator.create(newValue); - } - else { - property.getWorker().modifyVM(oldValue, newValue); - p = property; - } - } catch (VMsWorkerException e) { - message = e.getMessage(); - msg.openWarningDialog(message); - } - return p; - } - - // WidgetChangeListener - @Override - public void ChangeValue(TableWidget widget) { - widget.setValue(newValue); - if (!oldValue.equals(newValue)) { - confirmButton.setEnabled(true); - } else { - confirmButton.setEnabled(false); - } - } - - @Override - public void ChangeValue(boolean isSate) { - confirmButton.setEnabled(isSate); - } - - public String getToolTipText(String name) { - ArrayList list = null; - if (isCreateMode) { - list = createList; - } else { - list = modifyList; - } - - for (TableWidget widget : list) { - if (widget.getTitle().equals(name)) { - return widget.getToolTip(); - } - } - - return null; - } -} diff --git a/src/org/tizen/emulator/manager/ui/detail/VMResource.java b/src/org/tizen/emulator/manager/ui/detail/VMResources.java similarity index 91% rename from src/org/tizen/emulator/manager/ui/detail/VMResource.java rename to src/org/tizen/emulator/manager/ui/detail/VMResources.java index eb382ca..44f6993 100644 --- a/src/org/tizen/emulator/manager/ui/detail/VMResource.java +++ b/src/org/tizen/emulator/manager/ui/detail/VMResources.java @@ -34,7 +34,7 @@ import java.util.ArrayList; import org.tizen.emulator.manager.EmulatorManager; import org.tizen.emulator.manager.EmulatorManager.ManagerModeType; -import org.tizen.emulator.manager.tool.StringResource; +import org.tizen.emulator.manager.resources.StringResources; import org.tizen.emulator.manager.vms.RAM_SIZE; import org.tizen.emulator.manager.vms.RESOLUTION; @@ -95,8 +95,8 @@ class SupportType extends StringArrayResource private SupportType() { - add(0, StringResource.SUPPORTED); - add(1, StringResource.NOT_SUPPORTED); + add(0, StringResources.SUPPORTED); + add(1, StringResources.NOT_SUPPORTED); setDefaultIndex(1); } @@ -132,7 +132,7 @@ class DisplayResolution extends StringArrayResource clear(); int i = 0; - if (EmulatorManager.getInstance().getManagerMode() == ManagerModeType.INHOUSE_MODE) { + if (EmulatorManager.getManagerMode() == ManagerModeType.INHOUSE_MODE) { for (RESOLUTION r : RESOLUTION.values()) { if (r == RESOLUTION.HD) { setDefaultIndex(i); @@ -148,7 +148,7 @@ class DisplayResolution extends StringArrayResource } } - if (!(EmulatorManager.getInstance().getManagerMode() == ManagerModeType.INHOUSE_MODE)) { + if (!(EmulatorManager.getManagerMode() == ManagerModeType.INHOUSE_MODE)) { for (String s : getList()) { if (s.equals(re.toString())) { return; @@ -183,7 +183,7 @@ class DisplayResolution extends StringArrayResource public boolean isMinResoluion(RESOLUTION resolution) { for (RESOLUTION r : minResoultion) { - if (resolution.getValue().equals(r.getValue())) { + if (resolution.getStrValue().equals(r.getStrValue())) { return true; } } @@ -206,7 +206,7 @@ class RamSize extends StringArrayResource if (r == RAM_SIZE.RAM512) { setDefaultIndex(i); } - add(i++, r.toString() + " MB"); + add(i++, r.toString()); } } diff --git a/src/org/tizen/emulator/manager/ui/AboutDialog.java b/src/org/tizen/emulator/manager/ui/dialog/AboutDialog.java similarity index 82% rename from src/org/tizen/emulator/manager/ui/AboutDialog.java rename to src/org/tizen/emulator/manager/ui/dialog/AboutDialog.java index 7fa98c4..314a33a 100644 --- a/src/org/tizen/emulator/manager/ui/AboutDialog.java +++ b/src/org/tizen/emulator/manager/ui/dialog/AboutDialog.java @@ -1,4 +1,4 @@ -package org.tizen.emulator.manager.ui; +package org.tizen.emulator.manager.ui.dialog; import org.eclipse.swt.SWT; import org.eclipse.swt.layout.GridData; @@ -11,26 +11,27 @@ import org.eclipse.swt.widgets.Link; import org.eclipse.swt.widgets.Shell; import org.tizen.emulator.manager.EmulatorManager; import org.tizen.emulator.manager.logging.EMLogger; +import org.tizen.emulator.manager.resources.ImageResources; +import org.tizen.emulator.manager.resources.StringResources; import org.tizen.emulator.manager.tool.About; -import org.tizen.emulator.manager.tool.StringResource; -import org.tizen.emulator.manager.ui.ResourceRegistry.ImageName; -import org.tizen.emulator.manager.vms.EmulatorVMs; +import org.tizen.emulator.manager.ui.MainDialog; +import org.tizen.emulator.manager.vms.EmulatorVMList; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.events.SelectionListener; public class AboutDialog { private static Shell dialog = null; private static String textContents = ""; - private static int width = 436; //149 + 287 + private static int width = 436; //149 + 287 private static int height = 290; // 180 + 110 static { About.initAboutContents(); - textContents = StringResource.NEW_LINE + - "Tizen SDK" + - StringResource.NEW_LINE + StringResource.NEW_LINE + - "Version : " + About.getInstance().getAboutVersion() + - StringResource.NEW_LINE + - "Build id : " + About.getInstance().getBuildTime(); + textContents = StringResources.NEW_LINE + + "Tizen SDK" + + StringResources.NEW_LINE + StringResources.NEW_LINE + + "Version : " + About.getInstance().getAboutVersion() + + StringResources.NEW_LINE + + "Build id : " + About.getInstance().getBuildTime(); } @@ -40,7 +41,7 @@ public class AboutDialog { } private static void makeDialog() { - dialog = new Shell(EmulatorManager.getInstance().getMainDialog().getShell(), + dialog = new Shell(MainDialog.getShell(), SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL); dialog.setText("About Emulator Manager"); dialog.setSize(width, height); @@ -51,13 +52,13 @@ public class AboutDialog { upperComposite.setSize(width, 180); upperComposite.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE)); - if (!(System.getProperty("os.name").toLowerCase().indexOf("mac") > -1)) { + if (!(EmulatorManager.isMac())) { upperComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); } // About icon Label label = new Label(upperComposite, SWT.NONE); - label.setImage(ResourceRegistry.getImage(ImageName.ABOUTSDK)); + label.setImage(ImageResources.ABOUTSDK.getImage()); // About Contents makeTextContents(upperComposite); @@ -74,7 +75,7 @@ public class AboutDialog { Button okButton = new Button(lowerComposite, SWT.PUSH); okButton.setLayoutData(new GridData(110, SWT.DEFAULT)); - okButton.setText(StringResource.OK); + okButton.setText(StringResources.OK); okButton.setFocus(); okButton.addSelectionListener(new SelectionListener() { public void widgetSelected(SelectionEvent e) { @@ -104,21 +105,21 @@ public class AboutDialog { Link workspace = new Link(textComposite, SWT.NONE); workspace.setLayoutData(new GridData(280, SWT.DEFAULT)); workspace.setText("Workspace Path : " + - "" + EmulatorVMs.getInstance().getVMsBaseDirectory() + ""); + "" + EmulatorVMList.getInstance().getVMsBaseDirectory() + ""); workspace.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE)); workspace.addSelectionListener(new SelectionListener(){ public void widgetDefaultSelected(SelectionEvent arg0) { } public void widgetSelected(SelectionEvent arg0) { try { - org.eclipse.swt.program.Program.launch(EmulatorVMs.getInstance().getVMsBaseDirectory()); + org.eclipse.swt.program.Program.launch(EmulatorVMList.getInstance().getVMsBaseDirectory()); } catch (Throwable e) { return; } } }); - // link to tizen site + // link to tizen developer site Link visit = new Link(textComposite, SWT.NONE); visit.setLayoutData(new GridData(SWT.FILL, SWT.BOTTOM, false, false)); visit.setText("\n\n" + @@ -139,11 +140,10 @@ public class AboutDialog { } } catch (Throwable e) { EMLogger.getLogger().warning("Failed to open developer site" - + StringResource.NEW_LINE + e.getMessage()); + + StringResources.NEW_LINE + e.getMessage()); return; } } - }); } diff --git a/src/org/tizen/emulator/manager/ui/CloneDialog.java b/src/org/tizen/emulator/manager/ui/dialog/CloneDialog.java similarity index 77% rename from src/org/tizen/emulator/manager/ui/CloneDialog.java rename to src/org/tizen/emulator/manager/ui/dialog/CloneDialog.java index 02beb93..ccbf1ca 100644 --- a/src/org/tizen/emulator/manager/ui/CloneDialog.java +++ b/src/org/tizen/emulator/manager/ui/dialog/CloneDialog.java @@ -28,7 +28,7 @@ * */ -package org.tizen.emulator.manager.ui; +package org.tizen.emulator.manager.ui.dialog; import org.eclipse.swt.SWT; import org.eclipse.swt.events.ModifyEvent; @@ -42,19 +42,15 @@ import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Text; -import org.tizen.emulator.manager.tool.StringResource; -import org.tizen.emulator.manager.ui.MessageDialog; -import org.tizen.emulator.manager.ui.ResourceRegistry.ImageName; -import org.tizen.emulator.manager.ui.detail.VMPropertyView; -import org.tizen.emulator.manager.vms.VMCreateHelper; -import org.tizen.emulator.manager.vms.VMsProperty; -import org.tizen.emulator.manager.vms.VMsWorkerException; +import org.tizen.emulator.manager.resources.ImageResources; +import org.tizen.emulator.manager.resources.StringResources; +import org.tizen.emulator.manager.ui.MainDialog; +import org.tizen.emulator.manager.vms.HelperClass; +import org.tizen.emulator.manager.vms.VMProperty; +import org.tizen.emulator.manager.vms.VMWorkerException; public class CloneDialog { - private VMsProperty property = null; - private VMCreateHelper helper = null; - - private MainDialog mainDialog = null; + private VMProperty property = null; private Shell dialog = null; private Text name = null; private Label infoLabel = null; @@ -63,15 +59,12 @@ public class CloneDialog { private String vmName = null; - public CloneDialog(MainDialog mainDialog, VMsProperty prop) { - this.mainDialog = mainDialog; + public CloneDialog(VMProperty prop) { property = prop; - - helper = new VMCreateHelper(); } public void open() { - dialog = new Shell(mainDialog.getShell(), SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL); + dialog = new Shell(MainDialog.getShell(), SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL); dialog.setText("Emulator Cloning"); dialog.setSize(350, 180); dialog.setLayout(new GridLayout(1, true)); @@ -83,7 +76,7 @@ public class CloneDialog { sep.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, true)); name = new Text(dialog, SWT.BORDER); - name.setTextLimit(VMPropertyView.MAX_NAME_LEN); + //name.setTextLimit(VMPropertyView.MAX_NAME_LEN); name.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, true)); infoLabel = new Label(dialog, SWT.WRAP); @@ -95,13 +88,13 @@ public class CloneDialog { buttonComposite.setLayoutData(new GridData(SWT.RIGHT, SWT.FILL, true, false)); confirmButton = new Button(buttonComposite, SWT.PUSH); - confirmButton.setText(StringResource.CONFIRM); - confirmButton.setImage(ResourceRegistry.getImage(ImageName.CONFIRM)); + confirmButton.setText(StringResources.CONFIRM); + confirmButton.setImage(ImageResources.CONFIRM.getImage()); confirmButton.setEnabled(false); cancelButton = new Button(buttonComposite, SWT.PUSH); - cancelButton.setText(StringResource.CANCEL); - cancelButton.setImage(ResourceRegistry.getImage(ImageName.CANCEL)); + cancelButton.setText(StringResources.CANCEL); + cancelButton.setImage(ImageResources.CANCEL.getImage()); addListener(); @@ -128,15 +121,15 @@ public class CloneDialog { try { property.getWorker().cloneVM(vmName); //message = "Emulator cloning completed!"; - } catch (VMsWorkerException e) { + } catch (VMWorkerException e) { message = e.getMessage(); msg.openInfoDialog(message); } dialog.close(); - mainDialog.refreshProperties(); - mainDialog.vmsTree.setSelectProperty(property); + MainDialog.refreshVMPropertyList(); + //mainDialog.vmsTree.setSelectProperty(property); } }); @@ -149,37 +142,41 @@ public class CloneDialog { @Override public void widgetSelected(SelectionEvent arg0) { dialog.close(); - mainDialog.refreshProperties(); - mainDialog.vmsTree.setSelectProperty(property); + MainDialog.refreshVMPropertyList(); + //mainDialog.vmsTree.setSelectProperty(property); } }); } private void checkImageName() { + /* if (vmName.length() > VMPropertyView.MAX_NAME_LEN) { infoLabel.setText("Max length of name is 20."); confirmButton.setEnabled(false); return; } + */ - if (!helper.checkString(vmName)) { + if (!HelperClass.checkString(vmName)) { infoLabel.setText("Name has invalid character!"); confirmButton.setEnabled(false); return; } - if (helper.checkDupulicateName(vmName)) { + if (HelperClass.checkDupulicateName(vmName)) { infoLabel.setText("The same name already exists!"); confirmButton.setEnabled(false); return; } + /* if (vmName.length() == VMPropertyView.MAX_NAME_LEN) { infoLabel.setText("Max length of name is 20."); } else { infoLabel.setText("Input new VM-name."); } + */ if (vmName.isEmpty()) { confirmButton.setEnabled(false); } else { diff --git a/src/org/tizen/emulator/manager/ui/MessageDialog.java b/src/org/tizen/emulator/manager/ui/dialog/MessageDialog.java similarity index 90% rename from src/org/tizen/emulator/manager/ui/MessageDialog.java rename to src/org/tizen/emulator/manager/ui/dialog/MessageDialog.java index b7d2cc3..15d503c 100644 --- a/src/org/tizen/emulator/manager/ui/MessageDialog.java +++ b/src/org/tizen/emulator/manager/ui/dialog/MessageDialog.java @@ -28,7 +28,7 @@ * */ -package org.tizen.emulator.manager.ui; +package org.tizen.emulator.manager.ui.dialog; import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionEvent; @@ -41,14 +41,14 @@ import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Shell; -import org.tizen.emulator.manager.EmulatorManager; -import org.tizen.emulator.manager.tool.StringResource; +import org.tizen.emulator.manager.resources.StringResources; +import org.tizen.emulator.manager.ui.MainDialog; public class MessageDialog { private Shell shell; public MessageDialog() { - this.shell = EmulatorManager.getInstance().getMainDialog().getShell(); + this.shell = MainDialog.getShell(); } public MessageDialog(Shell shell) { @@ -109,10 +109,9 @@ public class MessageDialog dialog.setSize(x + 50, y + 100); - if (EmulatorManager.getInstance() != null - && EmulatorManager.getInstance().getMainDialog() != null) { - Point p = EmulatorManager.getInstance().getMainDialog().getShell().getLocation(); - Point s = EmulatorManager.getInstance().getMainDialog().getShell().getSize(); + if (MainDialog.getShell() != null) { + Point p = MainDialog.getShell().getLocation(); + Point s = MainDialog.getShell().getSize(); dialog.setLocation(p.x + (s.x>>2), p.y + (s.y>>2)); } @@ -152,7 +151,7 @@ public class MessageDialog if ((style & SWT.CANCEL) != 0 ) { Button cancleButton = new Button(buttonComposite, SWT.PUSH); cancleButton.setLayoutData(new GridData(90, SWT.DEFAULT)); - cancleButton.setText(StringResource.CANCEL); + cancleButton.setText(StringResources.CANCEL); cancleButton.setFocus(); cancleButton.addSelectionListener(new SelectionListener() { public void widgetSelected(SelectionEvent e) { @@ -169,7 +168,7 @@ public class MessageDialog Button okButton = new Button(buttonComposite, SWT.PUSH); okButton.setLayoutData(new GridData(90, SWT.DEFAULT)); - okButton.setText(StringResource.OK); + okButton.setText(StringResources.OK); okButton.setFocus(); okButton.addSelectionListener(new SelectionListener() { public void widgetSelected(SelectionEvent e) { diff --git a/src/org/tizen/emulator/manager/ui/SelectWorkspaceDialog.java b/src/org/tizen/emulator/manager/ui/dialog/SelectWorkspaceDialog.java similarity index 90% rename from src/org/tizen/emulator/manager/ui/SelectWorkspaceDialog.java rename to src/org/tizen/emulator/manager/ui/dialog/SelectWorkspaceDialog.java index 0129255..a088929 100644 --- a/src/org/tizen/emulator/manager/ui/SelectWorkspaceDialog.java +++ b/src/org/tizen/emulator/manager/ui/dialog/SelectWorkspaceDialog.java @@ -28,7 +28,7 @@ * */ -package org.tizen.emulator.manager.ui; +package org.tizen.emulator.manager.ui.dialog; import java.util.Properties; @@ -47,8 +47,8 @@ import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Listener; import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Text; -import org.tizen.emulator.manager.tool.StringResource; -import org.tizen.emulator.manager.vms.EmulatorVMs; +import org.tizen.emulator.manager.resources.StringResources; +import org.tizen.emulator.manager.vms.EmulatorVMList; public class SelectWorkspaceDialog { private Shell dialog; @@ -71,7 +71,7 @@ public class SelectWorkspaceDialog { public void create() { dialog = new Shell(Display.getCurrent(), SWT.CLOSE); - dialog.setText(StringResource.SWD_TITLE); + dialog.setText(StringResources.SWD_TITLE); dialog.setSize(500, 180); GridLayout layout = new GridLayout(1, false); layout.horizontalSpacing = 0; @@ -102,24 +102,24 @@ public class SelectWorkspaceDialog { pathText = new Text(browseComposite, SWT.BORDER); - if (prop == null || prop.getProperty(StringResource.RECENT_VMS_PATH).isEmpty()) { - selectedPath = EmulatorVMs.getInstance().getVMsBaseDirectory(); + if (prop == null || prop.getProperty(StringResources.RECENT_VMS_PATH).isEmpty()) { + selectedPath = EmulatorVMList.getInstance().getVMsBaseDirectory(); } else { - selectedPath =prop.getProperty(StringResource.RECENT_VMS_PATH); + selectedPath =prop.getProperty(StringResources.RECENT_VMS_PATH); } pathText.setText(selectedPath); pathText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); browseButton = new Button(browseComposite, SWT.PUSH); - browseButton.setText(StringResource.SWD_BROWSE); + browseButton.setText(StringResources.SWD_BROWSE); Composite bottomComposite = new Composite(dialog, SWT.NONE); bottomComposite.setLayout(new GridLayout(3, false)); bottomComposite.setLayoutData(new GridData(SWT.FILL, SWT.BOTTOM, false, true)); askButton = new Button(bottomComposite, SWT.CHECK); - askButton.setText(StringResource.SWD_ASK_AGAIN); + askButton.setText(StringResources.SWD_ASK_AGAIN); new Label(bottomComposite, SWT.NONE); new Label(bottomComposite, SWT.NONE); @@ -127,12 +127,12 @@ public class SelectWorkspaceDialog { new Label(bottomComposite, SWT.NONE); cancelButton = new Button(bottomComposite, SWT.PUSH); - cancelButton.setText(StringResource.CANCEL); + cancelButton.setText(StringResources.CANCEL); cancelButton.setSize(100, SWT.NONE); cancelButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); okButton = new Button(bottomComposite, SWT.PUSH); - okButton.setText(StringResource.OK); + okButton.setText(StringResources.OK); okButton.setSize(100, SWT.NONE); okButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); @@ -157,7 +157,7 @@ public class SelectWorkspaceDialog { @Override public void widgetSelected(SelectionEvent e) { DirectoryDialog dd = new DirectoryDialog(dialog, SWT.OPEN); - dd.setText(StringResource.SELECT_DIRECTORY); + dd.setText(StringResources.SELECT_DIRECTORY); selectedPath = dd.open(); if (selectedPath != null) { pathText.setText(selectedPath); diff --git a/src/org/tizen/emulator/manager/ui/tabfolder/PlatformTabButton.java b/src/org/tizen/emulator/manager/ui/tabfolder/PlatformTabButton.java new file mode 100644 index 0000000..4a3373f --- /dev/null +++ b/src/org/tizen/emulator/manager/ui/tabfolder/PlatformTabButton.java @@ -0,0 +1,130 @@ +package org.tizen.emulator.manager.ui.tabfolder; + +import org.eclipse.swt.SWT; +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.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Listener; +import org.tizen.emulator.manager.da.widgets.button.DACustomButton; +import org.tizen.emulator.manager.da.widgets.button.DACustomButtonAttribute; +import org.tizen.emulator.manager.da.widgets.button.DACustomButtonDefaultRenderer; +import org.tizen.emulator.manager.resources.ColorResources; +import org.tizen.emulator.manager.resources.FontResources; +import org.tizen.emulator.manager.resources.PatchImageResources; + +public class PlatformTabButton extends DACustomButton { + private boolean isSelected = false; + + public void setSelected(boolean isSelected) { + this.isSelected = isSelected; + ((PlatformTabButtonAttribute)attr).setSelected(isSelected); + } + + public PlatformTabButton(Composite parent, int style) { + super(parent, style); + // change Listener + buttonMouseListener = buttonMouseListener2; + attr = new PlatformTabButtonAttribute(); + this.addListeners(); + + this.setRenderer(new PlatformTabButtonRenderer()); + + // set Font + this.setFont(FontResources.TAB_BUTTON_FONT.getFont()); + + this.setFontColors(ColorResources.TAB_NORMAL_FONT_COLOR.getColor(), + ColorResources.TAB_SELECTED_FONT_COLOR.getColor(), + ColorResources.TAB_HOVER_FONT_COLOR.getColor(), + ColorResources.TAB_NORMAL_FONT_COLOR.getColor()); + + // set image + this.setImages(PatchImageResources.getUnselectedTabFolder(120, 29), + PatchImageResources.getSelectTabFolder(120, 29), + PatchImageResources.getUnselectedTabFolderHover(120, 29), + PatchImageResources.getUnselectedTabFolder(120, 29)); + } + + public PlatformTabButton(Composite parent, int style, String text) { + this(parent, style); + attr.setText(text); + } + + private Listener buttonMouseListener2 = new Listener() { + @Override + public void handleEvent(Event event) { + if (state == STATE_DISABLE) { + return; + } + + if (isSelected) { + //changeButtonState(STATE_PUSH); + //state = STATE_PUSH; + } else { + switch(event.type) { + case SWT.MouseEnter: + changeButtonState(STATE_HOVER); + break; + case SWT.MouseExit: + changeButtonState(STATE_NORMAL); + break; + case SWT.MouseDown: + changeButtonState(STATE_HOVER); + break; + case SWT.MouseUp: // FIXME + changeButtonState(STATE_HOVER); + break; + default: + changeButtonState(STATE_NORMAL); + break; + } + } + } + }; +} + +class PlatformTabButtonRenderer extends DACustomButtonDefaultRenderer { + @Override + public void draw(GC gc, Canvas canvas, int state, + DACustomButtonAttribute attr) { + Rectangle rect = canvas.getClientArea(); + + if (attr.getDrawType() == DACustomButton.TYPE_IMAGE) { + PlatformTabButtonAttribute tabAttr = (PlatformTabButtonAttribute)attr; + Image image = null; + if (tabAttr.isSelected()) { + // STATE_SELECT -> STATE_PUSH + image = tabAttr.getImage(DACustomButton.STATE_PUSH); + gc.drawImage(image, rect.x, rect.y); + drawButtonText(gc, rect, tabAttr, DACustomButton.STATE_PUSH); + } else { + image = attr.getImage(state); + gc.drawImage(image, rect.x, rect.y); + drawButtonText(gc, rect, attr, state); + } + if (null == image) { + return; + } + } else if (attr.getDrawType() == DACustomButton.TYPE_COLOR + || attr.getDrawType() == DACustomButton.TYPE_GRADATION) { + drawButton(gc, rect, state, attr); + } + + drawButtonImage(gc, rect, attr); + } +} + +class PlatformTabButtonAttribute extends DACustomButtonAttribute { + private boolean selected; + public PlatformTabButtonAttribute() { + this.selected = false; + } + public boolean isSelected() { + return selected; + } + public void setSelected(boolean selected) { + this.selected = selected; + } +} \ No newline at end of file diff --git a/src/org/tizen/emulator/manager/ui/tabfolder/PlatformTabFolder.java b/src/org/tizen/emulator/manager/ui/tabfolder/PlatformTabFolder.java new file mode 100644 index 0000000..f68fa05 --- /dev/null +++ b/src/org/tizen/emulator/manager/ui/tabfolder/PlatformTabFolder.java @@ -0,0 +1,227 @@ +package org.tizen.emulator.manager.ui.tabfolder; + +import java.util.ArrayList; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.layout.FillLayout; +import org.eclipse.swt.layout.FormAttachment; +import org.eclipse.swt.layout.FormData; +import org.eclipse.swt.layout.FormLayout; +import org.eclipse.swt.widgets.Composite; +import org.tizen.emulator.manager.da.widgets.button.DACustomButton; +import org.tizen.emulator.manager.da.widgets.button.DACustomButtonClickEventListener; +import org.tizen.emulator.manager.resources.ColorResources; +import org.tizen.emulator.manager.ui.VMsMainView; + +public class PlatformTabFolder { + private static final int TAB_WIDTH = 120; + private static final int TAB_HEIGHT = 29; + private static final int RIGHT_BUTTON_WIDTH = 18; + private static final int RIGHT_BUTTON_HEIGHT = 18; + + private ArrayList items + = new ArrayList(5); + private ArrayList buttons + = new ArrayList(5); + + private ArrayList rightButtons + = new ArrayList(5); + + private Composite mainComposite = null; + private Composite tabComposite = null; + private Composite contentsComposite = null; + + // + private static VMsMainView view; + + public Composite getTabComposite() { + return tabComposite; + } + + public Composite getComposite() { + return mainComposite; + } + + public PlatformTabFolder(Composite parent) { + mainComposite = new Composite(parent, SWT.NONE); + mainComposite.setLayout(new FormLayout()); + // + mainComposite.setBackground(ColorResources.TAB_BG_COLOR.getColor()); + // + /* + FormData data = new FormData(); + data.top = new FormAttachment(0, 0); + data.left = new FormAttachment(0, 0); + data.right = new FormAttachment(100, 0); + data.height = 460; + mainComposite.setLayoutData(data); + */ + + tabComposite = new Composite(mainComposite, SWT.DOUBLE_BUFFERED); + tabComposite.setLayout(new FormLayout()); + + FormData data = new FormData(); + data.top = new FormAttachment(0, 0); + data.left = new FormAttachment(0, 2); + data.right = new FormAttachment(100, -2); + data.height = TAB_HEIGHT + 1; + tabComposite.setLayoutData(data); + tabComposite.setBackground(ColorResources.TAB_BG_COLOR.getColor()); + + contentsComposite = new Composite(mainComposite, SWT.DOUBLE_BUFFERED); + contentsComposite.setLayout(new FillLayout()); + + data = new FormData(); + data.top = new FormAttachment(tabComposite, 0); + data.left = new FormAttachment(0, 2); + data.right = new FormAttachment(100, -2); + data.bottom = new FormAttachment(100, 0); + contentsComposite.setLayoutData(data); + contentsComposite.setBackground(ColorResources.TAB_CONTENTS_BG_COLOR.getColor()); + + // initialize main view + view = VMsMainView.getInstance(); + view.setInit(contentsComposite); + } + + public void draw() { + if(!items.isEmpty()) { + // clear + if (!buttons.isEmpty()) { + for (PlatformTabButton b : buttons) { + b.dispose(); + } + buttons.clear(); + } + + for (PlatformTabItem item : items) { + buttons.add(makeTabButton(item)); + } + + selectionItem(buttons.get(0)); + } + + if(!rightButtons.isEmpty()) { + int size = rightButtons.size() - 1; + for (int i = rightButtons.size() - 1; i >= 0; i--) { + FormData data = new FormData(); + data.top = new FormAttachment(0, 6); + if (i == size) { + data.right = new FormAttachment(99, 0); + } else { + data.right = new FormAttachment(rightButtons.get(i+1), -11); + } + data.width = RIGHT_BUTTON_WIDTH; + data.height = RIGHT_BUTTON_HEIGHT; + rightButtons.get(i).setLayoutData(data); + } + } + } + + public void redraw() { + // TODO + } + + private PlatformTabButton makeTabButton(PlatformTabItem item) { + PlatformTabButton tabButton = new PlatformTabButton(tabComposite, SWT.NONE); + tabButton.setText(item.getText()); + tabButton.setEnabled(true); + + FormData data = new FormData(); + data.top = new FormAttachment(0, 2); + if (buttons.size() == 0) { + data.left = new FormAttachment(0, 0); + } else { + data.left = new FormAttachment(buttons.get(buttons.size() - 1), 2); + } + + data.width = TAB_WIDTH; + data.height = TAB_HEIGHT; + tabButton.setLayoutData(data); + + tabButton.addClickListener(new DACustomButtonClickEventListener() { + @Override + public void handleClickEvent(DACustomButton button) { + selectionItem((PlatformTabButton)button); + } + }); + + return tabButton; + } + + private void selectionItem(PlatformTabButton button) { + PlatformTabButton b = null; + for (int i = 0; i < buttons.size(); i++) { + b = buttons.get(i); + if (button == b) { + this.setSelection(i); + b.setSelected(true); + b.redraw(); + // draw main view using selected platform + items.get(i).draw(); + contentsComposite.layout(true, true); + } else { + b.setSelected(false); + b.redraw(); + } + } + } + + private int selection = -1; + + public void setSelection(int index) { + selection = index; + } + + public PlatformTabItem getSelection() { + if (selection == -1) { + return null; + } else { + return items.get(selection); + } + } + + public int getSelectionIndex() { + return selection; + } + + public void clear() { + // TODO + } + + public VMsMainView getView() { + return view; + } + + public void addTabItem(PlatformTabItem item) { + items.add(item); + } + + public void addTabItem(int index, PlatformTabItem item) { + items.add(index, item); + } + + public void removeTabItem(PlatformTabItem item) { + items.remove(item); + } + + public PlatformTabItem removeTabItem(int index) { + return items.remove(index); + } + + public void addTabRightButton(DACustomButton button) { + rightButtons.add(button); + } + + public void addTabRightButton(int index, DACustomButton button) { + rightButtons.add(index, button); + } + + public void removeTabRightButton(DACustomButton button) { + rightButtons.remove(button); + } + + public DACustomButton removeTabRightButton(int index) { + return rightButtons.remove(index); + } +} diff --git a/src/org/tizen/emulator/manager/ui/tabfolder/PlatformTabItem.java b/src/org/tizen/emulator/manager/ui/tabfolder/PlatformTabItem.java new file mode 100644 index 0000000..1b23f26 --- /dev/null +++ b/src/org/tizen/emulator/manager/ui/tabfolder/PlatformTabItem.java @@ -0,0 +1,58 @@ +package org.tizen.emulator.manager.ui.tabfolder; + +import org.tizen.emulator.manager.platform.Platform; +import org.tizen.emulator.manager.ui.VMsMainView; + +public class PlatformTabItem { + private Platform platform; + + /** + * 모든 platform tab item 들이 공유 + */ + private static VMsMainView view; + + private String text; +// private Control control; + + public PlatformTabItem(Platform platform, PlatformTabFolder mainTab, int style) { + this.platform = platform; + mainTab.addTabItem(this); + + this.text = this.platform.getName(); + view = mainTab.getView(); + } + + public void draw() { + // TODO + view.setPlatform(platform); + } + + public void redraw() { + // TODO + view.resetPlatform(); + } + + public String getText() { + return text; + } + + public void setText(String text) { + this.text = text; + } +/* + public Control getControl() { + return control; + } + + public void setControl(Control control) { + this.control = control; + } +*/ + public Platform getPlatform() { + return platform; + } + + public void setPlatform(Platform platform) { + this.platform = platform; + } +} diff --git a/src/org/tizen/emulator/manager/ui/vmstree/ColumnContentHelper.java b/src/org/tizen/emulator/manager/ui/vmstree/ColumnContentHelper.java deleted file mode 100644 index 5cd39c2..0000000 --- a/src/org/tizen/emulator/manager/ui/vmstree/ColumnContentHelper.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * Emulator Manager - * - * Copyright (C) 2011 - 2012 Samsung Electronics Co., Ltd. All rights reserved. - * - * Contact: - * MunKyu Im - * SeokYeon Hwang - * JiHye Kim - * YeongKyoon Lee - * - * 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.vmstree; - -import org.tizen.emulator.manager.vms.VMsProperty; -import org.tizen.emulator.manager.vms.xml.DeviceType; -import org.tizen.emulator.manager.vms.xml.DisplayType; - - -// TODO: Support dynamic column editing -public abstract class ColumnContentHelper { - static final int numberOfColumns = 4; - static final String[] columnTitles = new String[] { "Name", "CPU", "Resolution", "Density", "RAM size", }; - static final ColumnContentHelper[] helpers = new ColumnContentHelper[] { - new NameContentHelper(0), - new ArchitectureHelper(1), - new ResolutionContentHelper(2), - new DensityContentHelper(3), - new RAMSizeContentHelper(4), - }; - - int index; - - protected ColumnContentHelper(int index) { - this.index = index; - } - - public String getTitle() { - return columnTitles[index]; - } - - public int getIndex() { - return index; - } - - public abstract String getContent(VMsProperty property); - - public static int getContentCount() { - return numberOfColumns; - } - - public static ColumnContentHelper[] getContentHelpers() { - return helpers; - } - -} - -class NameContentHelper extends ColumnContentHelper { - public NameContentHelper(int index) { - super(index); - } - - @Override - public String getContent(VMsProperty property) { - return property.getName(); - } -} - -class ArchitectureHelper extends ColumnContentHelper { - public ArchitectureHelper(int index) { - super(index); - } - - @Override - public String getContent(VMsProperty property) { - return property.getArch().name(); - } -} - -class ResolutionContentHelper extends ColumnContentHelper { - public ResolutionContentHelper(int index) { - super(index); - } - - @Override - public String getContent(VMsProperty property) { - DisplayType displayType = property.getConfiguration().getDevice().getDisplay(); - - return displayType.getResolution().getWidth() - + " x " + displayType.getResolution().getHeight(); - } -} - -class DensityContentHelper extends ColumnContentHelper { - public DensityContentHelper(int index) { - super(index); - } - - @Override - public String getContent(VMsProperty property) { - DisplayType displayType = property.getConfiguration().getDevice().getDisplay(); - return displayType.getDensity().getValue() + ""; - } -} - -class RAMSizeContentHelper extends ColumnContentHelper { - public RAMSizeContentHelper(int index) { - super(index); - } - - @Override - public String getContent(VMsProperty property) { - DeviceType deviceType = property.getConfiguration().getDevice(); - return deviceType.getRAM().getSize().getValue() + ""; - } -} diff --git a/src/org/tizen/emulator/manager/ui/vmstree/ColumnSortListner.java b/src/org/tizen/emulator/manager/ui/vmstree/ColumnSortListner.java deleted file mode 100644 index bc14c72..0000000 --- a/src/org/tizen/emulator/manager/ui/vmstree/ColumnSortListner.java +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Emulator Manager - * - * Copyright (C) 2011 - 2012 Samsung Electronics Co., Ltd. All rights reserved. - * - * Contact: - * MunKyu Im - * SeokYeon Hwang - * JiHye Kim - * YeongKyoon Lee - * - * 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.vmstree; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.widgets.Tree; -import org.eclipse.swt.widgets.TreeColumn; -import org.eclipse.swt.widgets.TreeItem; - -public class ColumnSortListner implements SelectionListener { - @Override - public void widgetSelected(SelectionEvent event) { - TreeColumn column = (TreeColumn)event.widget; - Tree tree = column.getParent(); - - tree.setSortColumn(column); - if(tree.getSortDirection() == SWT.NONE) { - tree.setSortDirection(SWT.UP); - } else if(tree.getSortDirection() == SWT.UP) { - tree.setSortDirection(SWT.DOWN); - } else if(tree.getSortDirection() == SWT.DOWN) { - tree.setSortDirection(SWT.UP); - } - for(TreeItem item : tree.getItems()) { - if(!(item.getData() instanceof Container)) {// double checking... - continue; - } - - int count = item.getItemCount(); - - for(int i = 0; i < count - 1; ++i) { - TreeItem subItem0 = item.getItem(i); - if(subItem0.getData() instanceof TreeMarker) { - continue; - } - - for(int j = i + 1; j < count; ++j) { - TreeItem subItem1 = item.getItem(j); - - if(subItem1.getData() instanceof TreeMarker) { - continue; - } - - if(tree.getSortDirection() == SWT.UP) { - if(subItem0.getText().compareTo(subItem1.getText()) > 0) { - PropertyContent content0 = (PropertyContent)subItem0.getData(); - PropertyContent content1 = (PropertyContent)subItem1.getData(); - - RowItem rowItem = new PropertyContent(content1.getProperty(), subItem0); - subItem0.setData(rowItem); - rowItem = new PropertyContent(content0.getProperty(), subItem1); - subItem1.setData(rowItem); - } - } - else if(tree.getSortDirection() == SWT.DOWN) { - if(subItem0.getText().compareTo(subItem1.getText()) < 0) { - PropertyContent content0 = (PropertyContent)subItem0.getData(); - PropertyContent content1 = (PropertyContent)subItem1.getData(); - - RowItem rowItem = new PropertyContent(content1.getProperty(), subItem0); - subItem0.setData(rowItem); - rowItem = new PropertyContent(content0.getProperty(), subItem1); - subItem1.setData(rowItem); - } - } - } - } - tree.redraw(); - } - } - - @Override - public void widgetDefaultSelected(SelectionEvent event) { - // TODO Auto-generated method stub - } - -} diff --git a/src/org/tizen/emulator/manager/ui/vmstree/ContextMenu.java b/src/org/tizen/emulator/manager/ui/vmstree/ContextMenu.java deleted file mode 100644 index 1614150..0000000 --- a/src/org/tizen/emulator/manager/ui/vmstree/ContextMenu.java +++ /dev/null @@ -1,203 +0,0 @@ -/* - * Emulator Manager - * - * Copyright (C) 2011 - 2012 Samsung Electronics Co., Ltd. All rights reserved. - * - * Contact: - * MunKyu Im - * SeokYeon Hwang - * JiHye Kim - * YeongKyoon Lee - * - * 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.vmstree; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.MenuEvent; -import org.eclipse.swt.events.MenuListener; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.widgets.Menu; -import org.eclipse.swt.widgets.MenuItem; -import org.eclipse.swt.widgets.Tree; -import org.eclipse.swt.widgets.TreeItem; -import org.tizen.emulator.manager.EmulatorManager; -import org.tizen.emulator.manager.tool.StringResource; -import org.tizen.emulator.manager.ui.MessageDialog; -import org.tizen.emulator.manager.ui.ResourceRegistry; -import org.tizen.emulator.manager.ui.ResourceRegistry.ImageName; -import org.tizen.emulator.manager.vms.VMsProperty; -import org.tizen.emulator.manager.vms.VMsWorkerException; - -public class ContextMenu { - Menu treeMenu; - - public Menu getMenu() { - return treeMenu; - } - - public void prepare(final Tree vmsTree) { - treeMenu = new Menu(vmsTree); - - final MenuItem launchItem = new MenuItem(treeMenu, SWT.NONE); - launchItem.setText(StringResource.LAUNCH); - launchItem.setImage(ResourceRegistry.getImage(ImageName.LAUNCH)); - launchItem.addSelectionListener(new SelectionListener() { - @Override - public void widgetSelected(SelectionEvent event) { - if(vmsTree.getSelectionCount() > 1) { - return; - } - - VMsProperty property = ((PropertyContent)vmsTree.getSelection()[0].getData()).property; - try { - property.getWorker().launchVM(); - } catch (VMsWorkerException e) { - new MessageDialog().openInfoDialog(e.getMessage()); - } - } - @Override - public void widgetDefaultSelected(SelectionEvent event) { - } - }); - - final MenuItem modifyItem = new MenuItem(treeMenu, SWT.NONE); - modifyItem.setText(StringResource.MODIFY); - modifyItem.setImage(ResourceRegistry.getImage(ImageName.MODIFY)); - modifyItem.addSelectionListener(new SelectionListener(){ - @Override - public void widgetDefaultSelected(SelectionEvent arg0) { - } - @Override - public void widgetSelected(SelectionEvent arg0) { - VMsProperty property = ((PropertyContent)vmsTree.getSelection()[0].getData()).property; - EmulatorManager.getInstance().getMainDialog().openModifyView(property); - } - }); - - new MenuItem(treeMenu, SWT.SEPARATOR); - - final MenuItem resetItem = new MenuItem(treeMenu, SWT.NONE); - resetItem.setText(StringResource.RESET); - resetItem.setImage(ResourceRegistry.getImage(ImageName.RESET)); - resetItem.addSelectionListener(new SelectionListener() { - @Override - public void widgetDefaultSelected(SelectionEvent arg0) { - } - @Override - public void widgetSelected(SelectionEvent arg0) { - EmulatorManager.getInstance().getMainDialog().resetVM(); - } - }); - - final MenuItem deleteItem = new MenuItem(treeMenu, SWT.NONE); - deleteItem.setText(StringResource.DELETE); - deleteItem.setImage(ResourceRegistry.getImage(ImageName.DELETE)); - deleteItem.addSelectionListener(new SelectionListener() { - @Override - public void widgetDefaultSelected(SelectionEvent arg0) { - } - @Override - public void widgetSelected(SelectionEvent arg0) { - EmulatorManager.getInstance().getMainDialog().deleteVM(); - } - }); - - new MenuItem(treeMenu, SWT.SEPARATOR); - - final MenuItem cloneItem = new MenuItem(treeMenu, SWT.NONE); - cloneItem.setText(StringResource.CLONE); - cloneItem.setImage(ResourceRegistry.getImage(ImageName.CLONE)); - cloneItem.addSelectionListener(new SelectionListener() { - @Override - public void widgetDefaultSelected(SelectionEvent arg0) { - } - - @Override - public void widgetSelected(SelectionEvent arg0) { - EmulatorManager.getInstance().getMainDialog().cloneVM(); - } - }); - - final MenuItem createImageItem = new MenuItem(treeMenu, SWT.NONE); - createImageItem.setText(StringResource.CREATE_IMAGE); - createImageItem.setImage(ResourceRegistry.getImage(ImageName.CREATEIMAGE)); - createImageItem.addSelectionListener(new SelectionListener() { - @Override - public void widgetSelected(SelectionEvent e) { - EmulatorManager.getInstance().getMainDialog().createBaseImage(); - } - @Override - public void widgetDefaultSelected(SelectionEvent e) { - } - - }); - - treeMenu.addMenuListener(new MenuListener() { - @Override - public void menuShown(MenuEvent e) { - if(vmsTree.getSelectionCount() == 0) { - launchItem.setEnabled(false); - deleteItem.setEnabled(false); - resetItem.setEnabled(false); - modifyItem.setEnabled(false); - cloneItem.setEnabled(false); - createImageItem.setEnabled(false); - return; - } - - for(MenuItem menuItem : treeMenu.getItems()) { - menuItem.setEnabled(true); - } - - if(vmsTree.getSelectionCount() > 1) { - for(TreeItem treeItem : vmsTree.getSelection()) { - RowItem rowItem = (RowItem)treeItem.getData(); - if(rowItem instanceof TreeMarker) { - deleteItem.setEnabled(false); - resetItem.setEnabled(false); - break; - } - } - cloneItem.setEnabled(false); - launchItem.setEnabled(false); - modifyItem.setEnabled(false); - createImageItem.setEnabled(false); - } - else { - if(vmsTree.getSelection()[0].getData() instanceof TreeMarker) { - launchItem.setEnabled(false); - deleteItem.setEnabled(false); - resetItem.setEnabled(false); - modifyItem.setEnabled(false); - cloneItem.setEnabled(false); - createImageItem.setEnabled(false); - return; - } - } - } - - @Override - public void menuHidden(MenuEvent e) {} - }); - } - -} diff --git a/src/org/tizen/emulator/manager/ui/vmstree/RowItem.java b/src/org/tizen/emulator/manager/ui/vmstree/RowItem.java deleted file mode 100644 index d1859f8..0000000 --- a/src/org/tizen/emulator/manager/ui/vmstree/RowItem.java +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Emulator Manager - * - * Copyright (C) 2011 - 2012 Samsung Electronics Co., Ltd. All rights reserved. - * - * Contact: - * MunKyu Im - * SeokYeon Hwang - * JiHye Kim - * YeongKyoon Lee - * - * 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.vmstree; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Font; -import org.eclipse.swt.graphics.FontData; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.TreeItem; -import org.tizen.emulator.manager.image.BaseImage; -import org.tizen.emulator.manager.ui.ResourceRegistry; -import org.tizen.emulator.manager.vms.VMsProperty; - -public interface RowItem {} - -interface TreeMarker extends RowItem {} - -interface TreeContent extends RowItem {} - - -class PropertyContent implements TreeContent { - VMsProperty property; - - public PropertyContent(VMsProperty property, TreeItem item) { - this.property = property; - - for(ColumnContentHelper helper : ColumnContentHelper.getContentHelpers()) { - item.setText(helper.getIndex(), helper.getContent(property)); - } - } - - public VMsProperty getProperty() { - return property; - } -} - -class CreateMarker implements TreeMarker { - private BaseImage image = null; - public CreateMarker(TreeItem item, BaseImage image) { - item.setText("<< Create new... >>"); - - Font font = ResourceRegistry.getFont(SWT.BOLD); - if(font == null) { - FontData[] fontData = item.getFont().getFontData(); - fontData[0].setStyle(SWT.BOLD); - font = new Font(Display.getCurrent(), fontData); - ResourceRegistry.addFont(SWT.BOLD, font); - } - item.setFont(font); - - this.image =image; - } - - public BaseImage getBaseImage() { - return image; - } -} - - -abstract class Container { - public Container(String text, TreeItem item) { - item.setText(text); - } -} - -class StandardVMsMarker extends Container implements TreeMarker { - public StandardVMsMarker(String version, TreeItem item) { - super(version, item); - } -} - -class CustomVMsMarker extends Container implements TreeMarker { - public CustomVMsMarker(TreeItem item) { - super("Custom", item); - } -} - \ No newline at end of file diff --git a/src/org/tizen/emulator/manager/ui/vmstree/VMsTree.java b/src/org/tizen/emulator/manager/ui/vmstree/VMsTree.java deleted file mode 100644 index 95a0c1d..0000000 --- a/src/org/tizen/emulator/manager/ui/vmstree/VMsTree.java +++ /dev/null @@ -1,366 +0,0 @@ -/* - * Emulator Manager - * - * Copyright (C) 2011 - 2012 Samsung Electronics Co., Ltd. All rights reserved. - * - * Contact: - * MunKyu Im - * SeokYeon Hwang - * JiHye Kim - * YeongKyoon Lee - * - * 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.vmstree; - -import java.util.ArrayList; - -import java.util.HashMap; -import java.util.Map; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.KeyEvent; -import org.eclipse.swt.events.KeyListener; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Menu; -import org.eclipse.swt.widgets.Tree; -import org.eclipse.swt.widgets.TreeColumn; -import org.eclipse.swt.widgets.TreeItem; -import org.tizen.emulator.manager.EmulatorManager; -import org.tizen.emulator.manager.image.BaseImage; -import org.tizen.emulator.manager.image.Platform; -import org.tizen.emulator.manager.ui.MainDialog; -import org.tizen.emulator.manager.ui.MessageDialog; -import org.tizen.emulator.manager.vms.EmulatorVMs; -import org.tizen.emulator.manager.vms.VMsProperty; -import org.tizen.emulator.manager.vms.VMsProperty.FSImageType; -import org.tizen.emulator.manager.vms.VMsWorkerException; -import org.tizen.emulator.manager.tool.SelectTemplate; - -public class VMsTree { - MainDialog mainDialog; - - Tree vmsTree; - ContextMenu contextMenu = new ContextMenu(); - - EmulatorVMs fsImage = EmulatorVMs.getInstance(); - - public VMsTree(final MainDialog mainDialog, Composite parent) { - this.mainDialog = mainDialog; - - this.vmsTree = new Tree(parent, SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION); - - vmsTree.setHeaderVisible(true); - vmsTree.setLinesVisible(true); - - for(ColumnContentHelper helper : ColumnContentHelper.getContentHelpers()) { - TreeColumn treeColumn = new TreeColumn(vmsTree, SWT.NONE); - treeColumn.setText(helper.getTitle()); - - if("Name".equalsIgnoreCase(treeColumn.getText())) { - treeColumn.addSelectionListener(new ColumnSortListner()); - } - } - - refreshContents(); - packAll(); - packAll(); // FIXME: Need second pack avoid column becomes too narrow... why ??? - - contextMenu.prepare(vmsTree); - Menu tableMenu = contextMenu.getMenu(); - vmsTree.setMenu(tableMenu); - - vmsTree.addSelectionListener(new SelectionListener() { - @Override - public void widgetSelected(SelectionEvent event) { - if(vmsTree.getSelectionCount() == 0 - || vmsTree.getSelectionCount() > 1) { - VMsTree.this.mainDialog.closeDetailView(); - } - else { - Object data = vmsTree.getSelection()[0].getData(); - - if(!(data instanceof RowItem)) { - return; - } - - // TODO : select template using platform - if (vmsTree.getSelection()[0].getData() instanceof CreateMarker) { - if (vmsTree.getSelection()[0].getParentItem().getText().equals("Custom")) { - mainDialog.openCreateDetailView(null, SelectTemplate.getInstance().getDefaultTemplate()); - } else { - mainDialog.openCreateDetailView(((CreateMarker)vmsTree.getSelection()[0].getData()).getBaseImage(), - SelectTemplate.getInstance().getDefaultTemplate()); - //mainDialog.openCreateDetailView(true); - } - return; - } - - if(vmsTree.getSelection()[0].getData() instanceof TreeMarker) { - mainDialog.closeDetailView(); - return; - } - - PropertyContent content = (PropertyContent)data; - mainDialog.openDetailView(content.property); - } - } - - @Override - public void widgetDefaultSelected(SelectionEvent event) { - if(vmsTree.getSelectionCount() == 0 - || vmsTree.getSelectionCount() > 1) { - return; - } - if(vmsTree.getSelection()[0].getData() instanceof TreeMarker) { - return; - } - - VMsProperty property = ((PropertyContent)vmsTree.getSelection()[0].getData()).property; - try { - property.getWorker().launchVM(); - } catch (VMsWorkerException e) { - new MessageDialog().openInfoDialog(e.getMessage()); - } - } - }); - - vmsTree.addKeyListener(new KeyListener() { - @Override - public void keyReleased(KeyEvent e) {} - @Override - public void keyPressed(KeyEvent e) { - if(e.keyCode == SWT.DEL) { - if (vmsTree.getSelectionCount() == 0) { - return; - } else { - for(TreeItem item : vmsTree.getSelection()) { - if(!(item.getData() instanceof PropertyContent)) { - return; - } - } - mainDialog.deleteVM(); - } - } - } - }); - } - - private void packAll() { - for(TreeColumn column : vmsTree.getColumns()) { - column.pack(); - } - vmsTree.pack(); - } - - public void refreshContents() { - refreshContents(null); - } - - private ArrayList createItems = new ArrayList(); - private ArrayList typeItems = new ArrayList(); - private Map itemsMap = new HashMap(); - private void refreshContents(String text) { -// boolean x86Selected = mainDialog.isX86Selected(); - vmsTree.removeAll(); - - createItems.clear(); - typeItems.clear(); - itemsMap.clear(); - - VMsProperty[] properties = (VMsProperty[])fsImage.getProperties(); - RowItem rowItem = null; - TreeItem createItem = null; - - // FIXME !! - // add standard image - for (Platform p : EmulatorManager.getInstance().getPlatformList()) { - String standardVersion = p.getVersion(); - if (!standardVersion.isEmpty()) { - TreeItem tempItem = new TreeItem(vmsTree, SWT.NONE); - rowItem = new StandardVMsMarker(standardVersion, tempItem); - tempItem.setData(rowItem); - itemsMap.put(p.getVersion(), tempItem); - typeItems.add(tempItem); - - for (BaseImage b : p.getImageList()) { - TreeItem t = new TreeItem(tempItem, SWT.NONE); - rowItem = new StandardVMsMarker(b.getName(), t); - t.setData(rowItem); - - itemsMap.put(p.getVersion()+b.getName(), t); - typeItems.add(t); - - createItem = new TreeItem(t, SWT.NONE); - rowItem = new CreateMarker(createItem, b); - createItem.setData(rowItem); - createItems.add(createItem); - } - } - } - // - // - - // add custom image - TreeItem customItem = new TreeItem(vmsTree, SWT.NONE); - rowItem = new CustomVMsMarker(customItem); - customItem.setData(rowItem); - - createItem = new TreeItem(customItem, SWT.NONE); - rowItem = new CreateMarker(createItem, null); - createItem.setData(rowItem); - createItems.add(createItem); - - // add VM - for(int i = 0; i < properties.length; ++i) { - if(text != null && !properties[i].getName().startsWith(text)) { - continue; - } - - // temporarily hard coded now... - /* - if(properties[i].getArch() == Architecture.ARM) - continue; - */ - - TreeItem propertyItem = null; - - if(FSImageType.standard == properties[i].getImageType()) { - String version = properties[i].getConfiguration().getBaseInformation().getDiskImage().getVersion(); - String base = properties[i].getConfiguration().getBaseInformation().getDiskImage().getBase(); - propertyItem = itemsMap.get(version+base); - if(propertyItem == null) { - propertyItem = itemsMap.get(version); - if (propertyItem == null) { - propertyItem = new TreeItem(vmsTree, SWT.NONE); - rowItem = new StandardVMsMarker(version, propertyItem); - propertyItem.setData(rowItem); - itemsMap.put(version, propertyItem); - typeItems.add(propertyItem); - } - propertyItem = new TreeItem(propertyItem, SWT.NONE); - rowItem = new StandardVMsMarker(base, propertyItem); - propertyItem.setData(rowItem); - - itemsMap.put(version+base, propertyItem); - typeItems.add(propertyItem); - } - propertyItem = new TreeItem(propertyItem, SWT.NONE); - } - else { - propertyItem = new TreeItem(customItem, SWT.NONE); - } - - rowItem = new PropertyContent(properties[i], propertyItem); - propertyItem.setData(rowItem); - } - - for (TreeItem item : createItems) { - item.setExpanded(true); - } - customItem.setExpanded(true); - for(TreeItem item : typeItems) { - item.setExpanded(true); - } - - } - - public int getSelectionContentCount() { - int count = 0; - Object data; - for (int i = 0; i < vmsTree.getSelectionCount(); i++) { - data = vmsTree.getSelection()[i].getData(); - if (data instanceof TreeMarker) { - return 0; - } - - count++; - } - return count; - } - - public VMsProperty[] getSelectionItems() { - VMsProperty[] properties = new VMsProperty[vmsTree.getSelectionCount()]; - - for(int i = 0; i < properties.length; ++i) { - properties[i] = ((PropertyContent)vmsTree.getSelection()[i].getData()).property; - } - - return properties; - } - - public ArrayList getSelectionItemsList() { - ArrayList list = new ArrayList(); - - VMsProperty property = null; - for (int i = 0; i < vmsTree.getSelectionCount(); i++) { - property = ((PropertyContent)vmsTree.getSelection()[i].getData()).property; - list.add(property); - } - - return list; - } - - public VMsProperty getSelectionItem() { - return ((PropertyContent)vmsTree.getSelection()[0].getData()).property; - - } - - public void setLayoutData(Object data) { - vmsTree.setLayoutData(data); - } - - private TreeItem isPropertySelected(TreeItem item, VMsProperty property) { - Object data; - for (TreeItem i : item.getItems()) { - data = i.getData(); - if (data instanceof CreateMarker) { - continue; - } else if (data instanceof TreeMarker) { - TreeItem t = isPropertySelected(i, property); - if (t == null) { - continue; - } else { - return t; - } - } else { - if (((PropertyContent)data).getProperty().getName().equals(property.getName())) { - return i; - } - } - } - return null; - } - - public void setSelectProperty(VMsProperty property) { - TreeItem t; - vmsTree.deselectAll(); - for (TreeItem item : vmsTree.getItems()) { - t = isPropertySelected(item, property); - if (t != null) { - vmsTree.setFocus(); - vmsTree.setSelection(t); - break; - } - } - } -} diff --git a/src/org/tizen/emulator/manager/ui/widgets/ImageLabel.java b/src/org/tizen/emulator/manager/ui/widgets/ImageLabel.java new file mode 100644 index 0000000..90ed755 --- /dev/null +++ b/src/org/tizen/emulator/manager/ui/widgets/ImageLabel.java @@ -0,0 +1,96 @@ +package org.tizen.emulator.manager.ui.widgets; + +import org.eclipse.swt.events.PaintEvent; +import org.eclipse.swt.events.PaintListener; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.Font; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.widgets.Canvas; +import org.eclipse.swt.widgets.Composite; +import org.tizen.emulator.manager.resources.ColorResources; +import org.tizen.emulator.manager.resources.FontResources; + +public class ImageLabel extends Canvas{ + public static final int STATE_ENABLE = 0; + public static final int STATE_DISABLE = 1; + + private ImageLabelRenderer renderer = new ImageLabelDefaultRenderer(); + private ImageLabelAttribute attr = new ImageLabelAttribute(); + + public ImageLabel(Composite parent, int style) { + super(parent, style); + attr.setState(STATE_ENABLE); + + attr.setFont(FontResources.DETAIL_LABEL_FONT.getFont()); + attr.setFontColor(STATE_ENABLE, ColorResources.DETAIL_ENABLE_FONT_COLOR.getColor()); + attr.setFontColor(STATE_DISABLE, ColorResources.DETAIL_DISABLE_FONT_COLOR.getColor()); + + this.addPaintListener(labelPaintListener); + } + + private PaintListener labelPaintListener = new PaintListener() { + + @Override + public void paintControl(PaintEvent e) { + renderer.draw(e.gc, (Canvas) e.widget, attr); + } + }; + + public void setText(String text) { + attr.setText(text); + this.redraw(); + } + + public String getText() { + return attr.getText(); + } + + public void setImage(int state, Image img) { + attr.setImage(state, img); + this.setSize(img.getImageData().width, img.getImageData().height); + } + + public Image getImage(int state) { + return attr.getImage(state); + } + + public void setFont(Font font) { + attr.setFont(font); + } + + public void setFontPoint(Point p) { + attr.setFontPoint(p); + } + + public void setForeground (Color color) { + this.setFontColor(STATE_ENABLE, color); + this.setFontColor(STATE_DISABLE, color); + super.setForeground(color); + } + + public void setFontColor(int state, Color color) { + attr.setFontColor(state, color); + } + + public void setRenderer(ImageLabelRenderer newRenderer) { + renderer = newRenderer; + } + + public void setEnabled(boolean enabled) { + if (enabled) { + changeState(STATE_ENABLE); + } else { + changeState(STATE_DISABLE); + } + } + + public boolean isEnabled() { + return attr.getState() == STATE_ENABLE ? true : false; + } + + protected void changeState(int s) { + attr.setState(s); + this.redraw(); + } +} diff --git a/src/org/tizen/emulator/manager/ui/widgets/ImageLabelAttribute.java b/src/org/tizen/emulator/manager/ui/widgets/ImageLabelAttribute.java new file mode 100644 index 0000000..be9bc4c --- /dev/null +++ b/src/org/tizen/emulator/manager/ui/widgets/ImageLabelAttribute.java @@ -0,0 +1,73 @@ +package org.tizen.emulator.manager.ui.widgets; + +import java.util.ArrayList; + +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.Font; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.Point; + +public class ImageLabelAttribute { + private ArrayList fontColors = new ArrayList(5); + private ArrayList images = new ArrayList(5); + private int state; + private Font font; + private Point fontPoint; + private String text; + + public ImageLabelAttribute() { + images.add(ImageLabel.STATE_ENABLE, null); + images.add(ImageLabel.STATE_DISABLE, null); + + fontColors.add(ImageLabel.STATE_ENABLE, null); + fontColors.add(ImageLabel.STATE_DISABLE, null); + } + + public void setImage(int state, Image image) { + images.add(state, image); + } + + public Image getImage(int state) { + return images.get(state); + } + + public void setFontColor(int state, Color color) { + fontColors.add(state, color); + } + + public Color getFontColor(int state) { + return fontColors.get(state); + } + + public Point getFontPoint() { + return fontPoint; + } + + public void setFontPoint(Point fontPoint) { + this.fontPoint = fontPoint; + } + + public String getText() { + return text; + } + + public void setText(String text) { + this.text = text; + } + + public int getState() { + return state; + } + + public void setState(int state) { + this.state = state; + } + + public Font getFont() { + return font; + } + + public void setFont(Font font) { + this.font = font; + } +} \ No newline at end of file diff --git a/src/org/tizen/emulator/manager/ui/widgets/ImageLabelDefaultRenderer.java b/src/org/tizen/emulator/manager/ui/widgets/ImageLabelDefaultRenderer.java new file mode 100644 index 0000000..0383619 --- /dev/null +++ b/src/org/tizen/emulator/manager/ui/widgets/ImageLabelDefaultRenderer.java @@ -0,0 +1,64 @@ +package org.tizen.emulator.manager.ui.widgets; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Font; +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.widgets.Canvas; +import org.eclipse.swt.widgets.Display; + +public class ImageLabelDefaultRenderer extends ImageLabelRenderer{ + + @Override + public void draw(GC gc, Canvas canvas, ImageLabelAttribute attr) { + Image image = attr.getImage(attr.getState()); + if (null == image) { + return; + } + + Rectangle rect = canvas.getClientArea(); + gc.drawImage(image, rect.x, rect.y); + drawText(gc, rect, attr); + } + + public int computeFontSize(Rectangle rect) { + if (rect.height > 20) + return 10; + else + return 8; + } + + protected void drawText(GC gc, Rectangle rect, ImageLabelAttribute attr) { + String text = attr.getText(); + Font font = null; + Point p = null; + + if (null != text) { + if (null == (font = attr.getFont())) { + font = new Font(Display.getCurrent(), "Arial", + computeFontSize(rect), SWT.BOLD); + attr.setFont(font); + } + gc.setFont(font); + gc.setForeground(attr.getFontColor(attr.getState())); + + int x = 0, y = 0; + int offset = 0; + if (null == (p = attr.getFontPoint())) { + p = gc.textExtent(text, SWT.DRAW_MNEMONIC); + x = (rect.width - p.x) / 2; + y = (rect.height - p.y) / 2; + x = (x < 0) ? 0 : x; + offset = 0; + } else { + x = p.x; + y = p.y; + } + + gc.drawText(text, x + offset , y, true); + } + } + +} diff --git a/src/org/tizen/emulator/manager/ui/widgets/ImageLabelRenderer.java b/src/org/tizen/emulator/manager/ui/widgets/ImageLabelRenderer.java new file mode 100644 index 0000000..02caf08 --- /dev/null +++ b/src/org/tizen/emulator/manager/ui/widgets/ImageLabelRenderer.java @@ -0,0 +1,8 @@ +package org.tizen.emulator.manager.ui.widgets; + +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.widgets.Canvas; + +public abstract class ImageLabelRenderer { + public abstract void draw(GC gc, Canvas canvas, ImageLabelAttribute attr); +} diff --git a/src/org/tizen/emulator/manager/ui/widgets/ModifyViewCombo.java b/src/org/tizen/emulator/manager/ui/widgets/ModifyViewCombo.java new file mode 100644 index 0000000..cc2a8ed --- /dev/null +++ b/src/org/tizen/emulator/manager/ui/widgets/ModifyViewCombo.java @@ -0,0 +1,29 @@ +package org.tizen.emulator.manager.ui.widgets; + +import org.eclipse.swt.events.PaintEvent; +import org.eclipse.swt.events.PaintListener; +import org.eclipse.swt.widgets.Composite; +import org.tizen.emulator.manager.da.widgets.combo.DACustomCombo; + +public class ModifyViewCombo extends DACustomCombo { + + public ModifyViewCombo(Composite parent, int style) { + super(parent, style); + addPaintListener(comboPaintListener); + } + + private PaintListener comboPaintListener = new PaintListener() { + + @Override + public void paintControl(PaintEvent e) { + if (!isImageCombo()) { + comboRenderer.draw(e.gc, combo, getText(), state); + } else { + comboRenderer.drawImage(e.gc, combo, + buttonUp != null ? buttonUp : getImages().get(state), getText(), + state); + } + } + }; + +} diff --git a/src/org/tizen/emulator/manager/ui/widgets/ModifyViewComboRenderer.java b/src/org/tizen/emulator/manager/ui/widgets/ModifyViewComboRenderer.java new file mode 100644 index 0000000..b920028 --- /dev/null +++ b/src/org/tizen/emulator/manager/ui/widgets/ModifyViewComboRenderer.java @@ -0,0 +1,31 @@ +package org.tizen.emulator.manager.ui.widgets; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.widgets.Canvas; +import org.tizen.emulator.manager.da.widgets.combo.TitleComboRenderer; +import org.tizen.emulator.manager.resources.ColorResources; +import org.tizen.emulator.manager.resources.FontResources; + +public class ModifyViewComboRenderer extends TitleComboRenderer { + @Override + public void drawImage(GC gc, Canvas canvas, Image image, String text, + int state) { + Rectangle rect = canvas.getClientArea(); + gc.drawImage(canvas.getBackgroundImage(), rect.x, rect.y); + Point p = gc.textExtent(text, SWT.DRAW_MNEMONIC); + gc.setFont(FontResources.DETAIL_LABEL_FONT.getFont()); + gc.setForeground(ColorResources.DETAIL_ENABLE_FONT_COLOR.getColor()); + gc.drawString(text, 5, (rect.height - p.y) / 2 + 2, true); + Rectangle clipping = new Rectangle(rect.x + rect.width - 19, rect.y, + 19, rect.height); + gc.setClipping(clipping); + gc.drawImage(canvas.getBackgroundImage(), rect.x, rect.y); + // image is drop down image + gc.drawImage(image, rect.x + rect.width - 12, + rect.y + 7 /*(rect.height - image.getImageData().height)/2*/); + } +} diff --git a/src/org/tizen/emulator/manager/ui/widgets/VMButton.java b/src/org/tizen/emulator/manager/ui/widgets/VMButton.java new file mode 100644 index 0000000..b8fe8d9 --- /dev/null +++ b/src/org/tizen/emulator/manager/ui/widgets/VMButton.java @@ -0,0 +1,165 @@ +package org.tizen.emulator.manager.ui.widgets; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.layout.FormAttachment; +import org.eclipse.swt.layout.FormData; +import org.eclipse.swt.layout.FormLayout; +import org.eclipse.swt.widgets.Canvas; +import org.eclipse.swt.widgets.Composite; +import org.tizen.emulator.manager.da.widgets.button.DACustomButton; +import org.tizen.emulator.manager.da.widgets.button.DACustomButtonAttribute; +import org.tizen.emulator.manager.da.widgets.button.DACustomButtonClickEventListener; +import org.tizen.emulator.manager.da.widgets.button.DACustomButtonDefaultRenderer; +import org.tizen.emulator.manager.resources.ColorResources; +import org.tizen.emulator.manager.resources.FontResources; +import org.tizen.emulator.manager.resources.ImageResources; +import org.tizen.emulator.manager.ui.VMButtonFactory; +import org.tizen.emulator.manager.ui.VMsMainView; +import org.tizen.emulator.manager.vms.VMProperty; +import org.tizen.emulator.manager.vms.VMPropertyValue; + +public class VMButton extends DACustomButton { + private VMButton button = null; + private VMProperty property = null; + protected DACustomButton launchButton = null; + + static int W_OFFSET = 2; + static int H_OFFSET = 3; + private static int LAUNCH_BUTTON_WIDTH = 40; + private static int LAUNCH_BUTTON_HEIGHT =14; + + public VMButton(Composite parent, int style) { + super(parent, style); + //button = this; + + this.attr = new VMButtonAttribute(); + this.setRenderer(new VMButtonRenderer()); + + // set font + this.setFontColors(ColorResources.VM_BUTTON_FONT_COLOR.getColor(), + ColorResources.VM_BUTTON_FONT_COLOR.getColor(), + ColorResources.VM_BUTTON_FONT_COLOR.getColor(), + ColorResources.VM_BUTTON_FONT_COLOR.getColor()); + this.setFont(FontResources.VM_BUTTON_FONT.getFont()); + + // set image + this.setImages(ImageResources.VM_IMAGE_NOMAL.getImage(), + ImageResources.VM_IMAGE_NOMAL.getImage(), + ImageResources.VM_IMAGE_HOVER.getImage(), + null); + + this.setBackground(ColorResources.LIST_BG_COLOR.getColor()); + this.setLayout(new FormLayout()); + + // TODO + launchButton = new DACustomButton(this, + ImageResources.BUTTON_LAUNCH_NOMAL.getImage(), + ImageResources.BUTTON_LAUNCH_PUSH.getImage(), + ImageResources.BUTTON_LAUNCH_HOVER.getImage(), + ImageResources.BUTTON_LAUNCH_NOMAL.getImage()); + FormData data = new FormData(); + data.top = new FormAttachment(0, 119 + H_OFFSET); + data.left = new FormAttachment(0, 34 + W_OFFSET); + data.width = LAUNCH_BUTTON_WIDTH; + data.height = LAUNCH_BUTTON_HEIGHT; + + launchButton.setLayoutData(data); + launchButton.addClickListener(new DACustomButtonClickEventListener() { + @Override + public void handleClickEvent(DACustomButton button) { + // TODO Auto-generated method stub + VMButtonFactory.clickVMButton(getThis()); + if (property != null) { + VMsMainView.getInstance().launchEmulator(property); + } + } + }); + + } + + private VMButton getThis() { + return button; + } + + public void setSelected(boolean selected) { + ((VMButtonAttribute)attr).setSelected(selected); + if (selected && property != null) { + VMsMainView.getInstance().drawDetailVM(property); + } + } + + public void setProperty(VMProperty property) { + ((VMButtonAttribute)attr).setProperty(property); + this.property = property; + } +} + +class VMButtonRenderer extends DACustomButtonDefaultRenderer { + @Override + public void draw(GC gc, Canvas canvas, int state, + DACustomButtonAttribute attr) { + Rectangle rect = canvas.getClientArea(); + + if (attr.getDrawType() == DACustomButton.TYPE_IMAGE) { + Image image = null; + image = attr.getImage(state); + + if (null == image) { + return; + } + + VMButtonAttribute vmAttr = (VMButtonAttribute)attr; + + gc.drawImage(image, rect.x + VMButton.W_OFFSET, rect.y + VMButton.H_OFFSET); + if (vmAttr.isSelected()) { + gc.drawImage(ImageResources.VM_IMAGE_SELECTED.getImage(), rect.x, rect.y); + } + drawButtonText(gc, rect, attr, state); + } else if (attr.getDrawType() == DACustomButton.TYPE_COLOR + || attr.getDrawType() == DACustomButton.TYPE_GRADATION) { + drawButton(gc, rect, state, attr); + } + drawButtonImage(gc, rect, attr); + } + + private static int X_POINT = 40 + VMButton.W_OFFSET; + private static int Y_POINT = 27 + VMButton.H_OFFSET; + private static int Y_GAP = 23; + private static int RE_X_POINT = 16 + VMButton.W_OFFSET; + protected void drawButtonText(GC gc, Rectangle rect, + DACustomButtonAttribute attr, int state) { + VMButtonAttribute vmAttr = (VMButtonAttribute)attr; + VMProperty property = vmAttr.getProperty(); + if (property == null) { + return; + } + + int x = 0; + Point p = null; + p = gc.textExtent(property.getName(), SWT.DRAW_MNEMONIC); + x = (rect.width - p.x) / 2; + + gc.setFont(FontResources.VM_BUTTON_TITLE_FONT.getFont()); + gc.setForeground(attr.getFontColor(state)); + + if (vmAttr.isSelected()) { + gc.setForeground(ColorResources.BLUE.getColor()); + } + + gc.drawString(property.getName(), x, 8, true); + + // reset font coloer + gc.setForeground(attr.getFontColor(state)); + + VMPropertyValue value = property.getPropertyValue(); + + gc.drawString(property.getArch().name(), X_POINT, Y_POINT, true); + gc.drawString(Integer.toString(value.dpi), X_POINT, Y_POINT + Y_GAP, true); + gc.drawString(Integer.toString(value.ramSize), X_POINT, Y_POINT + Y_GAP * 2, true); + gc.drawString(value.resolution.getStrValue(), RE_X_POINT, Y_POINT + Y_GAP * 3, true); + } +} \ No newline at end of file diff --git a/src/org/tizen/emulator/manager/ui/widgets/VMButtonAttribute.java b/src/org/tizen/emulator/manager/ui/widgets/VMButtonAttribute.java new file mode 100644 index 0000000..d09c062 --- /dev/null +++ b/src/org/tizen/emulator/manager/ui/widgets/VMButtonAttribute.java @@ -0,0 +1,22 @@ +package org.tizen.emulator.manager.ui.widgets; + +import org.tizen.emulator.manager.da.widgets.button.DACustomButtonAttribute; +import org.tizen.emulator.manager.vms.VMProperty; + +public class VMButtonAttribute extends DACustomButtonAttribute{ + private boolean selected = false; + private VMProperty property = null; + + public boolean isSelected() { + return selected; + } + public void setSelected(boolean selected) { + this.selected = selected; + } + public VMProperty getProperty() { + return property; + } + public void setProperty(VMProperty property) { + this.property = property; + } +} diff --git a/src/org/tizen/emulator/manager/ui/widgets/VMButtonClickEventListener.java b/src/org/tizen/emulator/manager/ui/widgets/VMButtonClickEventListener.java new file mode 100644 index 0000000..d6ed8ff --- /dev/null +++ b/src/org/tizen/emulator/manager/ui/widgets/VMButtonClickEventListener.java @@ -0,0 +1,37 @@ +package org.tizen.emulator.manager.ui.widgets; + +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.widgets.Event; +import org.tizen.emulator.manager.da.widgets.button.DACustomButton; +import org.tizen.emulator.manager.da.widgets.button.DACustomButtonClickEventListener; + +public abstract class VMButtonClickEventListener extends DACustomButtonClickEventListener{ + @Override + public void handleEvent(Event event) { + DACustomButton button = (DACustomButton) event.widget; + if (null != button && button.getState() != DACustomButton.STATE_DISABLE) { + Rectangle rectangle = button.getBounds(); + int x = event.x; + int y = event.y; + + if (x < 0 || x > rectangle.width || y < 0 || y > rectangle.height) { + return; + } else { + // TODO + // -> open detail view + // -> start emulator + /* + if ((x > 33 && x < 73) && (y > 118 && y < 133)) { + //new MessageDialog().openInfoDialog("TEST"); + } else { + + } + */ + } + } else { + return; + } + + handleClickEvent(button); + } +} \ No newline at end of file diff --git a/src/org/tizen/emulator/manager/vms/Creator.java b/src/org/tizen/emulator/manager/vms/Creator.java index 4a5e702..ba0ceb8 100644 --- a/src/org/tizen/emulator/manager/vms/Creator.java +++ b/src/org/tizen/emulator/manager/vms/Creator.java @@ -34,30 +34,30 @@ import java.io.File; import java.util.ArrayList; import java.util.List; -import org.tizen.emulator.manager.image.Skin; -import org.tizen.emulator.manager.image.SkinList; -import org.tizen.emulator.manager.tool.FilePath; -import org.tizen.emulator.manager.tool.StringResource; +import org.tizen.emulator.manager.platform.Skin; +import org.tizen.emulator.manager.platform.SkinList; +import org.tizen.emulator.manager.resources.FilePath; +import org.tizen.emulator.manager.resources.StringResources; import org.tizen.emulator.manager.vms.xml.EmulatorConfiguration; import org.tizen.emulator.manager.vms.xml.ObjectFactory; public class Creator { - VMsProperty property; + VMProperty property; VMPropertyValue newVM; File folder; private Creator() {} // for createInitialVMImage; private Creator(VMPropertyValue newVM) { - this.property = EmulatorVMs.getInstance().getNewProperty(newVM.vmsName); + this.property = EmulatorVMList.getInstance().getNewProperty(newVM.vmsName); this.newVM = newVM; this.folder = new File(FilePath.getInstance().getVirtualTargetPath(newVM.vmsName)); } - public VMsProperty createInternal() throws VMsWorkerException { + public VMProperty createInternal() throws VMWorkerException { if (this.property == null) { - throw new VMsWorkerException("Failed to create the VM property!"); + throw new VMWorkerException("Failed to create the VM property!"); } folder.mkdirs(); @@ -68,7 +68,7 @@ public class Creator { createRam(); createUsability(); } - catch(VMsCreatorException e) { + catch(VMCreatorException e) { deleteFolder(folder); throw e; } @@ -78,7 +78,7 @@ public class Creator { settingProperty(); - EmulatorVMs.getInstance().storeXML(property); + EmulatorVMList.getInstance().storeXML(property); return property; } @@ -103,24 +103,24 @@ public class Creator { private String customPath = null; private String swapPath = null; - private void createDiskImage() throws VMsCreatorException { + private void createDiskImage() throws VMCreatorException { if (newVM.baseImagePath == null || newVM.baseImagePath.isEmpty()) { // TODO //newVM.baseImagePath = FilePath.getInstance().getBaseimgPath(); - throw new VMsCreatorException("Base image does not exist.\n"); + throw new VMCreatorException("Base image does not exist.\n"); } if (!new File(newVM.baseImagePath).exists()) { - throw new VMsCreatorException("Base image does not exist.\n" + newVM.baseImagePath); + throw new VMCreatorException("Base image does not exist.\n" + newVM.baseImagePath); } checkCustomBaseImage(newVM.baseImagePath); customPath = folder.getAbsolutePath() + File.separator + "emulimg-" + - newVM.vmsName + "." + (newVM.isStandard ? newVM.archType.toString() : EmulatorVMs.getInstance().CustomArch.toString()); + newVM.vmsName + "." + (newVM.isStandard ? newVM.archType.toString() : EmulatorVMList.getInstance().CustomArch.toString()); createInitialVMImageInternal(newVM.baseImagePath, customPath); - String swap_base_path = FilePath.getInstance().getSwapPath() + File.separator + StringResource.SWAP_IMAGE; + String swap_base_path = FilePath.getInstance().getSwapPath() + File.separator + StringResources.SWAP_IMAGE; if (!new File(swap_base_path).exists()) { return; } @@ -129,7 +129,7 @@ public class Creator { createSwapImageInternal(swap_base_path, swapPath); } - private void createSwapImageInternal(String basePath, String targetPath) throws VMsCreatorException { + private void createSwapImageInternal(String basePath, String targetPath) throws VMCreatorException { String exe_path = FilePath.getInstance().getBinPath() + File.separator + "qemu-img"; List cmd = new ArrayList(); @@ -142,13 +142,13 @@ public class Creator { cmd.add(targetPath); if (!new QemuImgProc(cmd).Running()) { - throw new VMsCreatorException("Failed to create the VM because of failed qemu-img processing.\n" + throw new VMCreatorException("Failed to create the VM because of failed qemu-img processing.\n" + "You can get more information in log file (" + FilePath.getInstance().getTizenVmsPath() + File.separator + "emulator-manager)"); } } - private void checkCustomBaseImage(final String path) throws VMsCreatorException { + private void checkCustomBaseImage(final String path) throws VMCreatorException { String exe_path = FilePath.getInstance().getBinPath() + File.separator + "qemu-img"; List cmd = new ArrayList(); @@ -158,11 +158,11 @@ public class Creator { String errorMsg = new QemuImgProc(cmd).RunningForCheckImg(); if (errorMsg != null) { - throw new VMsCreatorException(errorMsg); + throw new VMCreatorException(errorMsg); } } - public void createInitialVMImageInternal(String baseImagePath, String targetImagePath) throws VMsCreatorException { + public void createInitialVMImageInternal(String baseImagePath, String targetImagePath) throws VMCreatorException { String exe_path = FilePath.getInstance().getBinPath() + File.separator + "qemu-img"; List cmd = new ArrayList(); @@ -175,23 +175,23 @@ public class Creator { cmd.add(targetImagePath); if (!new QemuImgProc(cmd).Running()) { - throw new VMsCreatorException("Failed to create the VM because of failed qemu-img processing.\n" + throw new VMCreatorException("Failed to create the VM because of failed qemu-img processing.\n" + "You can get more information in log file (" + FilePath.getInstance().getTizenVmsPath() + File.separator + "emulator-manager)"); } } // usability - private void createFileShare() throws VMsCreatorException { + private void createFileShare() throws VMCreatorException { if (newVM.isFileShareSupport) { if (newVM.fileSharePath == null || newVM.fileSharePath.isEmpty()) { - throw new VMsCreatorException("Select sharing file path"); + throw new VMCreatorException("Select sharing file path"); } } } // Device - private void createDisplay() throws VMsCreatorException { + private void createDisplay() throws VMCreatorException { /* int i = newVM.resolution.indexOf('x'); newVM.resolutionType = new Resolution(); @@ -201,7 +201,7 @@ public class Creator { // TODO if (newVM.skin == null && newVM.skinPath == null) { - ArrayList list = SkinList.getInstance().findSkinList(newVM.resolution.getValue()); + ArrayList list = SkinList.getInstance().findSkinList(newVM.resolution); if (!list.isEmpty()) { newVM.skin = list.get(0); } @@ -213,7 +213,7 @@ public class Creator { private void createUsability() {} private void settingProperty() { - ObjectFactory factory = EmulatorVMs.getInstance().getObjectFactory(); + ObjectFactory factory = EmulatorVMList.getInstance().getObjectFactory(); EmulatorConfiguration ec = property.getConfiguration(); ec.setBaseInformation(factory.createBaseInformationType()); ec.setUsability(factory.createUsabilityType()); @@ -237,7 +237,7 @@ public class Creator { } } else { ec.getBaseInformation().getDiskImage().setType("custom"); - ec.getBaseInformation().setArchitecture(EmulatorVMs.getInstance().CustomArch); + ec.getBaseInformation().setArchitecture(EmulatorVMList.getInstance().CustomArch); } // @@ -299,15 +299,15 @@ public class Creator { } } - public static VMsProperty create(VMPropertyValue newVM) throws VMsWorkerException { + public static VMProperty create(VMPropertyValue newVM) throws VMWorkerException { return new Creator(newVM).createInternal(); } - public static void createInitialVMImage(String basePath, String targetPath) throws VMsCreatorException { + public static void createInitialVMImage(String basePath, String targetPath) throws VMCreatorException { new Creator().createInitialVMImageInternal(basePath, targetPath); } - public static void createSwapImage(String basePath, String targetPath) throws VMsWorkerException { + public static void createSwapImage(String basePath, String targetPath) throws VMWorkerException { new Creator().createSwapImageInternal(basePath, targetPath); } diff --git a/src/org/tizen/emulator/manager/vms/EmulatorVMs.java b/src/org/tizen/emulator/manager/vms/EmulatorVMList.java similarity index 78% rename from src/org/tizen/emulator/manager/vms/EmulatorVMs.java rename to src/org/tizen/emulator/manager/vms/EmulatorVMList.java index c0faf14..9bffb52 100644 --- a/src/org/tizen/emulator/manager/vms/EmulatorVMs.java +++ b/src/org/tizen/emulator/manager/vms/EmulatorVMList.java @@ -35,6 +35,7 @@ import java.io.FileFilter; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; import javax.xml.bind.JAXBContext; @@ -45,18 +46,18 @@ import javax.xml.bind.Unmarshaller; import javax.xml.transform.stream.StreamSource; import org.tizen.emulator.manager.logging.EMLogger; -import org.tizen.emulator.manager.tool.FilePath; -import org.tizen.emulator.manager.tool.StringResource; +import org.tizen.emulator.manager.resources.FilePath; +import org.tizen.emulator.manager.resources.StringResources; import org.tizen.emulator.manager.vms.xml.EmulatorConfiguration; import org.tizen.emulator.manager.vms.xml.ObjectFactory; -public class EmulatorVMs { - static EmulatorVMs instance = null; +public class EmulatorVMList { + static EmulatorVMList instance = null; static { - synchronized(EmulatorVMs.class) { - instance = new EmulatorVMs(); + synchronized(EmulatorVMList.class) { + instance = new EmulatorVMList(); } } @@ -84,11 +85,11 @@ public class EmulatorVMs { } } - List propertiesList = new ArrayList(); + List propertiesList = new ArrayList(); ObjectFactory objectFactory = new ObjectFactory(); - public static EmulatorVMs getInstance() { + public static EmulatorVMList getInstance() { return instance; } @@ -117,14 +118,29 @@ public class EmulatorVMs { loadProperties(); } + class Pair implements Comparable { + public long t; + public File f; + + public Pair(File file) { + f = file; + t = file.lastModified(); + } + + public int compareTo(Object o) { + long u = ((Pair) o).t; + return t < u ? -1 : t == u ? 0 : 1; + } + }; + public void loadProperties() { propertiesList.clear(); // traverse VMs... File vmsDirectory = new File(vmsConfigDirectory); String configFilename = null; File configFile = null; - VMsProperty property = null; - for(File vm : vmsDirectory.listFiles(new FileFilter() { + VMProperty property = null; + File[] files = vmsDirectory.listFiles(new FileFilter() { @Override public boolean accept(File pathname) { if(!pathname.isDirectory()) { @@ -132,8 +148,19 @@ public class EmulatorVMs { } return true; } - })) { - configFilename = StringResource.PROPERTY_XML_NAME; + }); + Pair[] pairs = new Pair[files.length]; + for (int i = 0; i < files.length; i++) + pairs[i] = new Pair(files[i]); + + // Sort them by timestamp. + Arrays.sort(pairs); + + // Take the sorted pairs and extract only the file part, discarding the timestamp. + for (int i = 0; i < files.length; i++) + files[i] = pairs[i].f; + for(File vm : files) { + configFilename = StringResources.PROPERTY_XML_NAME; configFile = new File(vm, configFilename); if(!configFile.exists()) { continue ; // FIXME @@ -145,7 +172,7 @@ public class EmulatorVMs { } } - private VMsProperty parseXML(File configFile) { + private VMProperty parseXML(File configFile) { JAXBContext context = null; JAXBElement element = null; @@ -161,15 +188,15 @@ public class EmulatorVMs { return null; } - return new VMsProperty(configFile, element.getValue()); + return new VMProperty(configFile, element.getValue()); } - public VMsProperty getProperty(String name) { + public VMProperty getProperty(String name) { if(name == null) { return null; } - for(VMsProperty property : propertiesList) { + for(VMProperty property : propertiesList) { if(name.equals(property.getName())) { return property; } @@ -178,11 +205,11 @@ public class EmulatorVMs { return null; } - public VMsProperty[] getProperties() { - return propertiesList.toArray(new VMsProperty[propertiesList.size()]); + public VMProperty[] getProperties() { + return propertiesList.toArray(new VMProperty[propertiesList.size()]); } - public boolean storeXML(VMsProperty property) { + public boolean storeXML(VMProperty property) { JAXBContext context = null; try { @@ -209,9 +236,9 @@ public class EmulatorVMs { return true; } - public VMsProperty getNewProperty(String name) { + public VMProperty getNewProperty(String name) { String configDirectoryName = FilePath.getInstance().getTizenVmsPath() + File.separator + name; - String configFilename = configDirectoryName + File.separator + StringResource.PROPERTY_XML_NAME; + String configFilename = configDirectoryName + File.separator + StringResources.PROPERTY_XML_NAME; File configFile = new File(configFilename); @@ -231,7 +258,7 @@ public class EmulatorVMs { // . // . - return new VMsProperty(configFile, ec); + return new VMProperty(configFile, ec); } // for testing "load properties"... diff --git a/src/org/tizen/emulator/manager/vms/VMCreateHelper.java b/src/org/tizen/emulator/manager/vms/HelperClass.java similarity index 57% rename from src/org/tizen/emulator/manager/vms/VMCreateHelper.java rename to src/org/tizen/emulator/manager/vms/HelperClass.java index a42abf6..5ec5730 100644 --- a/src/org/tizen/emulator/manager/vms/VMCreateHelper.java +++ b/src/org/tizen/emulator/manager/vms/HelperClass.java @@ -32,13 +32,42 @@ package org.tizen.emulator.manager.vms; import org.eclipse.swt.SWT; import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Combo; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Event; import org.eclipse.swt.widgets.Listener; +import org.tizen.emulator.manager.EmulatorManager; +import org.tizen.emulator.manager.ui.MainDialog; -public class VMCreateHelper { - public boolean checkString(String t) { +public class HelperClass { + public static boolean checkImageName(String newName, boolean showStatus) { + String errorMsg = ""; + boolean result = true; + if (newName.length() > VMProperty.MAX_NAME_LEN) { + errorMsg = "Max length is 20."; + result = false; + } else if (!checkString(newName)) { + errorMsg = "Name is invalid!"; + result = false; + } else if (checkDupulicateName(newName)) { + errorMsg = "Same name exists!"; + result = false; + } else if (newName.length() == VMProperty.MAX_NAME_LEN) { + errorMsg = "Max length is 20."; + } else if (newName.isEmpty()) { + result = false; + } + if (showStatus) { + if (errorMsg.isEmpty()) { + MainDialog.getStatusBar().reset(); + } else { + MainDialog.getStatusBar().error(errorMsg); + } + } + return result; + } + public static boolean checkString(String t) { for(char ch : t.toCharArray()) { if((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') || @@ -52,14 +81,14 @@ public class VMCreateHelper { return true; } - public boolean checkDupulicateName(String t) { + public static boolean checkDupulicateName(String t) { boolean isWindows = false; - if (System.getProperty("os.name").toLowerCase().indexOf("windows") > -1) { + if (EmulatorManager.isWin()) { isWindows = true; t = t.toLowerCase(); } - VMsProperty[] properties = (VMsProperty[])EmulatorVMs.getInstance().getProperties(); - for (VMsProperty p : properties) { + VMProperty[] properties = (VMProperty[])EmulatorVMList.getInstance().getProperties(); + for (VMProperty p : properties) { if (isWindows ) { if (p.getName().toLowerCase().equals(t)) { return true; @@ -73,7 +102,7 @@ public class VMCreateHelper { return false; } - public Combo makeCombo(Composite composite) { + public static Combo makeCombo(Composite composite) { Combo combo = new Combo(composite, SWT.DROP_DOWN | SWT.READ_ONLY); combo.addListener(SWT.MouseWheel, new Listener() { @@ -88,7 +117,7 @@ public class VMCreateHelper { return combo; } - public void addComboItem(Combo combo, Object[] items) { + public static void addComboItem(Combo combo, Object[] items) { if (items == null) { return; } else { @@ -96,7 +125,7 @@ public class VMCreateHelper { } } - public void addComboItem(Combo combo, Object[] items, int defaultIndex) { + public static void addComboItem(Combo combo, Object[] items, int defaultIndex) { if (items == null || items.length == 0) { return; } @@ -107,4 +136,18 @@ public class VMCreateHelper { combo.select(defaultIndex); } + + public static GridLayout getNopaddedGridLayout(int numColumns, boolean makeColumnEqualWidth) { + GridLayout layout = new GridLayout(numColumns, makeColumnEqualWidth); + layout.horizontalSpacing = 0; + layout.verticalSpacing = 0; + layout.marginBottom = 0; + layout.marginHeight = 0; + layout.marginLeft = 0; + layout.marginRight = 0; + layout.marginTop = 0; + layout.marginWidth = 0; + + return layout; + } } diff --git a/src/org/tizen/emulator/manager/vms/Launcher.java b/src/org/tizen/emulator/manager/vms/Launcher.java index 2896d9a..fe28204 100644 --- a/src/org/tizen/emulator/manager/vms/Launcher.java +++ b/src/org/tizen/emulator/manager/vms/Launcher.java @@ -43,11 +43,12 @@ import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; import org.tizen.emulator.manager.EmulatorManager; import org.tizen.emulator.manager.logging.EMLogger; +import org.tizen.emulator.manager.resources.FilePath; import org.tizen.emulator.manager.tool.CheckVirtualization; -import org.tizen.emulator.manager.tool.FilePath; import org.tizen.emulator.manager.tool.PortHelper; import org.tizen.emulator.manager.tool.SelectWorkspace; -import org.tizen.emulator.manager.ui.MessageDialog; +import org.tizen.emulator.manager.ui.MainDialog; +import org.tizen.emulator.manager.ui.dialog.MessageDialog; import org.tizen.emulator.manager.vms.xml.TouchType; public class Launcher { @@ -58,7 +59,7 @@ public class Launcher { isConsole = EmulatorManager.isConsoleMode(); } - public List getLaunchCommand(VMsProperty property, String path) throws VMsWorkerException{ + public List getLaunchCommand(VMProperty property, String path) throws VMWorkerException{ String binary; String hwVirtualization = ""; int portNo; @@ -69,7 +70,7 @@ public class Launcher { if(portNo == -1) { String error = "Can not execute emulator.\n All available ports are in use."; if (!isConsole) { - MessageDialog alert = new MessageDialog(EmulatorManager.getInstance().getMainDialog().getShell()); + MessageDialog alert = new MessageDialog(MainDialog.getShell()); alert.openInfoDialog(error); } logger.log(Level.WARNING, error); @@ -77,13 +78,13 @@ public class Launcher { } if (property.getArch().toString().equals("x86")) { - if (System.getProperty("os.name").toLowerCase().indexOf("windows") > -1) { + if (EmulatorManager.isWin()) { binary = "emulator-x86.exe"; } else { binary = "emulator-x86"; } } else { - if (System.getProperty("os.name").toLowerCase().indexOf("windows") > -1) { + if (EmulatorManager.isWin()) { binary = "emulator-arm.exe"; } else { binary = "emulator-arm"; @@ -94,10 +95,10 @@ public class Launcher { File child = new File(property.getConfiguration().getBaseInformation().getDiskImage().getCurrentDiskImage().getValue()); File base = new File(property.getConfiguration().getBaseInformation().getDiskImage().getBaseDiskImage().getValue()); if (!child.exists()) { - throw new VMsWorkerException("Child disk image does not exist.\n" + child.getAbsolutePath()); + throw new VMWorkerException("Child disk image does not exist.\n" + child.getAbsolutePath()); } if (!base.exists()) { - throw new VMsWorkerException("Base disk image does not exist.\n" + base.getAbsolutePath()); + throw new VMWorkerException("Base disk image does not exist.\n" + base.getAbsolutePath()); } if (property.getConfiguration().getUsability().isHwVirtualization() && CheckVirtualization.getInstance().isSupportVirtualization()) { @@ -117,8 +118,6 @@ public class Launcher { } } String fileshare = property.getConfiguration().getUsability().getFileSharing().getPath(); - int isLinux = System.getProperty("os.name").toLowerCase().indexOf("linux"); - int isWindows = System.getProperty("os.name").toLowerCase().indexOf("windows"); String osVersion = System.getProperty("os.version"); boolean isFileshare = true; if (fileshare == null) { @@ -156,7 +155,7 @@ public class Launcher { cmd.add("c"); cmd.add("-append"); /* is linux and use fileshare [kernel option] */ - if(isLinux > -1 && isFileshare) { + if(EmulatorManager.isLinux() && isFileshare) { cmd.add("console=ttyS0 video=uvesafb:ywrap," + width + "x" @@ -175,13 +174,13 @@ public class Launcher { + " ip=10.0.2.16::10.0.2.2:255.255.255.0::eth0:none 5"); } /* is linux and use fileshare [non-kernel option] */ - if(isLinux > -1 && isFileshare) { + if(EmulatorManager.isLinux() && isFileshare) { cmd.add("-virtfs"); cmd.add("local,path=" + property.getConfiguration().getUsability().getFileSharing().getPath() +",security_model=none,mount_tag=fileshare"); } /* is windows XP and use fileshare */ - if(isWindows > -1 && osVersion.equals("5.1") && isFileshare) { + if(EmulatorManager.isWin() && osVersion.equals("5.1") && isFileshare) { /* delete if fileshare with the same name existed */ List cmd2 = new ArrayList(); cmd2.add("net"); @@ -216,7 +215,7 @@ public class Launcher { } } /* is windows 7 and use fileshare */ - else if(isWindows > -1 && osVersion.equals("6.1") && isFileshare) { + else if(EmulatorManager.isWin() && osVersion.equals("6.1") && isFileshare) { /* delete if fileshare with the same name existed */ List cmd2 = new ArrayList(); cmd2.add("net"); @@ -252,7 +251,7 @@ public class Launcher { } } cmd.add("-serial"); - cmd.add("file:" + EmulatorVMs.getInstance().getVMsConfigDirectory() + File.separator + property.getName() + File.separator + "logs" + File.separator + "emulator.klog"); + cmd.add("file:" + EmulatorVMList.getInstance().getVMsConfigDirectory() + File.separator + property.getName() + File.separator + "logs" + File.separator + "emulator.klog"); cmd.add("-m"); cmd.add(String.valueOf(property.getConfiguration().getDevice().getRAM().getSize().getValue())); cmd.add("-M"); @@ -320,11 +319,11 @@ public class Launcher { + " ip=10.0.2.16::10.0.2.2:255.255.255.0::eth0:none 5" + " virtio_mmio.device=4K@0x10AD0000:423 virtio_mmio.device=4K@0x10AC0000:422"); cmd.add("-serial"); - cmd.add(isLinux > -1 ? "/dev/null" : "none"); + cmd.add(EmulatorManager.isLinux() ? "/dev/null" : "none"); cmd.add("-serial"); - cmd.add(isLinux > -1 ? "/dev/null" : "none"); + cmd.add(EmulatorManager.isLinux() ? "/dev/null" : "none"); cmd.add("-serial"); - cmd.add("file:" + EmulatorVMs.getInstance().getVMsConfigDirectory() + File.separator + property.getName() + File.separator + "logs" + File.separator + "emulator.klog"); + cmd.add("file:" + EmulatorVMList.getInstance().getVMsConfigDirectory() + File.separator + property.getName() + File.separator + "logs" + File.separator + "emulator.klog"); cmd.add("-m"); cmd.add(String.valueOf(property.getConfiguration().getDevice().getRAM().getSize().getValue())); cmd.add("-M"); @@ -365,11 +364,11 @@ public class Launcher { return cmd; } - public boolean launch(VMsProperty property) { + public boolean launch(VMProperty property) { List cmd; try { cmd = getLaunchCommand(property, null); - } catch (VMsWorkerException e) { + } catch (VMWorkerException e) { if (!isConsole) { MessageDialog msg = new MessageDialog(new Shell(Display.getCurrent())); msg.openWarningDialog("Failed to launch : " + e.getMessage()); @@ -446,8 +445,8 @@ public class Launcher { } class MonitoringEmulator extends Thread { - private VMsProperty property; - public MonitoringEmulator(VMsProperty property) { + private VMProperty property; + public MonitoringEmulator(VMProperty property) { this.property = property; this.setDaemon(true); } @@ -455,7 +454,7 @@ class MonitoringEmulator extends Thread { public void run() { boolean isChecking = false; for (int i = 0; i < 8 ; i++) { - if (VMsWorker.checking(property)) { + if (VMWorker.checking(property)) { isChecking = true; CheckingRunningEmulator.removeEmulator(property.getName()); break; diff --git a/src/org/tizen/emulator/manager/vms/Modifier.java b/src/org/tizen/emulator/manager/vms/Modifier.java index 1dcccb8..9adbae5 100644 --- a/src/org/tizen/emulator/manager/vms/Modifier.java +++ b/src/org/tizen/emulator/manager/vms/Modifier.java @@ -36,7 +36,8 @@ import org.tizen.emulator.manager.vms.xml.TouchType; public class Modifier { private Modifier() {} - static void modify(VMsProperty property, VMPropertyValue oldVM, VMPropertyValue newVM) throws VMsWorkerException { + static void modify(VMProperty property, VMPropertyValue newVM) throws VMWorkerException { + VMPropertyValue oldVM = property.getPropertyValue(); if(oldVM.equals(newVM)) {// if nothing if modified... return; } @@ -113,7 +114,7 @@ public class Modifier { //else if (EmulatorManager.getInstance().getManagerMode().equals(ManagerModeType.INHOUSE_MODE)) { //touchType == null EmulatorConfiguration ec = property.getConfiguration(); - ec.getDevice().setTouch(EmulatorVMs.getInstance().getObjectFactory().createTouchType()); + ec.getDevice().setTouch(EmulatorVMList.getInstance().getObjectFactory().createTouchType()); ec.getDevice().getTouch().setMaxTouchPoint(newVM.maxTouchCount); } } @@ -122,12 +123,12 @@ public class Modifier { property.getConfiguration().getUsability().setAdvancedOptions(newVM.addOptions); } - EmulatorVMs.getInstance().storeXML(property); + EmulatorVMList.getInstance().storeXML(property); } - private static void modifyFileShare(VMPropertyValue newVM) throws VMsWorkerException { + private static void modifyFileShare(VMPropertyValue newVM) throws VMWorkerException { if (newVM.isFileShareSupport && newVM.fileSharePath.isEmpty()) { - throw new VMsWorkerException("Select sharing file path"); + throw new VMWorkerException("Select sharing file path"); } } } diff --git a/src/org/tizen/emulator/manager/vms/QemuImgProc.java b/src/org/tizen/emulator/manager/vms/QemuImgProc.java index 38f042a..5ae4924 100644 --- a/src/org/tizen/emulator/manager/vms/QemuImgProc.java +++ b/src/org/tizen/emulator/manager/vms/QemuImgProc.java @@ -37,7 +37,7 @@ import java.util.List; import java.util.logging.Level; import org.tizen.emulator.manager.logging.EMLogger; -import org.tizen.emulator.manager.tool.FilePath; +import org.tizen.emulator.manager.resources.FilePath; public class QemuImgProc { private List cmd = null; diff --git a/src/org/tizen/emulator/manager/vms/RESOLUTION.java b/src/org/tizen/emulator/manager/vms/RESOLUTION.java index 8ada0d4..9bea875 100644 --- a/src/org/tizen/emulator/manager/vms/RESOLUTION.java +++ b/src/org/tizen/emulator/manager/vms/RESOLUTION.java @@ -39,7 +39,7 @@ public enum RESOLUTION { private String type; private int dpi; private String strValue; - private String str; + private String strTypeValue; RESOLUTION(int width, int height, String type, int dpi) { this.resolution = new Resolution(); @@ -50,9 +50,9 @@ public enum RESOLUTION { strValue = width +"x" + height; if (type.isEmpty()) { - str = width + "x" + height; + strTypeValue = width + "x" + height; } else { - str = type + "(" + width + "x" + height + ")"; + strTypeValue = type + "(" + width + "x" + height + ")"; } } @@ -68,11 +68,15 @@ public enum RESOLUTION { return resolution; } - public String getValue() { + public String getStrValue() { return strValue; } + public String getStrTypeValue() { + return strTypeValue; + } + public String toString() { - return str; + return strTypeValue; } } diff --git a/src/org/tizen/emulator/manager/vms/SKIN_TYPE.java b/src/org/tizen/emulator/manager/vms/SKIN_TYPE.java new file mode 100644 index 0000000..5bee1e6 --- /dev/null +++ b/src/org/tizen/emulator/manager/vms/SKIN_TYPE.java @@ -0,0 +1,9 @@ +package org.tizen.emulator.manager.vms; + +public enum SKIN_TYPE { + GENERAL(0), PHONE_SHAPE(1); + int type; + SKIN_TYPE(int t) { + this.type = t; + } +} diff --git a/src/org/tizen/emulator/manager/vms/VMsCreatorException.java b/src/org/tizen/emulator/manager/vms/VMCreatorException.java similarity index 91% rename from src/org/tizen/emulator/manager/vms/VMsCreatorException.java rename to src/org/tizen/emulator/manager/vms/VMCreatorException.java index dba3965..f027eaf 100644 --- a/src/org/tizen/emulator/manager/vms/VMsCreatorException.java +++ b/src/org/tizen/emulator/manager/vms/VMCreatorException.java @@ -30,10 +30,10 @@ package org.tizen.emulator.manager.vms; -public class VMsCreatorException extends VMsWorkerException { +public class VMCreatorException extends VMWorkerException { private static final long serialVersionUID = -1670534140703381550L; - public VMsCreatorException(String message) { + public VMCreatorException(String message) { super(message); } } diff --git a/src/org/tizen/emulator/manager/vms/VMsProperty.java b/src/org/tizen/emulator/manager/vms/VMProperty.java similarity index 69% rename from src/org/tizen/emulator/manager/vms/VMsProperty.java rename to src/org/tizen/emulator/manager/vms/VMProperty.java index f1e1abb..62a5ba0 100644 --- a/src/org/tizen/emulator/manager/vms/VMsProperty.java +++ b/src/org/tizen/emulator/manager/vms/VMProperty.java @@ -34,28 +34,41 @@ import java.io.File; import org.tizen.emulator.manager.vms.xml.EmulatorConfiguration; -public class VMsProperty { +public class VMProperty { + public static final int MAX_NAME_LEN = 20; + public static final int MIN_DPI = 100; + public static final int MAX_DPI = 480; + File propertyFile; EmulatorConfiguration configuration; - VMsWorker worker; - VMPropertyValue value; - - public VMsProperty(File propertyFile, EmulatorConfiguration element) { + VMWorker worker; + VMPropertyValue value = null; + + @Override + public boolean equals(Object obj) { + VMProperty target = (VMProperty)obj; + if (target.getName().equals(getName())) { + return true; + } + return false; + } + public VMProperty(File propertyFile, EmulatorConfiguration element) { this.propertyFile = propertyFile; this.configuration = element; - this.worker = new VMsWorker(this); + this.worker = new VMWorker(this); } public VMPropertyValue getPropertyValue() { -// if(this.value == null) -// this.value = new VMPropertyValue(this); -// return value; - return new VMPropertyValue(this); // FIXME + if(this.value == null) { + this.value = new VMPropertyValue(this); + } + return value; + //return new VMsPropertyValue(this); // FIXME } - public VMsWorker getWorker() { + public VMWorker getWorker() { return worker; } @@ -83,6 +96,22 @@ public class VMsProperty { FSImageType.standard : FSImageType.custom; } + public String getBaseImageName() { + if(configuration.getBaseInformation() == null || configuration.getBaseInformation().getDiskImage() == null) { + return null; + } + + return configuration.getBaseInformation().getDiskImage().getBase(); + } + + public String getImageVersion() { + if(configuration.getBaseInformation() == null || configuration.getBaseInformation().getDiskImage() == null) { + return null; + } + + return configuration.getBaseInformation().getDiskImage().getVersion(); + } + public EmulatorConfiguration getConfiguration() { return configuration; } diff --git a/src/org/tizen/emulator/manager/vms/VMPropertyValue.java b/src/org/tizen/emulator/manager/vms/VMPropertyValue.java index 26d86e0..06a4323 100644 --- a/src/org/tizen/emulator/manager/vms/VMPropertyValue.java +++ b/src/org/tizen/emulator/manager/vms/VMPropertyValue.java @@ -34,12 +34,12 @@ import java.io.File; import java.io.IOException; import java.util.ArrayList; -import org.tizen.emulator.manager.image.BaseImage; -import org.tizen.emulator.manager.image.SkinList; -import org.tizen.emulator.manager.image.Skin; import org.tizen.emulator.manager.logging.EMLogger; +import org.tizen.emulator.manager.platform.BaseImage; +import org.tizen.emulator.manager.platform.Skin; +import org.tizen.emulator.manager.platform.SkinList; +import org.tizen.emulator.manager.resources.StringResources; import org.tizen.emulator.manager.tool.CheckVirtualization; -import org.tizen.emulator.manager.tool.StringResource; import org.tizen.emulator.manager.vms.xml.DisplayType.Resolution; import org.tizen.emulator.manager.vms.xml.TouchType; @@ -50,7 +50,7 @@ public class VMPropertyValue implements Cloneable { customSkins = new ArrayList(); } public BaseImage image; - public VMsProperty template; + public VMProperty template; public String vmsName; public String archType; @@ -81,7 +81,7 @@ public class VMPropertyValue implements Cloneable { private VMPropertyValue(){} // for clone - public VMPropertyValue(BaseImage image, VMsProperty template) { + public VMPropertyValue(BaseImage image, VMProperty template) { this.image = image; this.template = template; @@ -94,14 +94,14 @@ public class VMPropertyValue implements Cloneable { isStandard = true; archType = image.getCpu(); version = image.getVersion(); - baseName = image.getDirName(); + baseName = image.getName(); baseImagePath = image.getPath(); - baseImagePathName = image.getImagePathName(); + baseImagePathName = image.getPathName(); settingConfigure(template); } } - public VMPropertyValue(VMsProperty property) { + public VMPropertyValue(VMProperty property) { assert property == null; this.template = property; @@ -212,7 +212,7 @@ public class VMPropertyValue implements Cloneable { return true; } - private void settingConfigure(VMsProperty property) { + private void settingConfigure(VMProperty property) { if (property == null) { settingConfigure(); return; @@ -267,7 +267,7 @@ public class VMPropertyValue implements Cloneable { (fileSharePath.lastIndexOf(File.separator) + 1, fileSharePath.length()); } else { fileSharePath = ""; - fileSharePathName = StringResource.None; + fileSharePathName = StringResources.None; } ramSize = property.getConfiguration().getDevice().getRAM().getSize().getValue(); @@ -291,7 +291,7 @@ public class VMPropertyValue implements Cloneable { resolution = RESOLUTION.HD; dpi = RESOLUTION.HD.getDPI(); // this value be related to resolution - ArrayList list = SkinList.getInstance().findSkinList(resolution.getValue()); + ArrayList list = SkinList.getInstance().findSkinList(resolution); if (!list.isEmpty()) { skin = list.get(0); } @@ -309,7 +309,7 @@ public class VMPropertyValue implements Cloneable { isFileShareSupport = false; fileSharePath = ""; - fileSharePathName = StringResource.None; + fileSharePathName = StringResources.None; isHWVirtualization = CheckVirtualization.getInstance().isSupportVirtualization(); isGLAcceleration = CheckVirtualization.getInstance().isSupportGPU(); @@ -319,12 +319,12 @@ public class VMPropertyValue implements Cloneable { addOptions = null; } - private void settingDefault(boolean isStandard, VMsProperty template) { + private void settingDefault(boolean isStandard, VMProperty template) { vmsName = ""; archType = isStandard ? template.getArch().toString() : "x86"; baseImagePath = ""; - baseImagePathName = isStandard ? (archType.equals("x86") ? "( emulimg-2.0.x86 )" : "( emulimg-2.0.arm )") : StringResource.None; + baseImagePathName = isStandard ? (archType.equals("x86") ? "( emulimg-2.0.x86 )" : "( emulimg-2.0.arm )") : StringResources.None; settingConfigure(template); } diff --git a/src/org/tizen/emulator/manager/vms/VMsWorker.java b/src/org/tizen/emulator/manager/vms/VMWorker.java similarity index 77% rename from src/org/tizen/emulator/manager/vms/VMsWorker.java rename to src/org/tizen/emulator/manager/vms/VMWorker.java index 6d831ac..cd98ebf 100644 --- a/src/org/tizen/emulator/manager/vms/VMsWorker.java +++ b/src/org/tizen/emulator/manager/vms/VMWorker.java @@ -43,57 +43,52 @@ import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; import org.tizen.emulator.manager.EmulatorManager; import org.tizen.emulator.manager.logging.EMLogger; -import org.tizen.emulator.manager.tool.FilePath; -import org.tizen.emulator.manager.tool.StringResource; +import org.tizen.emulator.manager.resources.FilePath; +import org.tizen.emulator.manager.resources.StringResources; import org.tizen.emulator.manager.ui.MenuHandling; -import org.tizen.emulator.manager.ui.MessageDialog; +import org.tizen.emulator.manager.ui.dialog.MessageDialog; -public class VMsWorker { - VMsProperty property; +public class VMWorker { + VMProperty property; Launcher launcher; - WorkerThread worker = null; + WorkerThread worker = null; String baseImagePath = null; - public VMsWorker(VMsProperty property) { + public VMWorker(VMProperty property) { this.property = property; launcher = new Launcher(); } - public void launchVM() throws VMsWorkerException { + public void launchVM() throws VMWorkerException { if(isRunningNow()) { - throw new VMsWorkerException("Can not execute this VM." - + StringResource.NEW_LINE + throw new VMWorkerException("Can not execute this VM." + StringResources.NEW_LINE + "The same name is running now."); } launcher.launch(property); } - public boolean createVM(VMPropertyValue newVM) throws VMsWorkerException { - Creator.create(newVM); - - return true; - } - - public void modifyVM(VMPropertyValue oldVM, VMPropertyValue newVM) throws VMsWorkerException { + public void modifyVM(VMPropertyValue newVM) throws VMWorkerException { if(EmulatorManager.isConsoleMode() && property.getWorker().isRunningNow()) { - throw new VMsWorkerException("Not allowed to modify active VMs" - + StringResource.NEW_LINE + throw new VMWorkerException("Not allowed to modify active VMs" + + StringResources.NEW_LINE + "[" + property.getName() + "] is running now..."); } - Modifier.modify(property, oldVM, newVM); + Modifier.modify(property, newVM); } - public void createNewBaseImage(VMsProperty property, String dest) throws VMsWorkerException { + public void createNewBaseImage(VMProperty property, String dest) throws VMWorkerException { baseImagePath = dest; File childImage = new File(property.getConfiguration().getBaseInformation().getDiskImage().getCurrentDiskImage().getValue()); File baseImage = new File(property.getConfiguration().getBaseInformation().getDiskImage().getBaseDiskImage().getValue()); if(!childImage.exists()) { - throw new VMsWorkerException("Failed to create base image!\nFile does not exist :" + childImage.getAbsolutePath()); + throw new VMWorkerException("Failed to create base image!" + StringResources.NEW_LINE + + "File does not exist :" + childImage.getAbsolutePath()); } if(!baseImage.exists()) { - throw new VMsWorkerException("Failed to create base image!\nFile does not exist :" + baseImage.getAbsolutePath()); + throw new VMWorkerException("Failed to create base image!" + StringResources.NEW_LINE + + "File does not exist :" + baseImage.getAbsolutePath()); } String exe_path = FilePath.getInstance().getBinPath() + File.separator + "qemu-img"; @@ -121,7 +116,7 @@ public class VMsWorker { worker = new WorkerThread(proc); worker.start(); if (EmulatorManager.isConsoleMode()) { - System.out.println("Wait....while creating base image." + StringResource.NEW_LINE + System.out.println("Wait....while creating base image.\n" + "This task can take about 30 ~ 60 seconds"); synchronized(worker) { try { @@ -130,8 +125,8 @@ public class VMsWorker { e.printStackTrace(); } if (worker.isError()) { - throw new VMsWorkerException("Failed to create new base image becauese of failed qemu-img processing!" - + StringResource.NEW_LINE + throw new VMWorkerException("Failed to create new base image becauese of failed qemu-img processing!" + + StringResources.NEW_LINE + "You can get more information in log file (" + FilePath.getInstance().getTizenVmsPath() + File.separator + "emulator-manager)"); } @@ -144,8 +139,8 @@ public class VMsWorker { e.printStackTrace(); } if (worker.isError()) { - throw new VMsWorkerException("Failed to create new base image becauese of failed qemu-img processing!" - + StringResource.NEW_LINE + throw new VMWorkerException("Failed to create new base image becauese of failed qemu-img processing!" + + StringResources.NEW_LINE + "You can get more information in log file (" + FilePath.getInstance().getTizenVmsPath() + File.separator + "emulator-manager)"); } @@ -154,7 +149,8 @@ public class VMsWorker { /* if (! proc.Running()) { //dialog.Close(); - throw new VMsWorkerException("Failed to create new base image becauese of failed qemu-img processing!\n" + throw new VMsWorkerException("Failed to create new base image becauese of failed qemu-img processing!" + + StringResources.NEW_LINE + "You can get more information in log file (" + FileIO.getInstance().getTizenVmsArchPath() + File.separator + "emulator-manager)"); } @@ -185,11 +181,11 @@ public class VMsWorker { } } - public void deleteVM() throws VMsWorkerException { + public void deleteVM() throws VMWorkerException { File vmDirectory = property.propertyFile.getParentFile(); if(!vmDirectory.isDirectory()) { - throw new VMsWorkerException("Check VM path !"); + throw new VMWorkerException("Check VM path!"); } if (vmDirectory.exists()) { @@ -209,13 +205,13 @@ public class VMsWorker { } } - public void resetVM() throws VMsWorkerException { + public void resetVM() throws VMWorkerException { String basePath = property.getConfiguration().getBaseInformation().getDiskImage().getBaseDiskImage().getValue(); String targetPath = property.getConfiguration().getBaseInformation().getDiskImage().getCurrentDiskImage().getValue(); if (basePath == null || basePath.isEmpty() || targetPath == null || targetPath.isEmpty()) { - throw new VMsWorkerException("Fail to reset Emulator" + StringResource.NEW_LINE + - "Emulator Name : " + property.getName()); + throw new VMWorkerException("Fail to reset Emulator " + StringResources.NEW_LINE + + "Emulator Name : " + property.getName()); } File oldImageFile = new File(targetPath); @@ -225,21 +221,21 @@ public class VMsWorker { try { Creator.createInitialVMImage(basePath, targetPath); - } catch (VMsCreatorException e) { - throw new VMsWorkerException("Fail to reset Emulator" + StringResource.NEW_LINE + } catch (VMCreatorException e) { + throw new VMWorkerException("Fail to reset Emulator" + StringResources.NEW_LINE + "Emulator Name : " + property.getName() - + StringResource.NEW_LINE + e.getMessage()); + + StringResources.NEW_LINE + e.getMessage()); } if (property.getConfiguration().getBaseInformation().getDiskImage().getSwapDiskImage() != null) { - String swapBasePath = FilePath.getInstance().getSwapPath() + File.separator + StringResource.SWAP_IMAGE; + String swapBasePath = FilePath.getInstance().getSwapPath() + File.separator + StringResources.SWAP_IMAGE; String swapTargetPath = property.getConfiguration().getBaseInformation().getDiskImage().getSwapDiskImage().getValue(); if (!new File(swapBasePath).exists()) { return; } if (swapTargetPath == null || swapTargetPath.isEmpty()) { - throw new VMsWorkerException("Fail to reset Emulator beacause swap path is empty." + StringResource.NEW_LINE + - "Emulator Name : " + property.getName()); + throw new VMWorkerException("Fail to reset Emulator beacause swap path is empty." + StringResources.NEW_LINE + + "Emulator Name : " + property.getName()); } File oldSwapFile = new File(swapTargetPath); @@ -248,17 +244,17 @@ public class VMsWorker { } try { - Creator.createSwapImage(swapBasePath, swapTargetPath); - } catch (VMsCreatorException e) { - throw new VMsWorkerException("Fail to reset Emulator" + StringResource.NEW_LINE + Creator.createSwapImage(swapBasePath, swapTargetPath); + } catch (VMCreatorException e) { + throw new VMWorkerException("Fail to reset Emulator" + StringResources.NEW_LINE + "Emulator Name : " + property.getName() - + StringResource.NEW_LINE + e.getMessage()); + + StringResources.NEW_LINE + e.getMessage()); } } } - public void cloneVM(String newVMName) throws VMsWorkerException { - EmulatorVMs.getInstance().CustomArch = property.getArch().toString(); + public void cloneVM(String newVMName) throws VMWorkerException { + EmulatorVMList.getInstance().CustomArch = property.getArch().toString(); VMPropertyValue newValue = property.getPropertyValue(); newValue.vmsName = newVMName; // TODO @@ -283,21 +279,17 @@ public class VMsWorker { return checking(property); } - public static boolean checking(VMsProperty prop) { + public static boolean checking(VMProperty prop) { Logger logger = EMLogger.getLogger(); boolean result = false; - int isLinux = System.getProperty("os.name").toLowerCase().indexOf("linux"); - int isWindows = System.getProperty("os.name").toLowerCase().indexOf("windows"); - int isMac = System.getProperty("os.name").toLowerCase().indexOf("mac"); - String line; List cmd = new ArrayList(); - if(isLinux > -1) { + if(EmulatorManager.isLinux()) { cmd.add("/bin/ps"); cmd.add("-ef"); } - else if(isWindows > -1) { + else if(EmulatorManager.isWin()) { cmd.add("tasklist"); cmd.add("/V"); cmd.add("/FI"); @@ -305,7 +297,7 @@ public class VMsWorker { cmd.add("/FO"); cmd.add("CSV"); } - else if (isMac > -1){ + else if (EmulatorManager.isMac()){ cmd.add("/bin/ps"); cmd.add("-ef"); } @@ -319,7 +311,7 @@ public class VMsWorker { p = pb.start(); inputReader = new InputStreamReader(p.getInputStream()); stdOut = new BufferedReader(inputReader); - if(isLinux > -1) { + if(EmulatorManager.isLinux()) { while ((line = stdOut.readLine()) != null) { String imagePath = prop.getConfiguration().getBaseInformation().getDiskImage().getCurrentDiskImage().getValue(); if(line.contains(imagePath)) { @@ -329,7 +321,7 @@ public class VMsWorker { } } } - else if(isWindows > -1) { + else if(EmulatorManager.isWin()) { while ((line = stdOut.readLine()) != null) { String[] titleName = line.split(","); // "split[split.length - 1]" is window title. @@ -340,7 +332,7 @@ public class VMsWorker { } } } - else if(isMac > -1) { + else if(EmulatorManager.isMac()) { while ((line = stdOut.readLine()) != null) { String imagePath = prop.getConfiguration().getBaseInformation().getDiskImage().getCurrentDiskImage().getValue(); if(line.contains(imagePath)) { @@ -352,16 +344,15 @@ public class VMsWorker { } if (!result) { - logger.log(Level.INFO, "The same name of VM not exist anywhere. You can continue your job.\n"); + logger.log(Level.INFO, "The same name of VM not exist anywhere. You can continue your job."); } return result; } catch (IOException err) { logger.log(Level.SEVERE, err.getMessage()); if (!EmulatorManager.isConsoleMode()) { MessageDialog msg = new MessageDialog(new Shell(Display.getCurrent())); - msg.openWarningDialog("Error occured while checking if the same VM ." - + StringResource.NEW_LINE - + err.getMessage()); + msg.openWarningDialog("Error occured while checking if the same VM." + + StringResources.NEW_LINE + err.getMessage()); } return false; diff --git a/src/org/tizen/emulator/manager/vms/VMsWorkerException.java b/src/org/tizen/emulator/manager/vms/VMWorkerException.java similarity index 92% rename from src/org/tizen/emulator/manager/vms/VMsWorkerException.java rename to src/org/tizen/emulator/manager/vms/VMWorkerException.java index 6e550df..d2d0751 100644 --- a/src/org/tizen/emulator/manager/vms/VMsWorkerException.java +++ b/src/org/tizen/emulator/manager/vms/VMWorkerException.java @@ -30,10 +30,10 @@ package org.tizen.emulator.manager.vms; -public class VMsWorkerException extends Exception { +public class VMWorkerException extends Exception { private static final long serialVersionUID = -6819776106619652987L; - public VMsWorkerException(String message) { + public VMWorkerException(String message) { super(message); } } -- 2.7.4