From: jihye424.kim Date: Mon, 11 May 2015 06:01:53 +0000 (+0900) Subject: Tree View : modify tree view to display emulator list X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d5616b87929e9ebb191f98dd218faabc09767d49;p=sdk%2Femulator%2Femulator-manager.git Tree View : modify tree view to display emulator list - Add 'all' tab This tab displays all emulator list. Change-Id: Ib1a1f7ff23d4df93a690ce12671dbe63f441f8bb Signed-off-by: jihye424.kim --- diff --git a/common-project/src/org/tizen/emulator/manager/ui/MainDialog.java b/common-project/src/org/tizen/emulator/manager/ui/MainDialog.java index f1c3237..c3ae1cf 100644 --- a/common-project/src/org/tizen/emulator/manager/ui/MainDialog.java +++ b/common-project/src/org/tizen/emulator/manager/ui/MainDialog.java @@ -50,7 +50,6 @@ 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.PlatformList; import org.tizen.emulator.manager.platform.Profile; import org.tizen.emulator.manager.platform.ProfileList; import org.tizen.emulator.manager.resources.ColorResources; @@ -188,10 +187,10 @@ public class MainDialog { for (Profile p : ProfileList.getProfileList()) { profileItems.add(new ProfileTabItem(p, tabFolder)); } -/* + // add all tab (tree view) 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(), diff --git a/common-project/src/org/tizen/emulator/manager/ui/VMsListView.java b/common-project/src/org/tizen/emulator/manager/ui/VMsListView.java index 7e21760..a79666b 100644 --- a/common-project/src/org/tizen/emulator/manager/ui/VMsListView.java +++ b/common-project/src/org/tizen/emulator/manager/ui/VMsListView.java @@ -191,7 +191,8 @@ public class VMsListView { if (isTreeView) { treeButton.setSelection(true); itemButton.setSelection(false); - if (VMsMainView.getInstance().getPlatform() instanceof TotalPlatform) { + // TODO + if (VMsMainView.getInstance().getProfile().getName().equals("all")) { itemButton.setEnabled(false); TopListView = extendTreeListView; } else { diff --git a/common-project/src/org/tizen/emulator/manager/ui/list/ExtendTreeListView.java b/common-project/src/org/tizen/emulator/manager/ui/list/ExtendTreeListView.java index 24d94af..6533b49 100644 --- a/common-project/src/org/tizen/emulator/manager/ui/list/ExtendTreeListView.java +++ b/common-project/src/org/tizen/emulator/manager/ui/list/ExtendTreeListView.java @@ -40,6 +40,8 @@ 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.PlatformStringResources; +import org.tizen.emulator.manager.platform.Profile; +import org.tizen.emulator.manager.platform.ProfileList; import org.tizen.emulator.manager.ui.VMsMainView; import org.tizen.emulator.manager.vms.VMProperty; import org.tizen.emulator.manager.vms.VMProperty.FSImageType; @@ -175,6 +177,144 @@ public class ExtendTreeListView extends TreeListView { setSelectProperty(); } + @Override + public void drawVMList(int select, boolean isCreate) { + if (select < 0) { + return; + } + currentItem = null; + vmsTree.removeAll(); + createItems.clear(); + typeItems.clear(); + itemsMap.clear(); + + RowItem rowItem = null; + TreeItem createItem = null; + TreeItem propertyItem = null; + + // add standard image + for (Profile p : ProfileList.getProfileList()) { + String standardVersion = p.getName(); + if (!standardVersion.isEmpty()) { + TreeItem tempItem = new TreeItem(vmsTree, SWT.NONE); + rowItem = new StandardVMsMarker(standardVersion, tempItem); + tempItem.setData(rowItem); + itemsMap.put(p.getName(), tempItem); + typeItems.add(tempItem); + + createItem = new TreeItem(tempItem, SWT.NONE); + rowItem = new CreateMarker(createItem, p.getImageList().get(0)); + createItem.setData(rowItem); + createItems.add(createItem); +/* + for (BaseImage b : p.getImageList()) { + TreeItem t = new TreeItem(tempItem, SWT.NONE); + rowItem = new StandardVMsMarker(b.getName(), t); + t.setData(rowItem); + if (!p.isOldVersion()) { + itemsMap.put(p.getProfile() + "-" + p.getVersion() + b.getName(), t); + } else { + itemsMap.put(p.getName() + 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 + for (CustomPlatform p : PlatformList.getCustomPlatform()) { + TreeItem t = new TreeItem(vmsTree, SWT.NONE); + BaseImage b = p.getImageList().get(0); + rowItem = new CustomVMsMarker(p.getName(), t); + t.setData(rowItem); + itemsMap.put(p.getProfile(), t); + typeItems.add(t); + + createItem = new TreeItem(t, SWT.NONE); + rowItem = new CreateMarker(createItem, b); + createItem.setData(rowItem); + createItems.add(createItem); + } +*/ + // add VM + ArrayList properties = (ArrayList) VMsMainView.getInstance().getProfile().getEmulatorList(); + VMProperty prop; + for(int i = 0; i < properties.size(); ++i) { + prop = properties.get(i); + propertyItem = itemsMap.get(prop.getImageProfile()); + if (propertyItem != null) { + propertyItem = new TreeItem(propertyItem, SWT.NONE); + } + /* + // temporarily hard coded now... + //if(properties[i].getArch() == Architecture.ARM) + // continue; + prop = properties.get(i); + if(FSImageType.standard == prop.getImageType()) { + String version = prop.getImageVersion(); + String profile = prop.getImageProfile(); + + version = profile + "-" + version; + + String base = prop.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 { + String profile = prop.getImageProfile(); + customItem = itemsMap.get((profile == null ? PlatformStringResources.MobileProfile : profile)); + propertyItem = new TreeItem(customItem, SWT.NONE); + } +*/ + rowItem = new PropertyContent(prop, propertyItem); + propertyItem.setData(rowItem); + if (i == select) { + currentItem = propertyItem; + } + + } + + for (TreeItem item : createItems) { + item.setExpanded(true); + } + + for(TreeItem item : typeItems) { + item.setExpanded(true); + } + + packAll(); + packAll(); // FIXME: Need second pack avoid column becomes too narrow... why ??? + + if (currentItem == null) { + currentItem = vmsTree.getItem(0); + } + + setSelectProperty(); + } + private boolean isCancelCreateMode = false; @Override public void drawEmptyVMList() { @@ -182,7 +322,7 @@ public class ExtendTreeListView extends TreeListView { isCancelCreateMode = false; setSelectProperty(); } else { - drawVMList(null, 0, false); + drawVMList(0, false); } } diff --git a/common-project/src/org/tizen/emulator/manager/ui/list/TreeListView.java b/common-project/src/org/tizen/emulator/manager/ui/list/TreeListView.java index c9d152d..ed7aee8 100644 --- a/common-project/src/org/tizen/emulator/manager/ui/list/TreeListView.java +++ b/common-project/src/org/tizen/emulator/manager/ui/list/TreeListView.java @@ -259,15 +259,14 @@ public class TreeListView extends AbstractListView { TreeItem createItem = null; TreeItem propertyItem = null; Profile profile = VMsMainView.getInstance().getProfile(); - // TODO - BaseImage base = profile.getImageList().get(0); + createItem = new TreeItem(vmsTree, SWT.NONE); - rowItem = new CreateMarker(createItem, base); + rowItem = new CreateMarker(createItem, profile.getImageList().get(0)); createItem.setData(rowItem); VMProperty prop = null; - for(int i = 0; i < base.getVmsList().size(); i++) { - prop = base.getVmsList().get(i); + for(int i = 0; i < profile.getEmulatorList().size(); i++) { + prop = profile.getEmulatorList().get(i); propertyItem = new TreeItem(vmsTree, SWT.NONE); rowItem = new PropertyContent(prop, propertyItem); propertyItem.setData(rowItem); diff --git a/common-project/src/org/tizen/emulator/manager/ui/tabfolder/ProfileTabFolder.java b/common-project/src/org/tizen/emulator/manager/ui/tabfolder/ProfileTabFolder.java index c5b77bb..2a8d9a2 100644 --- a/common-project/src/org/tizen/emulator/manager/ui/tabfolder/ProfileTabFolder.java +++ b/common-project/src/org/tizen/emulator/manager/ui/tabfolder/ProfileTabFolder.java @@ -208,12 +208,12 @@ public class ProfileTabFolder { if (!b.isSelection()) { // draw main view using selected platform items.get(i).draw(); - /* + // this is temp code..please fix me - if (items.get(i).ProfileTabItem().getName().equals("all")) { + if (items.get(i).getProfile().getName().equals("all")) { items.get(i).draw(); } - */ + contentsComposite.layout(true, false); EmulatorManager.setCurrentTabIndex(i); }