Package prefuse.action

Examples of prefuse.action.ActionList


        FontAction fonts = new FontAction(treeNodes,
                FontLib.getFont("Tahoma", 10));
        fonts.add("ingroup('_focus_')", FontLib.getFont("Tahoma", 11));
       
        // recolor
        ActionList recolor = new ActionList();
        recolor.add(nodeColor);
        recolor.add(textColor);
        recolor.add(borderColor);
        recolor.add(borderHighlightColor);
        m_vis.putAction("recolor", recolor);
       
        // repaint
        ActionList repaint = new ActionList();
        repaint.add(recolor);
        repaint.add(new RepaintAction());
        m_vis.putAction("repaint", repaint);
       
        // animate paint change
        ActionList animatePaint = new ActionList(400);
        animatePaint.add(new ColorAnimator(treeNodes));
        animatePaint.add(new RepaintAction());
        m_vis.putAction("animatePaint", animatePaint);
       
        // create the tree layout action
        RadialTreeLayout treeLayout = new RadialTreeLayout(tree);
        m_vis.putAction("treeLayout", treeLayout);
       
        CollapsedSubtreeLayout subLayout = new CollapsedSubtreeLayout(tree);
        m_vis.putAction("subLayout", subLayout);
       
        // create the filtering and layout
        ActionList filter = new ActionList();
        filter.add(new ForceDirectedLayout(tree, true));
        filter.add(new TreeRootAction(tree));
        filter.add(fonts);
        filter.add(treeLayout);
        filter.add(subLayout);       
        filter.add(textColor);
        filter.add(nodeColor);
        filter.add(borderColor);
        filter.add(borderHighlightColor);
        filter.add(edgeColorAction)
        filter.add(edgeArrowAction);
        m_vis.putAction("filter", filter);
       
        // animated transition
        ActionList animate = new ActionList(1250);
        animate.setPacingFunction(new SlowInSlowOutPacer());
        animate.add(new QualityControlAnimator());
        animate.add(new VisibilityAnimator(tree));
        animate.add(new PolarLocationAnimator(treeNodes, linear));
        animate.add(new ColorAnimator(treeNodes));
        animate.add(new RepaintAction());
        m_vis.putAction("animate", animate);
        m_vis.alwaysRunAfter("filter", "animate");
       
        // visibility determiner
        ActionList visibility = new ActionList();
        visibility.add(new VisibilityFilter(new VisiblePredicate()));
        m_vis.putAction("visibility", visibility);
        visibility.alwaysRunAfter(animate);
       
        /*// add force repulsion
        ForceSimulator fsim = new ForceSimulator();
        fsim.addForce(new NBodyForce(-1f, .1f, 5f));
        fsim.addForce(new DragForce());
        */
       
        ActionList forces = new ActionList(m_vis, 1000);
        //forces.add(new ForceDirectedLayout(tree, fsim, false));
        forces.add(new RepaintAction());
        m_vis.putAction("forces", forces);
  forces.alwaysRunAfter(animate);       
       
        //======================================================================       
        // -- initialize the display --
        //======================================================================
        setSize(900,650);
View Full Code Here


        // uses edge colors
        ItemAction usesColor = new ColorAction( GRAPH_EDGES, usesPredicate, VisualItem.STROKECOLOR, ColorLib.rgb( 50, 50, 50 ) );
        ItemAction usesArrow = new ColorAction( GRAPH_EDGES, usesPredicate, VisualItem.FILLCOLOR, ColorLib.rgb( 50, 50, 50 ) );

        // color settings
        ActionList colors = new ActionList();
        colors.add( fillColor );
        colors.add( borderColor );
        colors.add( usesColor );
        colors.add( usesArrow );
        m_vis.putAction( COLORS_ACTION, colors );

        ActionList autoPan = new ActionList();
        autoPan.add( colors );
        autoPan.add( new AutoPanAction() );
        autoPan.add( new RepaintAction() );
        m_vis.putAction( AUTO_PAN_ACTION, autoPan );

        // create the layout action list
        stackedLayout = new StackedLayout( GRAPH );
        ActionList layout = new ActionList();
        layout.add( stackedLayout );
        layout.add( new LabelLayout( LABELS ) );
        layout.add( autoPan );
        m_vis.putAction( LAYOUT_ACTION, layout );

        // initialize our display
        Dimension size = new Dimension( 400, 400 );
        setSize( size );
View Full Code Here

        ItemAction edgeColor = new ColorAction( GRAPH_EDGES, edgesPredicate, VisualItem.STROKECOLOR, ColorLib.rgb( 200, 200, 200 ) );
        ItemAction usesColor = new ColorAction( GRAPH_EDGES, usesPredicate, VisualItem.STROKECOLOR, ColorLib.rgb( 255, 100, 100 ) );
        ItemAction usesArrow = new ColorAction( GRAPH_EDGES, usesPredicate, VisualItem.FILLCOLOR, ColorLib.rgb( 255, 100, 100 ) );

        // quick repaint
        ActionList repaint = new ActionList();
        repaint.add( nodeColor );
        repaint.add( new RepaintAction() );
        m_vis.putAction( REPAINT_ACTION, repaint );

        // full paint
        ActionList fullPaint = new ActionList();
        fullPaint.add( nodeColor );
        m_vis.putAction( FULL_PAINT_ACTION, fullPaint );

        // animate paint change
        //ActionList animatePaint = new ActionList( 0 );
        ActionList animatePaint = new ActionList();
        animatePaint.add( new ColorAnimator( GRAPH_NODES ) );
        animatePaint.add( new RepaintAction() );
        m_vis.putAction( ANIMATE_PAINT_ACTION, animatePaint );

        // create the GRAPH layout action
        NodeLinkTreeLayout treeLayout = new NodeLinkTreeLayout( GRAPH, orientation, 40, 0, 8 );
        treeLayout.setLayoutAnchor( new Point2D.Double( 25, 300 ) );
        m_vis.putAction( LAYOUT_ACTION, treeLayout );

        CollapsedSubtreeLayout subLayout = new CollapsedSubtreeLayout( GRAPH, orientation );
        m_vis.putAction( SUB_LAYOUT_ACTION, subLayout );

        // create the filtering and layout
        ActionList filter = new ActionList();
        filter.add( new ExtendedFisheyeTreeFilter( GRAPH, 2 ) );
        filter.add( new FontAction( GRAPH_NODES, FontLib.getFont( "Tahoma", 14 ) ) );
        filter.add( treeLayout );
        filter.add( subLayout );
        filter.add( textColor );
        filter.add( nodeColor );
        filter.add( edgeColor );
        filter.add( usesColor );
        filter.add( usesArrow );
        m_vis.putAction( FILTER_ACTION, filter );

        // animated transition
        AutoPanAction autoPan = new AutoPanAction();
        ActionList animate = new ActionList( 750 );
        animate.setPacingFunction( new SlowInSlowOutPacer() );
        animate.add( autoPan );
        animate.add( new QualityControlAnimator() );
        animate.add( new VisibilityAnimator( GRAPH ) );
        animate.add( new LocationAnimator( GRAPH_NODES ) );
        animate.add( new ColorAnimator( GRAPH_NODES ) );
        animate.add( new RepaintAction() );
        m_vis.putAction( ANIMATE_ACTION, animate );
        m_vis.alwaysRunAfter( FILTER_ACTION, ANIMATE_ACTION );

        m_vis.putAction( AUTO_ZOOM_ACTION, new AutoZoomAction() );
View Full Code Here

        ColorAction colors = new ColorAction(ITEMS, VisualItem.TEXTCOLOR);
        colors.setDefaultColor(ColorLib.gray(0));
        colors.add("hover()", ColorLib.rgb(255,0,0));
       
        // initial layout and coloring
        ActionList init = new ActionList();
        init.add(new VerticalLineLayout(m_maxHeight));
        init.add(colors);
        init.add(new RepaintAction());
        m_vis.putAction("init", init);

        // fisheye distortion based on the current anchor location
        ActionList distort = new ActionList();
        Distortion feye = new FisheyeDistortion(0,m_scale);
        distort.add(feye);
        distort.add(colors);
        distort.add(new RepaintAction());
        m_vis.putAction("distort", distort);
       
        // update the distortion anchor position to be the current
        // location of the mouse pointer
        addControlListener(new AnchorUpdateControl(feye, "distort"));
View Full Code Here

       
        ItemAction edgeColor = new ColorAction(treeEdges,
                VisualItem.STROKECOLOR, ColorLib.rgb(200,200,200));
       
        // quick repaint
        ActionList repaint = new ActionList();
        repaint.add(nodeColor);
        repaint.add(new RepaintAction());
        m_vis.putAction("repaint", repaint);
       
        // full paint
        ActionList fullPaint = new ActionList();
        fullPaint.add(nodeColor);
        m_vis.putAction("fullPaint", fullPaint);
       
        // animate paint change
        ActionList animatePaint = new ActionList(400);
        animatePaint.add(new ColorAnimator(treeNodes));
        animatePaint.add(new RepaintAction());
        m_vis.putAction("animatePaint", animatePaint);
       
        // create the tree layout action
        NodeLinkTreeLayout treeLayout = new NodeLinkTreeLayout(tree,
                m_orientation, 50, 0, 8);
        treeLayout.setLayoutAnchor(new Point2D.Double(25,300));
        m_vis.putAction("treeLayout", treeLayout);
       
        CollapsedSubtreeLayout subLayout =
            new CollapsedSubtreeLayout(tree, m_orientation);
        m_vis.putAction("subLayout", subLayout);
       
        AutoPanAction autoPan = new AutoPanAction();
       
        // create the filtering and layout
        ActionList filter = new ActionList();
        filter.add(new FisheyeTreeFilter(tree, 2));
        filter.add(new FontAction(treeNodes, FontLib.getFont("Tahoma", 16)));
        filter.add(treeLayout);
        filter.add(subLayout);
        filter.add(textColor);
        filter.add(nodeColor);
        filter.add(edgeColor);
        m_vis.putAction("filter", filter);
       
        // animated transition
        ActionList animate = new ActionList(1000);
        animate.setPacingFunction(new SlowInSlowOutPacer());
        animate.add(autoPan);
        animate.add(new QualityControlAnimator());
        animate.add(new VisibilityAnimator(tree));
        animate.add(new LocationAnimator(treeNodes));
        animate.add(new ColorAnimator(treeNodes));
        animate.add(new RepaintAction());
        m_vis.putAction("animate", animate);
        m_vis.alwaysRunAfter("filter", "animate");
       
        // create animator for orientation changes
        ActionList orient = new ActionList(2000);
        orient.setPacingFunction(new SlowInSlowOutPacer());
        orient.add(autoPan);
        orient.add(new QualityControlAnimator());
        orient.add(new LocationAnimator(treeNodes));
        orient.add(new RepaintAction());
        m_vis.putAction("orient", orient);
       
        // ------------------------------------------------
       
        // initialize the display
View Full Code Here

        m_vis.putAction("color", color);
       
        DataShapeAction shape = new DataShapeAction(group, sfield);
        m_vis.putAction("shape", shape);
       
        ActionList draw = new ActionList();
        draw.add(x_axis);
        draw.add(y_axis);
        if ( sfield != null )
            draw.add(shape);
        draw.add(color);
        draw.add(new RepaintAction());
        m_vis.putAction("draw", draw);
       
        // --------------------------------------------------------------------
        // STEP 3: set up a display and ui components to show the visualization
View Full Code Here

        });
        m_vis.setRendererFactory(rf);
       
        // -- actions ---------------------------------------------------------
       
        ActionList layout = new ActionList();
        layout.add(new AxisLayout(DATA, "lat", Y_AXIS));
        layout.add(new AxisLayout(DATA, "lon", X_AXIS));
        m_vis.putAction("layout", layout);
       
        // the update list updates the colors of data points and sets the visual
        // properties for any labels. Color updating is limited only to the
        // current focus items, ensuring faster performance.
        final Action update = new ZipColorAction(FOCUS);
        m_vis.putAction("update", update);
       
        // animate a change in color in the interface. this animation is quite
        // short, only 200ms, so that it does not impede with interaction.
        // color animation of data points looks only at the focus items,
        // ensuring faster performance.
        ActionList animate = new ActionList(200);
        animate.add(new ColorAnimator(FOCUS, VisualItem.FILLCOLOR));
        animate.add(new ColorAnimator(LABELS, VisualItem.TEXTCOLOR));
        animate.add(new RepaintAction());
        animate.addActivityListener(new ActivityAdapter() {
            public void activityCancelled(Activity a) {
                // if animation is canceled, set colors to final state
                update.run(1.0);
            }
        });
        m_vis.putAction("animate", animate);
       
        // update items after a resize of the display, animating them to their
        // new locations. this animates all data points, so is noticeably slow.
        ActionList resize = new ActionList(1500);
        resize.setPacingFunction(new SlowInSlowOutPacer());
        resize.add(new LocationAnimator(DATA));
        resize.add(new LocationAnimator(LABELS));
        resize.add(new RepaintAction());
        m_vis.putAction("resize", resize);
       
        // -- display ---------------------------------------------------------
       
        setSize(720, 360);
View Full Code Here

            { Constants.SHAPE_RECTANGLE, Constants.SHAPE_DIAMOND };
        DataShapeAction shape = new DataShapeAction(group, "Senate", shapes);
       
        Counter cntr = new Counter(group);
       
        ActionList draw = new ActionList();
        draw.add(cntr);
        draw.add(color);
        draw.add(shape);
        draw.add(xaxis);
        draw.add(yaxis);
        draw.add(ylabels);
        draw.add(new ColorAction(group, VisualItem.FILLCOLOR, 0));
        draw.add(new RepaintAction());
        vis.putAction("draw", draw);

        ActionList update = new ActionList();
        update.add(new VisibilityFilter(group, filter));
        update.add(cntr);
        update.add(xaxis);
        update.add(yaxis);
        update.add(ylabels);
        update.add(new RepaintAction());
        vis.putAction("update", update);
       
        UpdateListener lstnr = new UpdateListener() {
            public void update(Object src) {
                vis.run("update");
View Full Code Here

        ColorAction fill = new ColorAction(nodes,
                VisualItem.FILLCOLOR, ColorLib.rgb(200,200,255));
        fill.add(VisualItem.FIXED, ColorLib.rgb(255,100,100));
        fill.add(VisualItem.HIGHLIGHT, ColorLib.rgb(255,200,125));
       
        ActionList draw = new ActionList();
        draw.add(filter);
        draw.add(fill);
        draw.add(new ColorAction(nodes, VisualItem.STROKECOLOR, 0));
        draw.add(new ColorAction(nodes, VisualItem.TEXTCOLOR, ColorLib.rgb(0,0,0)));
        draw.add(new ColorAction(edges, VisualItem.FILLCOLOR, ColorLib.gray(200)));
        draw.add(new ColorAction(edges, VisualItem.STROKECOLOR, ColorLib.gray(200)));
       
        ActionList animate = new ActionList(Activity.INFINITY);
        animate.add(new ForceDirectedLayout(graph));
        animate.add(fill);
        animate.add(new RepaintAction());
       
        // finally, we register our ActionList with the Visualization.
        // we can later execute our Actions by invoking a method on our
        // Visualization, using the name we've chosen below.
        m_vis.putAction("draw", draw);
        m_vis.putAction("layout", animate);

        m_vis.runAfter("draw", "layout");
       
       
        // --------------------------------------------------------------------
        // set up a display to show the visualization
       
        Display display = new Display(m_vis);
        display.setSize(700,700);
        display.pan(350, 350);
        display.setForeground(Color.GRAY);
        display.setBackground(Color.WHITE);
       
        // main display controls
        display.addControlListener(new FocusControl(1));
        display.addControlListener(new DragControl());
        display.addControlListener(new PanControl());
        display.addControlListener(new ZoomControl());
        display.addControlListener(new WheelZoomControl());
        display.addControlListener(new ZoomToFitControl());
        display.addControlListener(new NeighborHighlightControl());

        // overview display
//        Display overview = new Display(vis);
//        overview.setSize(290,290);
//        overview.addItemBoundsListener(new FitOverviewListener());
       
        display.setForeground(Color.GRAY);
        display.setBackground(Color.WHITE);
       
        // --------------------------------------------------------------------       
        // launch the visualization
       
        // create a panel for editing force values
        ForceSimulator fsim = ((ForceDirectedLayout)animate.get(0)).getForceSimulator();
        JForcePanel fpanel = new JForcePanel(fsim);
       
//        JPanel opanel = new JPanel();
//        opanel.setBorder(BorderFactory.createTitledBorder("Overview"));
//        opanel.setBackground(Color.WHITE);
View Full Code Here

        // -- set up the actions ----------------------------------------------
       
        int maxhops = 4, hops = 4;
        final GraphDistanceFilter filter = new GraphDistanceFilter(graph, hops);

        ActionList draw = new ActionList();
        draw.add(filter);
        draw.add(new ColorAction(nodes, VisualItem.FILLCOLOR, ColorLib.rgb(200,200,255)));
        draw.add(new ColorAction(nodes, VisualItem.STROKECOLOR, 0));
        draw.add(new ColorAction(nodes, VisualItem.TEXTCOLOR, ColorLib.rgb(0,0,0)));
        draw.add(new ColorAction(edges, VisualItem.FILLCOLOR, ColorLib.gray(200)));
        draw.add(new ColorAction(edges, VisualItem.STROKECOLOR, ColorLib.gray(200)));
       
        ColorAction fill = new ColorAction(nodes,
                VisualItem.FILLCOLOR, ColorLib.rgb(200,200,255));
        fill.add("_fixed", ColorLib.rgb(255,100,100));
        fill.add("_highlight", ColorLib.rgb(255,200,125));
       
        ForceDirectedLayout fdl = new ForceDirectedLayout(graph);
        ForceSimulator fsim = fdl.getForceSimulator();
        fsim.getForces()[0].setParameter(0, -1.2f);
       
        ActionList animate = new ActionList(Activity.INFINITY);
        animate.add(fdl);
        animate.add(fill);
        animate.add(new RepaintAction());
       
        // finally, we register our ActionList with the Visualization.
        // we can later execute our Actions by invoking a method on our
        // Visualization, using the name we've chosen below.
        vis.putAction("draw", draw);
View Full Code Here

TOP

Related Classes of prefuse.action.ActionList

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.