[Ecm-checkins] r12098 - org.nuxeo.ecm.webapp/branches/NXGED-94_Publication_intf/src/org/nuxeo/ecm/webapp/contentbrowser

npaslaru svn at nuxeo.com
Fri Feb 9 19:41:42 CET 2007


Author: npaslaru
Date: Fri Feb  9 19:41:38 2007
New Revision: 12098

Modified:
   org.nuxeo.ecm.webapp/branches/NXGED-94_Publication_intf/src/org/nuxeo/ecm/webapp/contentbrowser/DocumentActionsBean.java

Log:
Model for the section listing(tree-like)

Modified: org.nuxeo.ecm.webapp/branches/NXGED-94_Publication_intf/src/org/nuxeo/ecm/webapp/contentbrowser/DocumentActionsBean.java
==============================================================================
--- org.nuxeo.ecm.webapp/branches/NXGED-94_Publication_intf/src/org/nuxeo/ecm/webapp/contentbrowser/DocumentActionsBean.java	(original)
+++ org.nuxeo.ecm.webapp/branches/NXGED-94_Publication_intf/src/org/nuxeo/ecm/webapp/contentbrowser/DocumentActionsBean.java	Fri Feb  9 19:41:38 2007
@@ -42,8 +42,14 @@
 import org.nuxeo.ecm.core.api.DocumentModel;
 import org.nuxeo.ecm.core.api.DocumentModelList;
 import org.nuxeo.ecm.core.api.DocumentRef;
+import org.nuxeo.ecm.core.api.DocumentModelTree;
+import org.nuxeo.ecm.core.api.DocumentModelTreeNode;
+import org.nuxeo.ecm.core.api.DocumentRef;
 import org.nuxeo.ecm.core.api.ejb.DocumentManager;
 import org.nuxeo.ecm.core.api.ejb.EJBExceptionHandler;
+import org.nuxeo.ecm.core.api.impl.DocumentModelListImpl;
+import org.nuxeo.ecm.core.api.impl.DocumentModelTreeImpl;
+import org.nuxeo.ecm.core.api.impl.DocumentModelTreeNodeImpl;
 import org.nuxeo.ecm.platform.mimetype.NXMimeType;
 import org.nuxeo.ecm.platform.mimetype.interfaces.MimetypeEntry;
 import org.nuxeo.ecm.platform.mimetype.service.MimetypeRegistryService;
@@ -458,6 +464,48 @@
         return model;
     }
 
+    public SelectDataModel getSectionsSelectModel() throws ClientException {
+        DocumentModel domain = navigationContext.getCurrentDomain();
+        DocumentModelList sectionsRoot = documentManager.getChildren(domain.getRef(), "SectionRoot");
+
+        DocumentModel sectionRoot = sectionsRoot.get(0);
+
+        DocumentModelTree sections = new DocumentModelTreeImpl();
+
+        DocumentModelList mainSections = documentManager.getChildren(sectionRoot.getRef());
+        if (mainSections != null && mainSections.size()>0){
+            for (DocumentModel section : mainSections) {
+                addSubSections(section, sections, 0);
+            }
+        }
+
+        // XXX NP : Temporary
+        List<DocumentModel> selectedDocuments = documentsListsManager
+                .getWorkingList(DocumentsListsManager.CURRENT_DOCUMENT_SELECTION);
+
+        SelectDataModel model = new SelectDataModelImpl(SECTIONS_DOCUMENT_TREE,
+                sections, selectedDocuments);
+        model.addSelectModelListener(this);
+        // XXX AT: see if cache is useful
+        // cacheUpdateNotifier.addCacheListener(model);
+        return model;
+    }
+
+    private void addSubSections(DocumentModel sectionRoot, DocumentModelTree sections, Integer level) throws ClientException {
+        if (sectionRoot != null){
+            DocumentModelTreeNode node = new DocumentModelTreeNodeImpl(sectionRoot, level);
+            sections.add(node);
+            DocumentModelList subSections = documentManager.getChildren(sectionRoot.getRef());
+
+            if (subSections != null && subSections.size() > 0){
+                level++;
+                for (DocumentModel section : subSections) {
+                    addSubSections(section, sections, level);
+                }
+            }
+        }
+    }
+
     // SelectModelListener interface
 
     public void processSelectRowEvent(SelectDataModelRowEvent event) {


About

This page is a mailing archive for one of the Nuxeo projects.

Project News

[2008/11/18] Nuxeo 5.2.M3 and Nuxeo WebEngine 1.0.RC released![2008/11/13] First Nuxeo Developer Day (1st Dec. 2008) - Still a few seats available[2008/11/13] First Nuxeo Survey[2008/10/08] Nuxeo 5.1.6 Released

Corporate News

[2008/11/20] Nuxeo secures 2 million Euros and strengthens its board of directors and corporate governance[2008/11/17] Nuxeo joins OASIS[2008/10/23] IFRA Expo 2008 Amsterdam, October 27th to 30th, Booth 9363, Hall 9[2008/10/08] Nuxeo announces the appointment of Carina Rimoli as Indirect Sales Manager