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);
}
g.drawRectangle(r.x, r.y, r.width, r.height);
if (isChecked){
g.drawLine(r.x + 3, r.y + 3, r.x + r.width - 3, r.y + r.height - 3);
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();