@Test public void test2947660() { AbstractCategoryItemRenderer r = new LineAndShapeRenderer(); assertNotNull(r.getLegendItems()); assertEquals(0, r.getLegendItems().size()); DefaultCategoryDataset dataset = new DefaultCategoryDataset(); CategoryPlot plot = new CategoryPlot(); plot.setDataset(dataset); plot.setRenderer(r); assertEquals(0, r.getLegendItems().size()); dataset.addValue(1.0, "S1", "C1"); List<LegendItem> lic = r.getLegendItems(); assertEquals(1, lic.size()); assertEquals("S1", lic.get(0).getLabel()); }
@Override public List<LegendItem> getLegendItems() { List<LegendItem> result = new ArrayList<LegendItem>(); if (this.plot == null) { return result; } int index = this.plot.getIndexOf(this); CategoryDataset dataset = this.plot.getDataset(index); if (dataset == null) { return result; } int seriesCount = dataset.getRowCount(); if (plot.getRowRenderingOrder().equals(SortOrder.ASCENDING)) { for (int i = 0; i < seriesCount; i++) { if (isSeriesVisibleInLegend(i)) { LegendItem item = getLegendItem(index, i); if (item != null) { result.add(item); } } } } else { for (int i = seriesCount - 1; i >= 0; i--) { if (isSeriesVisibleInLegend(i)) { LegendItem item = getLegendItem(index, i); if (item != null) { result.add(item); } } } } return result; }
AbstractCategoryItemRenderer extends AbstractRenderer implements CategoryItemRenderer, Cloneable, PublicCloneable,
        Serializable { @Override public List<LegendItem> getLegendItems() { List<LegendItem> result = new ArrayList<LegendItem>(); if (this.plot == null) { return result; } int index = this.plot.getIndexOf(this); CategoryDataset dataset = this.plot.getDataset(index); if (dataset == null) { return result; } int seriesCount = dataset.getRowCount(); if (plot.getRowRenderingOrder().equals(SortOrder.ASCENDING)) { for (int i = 0; i < seriesCount; i++) { if (isSeriesVisibleInLegend(i)) { LegendItem item = getLegendItem(index, i); if (item != null) { result.add(item); } } } } else { for (int i = seriesCount - 1; i >= 0; i--) { if (isSeriesVisibleInLegend(i)) { LegendItem item = getLegendItem(index, i); if (item != null) { result.add(item); } } } } return result; } }
AbstractCategoryItemRenderer extends AbstractRenderer implements CategoryItemRenderer, Cloneable, PublicCloneable,
        Serializable { @Override public List<LegendItem> getLegendItems() { List<LegendItem> result = new ArrayList<LegendItem>(); if (this.plot == null) { return result; } int index = this.plot.getIndexOf(this); CategoryDataset dataset = this.plot.getDataset(index); if (dataset == null) { return result; } int seriesCount = dataset.getRowCount(); if (plot.getRowRenderingOrder().equals(SortOrder.ASCENDING)) { for (int i = 0; i < seriesCount; i++) { if (isSeriesVisibleInLegend(i)) { LegendItem item = getLegendItem(index, i); if (item != null) { result.add(item); } } } } else { for (int i = seriesCount - 1; i >= 0; i--) { if (isSeriesVisibleInLegend(i)) { LegendItem item = getLegendItem(index, i); if (item != null) { result.add(item); } } } } return result; } protected  AbstractCategoryItemRenderer(); }
AbstractCategoryItemRenderer extends AbstractRenderer implements CategoryItemRenderer, Cloneable, PublicCloneable,
        Serializable { @Override public List<LegendItem> getLegendItems() { List<LegendItem> result = new ArrayList<LegendItem>(); if (this.plot == null) { return result; } int index = this.plot.getIndexOf(this); CategoryDataset dataset = this.plot.getDataset(index); if (dataset == null) { return result; } int seriesCount = dataset.getRowCount(); if (plot.getRowRenderingOrder().equals(SortOrder.ASCENDING)) { for (int i = 0; i < seriesCount; i++) { if (isSeriesVisibleInLegend(i)) { LegendItem item = getLegendItem(index, i); if (item != null) { result.add(item); } } } } else { for (int i = seriesCount - 1; i >= 0; i--) { if (isSeriesVisibleInLegend(i)) { LegendItem item = getLegendItem(index, i); if (item != null) { result.add(item); } } } } return result; } protected  AbstractCategoryItemRenderer(); @Override int getPassCount(); @Override CategoryPlot getPlot(); @Override void setPlot(CategoryPlot plot); @Override CategoryItemLabelGenerator getItemLabelGenerator(int row,
            int column); @Override CategoryItemLabelGenerator getSeriesItemLabelGenerator(int series); @Override void setSeriesItemLabelGenerator(int series,
            CategoryItemLabelGenerator generator); @Override void setSeriesItemLabelGenerator(int series,
                CategoryItemLabelGenerator generator, boolean notify); @Override CategoryItemLabelGenerator getDefaultItemLabelGenerator(); @Override void setDefaultItemLabelGenerator(
            CategoryItemLabelGenerator generator); @Override void setDefaultItemLabelGenerator(
            CategoryItemLabelGenerator generator, boolean notify); @Override CategoryToolTipGenerator getToolTipGenerator(int row, int column); @Override CategoryToolTipGenerator getSeriesToolTipGenerator(int series); @Override void setSeriesToolTipGenerator(int series,
                                          CategoryToolTipGenerator generator); @Override void setSeriesToolTipGenerator(int series,
                CategoryToolTipGenerator generator, boolean notify); @Override CategoryToolTipGenerator getDefaultToolTipGenerator(); @Override void setDefaultToolTipGenerator(CategoryToolTipGenerator generator); @Override void setDefaultToolTipGenerator(CategoryToolTipGenerator generator,
            boolean notify); @Override CategoryURLGenerator getItemURLGenerator(int row, int column); @Override CategoryURLGenerator getSeriesItemURLGenerator(int series); @Override void setSeriesItemURLGenerator(int series,
                                          CategoryURLGenerator generator); @Override void setSeriesItemURLGenerator(int series,
                CategoryURLGenerator generator, boolean notify); @Override CategoryURLGenerator getDefaultItemURLGenerator(); @Override void setDefaultItemURLGenerator(CategoryURLGenerator generator); @Override void setDefaultItemURLGenerator(CategoryURLGenerator generator,
            boolean notify); int getRowCount(); int getColumnCount(); @Override CategoryItemRendererState initialise(Graphics2D g2,
            Rectangle2D dataArea, CategoryPlot plot, int rendererIndex,
            PlotRenderingInfo info); @Override Range findRangeBounds(CategoryDataset dataset); @Override double getItemMiddle(Comparable rowKey, Comparable columnKey,
            CategoryDataset dataset, CategoryAxis axis, Rectangle2D area,
            RectangleEdge edge); @Override void drawBackground(Graphics2D g2, CategoryPlot plot,
                               Rectangle2D dataArea); @Override void drawOutline(Graphics2D g2, CategoryPlot plot,
                            Rectangle2D dataArea); @Override void drawDomainGridline(Graphics2D g2, CategoryPlot plot,
            Rectangle2D dataArea, double value); @Override void drawRangeGridline(Graphics2D g2, CategoryPlot plot,
            ValueAxis axis, Rectangle2D dataArea, double value); void drawRangeGridline(Graphics2D g2, CategoryPlot plot, ValueAxis axis,
            Rectangle2D dataArea, double value, Paint paint, Stroke stroke); @Override void drawDomainMarker(Graphics2D g2, CategoryPlot plot,
            CategoryAxis axis, CategoryMarker marker, Rectangle2D dataArea); @Override void drawRangeMarker(Graphics2D g2, CategoryPlot plot,
            ValueAxis axis, Marker marker, Rectangle2D dataArea); @Override LegendItem getLegendItem(int datasetIndex, int series); @Override boolean equals(Object obj); @Override int hashCode(); @Override DrawingSupplier getDrawingSupplier(); @Override Object clone(); @Override List<LegendItem> getLegendItems(); CategorySeriesLabelGenerator getLegendItemLabelGenerator(); void setLegendItemLabelGenerator(
            CategorySeriesLabelGenerator generator); CategorySeriesLabelGenerator getLegendItemToolTipGenerator(); void setLegendItemToolTipGenerator(
            CategorySeriesLabelGenerator generator); CategorySeriesLabelGenerator getLegendItemURLGenerator(); void setLegendItemURLGenerator(
            CategorySeriesLabelGenerator generator); }
AbstractCategoryItemRenderer extends AbstractRenderer implements CategoryItemRenderer, Cloneable, PublicCloneable,
        Serializable { @Override public List<LegendItem> getLegendItems() { List<LegendItem> result = new ArrayList<LegendItem>(); if (this.plot == null) { return result; } int index = this.plot.getIndexOf(this); CategoryDataset dataset = this.plot.getDataset(index); if (dataset == null) { return result; } int seriesCount = dataset.getRowCount(); if (plot.getRowRenderingOrder().equals(SortOrder.ASCENDING)) { for (int i = 0; i < seriesCount; i++) { if (isSeriesVisibleInLegend(i)) { LegendItem item = getLegendItem(index, i); if (item != null) { result.add(item); } } } } else { for (int i = seriesCount - 1; i >= 0; i--) { if (isSeriesVisibleInLegend(i)) { LegendItem item = getLegendItem(index, i); if (item != null) { result.add(item); } } } } return result; } protected  AbstractCategoryItemRenderer(); @Override int getPassCount(); @Override CategoryPlot getPlot(); @Override void setPlot(CategoryPlot plot); @Override CategoryItemLabelGenerator getItemLabelGenerator(int row,
            int column); @Override CategoryItemLabelGenerator getSeriesItemLabelGenerator(int series); @Override void setSeriesItemLabelGenerator(int series,
            CategoryItemLabelGenerator generator); @Override void setSeriesItemLabelGenerator(int series,
                CategoryItemLabelGenerator generator, boolean notify); @Override CategoryItemLabelGenerator getDefaultItemLabelGenerator(); @Override void setDefaultItemLabelGenerator(
            CategoryItemLabelGenerator generator); @Override void setDefaultItemLabelGenerator(
            CategoryItemLabelGenerator generator, boolean notify); @Override CategoryToolTipGenerator getToolTipGenerator(int row, int column); @Override CategoryToolTipGenerator getSeriesToolTipGenerator(int series); @Override void setSeriesToolTipGenerator(int series,
                                          CategoryToolTipGenerator generator); @Override void setSeriesToolTipGenerator(int series,
                CategoryToolTipGenerator generator, boolean notify); @Override CategoryToolTipGenerator getDefaultToolTipGenerator(); @Override void setDefaultToolTipGenerator(CategoryToolTipGenerator generator); @Override void setDefaultToolTipGenerator(CategoryToolTipGenerator generator,
            boolean notify); @Override CategoryURLGenerator getItemURLGenerator(int row, int column); @Override CategoryURLGenerator getSeriesItemURLGenerator(int series); @Override void setSeriesItemURLGenerator(int series,
                                          CategoryURLGenerator generator); @Override void setSeriesItemURLGenerator(int series,
                CategoryURLGenerator generator, boolean notify); @Override CategoryURLGenerator getDefaultItemURLGenerator(); @Override void setDefaultItemURLGenerator(CategoryURLGenerator generator); @Override void setDefaultItemURLGenerator(CategoryURLGenerator generator,
            boolean notify); int getRowCount(); int getColumnCount(); @Override CategoryItemRendererState initialise(Graphics2D g2,
            Rectangle2D dataArea, CategoryPlot plot, int rendererIndex,
            PlotRenderingInfo info); @Override Range findRangeBounds(CategoryDataset dataset); @Override double getItemMiddle(Comparable rowKey, Comparable columnKey,
            CategoryDataset dataset, CategoryAxis axis, Rectangle2D area,
            RectangleEdge edge); @Override void drawBackground(Graphics2D g2, CategoryPlot plot,
                               Rectangle2D dataArea); @Override void drawOutline(Graphics2D g2, CategoryPlot plot,
                            Rectangle2D dataArea); @Override void drawDomainGridline(Graphics2D g2, CategoryPlot plot,
            Rectangle2D dataArea, double value); @Override void drawRangeGridline(Graphics2D g2, CategoryPlot plot,
            ValueAxis axis, Rectangle2D dataArea, double value); void drawRangeGridline(Graphics2D g2, CategoryPlot plot, ValueAxis axis,
            Rectangle2D dataArea, double value, Paint paint, Stroke stroke); @Override void drawDomainMarker(Graphics2D g2, CategoryPlot plot,
            CategoryAxis axis, CategoryMarker marker, Rectangle2D dataArea); @Override void drawRangeMarker(Graphics2D g2, CategoryPlot plot,
            ValueAxis axis, Marker marker, Rectangle2D dataArea); @Override LegendItem getLegendItem(int datasetIndex, int series); @Override boolean equals(Object obj); @Override int hashCode(); @Override DrawingSupplier getDrawingSupplier(); @Override Object clone(); @Override List<LegendItem> getLegendItems(); CategorySeriesLabelGenerator getLegendItemLabelGenerator(); void setLegendItemLabelGenerator(
            CategorySeriesLabelGenerator generator); CategorySeriesLabelGenerator getLegendItemToolTipGenerator(); void setLegendItemToolTipGenerator(
            CategorySeriesLabelGenerator generator); CategorySeriesLabelGenerator getLegendItemURLGenerator(); void setLegendItemURLGenerator(
            CategorySeriesLabelGenerator generator);  }