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;
}