Package net.sourceforge.jpowergraph

Examples of net.sourceforge.jpowergraph.NodeLegendItem


    public void refreshLegend(Graph graph) {
        m_legend.clear();
        for (Iterator i = graph.getAllNodes().iterator(); i.hasNext();) {
            Node node = (Node) i.next();
            NodePainter nodePainter = getPainterForNode(node);
            m_legend.add(new NodeLegendItem(node.getClass(), nodePainter, node.getNodeType()));
        }
    }
View Full Code Here


        this.disabledButtonColor = theDisabledColor;
    }

    public void paintLegendItem(final JGraphPane graphPane, JPowerGraphGraphics g, LegendItem legendItem, Legend theLegend, JPowerGraphPoint thePoint, JPowerGraphRectangle theLegendRectangle) {
        if (legendItem instanceof NodeLegendItem){
            final NodeLegendItem nodeLegendItem = (NodeLegendItem) legendItem;

            JPowerGraphDimension d = nodeLegendItem.getNodePainter().getLegendItemSize(graphPane, nodeLegendItem.getDescription());
            nodeLegendItem.getNodePainter().paintLegendItem(g, thePoint, nodeLegendItem.getDescription());
           
            if (graphPane.getGraph().getNodeFilter() != null && theLegend.isInteractive()){
                int buttonX = theLegendRectangle.x + (theLegendRectangle.width - (buttonWidth + widthPadding));
                int buttonY = thePoint.y - heightpadding;
                int buttonHeight = d.getHeight() - 5;
               
                boolean canFilterNode = graphPane.getGraph().getNodeFilter().canChangeFilterState(nodeLegendItem.getNodeClass());
                boolean isChecked = graphPane.getGraph().getNodeFilter().getFilterState(nodeLegendItem.getNodeClass());
                JPowerGraphRectangle r = new JPowerGraphRectangle(buttonX, buttonY, buttonWidth, buttonHeight);
                if (canFilterNode){
                    g.setForeground(enabledButtonColor);
                    theLegend.addActionRectangle(r, new AbstractAction() {
                        public void actionPerformed(ActionEvent e) {
                            graphPane.getGraph().getNodeFilter().setFilterState(nodeLegendItem.getNodeClass(), !graphPane.getGraph().getNodeFilter().getFilterState(nodeLegendItem.getNodeClass()));
                        }
                    });
                }
                else{
                    g.setForeground(disabledButtonColor);
View Full Code Here

TOP

Related Classes of net.sourceforge.jpowergraph.NodeLegendItem

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.