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