Example usage for org.jfree.chart.util ParamChecks nullNotPermitted

List of usage examples for org.jfree.chart.util ParamChecks nullNotPermitted

Introduction

In this page you can find the example usage for org.jfree.chart.util ParamChecks nullNotPermitted.

Prototype

public static void nullNotPermitted(Object param, String name) 

Source Link

Document

Throws an IllegalArgumentException if the supplied param is null.

Usage

From source file:org.jfree.data.gantt.Task.java

/**
 * Adds a sub-task to the task./*  w  w w  .  j  ava2  s .  com*/
 *
 * @param subtask  the subtask (<code>null</code> not permitted).
 */
public void addSubtask(Task subtask) {
    ParamChecks.nullNotPermitted(subtask, "subtask");
    this.subtasks.add(subtask);
}

From source file:org.jfree.data.DefaultKeyedValues.java

/**
 * Returns the index for a given key./*  www  .j  ava 2 s. c  o m*/
 *
 * @param key  the key (<code>null</code> not permitted).
 *
 * @return The index, or <code>-1</code> if the key is not recognised.
 *
 * @throws IllegalArgumentException if <code>key</code> is
 *     <code>null</code>.
 */
@Override
public int getIndex(Comparable key) {
    ParamChecks.nullNotPermitted(key, "key");
    final Integer i = (Integer) this.indexMap.get(key);
    if (i == null) {
        return -1; // key not found
    }
    return i.intValue();
}

From source file:org.jfree.data.time.Day.java

/**
 * Constructs a new one day time period.
 *
 * @param serialDate  the day (<code>null</code> not permitted).
 *//*www .  ja va2s.  c  o  m*/
public Day(SerialDate serialDate) {
    ParamChecks.nullNotPermitted(serialDate, "serialDate");
    this.serialDate = serialDate;
    peg(Calendar.getInstance());
}

From source file:org.jfree.data.KeyToGroupMap.java

/**
 * Maps a key to a group.//from w w  w. jav a  2s . com
 *
 * @param key  the key (<code>null</code> not permitted).
 * @param group  the group (<code>null</code> permitted, clears any
 *               existing mapping).
 */
public void mapKeyToGroup(Comparable key, Comparable group) {
    ParamChecks.nullNotPermitted(key, "key");
    Comparable currentGroup = getGroup(key);
    if (!currentGroup.equals(this.defaultGroup)) {
        if (!currentGroup.equals(group)) {
            int count = getKeyCount(currentGroup);
            if (count == 1) {
                this.groups.remove(currentGroup);
            }
        }
    }
    if (group == null) {
        this.keyToGroupMap.remove(key);
    } else {
        if (!this.groups.contains(group)) {
            if (!this.defaultGroup.equals(group)) {
                this.groups.add(group);
            }
        }
        this.keyToGroupMap.put(key, group);
    }
}

From source file:de.hs.mannheim.modUro.controller.diagram.fx.ChartCanvas.java

/**
 * Creates a new canvas to display the supplied chart in JavaFX.
 * /*  ww w .  j  a  va 2  s  .  c om*/
 * @param chart  the chart ({@code null} not permitted). 
 */
public ChartCanvas(JFreeChart chart) {
    ParamChecks.nullNotPermitted(chart, "chart");
    this.chart = chart;
    this.chart.addChangeListener(this);
    this.tooltip = null;
    this.tooltipEnabled = true;
    this.chartMouseListeners = new ArrayList<ChartMouseListenerFX>();

    widthProperty().addListener(evt -> draw());
    heightProperty().addListener(evt -> draw());
    this.g2 = new FXGraphics2D(getGraphicsContext2D());
    this.liveHandler = null;
    this.availableMouseHandlers = new ArrayList<MouseHandlerFX>();

    this.availableMouseHandlers.add(new PanHandlerFX("pan", true, false, false, false));

    this.auxiliaryMouseHandlers = new ArrayList<MouseHandlerFX>();
    this.auxiliaryMouseHandlers.add(new TooltipHandlerFX("tooltip"));
    this.auxiliaryMouseHandlers.add(new ScrollHandlerFX("scroll"));
    this.auxiliaryMouseHandlers.add(new AnchorHandlerFX("anchor"));
    this.auxiliaryMouseHandlers.add(new DispatchHandlerFX("dispatch"));

    setOnMouseMoved((MouseEvent e) -> {
        handleMouseMoved(e);
    });
    setOnMouseClicked((MouseEvent e) -> {
        handleMouseClicked(e);
    });
    setOnMousePressed((MouseEvent e) -> {
        handleMousePressed(e);
    });
    setOnMouseDragged((MouseEvent e) -> {
        handleMouseDragged(e);
    });
    setOnMouseReleased((MouseEvent e) -> {
        handleMouseReleased(e);
    });
    setOnScroll((ScrollEvent event) -> {
        handleScroll(event);
    });
}

From source file:org.jfree.data.general.Series.java

/**
 * Sets the key for the series and sends a <code>VetoableChangeEvent</code>
 * (with the property name "Key") to all registered listeners.  For 
 * backwards compatibility, this method also fires a regular 
 * <code>PropertyChangeEvent</code>.  If the key change is vetoed this 
 * method will throw an IllegalArgumentException.
 *
 * @param key  the key (<code>null</code> not permitted).
 *
 * @see #getKey()/*from  w  w w  .j a va 2 s.c  o m*/
 */
public void setKey(Comparable key) {
    ParamChecks.nullNotPermitted(key, "key");
    Comparable old = this.key;
    try {
        // if this series belongs to a dataset, the dataset might veto the
        // change if it results in two series within the dataset having the
        // same key
        this.vetoableChangeSupport.fireVetoableChange("Key", old, key);
        this.key = key;
        // prior to 1.0.14, we just fired a PropertyChange - so we need to
        // keep doing this
        this.propertyChangeSupport.firePropertyChange("Key", old, key);
    } catch (PropertyVetoException e) {
        throw new IllegalArgumentException(e.getMessage());
    }
}

From source file:org.jfree.data.xyz.XYZSeriesCollection.java

/**
 * Returns the number of items in the specified series.
 * /*from www  . jav  a 2s.com*/
 * @param seriesIndex  the series index.
 * 
 * @return The number of items in the specified series. 
 */
@Override
public int getItemCount(int seriesIndex) {
    ParamChecks.nullNotPermitted(this, null);
    XYZSeries s = this.series.get(seriesIndex);
    return s.getItemCount();
}

From source file:org.jfree.data.KeyedObjects2D.java

/**
 * Returns the column index for a given key, or <code>-1</code> if the key
 * is not recognised./*from  w w w . ja  v  a 2 s.  co m*/
 *
 * @param key  the key (<code>null</code> not permitted).
 *
 * @return The column index.
 *
 * @see #getColumnKey(int)
 */
public int getColumnIndex(Comparable key) {
    ParamChecks.nullNotPermitted(key, "key");
    return this.columnKeys.indexOf(key);
}

From source file:org.jfree.data.xy.VectorSeriesCollection.java

/**
 * Returns the index of the specified series, or -1 if that series is not
 * present in the dataset./*www . j  a  va 2  s  .  c om*/
 *
 * @param series  the series (<code>null</code> not permitted).
 *
 * @return The series index.
 */
public int indexOf(VectorSeries series) {
    ParamChecks.nullNotPermitted(series, "series");
    return this.data.indexOf(series);
}

From source file:org.jfree.data.time.TimeTableXYDataset.java

/**
 * Creates a new dataset with the given time zone and locale.
 *
 * @param zone  the time zone to use (<code>null</code> not permitted).
 * @param locale  the locale to use (<code>null</code> not permitted).
 *///w w w  .  ja  va  2s.  c o m
public TimeTableXYDataset(TimeZone zone, Locale locale) {
    ParamChecks.nullNotPermitted(zone, "zone");
    ParamChecks.nullNotPermitted(locale, "locale");
    this.values = new DefaultKeyedValues2D(true);
    this.workingCalendar = Calendar.getInstance(zone, locale);
    this.xPosition = TimePeriodAnchor.START;
}