From: Bruno Sinou Date: Fri, 15 Mar 2013 16:03:52 +0000 (+0000) Subject: enhance UI after first feed backs. X-Git-Tag: argeo-slc-2.1.7~399 X-Git-Url: http://git.argeo.org/?a=commitdiff_plain;h=a51b2bec5e5363b0cbebf4172f4d4d7e58ca0cc9;p=gpl%2Fargeo-slc.git enhance UI after first feed backs. git-svn-id: https://svn.argeo.org/slc/trunk@6141 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc --- 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 index 000000000..131c28da4 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 index 131c28da4..000000000 Binary files a/plugins/org.argeo.slc.client.ui.dist/icons/package_obj.gif and /dev/null differ diff --git a/plugins/org.argeo.slc.client.ui.dist/plugin.xml b/plugins/org.argeo.slc.client.ui.dist/plugin.xml index 2513bcb31..f4626e4b5 100644 --- a/plugins/org.argeo.slc.client.ui.dist/plugin.xml +++ b/plugins/org.argeo.slc.client.ui.dist/plugin.xml @@ -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"> + icon="icons/repo.gif"> diff --git a/plugins/org.argeo.slc.client.ui.dist/src/main/java/org/argeo/slc/client/ui/dist/DistImages.java b/plugins/org.argeo.slc.client.ui.dist/src/main/java/org/argeo/slc/client/ui/dist/DistImages.java index cd9b229f6..31f4c5789 100644 --- a/plugins/org.argeo.slc.client.ui.dist/src/main/java/org/argeo/slc/client/ui/dist/DistImages.java +++ b/plugins/org.argeo.slc.client.ui.dist/src/main/java/org/argeo/slc/client/ui/dist/DistImages.java @@ -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(); diff --git a/plugins/org.argeo.slc.client.ui.dist/src/main/java/org/argeo/slc/client/ui/dist/editors/BundleDetailsPage.java b/plugins/org.argeo.slc.client.ui.dist/src/main/java/org/argeo/slc/client/ui/dist/editors/BundleDetailsPage.java index 052301a00..c9d927ba7 100644 --- a/plugins/org.argeo.slc.client.ui.dist/src/main/java/org/argeo/slc/client/ui/dist/editors/BundleDetailsPage.java +++ b/plugins/org.argeo.slc.client.ui.dist/src/main/java/org/argeo/slc/client/ui/dist/editors/BundleDetailsPage.java @@ -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 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 */ diff --git a/plugins/org.argeo.slc.client.ui.dist/src/main/java/org/argeo/slc/client/ui/dist/editors/DistributionOverviewPage.java b/plugins/org.argeo.slc.client.ui.dist/src/main/java/org/argeo/slc/client/ui/dist/editors/DistributionOverviewPage.java index accde864d..b7d17eb91 100644 --- a/plugins/org.argeo.slc.client.ui.dist/src/main/java/org/argeo/slc/client/ui/dist/editors/DistributionOverviewPage.java +++ b/plugins/org.argeo.slc.client.ui.dist/src/main/java/org/argeo/slc/client/ui/dist/editors/DistributionOverviewPage.java @@ -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 diff --git a/plugins/org.argeo.slc.client.ui.dist/src/main/java/org/argeo/slc/client/ui/dist/views/HelpView.java b/plugins/org.argeo.slc.client.ui.dist/src/main/java/org/argeo/slc/client/ui/dist/views/HelpView.java index e5454e325..9a3c29cdd 100644 --- a/plugins/org.argeo.slc.client.ui.dist/src/main/java/org/argeo/slc/client/ui/dist/views/HelpView.java +++ b/plugins/org.argeo.slc.client.ui.dist/src/main/java/org/argeo/slc/client/ui/dist/views/HelpView.java @@ -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)); }