Uploaded image for project: 'Magnolia'
  1. Magnolia
  2. MAGNOLIA-3585

JCR Browser should show all types

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Won't Do
    • Icon: Minor Minor
    • None
    • None
    • admininterface
    • None
    • Yes

      When using the jcrbrowser tree to display a workspace that uses different node types, one has to subclass the treeConfiguration class to allow those types.

      Since MAGNOLIA-2950 (Magnolia 4.2), we could replace info.magnolia.module.admininterface.trees.JcrBrowserTreeConfiguration#prepareTree with the following code, we will display ALL nodes of that workspaces. (Note that this includes (mgnl:)MetaData as well as jcr:system nodes and its subnodes)

          @Override
          public void prepareTree(Tree tree, boolean browseMode, HttpServletRequest request) {
              super.prepareTree(tree, browseMode, request);
              tree.addItemType("nt:base", null, false);
      
              tree.addColumn(makeNodeTypeColumn(tree));
          }
      
          protected TreeColumn makeNodeTypeColumn(Tree tree) {
              final TreeColumn nodeType = TreeColumn.createColumn(tree, "Node type", new TreeColumnHtmlRenderer() {
                  public String renderHtml(TreeColumn treeColumn, Content content) {
                      try {
                          return content.getNodeType().getName();
                      } catch (RepositoryException e) {
                          log.error("Can't get node type for {}", content, e);
                          return "error: " + e.getMessage();
                      }
                  }
              });
              nodeType.setWidth(2);
              return nodeType;
          }
      

        Acceptance criteria

              Unassigned Unassigned
              gjoseph Magnolia International
              Votes:
              2 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: