]> git.argeo.org Git - lgpl/argeo-commons.git/blobdiff - swt/org.argeo.cms.swt/src/org/argeo/cms/swt/app/AcrContentTreeView.java
Improve UX data parts
[lgpl/argeo-commons.git] / swt / org.argeo.cms.swt / src / org / argeo / cms / swt / app / AcrContentTreeView.java
index fb1a79d44333f016faa2d201a2ef349c6ee19418..a3d533e2fb879b3d43bf222fd42736c1a94d0205 100644 (file)
@@ -10,8 +10,8 @@ import javax.xml.namespace.QName;
 import org.argeo.api.acr.Content;
 import org.argeo.api.acr.NamespaceUtils;
 import org.argeo.cms.swt.CmsSwtUtils;
-import org.argeo.cms.swt.widgets.SwtHierarchicalPart;
-import org.argeo.cms.swt.widgets.SwtTabularPart;
+import org.argeo.cms.swt.widgets.SwtTableView;
+import org.argeo.cms.swt.widgets.SwtTreeView;
 import org.argeo.cms.ux.acr.ContentHierarchicalPart;
 import org.argeo.cms.ux.widgets.Column;
 import org.argeo.cms.ux.widgets.DefaultTabularPart;
@@ -19,6 +19,7 @@ import org.eclipse.swt.SWT;
 import org.eclipse.swt.custom.SashForm;
 import org.eclipse.swt.widgets.Composite;
 
+/** A simple ACR browser. */
 public class AcrContentTreeView extends Composite {
        private static final long serialVersionUID = -3707881216246077323L;
 
@@ -36,9 +37,16 @@ public class AcrContentTreeView extends Composite {
                split.setLayoutData(CmsSwtUtils.fillAll());
 
                ContentHierarchicalPart contentPart = new ContentHierarchicalPart();
+               contentPart.addColumn((model) -> {
+                       try {
+                               return NamespaceUtils.toPrefixedName(model.getName());
+                       } catch (IllegalStateException e) {
+                               return model.getName().toString();
+                       }
+               });
                contentPart.setInput(rootContent);
 
-               SwtHierarchicalPart<Content> hPart = new SwtHierarchicalPart<>(split, getStyle(), contentPart);
+               new SwtTreeView<>(split, getStyle(), contentPart);
 
                Composite area = new Composite(split, SWT.BORDER);
                area.setLayout(CmsSwtUtils.noSpaceGridLayout(2));
@@ -79,7 +87,7 @@ public class AcrContentTreeView extends Composite {
                });
                // attributesPart.setInput(selected);
 
-               SwtTabularPart<Content, QName> attributeTable = new SwtTabularPart<>(area, style, attributesPart);
+               SwtTableView<Content, QName> attributeTable = new SwtTableView<>(area, style, attributesPart);
                attributeTable.setLayoutData(CmsSwtUtils.fillAll());
 
                // types
@@ -101,7 +109,7 @@ public class AcrContentTreeView extends Composite {
 
                // typesPart.setInput(selected);
 
-               SwtTabularPart<Content, QName> typesTable = new SwtTabularPart<>(area, style, typesPart);
+               SwtTableView<Content, QName> typesTable = new SwtTableView<>(area, style, typesPart);
                typesTable.setLayoutData(CmsSwtUtils.fillAll());
 
                // controller