]> git.argeo.org Git - gpl/argeo-slc.git/commitdiff
enhance UI after first feed backs.
authorBruno Sinou <bsinou@argeo.org>
Fri, 15 Mar 2013 16:03:52 +0000 (16:03 +0000)
committerBruno Sinou <bsinou@argeo.org>
Fri, 15 Mar 2013 16:03:52 +0000 (16:03 +0000)
git-svn-id: https://svn.argeo.org/slc/trunk@6141 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc

plugins/org.argeo.slc.client.ui.dist/icons/package.gif [new file with mode: 0644]
plugins/org.argeo.slc.client.ui.dist/icons/package_obj.gif [deleted file]
plugins/org.argeo.slc.client.ui.dist/plugin.xml
plugins/org.argeo.slc.client.ui.dist/src/main/java/org/argeo/slc/client/ui/dist/DistImages.java
plugins/org.argeo.slc.client.ui.dist/src/main/java/org/argeo/slc/client/ui/dist/editors/BundleDetailsPage.java
plugins/org.argeo.slc.client.ui.dist/src/main/java/org/argeo/slc/client/ui/dist/editors/DistributionOverviewPage.java
plugins/org.argeo.slc.client.ui.dist/src/main/java/org/argeo/slc/client/ui/dist/views/HelpView.java

diff --git a/plugins/org.argeo.slc.client.ui.dist/icons/package.gif b/plugins/org.argeo.slc.client.ui.dist/icons/package.gif
new file mode 100644 (file)
index 0000000..131c28d
Binary files /dev/null and b/plugins/org.argeo.slc.client.ui.dist/icons/package.gif differ
diff --git a/plugins/org.argeo.slc.client.ui.dist/icons/package_obj.gif b/plugins/org.argeo.slc.client.ui.dist/icons/package_obj.gif
deleted file mode 100644 (file)
index 131c28d..0000000
Binary files a/plugins/org.argeo.slc.client.ui.dist/icons/package_obj.gif and /dev/null differ
index 2513bcb31cd05770af40d49427748206bc7d0fff..f4626e4b5f86f38e99a12bd5d49bf1c804e06407 100644 (file)
@@ -8,13 +8,13 @@
             name="SLC Repo"
             class="org.argeo.slc.client.ui.dist.DistributionPerspective"
             id="org.argeo.slc.client.ui.dist.distributionPerspective"
-            icon="icons/repo.gif">
+            icon="icons/distribution_perspective.gif">
                </perspective>
                <perspective
             name="SLC Distribution"
             class="org.argeo.slc.client.ui.dist.AnonymousDistributionPerspective"
             id="org.argeo.slc.client.ui.dist.anonymousDistributionPerspective"
-            icon="icons/distribution_perspective.gif">
+            icon="icons/repo.gif">
                </perspective>
    </extension>
    <!-- Views -->
index cd9b229f67544b733fa3abc29b6bc434d0dd6580..31f4c57899d036645d1767b8fde999e9c6efbd80 100644 (file)
@@ -22,6 +22,9 @@ public class DistImages {
 
        public final static Image IMG_ARTIFACT_BASE = DistPlugin
                        .getImageDescriptor("icons/artifactBase.gif").createImage();
+       public final static Image IMG_PACKAGE = DistPlugin.getImageDescriptor(
+                       "icons/package.gif").createImage();
+
        public final static Image IMG_ARTIFACT_VERSION_BASE = DistPlugin
                        .getImageDescriptor("icons/artifactVersionBase.gif").createImage();
        public final static Image IMG_FILE = DistPlugin.getImageDescriptor(
@@ -50,8 +53,7 @@ public class DistImages {
                        "icons/distGrp.gif").createImage();
        public final static Image IMG_DISTGRP_READONLY = DistPlugin
                        .getImageDescriptor("icons/distGrpReadOnly.gif").createImage();
-       
-       
+
        /* CHECK BOXES */
        public final static Image CHECKED = DistPlugin.getImageDescriptor(
                        "icons/checked.gif").createImage();
index 052301a00a109ba6f208f5126cd466727ef6c977..c9d927ba7c45979fb0f3a1d823a05653f76f55f6 100644 (file)
@@ -26,6 +26,7 @@ import org.argeo.eclipse.ui.ErrorFeedback;
 import org.argeo.jcr.JcrUtils;
 import org.argeo.slc.SlcException;
 import org.argeo.slc.client.ui.dist.DistConstants;
+import org.argeo.slc.client.ui.dist.DistImages;
 import org.argeo.slc.jcr.SlcNames;
 import org.argeo.slc.jcr.SlcTypes;
 import org.eclipse.jface.viewers.ColumnLabelProvider;
@@ -117,6 +118,25 @@ public class BundleDetailsPage extends FormPage implements SlcNames, SlcTypes {
 
        }
 
+       // Workaround to add an artificial level to the export package browser
+       private class LevelElem {
+               private String label;
+               private Object parent;
+
+               public LevelElem(String label, Object parent) {
+                       this.label = label;
+                       this.parent = parent;
+               }
+
+               public String toString() {
+                       return label;
+               }
+
+               public Object getParent() {
+                       return parent;
+               }
+       }
+
        /** Export Package Section */
        private void createExportPackageSection(Composite parent)
                        throws RepositoryException {
@@ -141,11 +161,28 @@ public class BundleDetailsPage extends FormPage implements SlcNames, SlcTypes {
                col.setLabelProvider(new ColumnLabelProvider() {
                        @Override
                        public String getText(Object element) {
-                               return JcrUtils.get((Node) element, SlcNames.SLC_NAME);
+                               if (element instanceof Node)
+                                       return JcrUtils.get((Node) element, SlcNames.SLC_NAME);
+                               else
+                                       return element.toString();
                        }
 
                        @Override
                        public Image getImage(Object element) {
+                               if (element instanceof Node) {
+                                       try {
+
+                                               Node node = (Node) element;
+                                               if (node.isNodeType(SlcTypes.SLC_EXPORTED_PACKAGE))
+                                                       return DistImages.IMG_PACKAGE;
+                                               else if (node.isNodeType(SlcTypes.SLC_JAVA_PACKAGE))
+                                                       return DistImages.IMG_PACKAGE;
+
+                                       } catch (RepositoryException e) {
+                                               throw new SlcException("Error retriving "
+                                                               + "image for the labelProvider", e);
+                                       }
+                               }
                                return null;
                        }
                });
@@ -173,15 +210,25 @@ public class BundleDetailsPage extends FormPage implements SlcNames, SlcTypes {
                        public Object[] getChildren(Object parentElement) {
                                // Only 2 levels for the time being
                                try {
-                                       Node pNode = (Node) parentElement;
-                                       if (pNode.isNodeType(SlcTypes.SLC_EXPORTED_PACKAGE)) {
+                                       if (parentElement instanceof LevelElem) {
+                                               Node node = (Node) ((LevelElem) parentElement)
+                                                               .getParent();
                                                List<Node> nodes = JcrUtils
-                                                               .nodeIteratorToList(listNodes(pNode,
+                                                               .nodeIteratorToList(listNodes(node,
                                                                                SlcTypes.SLC_JAVA_PACKAGE,
                                                                                SlcNames.SLC_NAME));
                                                return nodes.toArray();
-                                       } else
-                                               return null;
+                                       } else if (parentElement instanceof Node) {
+                                               Node pNode = (Node) parentElement;
+                                               if (pNode.isNodeType(SlcTypes.SLC_EXPORTED_PACKAGE)) {
+                                                       if (listNodes(pNode, SlcTypes.SLC_JAVA_PACKAGE,
+                                                                       SlcNames.SLC_NAME).getSize() > 0) {
+                                                               Object[] result = { new LevelElem("uses", pNode) };
+                                                               return result;
+                                                       }
+                                               }
+                                       }
+                                       return null;
                                } catch (RepositoryException e) {
                                        throw new SlcException("Cannot list children Nodes", e);
                                }
@@ -194,12 +241,16 @@ public class BundleDetailsPage extends FormPage implements SlcNames, SlcTypes {
 
                        public boolean hasChildren(Object element) {
                                try {
-                                       Node pNode = (Node) element;
-                                       if (pNode.isNodeType(SlcTypes.SLC_EXPORTED_PACKAGE)) {
-                                               // might return true even if there is no "valid" child
-                                               return pNode.hasNodes();
-                                       } else
-                                               return false;
+                                       if (element instanceof LevelElem)
+                                               return true;
+                                       else {
+                                               Node pNode = (Node) element;
+                                               if (pNode.isNodeType(SlcTypes.SLC_EXPORTED_PACKAGE)) {
+                                                       return listNodes(pNode, SlcTypes.SLC_JAVA_PACKAGE,
+                                                                       SlcNames.SLC_NAME).getSize() > 0;
+                                               }
+                                       }
+                                       return false;
                                } catch (RepositoryException e) {
                                        throw new SlcException("Cannot check children Nodes", e);
                                }
@@ -210,7 +261,7 @@ public class BundleDetailsPage extends FormPage implements SlcNames, SlcTypes {
                viewer.setInput("Initialize");
                // work around a display problem : the tree table has only a few lines
                // when the tree is not expended
-               viewer.expandToLevel(2);
+               viewer.expandToLevel(3);
        }
 
        /** Import Package Section */
index accde864d6be445935264d16f613116a7f04b907..b7d17eb91e968b5d8351ed7aa960acaad9fc62e6 100644 (file)
@@ -337,7 +337,7 @@ public class DistributionOverviewPage extends FormPage implements SlcNames {
 
                // Version
                col = new TableViewerColumn(viewer, SWT.NONE);
-               col.getColumn().setWidth(100);
+               col.getColumn().setWidth(130);
                col.getColumn().setText("Version");
                col.setLabelProvider(new ColumnLabelProvider() {
                        @Override
index e5454e32555f51c8e8504b400cbaeb88c5226d87..9a3c29cddfd47f4e34d78999de7ff8eef660c765 100644 (file)
@@ -35,7 +35,7 @@ public class HelpView extends ViewPart {
        public void createPartControl(Composite parent) {
                parent.setLayout(new GridLayout(2, false));
                Browser browser = new Browser(parent, SWT.NONE);
-               browser.setUrl("http://www.argeo.org");
+               browser.setUrl("/repo/howto.html");
                browser.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1));
        }