Examples of LabelRenderer


Examples of prefuse.render.LabelRenderer

       
        // -- renderers -------------------------------------------------------
       
        DefaultRendererFactory rf = new DefaultRendererFactory();
        rf.setDefaultRenderer(new ShapeRenderer(1)); // 1 pixel rectangles
        rf.add("INGROUP('labels')", new LabelRenderer("label") {
            public Shape getShape(VisualItem item) {
                // set horizontal alignment based on x-coordinate position
                setHorizontalAlignment(item.getX()>getWidth()/2 ? RIGHT:LEFT);
                // now return shape as usual
                return super.getShape(item);
View Full Code Here

Examples of prefuse.render.LabelRenderer

        m_vis.addDecorators(labels, treeNodes, labelP, LABEL_SCHEMA);
       
        // set up the renderers - one for nodes and one for labels
        DefaultRendererFactory rf = new DefaultRendererFactory();
        rf.add(new InGroupPredicate(treeNodes), new NodeRenderer());
        rf.add(new InGroupPredicate(labels), new LabelRenderer(label));
        m_vis.setRendererFactory(rf);
                      
        // border colors
        final ColorAction borderColor = new BorderColorAction(treeNodes);
        final ColorAction fillColor = new FillColorAction(treeNodes);
View Full Code Here

Examples of prefuse.render.LabelRenderer

   
    public DataMountain(Table t) {
        super(new Visualization());
        m_vis.addTable("data", t);
       
        LabelRenderer nodeRenderer = new LabelRenderer(null, "image");
        nodeRenderer.setTextField(null);
        nodeRenderer.setVerticalAlignment(Constants.BOTTOM);
        nodeRenderer.setHorizontalPadding(0);
        nodeRenderer.setVerticalPadding(0);
        nodeRenderer.setMaxImageDimensions(100,100);
       
        m_vis.setRendererFactory(new DefaultRendererFactory(nodeRenderer));
       
        ActionList init = new ActionList();
        init.add(new RandomLayout());
        init.add(new DataMountainSizeAction());
        m_vis.putAction("init", init);
       
        ActionList update = new ActionList();
        update.add(new DataMountainSizeAction());
        update.add(new ColorAction("data", VisualItem.STROKECOLOR) {
            public int getColor(VisualItem item) {
                return ColorLib.rgb((item.isHover() ? 255 : 0), 0, 0);
            }
        });
        update.add(new RepaintAction());
        m_vis.putAction("update", update);

        // we run this to make sure the forces are stabilized
        ActionList preforce = new ActionList(1000);
        preforce.add(new DataMountainForceLayout(true));
        m_vis.putAction("preforce", preforce);

        // this will cause docs to move out of the way when dragging
        final ForceDirectedLayout fl = new DataMountainForceLayout(false);
        ActivityListener fReset = new ActivityAdapter() {
            public void activityCancelled(Activity a) {
                fl.reset();
             }
        };
        ActionList forces = new ActionList(Activity.INFINITY);
        forces.add(fl);
        forces.add(update);
        forces.addActivityListener(fReset);
        m_vis.putAction("forces", forces);
       
        setSize(640,450);
        setDamageRedraw(false); // disable due to Java2D image clipping errors
        setBorder(BorderFactory.createEmptyBorder(30,20,5,20));
        setItemSorter(new DataMountainSorter());
        addControlListener(new DataMountainControl());
       
        // pre-load images, otherwise they will be loaded asynchronously
        nodeRenderer.getImageFactory().preloadImages(m_vis.items(),"image");
       
        // initialize and present the interface
        m_vis.run("init");
        m_vis.runAfter("preforce", "update");
        m_vis.run("preforce");
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.