Package net.sourceforge.jpowergraph

Examples of net.sourceforge.jpowergraph.GroupLegendItem


            return f;
        }
    }

    public GroupLegendItem getLegendRoot() {
        GroupLegendItem root = new GroupLegendItem();
       
        GroupLegendItem group1 = new GroupLegendItem("Group 1");
        group1.addGroupClass(NodeType1.class);
        group1.addGroupClass(NodeType3.class);
        root.add(group1);
       
        GroupLegendItem group2 = new GroupLegendItem("Group 2");
        group2.addGroupClass(NodeType2.class);
//        group2.addGroupClass(GroupLegendItem.class);
        root.add(group2);
       
        GroupLegendItem group3 = new GroupLegendItem("Group 3");
        root.add(group3);
       
        GroupLegendItem group4 = new GroupLegendItem("Group 4");
        root.add(group4);
       
        GroupLegendItem group5 = new GroupLegendItem("Group 5");
        root.add(group5);
       
        return root;
    }
View Full Code Here


                    g.drawLine(r.x + 3, r.y + r.height - 3, r.x + r.width - 3, r.y + 3);
                }
            }
        }
        else if (legendItem instanceof GroupLegendItem){
            final GroupLegendItem groupLegendItem = (GroupLegendItem) legendItem;
            if (groupLegendItem.getLegendItems().size() > 0){
                JPowerGraphRectangle r = new JPowerGraphRectangle(thePoint.x + 5, thePoint.y, toggleWidth - 10, toggleHeight);
               
                theLegend.addActionRectangle(r, new AbstractAction() {
                    public void actionPerformed(ActionEvent e) {
                        groupLegendItem.setExpanded(!groupLegendItem.isExpanded());
                        graphPane.redraw();
                    }
                });
               
                g.setForeground(enabledButtonColor);
                g.drawLine(r.x, r.y + r.height/2, r.x + r.width, r.y + r.height/2);
                g.drawString(groupLegendItem.getDescription(), r.x + r.width + 5, r.y - 2, 1);
                if (groupLegendItem.isExpanded()){
                    JPowerGraphPoint subPoint = new JPowerGraphPoint(thePoint.x + indent, thePoint.y + Math.max(toggleHeight, g.getAscent() + g.getDescent() + 4));
                    for (LegendItem subLegendItem : groupLegendItem.getLegendItems()) {
                        JPowerGraphDimension subDimension = new JPowerGraphDimension(0, 0);
                        getLegendItemSize(graphPane, subLegendItem, theLegend, subDimension);
                        paintLegendItem(graphPane, g, subLegendItem, theLegend, subPoint, theLegendRectangle);
                        subPoint.y += subDimension.height;
                    }
View Full Code Here

TOP

Related Classes of net.sourceforge.jpowergraph.GroupLegendItem

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.