Package org.gatein.api.navigation

Examples of org.gatein.api.navigation.Node


        boolean firstActiveSet = false;

        Iterator<Node> nodeIterator = node.iterator();

        while (nodeIterator.hasNext()) {
            Node childNode = nodeIterator.next();
            NavigationNodeBean childNodeBean = new NavigationNodeBean(childNode);

            if (firstActive && !firstActiveSet){
                childNodeBean.setActive(true);
                firstActiveSet = true;
View Full Code Here


     *
     * @return the page of the current portal request.
     */
    public Page getPage() {
        if (!pageLoaded) {
            Node node = getNavigation().getNode(getNodePath());
            PageId pageId = node != null ? node.getPageId() : null;
            page = (pageId == null) ? null : getPortal().getPage(pageId);
            pageLoaded = true;
        }

        return page;
View Full Code Here

        prd.include(request, response);
    }

    protected String generateFeaturePageLink(String featurePageName) {
        if (featurePageName != null) {
            Node featureNode = PortalRequest.getInstance().getNavigation().getNode(NodePath.fromString(featurePageName));
            if (featureNode != null) {
                return featureNode.getURI();
            }
        }
        return null;
    }
View Full Code Here

    // TODO: move this to a different bean
    public List<String> loadOriginNodes(String siteName) {
        try {
            ArrayList<String> nodes = new ArrayList<String>();
            if (siteName != null) {
                Node n = PortalRequest.getInstance().getPortal().getNavigation(new SiteId(siteName))
                        .getRootNode(Nodes.visitAll());
                for (Node node : Nodes.asList(n)) {
                    nodes.add(node.getNodePath().toString());
                }
            }
View Full Code Here

        try {
            ArrayList<String> nodes = new ArrayList<String>();
            if (this.pr.getRedirectSite() != null) {
                Navigation nav = PortalRequest.getInstance().getPortal().getNavigation(new SiteId(this.pr.getRedirectSite()));
                if (nav != null) {
                    Node n = nav.getRootNode(Nodes.visitAll());
                    for (Node node : Nodes.asList(n)) {
                        nodes.add(node.getNodePath().toString());
                    }
                }
            }
View Full Code Here

        if (scopeAttribute != null) {
            scope = Integer.parseInt(scopeAttribute);
            visitor = Nodes.visitNodes(scope);
        }

        Node node = getNode(NodePath.root(), true, visitor);
        boolean showAll = showAllAttribute != null && Boolean.parseBoolean(showAllAttribute);
        if (!showAll || !context.getExternalContext().isUserInRole("administrators")) {
            node = node.filter().showDefault();
        }

        return populateNavigationModel(node, scope, context);
    }
View Full Code Here

        ModelNumber priority = get(navModel, ModelNumber.class, "priority");
        if (priority.isDefined()) {
            navigation.setPriority(priority.getInt());
        }

        Node node = getNode(NodePath.root(), true, Nodes.visitChildren());
        return populateNavigationModel(node, 0, context);
    }
View Full Code Here

        int scope = 0;
        if (scopeAttribute != null) {
            scope = Integer.parseInt(scopeAttribute);
            visitor = Nodes.visitNodes(scope);
        }
        Node node = getNode(path, true, visitor);
        boolean showAll = showAllAttribute != null && Boolean.parseBoolean(showAllAttribute);
        if (showAll && context.getExternalContext().isUserInRole("administrators")) {
            node = node.filter().showDefault();
        } else {
            node = node.filter().showDefault();
        }

        // Populate the model
        ModelObject model = modelProvider.newModel(ModelObject.class);
        populateNode(node, scope, model, context.getAddress());
View Full Code Here

    @Managed("{path: .*}")
    @ManagedRole("administrators")
    @ManagedOperation(name = OperationNames.REMOVE_RESOURCE, description = "Removes the navigation node")
    public void removeNode(@MappedPath("path") String path) {
        Node node = getNode(path, true);

        Node parent = node.getParent();
        parent.removeChild(node.getName());
        navigation.saveNode(parent);
    }
View Full Code Here

    @Managed("{path: .*}")
    @ManagedRole("administrators")
    @ManagedOperation(name = OperationNames.ADD_RESOURCE, description = "Adds the navigation node")
    public ModelObject addNode(@MappedPath("path") String path, @ManagedContext PathAddress address) {
        NodePath nodePath = NodePath.fromString(path);
        Node parent = getNode(nodePath.parent(), true, Nodes.visitChildren());
        String name = nodePath.getLastSegment();

        if (parent.hasChild(name)) {
            throw alreadyExists("Cannot add node", navigation.getSiteId(), nodePath);
        }

        // Add child and save
        Node child = parent.addChild(name);
        navigation.saveNode(parent);

        // Populate model
        ModelObject model = modelProvider.newModel(ModelObject.class);
        populateNode(child, 0, model, address);
View Full Code Here

TOP

Related Classes of org.gatein.api.navigation.Node

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.