Profile : add list view method for profile tab.
authorjihye424.kim <jihye424.kim@samsung.com>
Mon, 11 May 2015 04:27:13 +0000 (13:27 +0900)
committerjihye424.kim <jihye424.kim@samsung.com>
Mon, 11 May 2015 06:34:42 +0000 (15:34 +0900)
- Drawing vm list using profile

Change-Id: I558b40c6979b871c58df420701e6ff16d2721d53
Signed-off-by: jihye424.kim <jihye424.kim@samsung.com>
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/list/AbstractListView.java
common-project/src/org/tizen/emulator/manager/ui/list/ItemListVew.java
common-project/src/org/tizen/emulator/manager/ui/list/TreeListView.java
common-project/src/org/tizen/emulator/manager/ui/tabfolder/ProfileTabItem.java

index ca876dd..96f7d6f 100644 (file)
@@ -54,6 +54,7 @@ public class VMsDetailView {
 
        private boolean isModifyMode = false;
        private boolean isChnagePlatform = false;
+       private boolean isChangeProfile = false;
 
        public VMsDetailView(Composite parent) {
                this.parent = parent;
@@ -120,6 +121,10 @@ public class VMsDetailView {
                isChnagePlatform = true;
        }
 
+       public void changeProfile() {
+               isChangeProfile = true;
+       }
+
        public void drawEmptyVM() {
                // for setting text
                emptyView.drawPropertyView(null, false);
index 4f9fb90..d883872 100644 (file)
@@ -40,6 +40,7 @@ import org.eclipse.swt.layout.FormLayout;
 import org.eclipse.swt.widgets.Composite;
 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.FontResources;
@@ -265,11 +266,35 @@ public class VMsListView {
                TopListView.drawPlatform(platform, imageIndex);
        }
 
+       public void drawProfile(Profile profile, boolean isRefresh) {
+               if (profile.getName().equals("all")) { // TODO
+                       if (!isRefresh) {
+                               itemButton.setEnabled(false);
+                               selectRadioButton(true);
+                       }
+                       imageCombo.removeAll();
+                       imageCombo.setEnabled(false);
+                       imageCombo.layout();
+               } else {
+                       if (!isRefresh) {
+                               itemButton.setEnabled(true);
+                               selectRadioButton(false);
+                       }
+               }
+
+               TopListView.drawProfile(profile);
+       }
+
        public void drawVMList(BaseImage base, int select, boolean isCreate) {
                TopListView.drawVMList(base, select, isCreate);
                mainView.layout(true, true);
        }
 
+       public void drawVMList(int select, boolean isCreate) {
+               TopListView.drawVMList(select, isCreate);
+               mainView.layout(true, true);
+       }
+
        public void drawEmptyVMList() {
                TopListView.drawEmptyVMList();
                mainView.layout(true, true);
index ef292b0..fdfb7f5 100644 (file)
@@ -33,13 +33,16 @@ import org.eclipse.swt.graphics.Point;
 import org.eclipse.swt.widgets.Composite;
 import org.tizen.emulator.manager.platform.BaseImage;
 import org.tizen.emulator.manager.platform.Platform;
+import org.tizen.emulator.manager.platform.Profile;
 
 public abstract class AbstractListView {
        protected Composite listView;
 
        public abstract void init(Composite parent, int width, int height);
        public abstract void drawPlatform(Platform platform, int imageIndex);
+       public abstract void drawProfile(Profile profile);
        public abstract void drawVMList(BaseImage base, int select, boolean isCreate);
+       public abstract void drawVMList(int select, boolean isCreate);
        public abstract void drawEmptyVMList();
        public abstract void cancelModify(int index);
        public abstract void draw();
index 5215633..e4ca0b7 100644 (file)
@@ -46,6 +46,7 @@ import org.eclipse.swt.widgets.MenuItem;
 import org.eclipse.swt.widgets.Text;
 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.SortBy;
 import org.tizen.emulator.manager.resources.ColorResources;
 import org.tizen.emulator.manager.resources.ImageResources;
@@ -201,6 +202,75 @@ public class ItemListVew extends AbstractListView {
        }
 
        @Override
+       public void drawProfile(Profile profile) {
+               VMsMainView.getInstance().drawVMList(profile);
+       }
+
+       @Override
+       public void drawVMList(int select, boolean isCreate) {
+               Profile profile = VMsMainView.getInstance().getProfile();
+               if (createButton != null) {
+                       if (profile.getEmulatorList().isEmpty()) {
+                               FormData data = new FormData();
+                               data.width = 0;
+                               data.height = 0;
+                               createButton.setLayoutData(data);
+                               createButton.setEnabled(false);
+                       } else {
+                               createButton.dispose();
+                               createButton = null;
+                       }
+               }
+
+               resetPopupMenu(profile.getSortType());
+
+               if (select == -1) {
+                       select = 0;
+               }
+
+               state = VIEW_STATE.DETAIL;
+
+               VMButtonFactory.clear();
+               if (profile.getEmulatorList().size() != 0) {
+                       VMButton button = null;
+                       for (int i = 0; i < profile.getEmulatorList().size(); i++) {
+                               // TODO
+                               button = VMButtonFactory.getButton(vmList, profile.getImageList().get(0));
+                               button.setProperty(profile.getEmulatorList().get(i));
+                               if (i == select) {
+                                       VMButtonFactory.clickVMButton(button);
+                               }
+                       }
+               }
+
+               // add create button
+               // TODO
+               addNewButton = VMButtonFactory.getCreateButton(vmList, profile.getImageList().get(0));
+               if (isCreate) {
+                       addNewButton.setSelection(true);
+               } else {
+                       addNewButton.setSelection(false);
+               }
+               addNewButton.addSelectionListener(new SelectionListener() {
+                       @Override
+                       public void widgetSelected(SelectionEvent e) {
+                               clickCreateButton();
+                       }
+
+                       @Override
+                       public void widgetDefaultSelected(SelectionEvent e) {
+                               // TODO Auto-generated method stub
+                       }
+               });
+
+               BUTTON_WIDTH = VMButtonFactory.getButtonSize().x + 4;
+               BUTTON_HEIGHT = VMButtonFactory.getButtonSize().y + 4;
+
+               arrayVMList();
+               dumyText.setFocus();
+       }
+
+       @Override
        public void drawVMList(BaseImage base, int select, boolean isCreate) {
                if (createButton != null) {
                        if (base.getVmsList().isEmpty()) {
@@ -498,5 +568,4 @@ public class ItemListVew extends AbstractListView {
                        }
                }
        }
-
 }
index 1a33beb..d3a4fec 100644 (file)
@@ -45,6 +45,7 @@ import org.eclipse.swt.widgets.TreeColumn;
 import org.eclipse.swt.widgets.TreeItem;
 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.resources.ColorResources;
 import org.tizen.emulator.manager.resources.FontResources;
 import org.tizen.emulator.manager.ui.VMsMainView;
@@ -243,6 +244,45 @@ public class TreeListView extends AbstractListView {
                VMsMainView.getInstance().drawVMList(imageIndex);
        }
 
+       @Override
+       public void drawProfile(Profile profile) {
+               VMsMainView.getInstance().drawVMList(profile);
+       }
+
+       @Override
+       public void drawVMList(int select, boolean isCreate) {
+               if (select >= 0) {
+                       vmsTree.removeAll();
+                       //currentProp = null;
+                       currentItem = null;
+                       RowItem rowItem = null;
+                       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);
+                       createItem.setData(rowItem);
+
+                       VMProperty prop = null;
+                       for(int i = 0; i < base.getVmsList().size(); i++) {
+                               prop = base.getVmsList().get(i);
+                               propertyItem = new TreeItem(vmsTree, SWT.NONE);
+                               rowItem = new PropertyContent(prop, propertyItem);
+                               propertyItem.setData(rowItem);
+                               if (i == select) {
+                                       //currentProp = (PropertyContent)rowItem;
+                                       currentItem = propertyItem;
+                                       VMsMainView.getInstance().drawDetailVM(prop, -1);
+                               }
+                       }
+                       packAll();
+                       packAll();  // FIXME: Need second pack avoid column becomes too narrow... why ???
+                       setSelectProperty();
+               }
+       }
+
        //private ArrayList<TreeItem> createItems = new ArrayList<TreeItem>();
        //private ArrayList<TreeItem> typeItems = new ArrayList<TreeItem>();
        //private Map<String, TreeItem> itemsMap = new HashMap<String, TreeItem>();
index 50827a7..e8e714b 100644 (file)
@@ -64,7 +64,7 @@ public class ProfileTabItem {
 
        public void draw() {
                // TODO
-               view.clearPlatform();
+               view.clearProfile();
                view.setProfile(profile);
        }