Package org.antlr.works.visualization.graphics.graph

Examples of org.antlr.works.visualization.graphics.graph.GGraphGroup


        // Add only graphs that are referenced by at least one error path.
        // For example, the statement rule of the java.g grammar produces
        // states that do not exist in the graph (they are after the accepted state
        // and are ignored by the FAFactory)
        GGraphGroup gg = new GGraphGroup();
        for (GGraph graph : graphs) {
            if (graph.containsAtLeastOneState(error.states))
                gg.add(graph);
        }

        // Attach all error paths to the GGraphGroup
        for(int i=0; i<error.paths.size(); i++) {
            List states = error.paths.get(i);
            Boolean disabled = error.pathsDisabled.get(i);
            try {
                gg.addPath(states, disabled, factory.getSkippedStatesMap());
            } catch(Exception e) {
                if(console == null)
                    e.printStackTrace();
                else
                    console.println(e);
            }
        }

        // Attach all unreacheable alts to the GGraphGroup
        for (Object[] unreachableAlt : error.unreachableAlts) {
            gg.addUnreachableAlt((NFAState) unreachableAlt[0], (Integer) unreachableAlt[1]);
        }

        if(error.paths.size() > 0)
            gg.getPathGroup().setPathVisible(0, true);

        return gg;
    }
View Full Code Here


        pathButtonSelectionBox.removeAll();

        if(!(view.getCurrentGraph() instanceof GGraphGroup))
            return;

        GGraphGroup gg = (GGraphGroup)view.getCurrentGraph();
        int count = gg.getPathGroup().getNumberOfPaths();
        if(count <= 1)
            pathButtonSelectionBox.add(new JLabel("Alternative:"));
        else
            pathButtonSelectionBox.add(new JLabel("Alternatives:"));
View Full Code Here

        button.setName(String.valueOf(pathIndex));
        button.setFocusable(false);
        button.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent event) {
                JCheckBox button = (JCheckBox)event.getSource();
                GGraphGroup gg = (GGraphGroup)view.getCurrentGraph();
                gg.getPathGroup().setPathVisible(Integer.parseInt(button.getName()), button.isSelected());
                gg.getPathGroup().makeSureCurrentPathIsVisible();
                view.cacheRerender();
                view.repaint();
            }
        });

        GGraphGroup gg = (GGraphGroup)view.getCurrentGraph();
        button.setSelected(gg.getPathGroup().isPathVisible(pathIndex));

        return button;
    }
View Full Code Here

        button.setFocusable(false);
        button.setToolTipText("Show links between rules");
        button.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent event) {
                for (Object o : view.getGraphs()) {
                    GGraphGroup gg = (GGraphGroup) o;
                    gg.getPathGroup().toggleShowRuleLinks();
                }
                view.cacheRerender();
                view.repaint();
            }
        });
View Full Code Here

TOP

Related Classes of org.antlr.works.visualization.graphics.graph.GGraphGroup

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.