private static JFreeChart createChart(PieDataset paramPieDataset) {
   JFreeChart localJFreeChart =
       ChartFactory.createPieChart("Legend Wrapper Demo 1", paramPieDataset, false, true, false);
   PiePlot localPiePlot = (PiePlot) localJFreeChart.getPlot();
   localPiePlot.setLabelFont(new Font("SansSerif", 0, 12));
   localPiePlot.setNoDataMessage("No data available");
   localPiePlot.setCircular(true);
   localPiePlot.setLabelGap(0.02D);
   LegendTitle localLegendTitle = new LegendTitle(localJFreeChart.getPlot());
   BlockContainer localBlockContainer1 = new BlockContainer(new BorderArrangement());
   localBlockContainer1.setFrame(new BlockBorder(1.0D, 1.0D, 1.0D, 1.0D));
   LabelBlock localLabelBlock1 = new LabelBlock("Legend Items:", new Font("SansSerif", 1, 12));
   localLabelBlock1.setPadding(5.0D, 5.0D, 5.0D, 5.0D);
   localBlockContainer1.add(localLabelBlock1, RectangleEdge.TOP);
   LabelBlock localLabelBlock2 = new LabelBlock("Source: http://www.jfree.org");
   localLabelBlock2.setPadding(8.0D, 20.0D, 2.0D, 5.0D);
   localBlockContainer1.add(localLabelBlock2, RectangleEdge.BOTTOM);
   BlockContainer localBlockContainer2 = localLegendTitle.getItemContainer();
   localBlockContainer2.setPadding(2.0D, 10.0D, 5.0D, 2.0D);
   localBlockContainer1.add(localBlockContainer2);
   localLegendTitle.setWrapper(localBlockContainer1);
   localLegendTitle.setPosition(RectangleEdge.RIGHT);
   localLegendTitle.setHorizontalAlignment(HorizontalAlignment.LEFT);
   localJFreeChart.addSubtitle(localLegendTitle);
   ChartUtilities.applyCurrentTheme(localJFreeChart);
   return localJFreeChart;
 }
  /**
   * Creates a legend item block.
   *
   * @param item the legend item.
   * @return The block.
   */
  protected Block createLegendItemBlock(LegendItem item) {
    BlockContainer result = null;
    LegendGraphic lg = new LegendGraphic(item.getShape(), item.getFillPaint());
    lg.setFillPaintTransformer(item.getFillPaintTransformer());
    lg.setShapeFilled(item.isShapeFilled());
    lg.setLine(item.getLine());
    lg.setLineStroke(item.getLineStroke());
    lg.setLinePaint(item.getLinePaint());
    lg.setLineVisible(item.isLineVisible());
    lg.setShapeVisible(item.isShapeVisible());
    lg.setShapeOutlineVisible(item.isShapeOutlineVisible());
    lg.setOutlinePaint(item.getOutlinePaint());
    lg.setOutlineStroke(item.getOutlineStroke());
    lg.setPadding(this.legendItemGraphicPadding);

    LegendItemBlockContainer legendItem =
        new LegendItemBlockContainer(
            new BorderArrangement(), item.getDataset(), item.getSeriesKey());
    lg.setShapeAnchor(getLegendItemGraphicAnchor());
    lg.setShapeLocation(getLegendItemGraphicLocation());
    legendItem.add(lg, this.legendItemGraphicEdge);
    Font textFont = item.getLabelFont();
    if (textFont == null) {
      textFont = this.itemFont;
    }
    Paint textPaint = item.getLabelPaint();
    if (textPaint == null) {
      textPaint = this.itemPaint;
    }
    LabelBlock labelBlock = new LabelBlock(item.getLabel(), textFont, textPaint);
    labelBlock.setPadding(this.itemLabelPadding);
    legendItem.add(labelBlock);
    legendItem.setToolTipText(item.getToolTipText());
    legendItem.setURLText(item.getURLText());

    result = new BlockContainer(new CenterArrangement());
    result.add(legendItem);

    return result;
  }