[INST] Modified profile selection UX. 30/21030/1
authoryongsung1.kim <yongsung1.kim@samsung.com>
Wed, 14 May 2014 14:08:14 +0000 (23:08 +0900)
committeryongsung1.kim <yongsung1.kim@samsung.com>
Wed, 14 May 2014 14:08:14 +0000 (23:08 +0900)
Change-Id: I9fde73f454eda5d221b8a7c0e026969f2073fc48
Signed-off-by: yongsung1.kim <yongsung1.kim@samsung.com>
InstallManager_java/src/org/tizen/installmanager/ui/page/PackageListPage.java

index bfcb080..3c84bec 100644 (file)
@@ -33,9 +33,7 @@ import java.util.ArrayList;
 import java.util.Collection;\r
 import java.util.Collections;\r
 import java.util.HashMap;\r
-import java.util.HashSet;\r
 import java.util.List;\r
-import java.util.Set;\r
 \r
 import org.eclipse.jface.viewers.CheckStateChangedEvent;\r
 import org.eclipse.jface.viewers.CheckboxTreeViewer;\r
@@ -53,15 +51,13 @@ import org.eclipse.swt.graphics.Color;
 import org.eclipse.swt.graphics.Font;\r
 import org.eclipse.swt.graphics.FontData;\r
 import org.eclipse.swt.graphics.Point;\r
-import org.eclipse.swt.layout.FillLayout;\r
 import org.eclipse.swt.layout.GridData;\r
 import org.eclipse.swt.widgets.Button;\r
 import org.eclipse.swt.widgets.Composite;\r
 import org.eclipse.swt.widgets.Display;\r
+import org.eclipse.swt.widgets.Group;\r
 import org.eclipse.swt.widgets.Label;\r
 import org.eclipse.swt.widgets.Table;\r
-import org.eclipse.swt.widgets.TableColumn;\r
-import org.eclipse.swt.widgets.TableItem;\r
 import org.eclipse.swt.widgets.Tree;\r
 import org.eclipse.swt.widgets.TreeColumn;\r
 import org.eclipse.swt.widgets.TreeItem;\r
@@ -69,7 +65,6 @@ import org.tizen.installmanager.core.Config;
 import org.tizen.installmanager.core.InstallManager;\r
 import org.tizen.installmanager.lib.Log;\r
 import org.tizen.installmanager.lib.Platform;\r
-import org.tizen.installmanager.pkg.lib.PackageManager;\r
 import org.tizen.installmanager.pkg.model.Package;\r
 import org.tizen.installmanager.pkg.model.PackageSet;\r
 import org.tizen.installmanager.ui.InstallManagerWindow;\r
@@ -81,8 +76,6 @@ import org.tizen.installmanager.ui.model.ItemTreeContentProvider;
 import org.tizen.installmanager.ui.model.Item.CheckState;\r
 import org.tizen.installmanager.ui.model.Item.InstallState;\r
 \r
-import sun.net.www.protocol.http.AuthCacheValue.Type;\r
-\r
 /**\r
  * Display install or uninstall package lists via tree view.\r
  * \r
@@ -109,14 +102,13 @@ public abstract class PackageListPage extends PageTemplate {
        protected Label presetLabel;\r
        protected Table presetTable;\r
 \r
-       private Composite profileComposite;\r
+       protected Group profileGroup;\r
        protected Button profileButton;\r
        private Package selectedProfile = null;\r
 \r
        ViewController viewController = InstallManagerWindow.getInstallManagerWindow().getViewController();;\r
        \r
        private ArrayList<String> profileList = null;\r
-       private ArrayList<String> profileLabelList = null;\r
        protected Package defaultSelectionProfile = null;\r
        private HashMap<Package, String> profileSet = new HashMap<Package, String>();\r
 \r
@@ -138,7 +130,6 @@ public abstract class PackageListPage extends PageTemplate {
        }\r
        \r
        protected InstallTypeStatus installTypeStatus = null;\r
-       private ArrayList<String> currentProfile= new ArrayList<String>();\r
        \r
        /**\r
         * Set environments for packagelist page, such as style, adding listener.\r
@@ -150,14 +141,14 @@ public abstract class PackageListPage extends PageTemplate {
                super(parent, style, true);\r
 \r
                profileList = new ArrayList<String>();\r
-               profileLabelList = new ArrayList<String>();\r
                customTreeItems = new ArrayList<Item>();\r
                \r
                setTitleLabel(getCustomComposite());\r
                setDescriptionText(getCustomComposite());\r
-               if (!Config.isOldPackageServer) {\r
-                       setProfileLabel(getCustomComposite());\r
-                       setProfileButton(getCustomComposite(), InstallType.TYPICAL.name());\r
+               if (type == Type.INSTALL) {\r
+                       if (!Config.isOldPackageServer) {\r
+                               setProfileButton(getCustomComposite(), InstallType.TYPICAL.name());\r
+                       }\r
                }\r
                \r
                setTree(getCustomComposite(), type);\r
@@ -181,62 +172,64 @@ public abstract class PackageListPage extends PageTemplate {
                }\r
        }\r
        \r
-       private void setProfileLabel(Composite composite) {\r
-               profileLabel = new Label(composite, SWT.NONE);\r
-               profileLabel.setBounds(150, 31, 468, 20);\r
-               profileLabel.setText("Profile");\r
-               profileLabel.setBackground(InstallManagerWindow.getBackgroundColor());\r
-       }\r
-       \r
        protected void setProfileButton(Composite composite, String installType) {\r
                // contain default license\r
                int height = 25;\r
                int width = 250;\r
-               int defaultHeight = 53;\r
+               int defaultHeight = 35;\r
                int defaultGap = 3;\r
                \r
-               if (profileComposite != null) {\r
-                       profileComposite.dispose();\r
+               if (profileGroup != null) {\r
+                       profileGroup.dispose();\r
                }\r
-               \r
-               profileComposite = new Composite(composite, SWT.NONE);\r
-               profileComposite.setBounds(150, defaultHeight, 468, 280);\r
-               profileComposite.setBackground(InstallManagerWindow.getBackgroundColor());\r
-               \r
-               // add license of items\r
-               int yCoordinate = 0;\r
-               for (String profileName : profileList) {\r
-                       profileButton = new Button(profileComposite, SWT.RADIO);                                \r
-                       profileButton.setBounds(0, yCoordinate, width, height);\r
-                       Package profile = InstallManager.getInstance().getPackageManager().getPackageByName(profileName);\r
-                       String label = profileSet.get(profile);\r
-                       profileButton.setText(label);\r
-                       profileButton.setBackground(InstallManagerWindow.getBackgroundColor());\r
-\r
-                       if (selectedProfile == null) {\r
-                               if (profileName.equalsIgnoreCase(defaultSelectionProfile.getPackageName())) {\r
-                                       profileButton.setSelection(true);\r
-                               }\r
-                       } else {\r
-                               if (profileName.equalsIgnoreCase(selectedProfile.getPackageName())) {\r
-                                       profileButton.setSelection(true);\r
+               profileGroup = new Group(composite, SWT.SHADOW_ETCHED_IN);\r
+               profileGroup.setBounds(150, defaultHeight, 458, 250);\r
+               profileGroup.setText("Profiles");\r
+               if (Platform.isUbuntu()) {\r
+                       profileGroup.setFont((new Font(Display.getCurrent(), new FontData("Dejavu Sans", 10, SWT.BOLD))));\r
+               } else if (Platform.isWindows()) {\r
+                       profileGroup.setFont((new Font(Display.getCurrent(), new FontData("Verdana", 10, SWT.BOLD))));                  \r
+               } else {\r
+                       profileGroup.setFont((new Font(Display.getCurrent(), new FontData("Lucida Grande", 12, SWT.BOLD))));\r
+               }\r
+               profileGroup.setBackground(InstallManagerWindow.getBackgroundColor());\r
+\r
+               if (profileList.size() != 0) {\r
+                       // add license of items\r
+                       int yCoordinate = 20;\r
+                       for (String profileName : profileList) {\r
+                               profileButton = new Button(profileGroup, SWT.RADIO);                            \r
+                               profileButton.setBounds(15, yCoordinate, width, height);\r
+                               Package profile = InstallManager.getInstance().getPackageManager().getPackageByName(profileName);\r
+                               String label = profileSet.get(profile);\r
+                               profileButton.setText(label);\r
+                               profileButton.setBackground(InstallManagerWindow.getBackgroundColor());\r
+\r
+                               if (selectedProfile == null) {\r
+                                       if (profileName.equalsIgnoreCase(defaultSelectionProfile.getPackageName())) {\r
+                                               profileButton.setSelection(true);\r
+                                       }\r
+                               } else {\r
+                                       if (profileName.equalsIgnoreCase(selectedProfile.getPackageName())) {\r
+                                               profileButton.setSelection(true);\r
+                                       }\r
                                }\r
-                       }\r
-                       \r
-                       profileButton.addSelectionListener(new SelectionAdapter() {\r
-                               @Override\r
-                               public void widgetSelected(SelectionEvent e) {\r
-                                       Button button = (Button) e.widget;\r
-                                       for (Package pkg : profileSet.keySet()) {\r
-                                               if (pkg.getLabel().equalsIgnoreCase(button.getText())) {\r
-                                                       refreshByType(pkg.getPackageName());\r
-                                                       setSelectedProfile(pkg);\r
+                               \r
+                               profileButton.addSelectionListener(new SelectionAdapter() {\r
+                                       @Override\r
+                                       public void widgetSelected(SelectionEvent e) {\r
+                                               Button button = (Button) e.widget;\r
+                                               for (Package pkg : profileSet.keySet()) {\r
+                                                       if (pkg.getLabel().equalsIgnoreCase(button.getText())) {\r
+                                                               refreshByType(pkg.getPackageName());\r
+                                                               setSelectedProfile(pkg);\r
+                                                       }\r
                                                }\r
                                        }\r
-                               }\r
-                       });\r
+                               });\r
 \r
-                       yCoordinate = yCoordinate + height + defaultGap;\r
+                               yCoordinate = yCoordinate + height + defaultGap;\r
+                       }\r
                }\r
        }\r
 \r
@@ -523,6 +516,7 @@ public abstract class PackageListPage extends PageTemplate {
        \r
        protected void setTitleLabelText(String title) {\r
                titleLabel.setText(title);\r
+               titleLabel.setBackground(InstallManagerWindow.getBackgroundColor());\r
        }\r
 \r
        // set next button to be enabled by checked item count condition.\r
@@ -1017,15 +1011,17 @@ public abstract class PackageListPage extends PageTemplate {
        \r
        protected void changeTableVisibleStatus(InstallType type) {\r
                if (type == InstallType.TYPICAL) {\r
-                       profileLabel.setVisible(true);\r
-                       profileComposite.setVisible(true);\r
+//                     profileLabel.setVisible(true);\r
+//                     profileComposite.setVisible(true);\r
+                       profileGroup.setVisible(true);\r
                        tree.setVisible(false);\r
                        tree.setEnabled(false);\r
                        mDescriptionText.setVisible(false);\r
                } else if (type == InstallType.CUSTOM) {\r
                        if (!Config.isOldPackageServer) {\r
-                               profileLabel.setVisible(false);\r
-                               profileComposite.setVisible(false);\r
+//                             profileLabel.setVisible(false);\r
+//                             profileComposite.setVisible(false);\r
+                               profileGroup.setVisible(false);\r
                        }\r
                        tree.setVisible(true);\r
                        tree.setEnabled(true);\r
@@ -1120,3 +1116,4 @@ public abstract class PackageListPage extends PageTemplate {
                return retItem;\r
        }\r
 }\r
+\r