Tab Item : change tab item to profile from platform
authorjihye424.kim <jihye424.kim@samsung.com>
Mon, 11 May 2015 05:18:23 +0000 (14:18 +0900)
committerJiHye Kim <jihye424.kim@samsung.com>
Mon, 11 May 2015 06:35:07 +0000 (15:35 +0900)
- make tab item using profile list
- item view work normally
- tree view does not work

Change-Id: I603392182e9fa158994b4d16d0d74d5594af60a0
Signed-off-by: jihye424.kim <jihye424.kim@samsung.com>
common-project/src/org/tizen/emulator/manager/ui/MainDialog.java
common-project/src/org/tizen/emulator/manager/ui/VMsDetailView.java
common-project/src/org/tizen/emulator/manager/ui/VMsListView.java
common-project/src/org/tizen/emulator/manager/ui/VMsMainView.java
common-project/src/org/tizen/emulator/manager/ui/detail/PInfoViewPage.java
common-project/src/org/tizen/emulator/manager/ui/detail/PModifyViewPage.java
common-project/src/org/tizen/emulator/manager/ui/list/ItemListVew.java
common-project/src/org/tizen/emulator/manager/ui/list/TreeListView.java

index 1e60aee..f1c3237 100644 (file)
@@ -50,15 +50,15 @@ import org.eclipse.swt.widgets.Menu;
 import org.eclipse.swt.widgets.Shell;
 import org.tizen.emulator.manager.EmulatorManager.ManagerModeType;
 import org.tizen.emulator.manager.logging.EMLogger;
-import org.tizen.emulator.manager.platform.CustomPlatform;
-import org.tizen.emulator.manager.platform.Platform;
 import org.tizen.emulator.manager.platform.PlatformList;
+import org.tizen.emulator.manager.platform.Profile;
+import org.tizen.emulator.manager.platform.ProfileList;
 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;
+import org.tizen.emulator.manager.ui.tabfolder.ProfileTabFolder;
+import org.tizen.emulator.manager.ui.tabfolder.ProfileTabItem;
 import org.tizen.emulator.manager.ui.widgets.ImageButton;
 import org.tizen.emulator.manager.vms.helper.CheckingRunningEmulator;
 import org.tizen.emulator.manager.vms.helper.RefreshWorker;
@@ -129,8 +129,8 @@ public class MainDialog {
                }
        }
 
-       private ArrayList<PlatformTabItem> platformItems = new ArrayList<PlatformTabItem>(10);
-       private static PlatformTabFolder tabFolder = null;
+       private ArrayList<ProfileTabItem> profileItems = new ArrayList<ProfileTabItem>(10);
+       private static ProfileTabFolder tabFolder = null;
        private ImageButton resetButton = null;
        private ImageButton infoButton  = null;
        private static StatusBar statusBar = null;
@@ -163,7 +163,7 @@ public class MainDialog {
                        }
                });
 
-               tabFolder = new PlatformTabFolder(mainComposite);
+               tabFolder = new ProfileTabFolder(mainComposite);
                statusBar = new StatusBar(mainComposite);
 
                Composite tabComposite = tabFolder.getComposite();
@@ -185,19 +185,13 @@ public class MainDialog {
                barComposite.setLayoutData(data);
 
                // add platform tab item
-               for (Platform p : PlatformList.getPlatformList()) {
-                       platformItems.add(new PlatformTabItem(p, tabFolder, SWT.CENTER));
+               for (Profile p : ProfileList.getProfileList()) {
+                       profileItems.add(new ProfileTabItem(p, tabFolder));
                }
-
-               // add custom tab
-               for (CustomPlatform p : PlatformList.getCustomPlatform()) {
-                       platformItems.add(new PlatformTabItem(p, tabFolder, SWT.CENTER));
-               }
-
+/*
                // add all tab (tree view)
-               platformItems.add(new PlatformTabItem(PlatformList.getTotalPlatform(),
-                               tabFolder, SWT.CENTER));
-
+               profileItems.add(new ProfileTabItem(ProfileList.getTotalProfile(), tabFolder));
+*/
                resetButton = new ImageButton(tabFolder.getTabComposite(), SWT.PUSH);
                resetButton.setImages(ImageResources.RESET_ICON_NOMAL.getImage(),
                                ImageResources.RESET_ICON_HOVER.getImage(),
@@ -241,7 +235,7 @@ public class MainDialog {
        }
 
        public static void refreshVMPropertyList(boolean isClear) {
-               PlatformList.settingVMPropertyList();
+               ProfileList.settingVMPropertyList();
                CheckingRunningEmulator.refreshVMPropertyList();
                RefreshWorker.refreshVMConnect();
 
index 96f7d6f..dac0d70 100644 (file)
@@ -63,11 +63,11 @@ public class VMsDetailView {
        static final StackLayout stackLayout = new StackLayout();
        static DetailViewPage topViewPage;
        private void setTopControl(DetailViewPage page) {
-               if (isChnagePlatform || stackLayout.topControl != page.getComposite()) {
+               if (isChangeProfile || stackLayout.topControl != page.getComposite()) {
                        stackLayout.topControl = page.getComposite();
                        topViewPage = page;
                        page.resize(HEIGHT);
-                       isChnagePlatform = false;
+                       isChangeProfile = false;
                }
                mainView.layout();
 //             mainView.layout(true,true);
index d883872..7e21760 100644 (file)
@@ -157,7 +157,7 @@ public class VMsListView {
                        public void widgetSelected(SelectionEvent e) {
                                if (itemButton.isSelection() && isTreeViewSelect) {
                                        selectRadioButton(false);
-                                       VMsMainView.getInstance().drawVMList(VMsMainView.getInstance().getCurrentImage());
+                                       VMsMainView.getInstance().drawVMList(VMsMainView.getInstance().getProfile());
                                }
                        }
 
@@ -176,7 +176,7 @@ public class VMsListView {
                        public void widgetSelected(SelectionEvent e) {
                                if (treeButton.isSelection() && !isTreeViewSelect) {
                                        selectRadioButton(true);
-                                       VMsMainView.getInstance().drawVMList(VMsMainView.getInstance().getCurrentImage());
+                                       VMsMainView.getInstance().drawVMList(VMsMainView.getInstance().getProfile());
                                }
                        }
 
index 66be492..dbdb32f 100644 (file)
@@ -41,7 +41,6 @@ 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.platform.Profile;
-import org.tizen.emulator.manager.platform.TotalPlatform;
 import org.tizen.emulator.manager.resources.ColorResources;
 import org.tizen.emulator.manager.resources.StringResources;
 import org.tizen.emulator.manager.ui.dialog.MessageDialog;
@@ -175,11 +174,10 @@ public class VMsMainView {
                }
 
                this.currentProfile = profile;
-               // TODO
-               /*
-               detailView.changeProfile();
+
+               detailView.changeProfile(); // TODO
                listView.drawProfile(profile, isRefresh);
-               */
+
        }
 
        public void resetProfile() {
@@ -260,11 +258,11 @@ public class VMsMainView {
        }
 
        public void drawVMList(int index) {
-               if (currentPlatform == null) {
+               if (currentProfile == null) {
                        return;
                } else {
-                       currentPlatform.setCurrentImageIndex(index); // for Tab switching
-                       drawVMList(currentPlatform.getImageList().get(index));
+                       //currentPlatform.setCurrentImageIndex(index); // for Tab switching
+                       drawVMList(currentProfile);
                }
        }
 
@@ -273,11 +271,9 @@ public class VMsMainView {
                if (profile.getEmulatorList().isEmpty()) {
                        drawEmptyVMList();
                } else {
-                       /* TODO
                        listView.drawVMList((currentProperty == null ? 0
-                                       : profile.getEmulatorList().indexOf(currentProperty),
-                                       false));
-                       */
+                                       : profile.getEmulatorList().indexOf(currentProperty)),
+                                       false);
                }
        }
 
@@ -309,11 +305,11 @@ public class VMsMainView {
        // for launch emulator
        public void drawDetailVM(int index) {
                if (index < 0
-               || index > currentImage.getVmsList().size()) {
+               || index > currentProfile.getEmulatorList().size()) {
                        return;
                }
 
-               drawDetailVM(currentImage.getVmsList().get(index), index);
+               drawDetailVM(currentProfile.getEmulatorList().get(index), index);
        }
 
        public void drawModifyVM(VMProperty property) {
@@ -344,14 +340,12 @@ public class VMsMainView {
        }
 
        public void drawCreateVM(boolean setFocus) {
-               if (currentImage.getVmsList().isEmpty()) {
-                       listView.drawVMList(currentImage, -1, true);
+               if (currentProfile.getEmulatorList().isEmpty()) {
+                       listView.drawVMList(-1, true);
                }
-               /*
-               BaseImage image = (currentPlatform.getName().equals("custom"))
-                                                       ? null : currentImage;
-               */
-               drawCreateVM(currentImage, setFocus);
+
+               // TODO
+               drawCreateVM(currentProfile.getImageList().get(0), setFocus);
        }
 
        public void drawCreateVM(BaseImage image, boolean setFocus) {
@@ -368,14 +362,15 @@ public class VMsMainView {
        public void drawCancelCreaetVM() {
                isCreateMode = false;
 
-               if (currentImage.getVmsList().isEmpty()) {
+               if (currentProfile.getEmulatorList().isEmpty()) {
                        listView.cancelModify(-1);
-                       if (currentPlatform == null || !(currentPlatform instanceof TotalPlatform)) {
-                               drawEmptyVMList();
-                       }
+                       //TODO
+                       //if (currentPlatform == null || !(currentPlatform instanceof TotalPlatform)) {
+                               //drawEmptyVMList();
+                       //}
                } else {
                        if (currentProperty != null) {
-                               int i = currentImage.getVmsList().indexOf(currentProperty);
+                               int i = currentProfile.getEmulatorList().indexOf(currentProperty);
                                listView.cancelModify(i);
                                //detailView.drawDetailVM(currentProperty);
                        } else {
index d2c7b20..3e7ae60 100644 (file)
@@ -43,7 +43,8 @@ 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.platform.PlatformList;
+import org.tizen.emulator.manager.platform.Profile;
+import org.tizen.emulator.manager.platform.ProfileList;
 import org.tizen.emulator.manager.plugin.ExtensionItem;
 import org.tizen.emulator.manager.plugin.PluginStringResources;
 import org.tizen.emulator.manager.resources.ImageResources;
@@ -190,26 +191,34 @@ public class PInfoViewPage extends DetailViewPage {
 
                infoItemList = new ArrayList<InfoViewItemList>();
                ExtensionItem item = null;
-               for (Platform platform : PlatformList.getPlatformList()) {
-                       if (platform.getPlugin() != null) {
-                               item = platform.getPlugin().getExtensionItem(PluginStringResources.ItemFactory);
-                               if (item != null) {
-                                       List<ItemList> templateList = new ArrayList<ItemList>();
-                                       for (BaseImage image : platform.getImageList()) {
-                                               ItemList template = image.getItemList();
-                                               if (template != null) {
-                                                       templateList.add(template);
-                                                       infoItemList.add(new InfoViewItemList(item, this.getItemListComposite(),
-                                                                       template, platform.getProfile(), image.getName(), false));
+               for (Profile profile : ProfileList.getProfileList()) {
+                       for (Platform platform : profile.getPlatformList()) {
+                               if (platform.getPlugin() != null) {
+                                       item = platform.getPlugin().getExtensionItem(PluginStringResources.ItemFactory);
+                                       if (item != null) {
+                                               List<ItemList> templateList = new ArrayList<ItemList>();
+                                               for (BaseImage image : profile.getImageList()) {
+                                                       if (!image.getPlatform().equals(platform)) {
+                                                               continue;
+                                                       }
+                                                       ItemList template = image.getItemList();
+                                                       if (template != null) {
+                                                               templateList.add(template);
+                                                               infoItemList.add(new InfoViewItemList(item, this.getItemListComposite(),
+                                                                               template, platform.getProfile(), image.getName(), false));
+                                                       }
                                                }
-                                       }
 
-                                       // add itemlist for custom.
-                                       for (Platform custom : PlatformList.getCustomPlatform()) {
-                                               if (custom.getProfile().equals(platform.getProfile())) {
-                                                       infoItemList.add(new InfoViewItemList(item, this.getItemListComposite(),
-                                                                       custom.getImageList().get(0).getItemList(), custom.getProfile(), null, true));
+                                               // TODO
+                                               // add itemlist for custom.
+                                               /*
+                                               for (Platform custom : PlatformList.getCustomPlatform()) {
+                                                       if (custom.getProfile().equals(platform.getProfile())) {
+                                                               infoItemList.add(new InfoViewItemList(item, this.getItemListComposite(),
+                                                                               custom.getImageList().get(0).getItemList(), custom.getProfile(), null, true));
+                                                       }
                                                }
+                                               */
                                        }
                                }
                        }
index 4db981c..957dc4c 100644 (file)
@@ -44,6 +44,8 @@ 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.platform.PlatformList;
+import org.tizen.emulator.manager.platform.Profile;
+import org.tizen.emulator.manager.platform.ProfileList;
 import org.tizen.emulator.manager.plugin.ExtensionItem;
 import org.tizen.emulator.manager.plugin.PluginStringResources;
 import org.tizen.emulator.manager.resources.ImageResources;
@@ -168,26 +170,34 @@ public class PModifyViewPage extends DetailViewPage
                                                                "Failed to load template");
                modifyItemList = new ArrayList<ModifyViewItemList>();
                ExtensionItem item = null;
-               for (Platform platform : PlatformList.getPlatformList()) {
-                       if (platform.getPlugin() != null) {
-                               item = platform.getPlugin().getExtensionItem(PluginStringResources.ItemFactory);
-                               if (item != null) {
-                                       List<ItemList> templateList = new ArrayList<ItemList>();
-                                       for (BaseImage image : platform.getImageList()) {
-                                               ItemList template = image.getItemList();
-                                               if (template != null) {
-                                                       templateList.add(template);
-                                                       modifyItemList.add(new ModifyViewItemList(item, this,
-                                                                       template, platform.getProfile(), image.getName(), false));
+               for(Profile profile : ProfileList.getProfileList()) {
+                       for (Platform platform : profile.getPlatformList()) {
+                               if (platform.getPlugin() != null) {
+                                       item = platform.getPlugin().getExtensionItem(PluginStringResources.ItemFactory);
+                                       if (item != null) {
+                                               List<ItemList> templateList = new ArrayList<ItemList>();
+                                               for (BaseImage image : profile.getImageList()) {
+                                                       if (!image.getPlatform().equals(platform)) {
+                                                               continue;
+                                                       }
+                                                       ItemList template = image.getItemList();
+                                                       if (template != null) {
+                                                               templateList.add(template);
+                                                               modifyItemList.add(new ModifyViewItemList(item, this,
+                                                                               template, platform.getProfile(), image.getName(), false));
+                                                       }
                                                }
-                                       }
 
-                                       // add itemlist for custom.
-                                       for (Platform custom : PlatformList.getCustomPlatform()) {
-                                               if (custom.getProfile().equals(platform.getProfile())) {
-                                                       modifyItemList.add(new ModifyViewItemList(item, this,
-                                                                       custom.getImageList().get(0).getItemList(), custom.getProfile(), null, true));
+                                               // TODO
+                                               // add itemlist for custom.
+                                               /*
+                                               for (Platform custom : PlatformList.getCustomPlatform()) {
+                                                       if (custom.getProfile().equals(platform.getProfile())) {
+                                                               modifyItemList.add(new ModifyViewItemList(item, this,
+                                                                               custom.getImageList().get(0).getItemList(), custom.getProfile(), null, true));
+                                                       }
                                                }
+                                               */
                                        }
                                }
                        }
index e4ca0b7..9449c83 100644 (file)
@@ -339,7 +339,7 @@ public class ItemListVew extends AbstractListView {
                        createButton = null;
                }
 
-               resetPopupMenu(VMsMainView.getInstance().getCurrentImage().getSortType());
+               resetPopupMenu(VMsMainView.getInstance().getProfile().getSortType());
 
                // clear
                VMButtonFactory.clear();
index d3a4fec..c9d152d 100644 (file)
@@ -320,7 +320,7 @@ public class TreeListView extends AbstractListView {
 
        @Override
        public void drawEmptyVMList() {
-               drawVMList(VMsMainView.getInstance().getCurrentImage(), 0, false);
+               drawVMList(0, false);
        }
 
        @Override