    001/* ===========================================================
    002 * Orson Charts : a 3D chart library for the Java(tm) platform
    003 * ===========================================================
    004 *
    005 * (C)opyright 2013-2016, by Object Refinery Limited.  All rights reserved.
    006 *
    007 * http://www.object-refinery.com/orsoncharts/index.html
    008 *
    009 * This program is free software: you can redistribute it and/or modify
    010 * it under the terms of the GNU General Public License as published by
    011 * the Free Software Foundation, either version 3 of the License, or
    012 * (at your option) any later version.
    013 *
    014 * This program is distributed in the hope that it will be useful,
    015 * but WITHOUT ANY WARRANTY; without even the implied warranty of
    016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    017 * GNU General Public License for more details.
    018 *
    019 * You should have received a copy of the GNU General Public License
    020 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
    021 *
    022 * [Oracle and Java are registered trademarks of Oracle and/or its affiliates.
    023 * Other names may be trademarks of their respective owners.]
    024 *
    025 * If you do not wish to be bound by the terms of the GPL, an alternative
    026 * commercial license can be purchased.  For details, please see visit the
    027 * Orson Charts home page:
    028 *
    029 * http://www.object-refinery.com/orsoncharts/index.html
    030 *
    031 */
    032
    033package com.orsoncharts.legend;
    034
    035import com.orsoncharts.Chart3D;
    036import com.orsoncharts.plot.Plot3D;
    037import com.orsoncharts.style.ChartStyle;
    038import com.orsoncharts.table.TableElement;
    039import com.orsoncharts.util.Anchor2D;
    040import com.orsoncharts.util.Orientation;
    041
    042/**
    043 * A legend builder is responsible for creating a legend for a chart.  The API
    044 * has been kept to a minimum intentionally, so as not to overly constrain
    045 * developers that want to implement a custom legend builder.  The
    046 * {@code get/setItemFont()} methods have been added for convenience
    047 * because changing the font of the legend item text is a very common
    048 * operation.
    049 * <p>
    050 * Classes that implement this interface should also implement
    051 * {@code java.io.Serializable} if you intend to serialize and deserialize
    052 * chart objects.
    053 *
    054 * @see Chart3D#setLegendBuilder(LegendBuilder)
    055 */
    056public interface LegendBuilder {
    057
    058    /**
    059     * Creates a legend for the specified plot.  If this method returns
    060     * {@code null}, no legend will be displayed.
    061     *
    062     * @param plot  the plot ({@code null} not permitted).
    063     * @param anchor  the anchor ({@code null} not permitted).
    064     * @param orientation  the legend orientation ({@code null} not
    065     *         permitted).
    066     * @param style  the style ({@code null} not permitted).
    067     *
    068     * @return A legend (possibly {@code null}).
    069     *
    070     * @since 1.2
    071     */
    072    TableElement createLegend(Plot3D plot, Anchor2D anchor,
    073            Orientation orientation, ChartStyle style);
    074
    075}