Package org.brixcms.jcr.wrapper

Examples of org.brixcms.jcr.wrapper.BrixNode


        return source;
    }

    @Override
    public boolean isVisible() {
        BrixNode node = getModelObject();
        return SitePlugin.get().canViewNode(node, Context.PRESENTATION);
    }
View Full Code Here


            response.write(">");
            List<ChildEntry> childEntryList = entry.getChildren();
            ChildEntry firstEntry = childEntryList.get(0);
            ChildEntry lastEntry = childEntryList.get(childEntryList.size() - 1);
            for (ChildEntry e : childEntryList) {
                BrixNode node = getNode(e);
                if (node == null || SitePlugin.get().canViewNode(node, Context.PRESENTATION)) {
                    renderEntry(e, adapter, response, selectedItems, firstEntry.equals(e), lastEntry.equals(e));
                }
            }
            response.write("</ul>");
View Full Code Here

    private static final NodeFilter SITE_FILTER = new SiteNodeFilter(false, null);



    public void query(IQuery query, IQueryResult result) {
        BrixNode node = getFolderNode();
        List<BrixNode> visibleNodes = visibleNodes(node.getNodes());
        if (query.getSortState().getColumns().isEmpty() == false) {
            sort(visibleNodes, query.getSortState());
        } else {
            sort(visibleNodes, PROPERTY_NAME, IGridSortState.Direction.ASC);
        }

        if (node.getPath().equals(SitePlugin.get().getSiteRootPath()) == false) {
            BrixNode parent = (BrixNode) node.getParent();
            if (canShowNode(parent)) {
                visibleNodes.add(0, parent);
            }
        }
View Full Code Here

    }

    private List<BrixNode> visibleNodes(JcrNodeIterator iterator) {
        List<BrixNode> res = new ArrayList<BrixNode>();
        while (iterator.hasNext()) {
            BrixNode node = (BrixNode) iterator.nextNode();
            if (canShowNode(node)) {
                res.add(node);
            }
        }
        return res;
View Full Code Here

        add(tree = new Tree("tree", new TreeModel()));

        WebMarkupContainer createNodesContainer = new WebMarkupContainer("createNodesContainer") {
            @Override
            public boolean isVisible() {
                BrixNode folderNode = getNewNodeParent().getObject();
                return SitePlugin.get().canAddNodeChild(folderNode, Context.ADMINISTRATION);
            }
        };
        add(createNodesContainer);
View Full Code Here

    private Component getEditor() {
        return get(EDITOR_ID);
    }

    private IModel<BrixNode> getNewNodeParent() {
        BrixNode current = getModelObject();
        if (current instanceof FolderNode) {
            return getModel();
        } else {
            return new BrixNodeModel((BrixNode) current.getParent());
        }
    }
View Full Code Here

    @Override
    protected void onBeforeRender() {
        Workspace workspace = workspaceModel.getObject();

        BrixNode node;
        try {
            node = getModelObject();
        }
        catch (JcrException e) {
            if (e.getCause() instanceof ItemNotFoundException) {
                node = SitePlugin.get().getSiteRootNode(workspace.getId());
                getModel().setObject(null);
                selectNode(node);
                setupDefaultEditor();
                tree.invalidateAll();
            } else {
                throw (e);
            }
        }

        String nodeWorkspaceName = node.getSession().getWorkspace().getName();
        if (!nodeWorkspaceName.equals(workspace.getId())) {
            // we have to either update node or workspace
            if (oldWorkspaceId != null && workspace.getId().equals(oldWorkspaceId)) {
                // the node changed, need to update the workspace
                Workspace newWorkspace = node.getBrix().getWorkspaceManager().getWorkspace(
                        nodeWorkspaceName);
                workspaceModel.setObject(newWorkspace);
            } else {
                // the workspace has changed, update the node
                // 1 try to get node with same UUID, 2 try to get node with same
                // path, 3 get root node
                JcrSession newSession = node.getBrix().getCurrentSession(workspace.getId());
                String uuid = node.getIdentifier();
                BrixNode newNode = JcrUtil.getNodeByUUID(newSession, uuid);
                if (newNode == null) {
                    String path = node.getPath();
                    if (newSession.getRootNode().hasNode(path.substring(1))) {
                        newNode = (BrixNode) newSession.getItem(path);
                    }
View Full Code Here

        super(id, model);

        IModel<String> labelModel = new AbstractModel<String>() {
            @Override
            public String getObject() {
                BrixNode node = NodeColumnPanel.this.getModelObject();
                return node != null ? SitePlugin.get().pathForNode(node) : "";
            }
        };
        final Label label = new Label("label", labelModel);
        add(label);
View Full Code Here

    }

    private static BrixNode getRootNode(IModel<Workspace> workspaceModel) {
        Workspace workspace = workspaceModel.getObject();
        if (workspace != null) {
            BrixNode root = (BrixNode) Brix.get().getCurrentSession(workspace.getId()).getItem(
                    SitePlugin.get().getSiteRootPath());
            return root;
        } else {
            return null;
        }
View Full Code Here

    public String getName() {
        return "Folder";
    }

    public IRequestHandler respond(IModel<BrixNode> nodeModel, BrixPageParameters requestParameters) {
        BrixNode node = nodeModel.getObject();

//        String path = requestParameters.getPath();
//        if (!path.startsWith("/"))
//            path = "/" + path;
//
View Full Code Here

TOP

Related Classes of org.brixcms.jcr.wrapper.BrixNode

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.