Package diva.graph

Examples of diva.graph.GraphPane


            if (_entity == null) {
                _createBlankEntity();
            }

            ActorGraphModel graphModel = new ActorGraphModel(_entity);
            GraphPane graphPane = new GraphPane(controller, graphModel);
            _graph = new JGraph(graphPane);

            // If the model has a recorded size, use it.
            List size = _entity.attributeList(SizeAttribute.class);
            if (size.size() > 0) {
View Full Code Here


    /** Construct a new instance of the graph demo in a particular context.
     *  @param context The context in which the demo is constructed.
     */
    public BasicGraphDemo(AppContext context) {
        final BasicGraphModel model = new BasicGraphModel();
        JGraph jg = new JGraph(new GraphPane(new BasicGraphController(), model));
        JGraph jg2 = new JGraph(
                new GraphPane(new BasicGraphController(), model));

        context.getContentPane().setLayout(new GridLayout(2, 1));
        context.getContentPane().add(jg);
        context.getContentPane().add(jg2);

View Full Code Here

     * This initialization cannot be done in the constructor because
     * the controller does not yet have a reference to its pane
     * at that time.
     */
    protected void initializeInteraction() {
        GraphPane pane = getGraphPane();

        // Create and set up the selection dragger
        _selectionDragger = new SelectionDragger(pane);
        _selectionDragger.addSelectionModel(getSelectionModel());

        // Create a listener that creates new nodes
        _nodeCreator = new NodeCreator();
        _nodeCreator.setMouseFilter(_controlFilter);
        pane.getBackgroundEventLayer().addInteractor(_nodeCreator);

        // Create the interactor that drags new edges.
        _edgeCreator = new EdgeCreator(this) {
            public Object createEdge() {
                Object semanticObject = Integer.valueOf(_globalCount++);
View Full Code Here

            }
        });
    }

    public SimpleTutorial(AppContext context) {
        JGraph jg = new JGraph(new GraphPane(new BasicGraphController(),
                new BasicGraphModel()));
        context.getContentPane().add("Center", jg);
    }
View Full Code Here

    }

    public EditorTutorial(AppContext context) {
        _model = new BasicGraphModel();

        GraphPane pane = new GraphPane(new BasicGraphController(), _model);
        _editor = new JGraph(pane);
        context.getContentPane().add("Center", _editor);
        _target = new BasicLayoutTarget(_editor.getGraphPane()
                .getGraphController());
        _layout = new LevelLayout(_target);
View Full Code Here

     * and are all clustered in the upper-left corner.  This
     * is remedied in the other techniques given below.
     */
    public void bogusLayout(MutableGraphModel model, AppContext context) {
        BasicGraphController gc = new BasicGraphController();
        context.getContentPane().add(new JGraph(new GraphPane(gc, model)));

        RandomLayout random = new RandomLayout(new BasicLayoutTarget(gc));
        random.layout(model.getRoot());
    }
View Full Code Here

     * be useful in some cases.
     */
    public void layoutPostDisplay(final MutableGraphModel model,
            AppContext context) {
        final BasicGraphController bgc = new BasicGraphController();
        context.getContentPane().add(new JGraph(new GraphPane(bgc, model)));
        SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                RandomLayout random = new RandomLayout(new BasicLayoutTarget(
                        bgc));
                random.layout(model.getRoot());
View Full Code Here

    public void setModelPostDisplay(MutableGraphModel model, AppContext context) {
        BasicGraphController gc = new BasicGraphController();
        gc.addGraphViewListener(new IncrementalLayoutListener(
                new IncrLayoutAdapter(
                        new LevelLayout(new BasicLayoutTarget(gc))), null));
        context.getContentPane().add(new JGraph(new GraphPane(gc, model)));
    }
View Full Code Here

     * this might be useful in some cases.
     */
    public void layoutPostDisplay(final MutableGraphModel model,
            AppContext context) {
        final BasicGraphController bgc = new BasicGraphController();
        context.getContentPane().add(new JGraph(new GraphPane(bgc, model)));
        SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                RandomLayout random = new RandomLayout(new BasicLayoutTarget(
                        bgc));
                random.layout(model.getRoot());
View Full Code Here

     * selected.  In addition, delete any edges that are connected to
     * any deleted nodes.
     */
    public void actionPerformed(ActionEvent e) {
        JGraph jgraph = (JGraph) e.getSource();
        GraphPane graphPane = jgraph.getGraphPane();
        GraphController controller = graphPane.getGraphController();
        GraphModel graphModel = controller.getGraphModel();
        SelectionModel model = controller.getSelectionModel();
        Object[] selection = model.getSelectionAsArray();
        Object[] userObjects = new Object[selection.length];

View Full Code Here

TOP

Related Classes of diva.graph.GraphPane

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.