Package org.apache.geronimo.gshell.layout.model

Examples of org.apache.geronimo.gshell.layout.model.GroupNode


        if (properties.containsKey("rank")) {
            rank = Integer.parseInt((String) properties.get("rank"));
        }

        // Find or create the subshell group
        GroupNode gn = layout;
        String shell = (String) properties.get("shell");
        String[] aliases = properties.get("alias") != null ? properties.get("alias").toString().split(",") : new String[0];

        if (name.equals(shell))
        {
            Node n = gn.find(shell);
            MutableGroupNode g = new MutableGroupNode(shell);
            gn.add(g);
            register(command);
        }
        else
        {
            if (shell != null && shell.length() > 0) {
                Node n = gn.find(shell);
                if (n == null) {
                    MutableGroupNode g = new MutableGroupNode(shell);
                    gn.add(g);
                    register(new GroupCommand(shell, g));
                    gn = g;
                } else if (n instanceof GroupNode) {
                    gn = (GroupNode) n;
                } else {
                    throw new IllegalStateException("A command conflicts has been detected when registering " + command.getId());
                }
            }

            CommandNode cn = new CommandNode(name, command.getId());
            gn.add(cn);

            for (int i = 0; i < aliases.length; i++) {
                if (!name.equals(aliases[i])) {
                    AliasNode an = new AliasNode(aliases[i], ALIAS_PREFIX + command.getId());
                    gn.add(an);
                }
            }

            register(command);
        }
View Full Code Here


        io.out.print(branding.getAbout());
        io.out.println();
        io.out.println("Available commands:");

        GroupNode group = layoutManager.getLayout();

        displayGroupCommands(group);
    }
View Full Code Here

        io.out.println();

        // Then groups
        for (Node child : group.nodes()) {
            if (child instanceof GroupNode) {
                GroupNode node = (GroupNode) child;

                io.out.print("  ");
                io.out.println(renderer.render(Renderer.encode(node.getPath(), Code.BOLD)));

                io.out.println();
                displayGroupCommands(node);
                io.out.println();
            }
View Full Code Here

        io.out.print(branding.getAbout());
        io.out.println();
        io.out.println("Available commands:");

        GroupNode group = layoutManager.getLayout();

        displayGroupCommands(group);
    }
View Full Code Here

        io.out.println();

        // Then groups
        for (Node child : group.nodes()) {
            if (child instanceof GroupNode) {
                GroupNode node = (GroupNode) child;

                io.out.print("  ");
                io.out.println(renderer.render(Renderer.encode(node.getPath(), Code.BOLD)));

                io.out.println();
                displayGroupCommands(node);
                io.out.println();
            }
View Full Code Here

    }

    protected Object doExecute() throws Exception {
        io.out.println();

        GroupNode gn = layoutManager.getLayout();
        if (context.getVariables().get(LayoutManager.CURRENT_NODE) != null) {
            gn = (GroupNode) context.getVariables().get(LayoutManager.CURRENT_NODE);
        }
        CommandNode cn = null;
        if (path != null) {
            for (String p : path) {
                if (cn != null) {
                    io.err.println("Unexpected path '" + p + "'");
                    return FAILURE;
                }
                Node n = gn.find(p);
                if (n == null) {
                    io.err.println("Path '" + p + "' not found!");
                    return FAILURE;
                } else if (n instanceof GroupNode) {
                    gn = (GroupNode) n;
View Full Code Here

        if (hasShells) {
            io.out.println("Available shells:");
            // Then groups
            for (Node child : nodes) {
                if (child instanceof GroupNode) {
                    GroupNode node = (GroupNode) child;
                    io.out.print("  ");
                    io.out.println(renderer.render(Renderer.encode(node.getName(), Code.BOLD)));
                }
            }
            io.out.println();
        }
    }
View Full Code Here

        if (properties.containsKey("rank")) {
            rank = Integer.parseInt((String) properties.get("rank"));
        }

        // Find or create the subshell group
        GroupNode gn = layout;
        String shell = (String) properties.get("shell");
        String[] aliases = properties.get("alias") != null ? properties.get("alias").toString().split(",") : new String[0];

        if (name.equals(shell))
        {
            Node n = gn.find(shell);
            MutableGroupNode g = new MutableGroupNode(shell);
            gn.add(g);
            register(command);
        }
        else
        {
            if (shell != null && shell.length() > 0) {
                Node n = gn.find(shell);
                if (n == null) {
                    MutableGroupNode g = new MutableGroupNode(shell);
                    gn.add(g);
                    register(new GroupCommand(shell, g));
                    gn = g;
                } else if (n instanceof GroupNode) {
                    gn = (GroupNode) n;
                } else {
                    throw new IllegalStateException("A command conflicts has been detected when registering " + command.getId());
                }
            }

            CommandNode cn = new CommandNode(name, command.getId());
            gn.add(cn);

            for (int i = 0; i < aliases.length; i++) {
                if (!name.equals(aliases[i])) {
                    AliasNode an = new AliasNode(aliases[i], ALIAS_PREFIX + command.getId());
                    gn.add(an);
                }
            }

            register(command);
        }
View Full Code Here

        if (properties.containsKey("rank")) {
            rank = Integer.parseInt((String) properties.get("rank"));
        }

        // Find or create the subshell group
        GroupNode gn = layout;
        String shell = (String) properties.get("shell");
        String[] aliases = properties.get("alias") != null ? properties.get("alias").toString().split(",") : new String[0];

        if (name.equals(shell))
        {
            Node n = gn.find(shell);
            MutableGroupNode g = new MutableGroupNode(shell);
            gn.add(g);
            register(command);
        }
        else
        {
            if (shell != null && shell.length() > 0) {
                Node n = gn.find(shell);
                if (n == null) {
                    MutableGroupNode g = new MutableGroupNode(shell);
                    gn.add(g);
                    register(new GroupCommand(shell, g));
                    gn = g;
                } else if (n instanceof GroupNode) {
                    gn = (GroupNode) n;
                } else {
                    throw new IllegalStateException("A command conflicts has been detected when registering " + command.getId());
                }
            }

            CommandNode cn = new CommandNode(name, command.getId());
            gn.add(cn);

            for (int i = 0; i < aliases.length; i++) {
                if (!name.equals(aliases[i])) {
                    AliasNode an = new AliasNode(aliases[i], ALIAS_PREFIX + command.getId());
                    gn.add(an);
                }
            }

            register(command);
        }
View Full Code Here

TOP

Related Classes of org.apache.geronimo.gshell.layout.model.GroupNode

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.