Example usage for org.jfree.data.gantt TaskSeriesCollection getSubIntervalCount

List of usage examples for org.jfree.data.gantt TaskSeriesCollection getSubIntervalCount

Introduction

In this page you can find the example usage for org.jfree.data.gantt TaskSeriesCollection getSubIntervalCount.

Prototype

@Override
public int getSubIntervalCount(Comparable rowKey, Comparable columnKey) 

Source Link

Document

Returns the number of sub-intervals for a given item.

Usage

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

/**
 * Some tests for the bug report 1099331.  We create a TaskSeriesCollection
 * with two series - the first series has two tasks, but the second has
 * only one.  The key is to ensure that the methods in TaskSeriesCollection
 * translate the index values to key values *before* accessing the tasks
 * in the series.//w w  w  .  j  a va  2s  .  co  m
 */
@Test
public void testGetSubIntervalCount() {
    TaskSeriesCollection tsc = createCollection3();
    assertEquals(1, tsc.getSubIntervalCount(0, 0));
    assertEquals(2, tsc.getSubIntervalCount(0, 1));
    assertEquals(0, tsc.getSubIntervalCount(1, 0));
    assertEquals(3, tsc.getSubIntervalCount(1, 1));
}

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

/**
 * A test for bug report 800324./*from   w w w. j a  v a  2  s . co  m*/
 */
@Test
public void test800324() {
    TaskSeries s1 = new TaskSeries("S1");
    s1.add(new Task("Task 1", new SimpleTimePeriod(new Date(), new Date())));
    s1.add(new Task("Task 2", new SimpleTimePeriod(new Date(), new Date())));
    s1.add(new Task("Task 3", new SimpleTimePeriod(new Date(), new Date())));

    TaskSeriesCollection tsc = new TaskSeriesCollection();
    tsc.add(s1);

    // these methods should throw an IndexOutOfBoundsException since the
    // column is too high...
    try {
        /* Number start = */ tsc.getStartValue(0, 3);
        assertTrue(false);
    } catch (IndexOutOfBoundsException e) {
        // expected
    }
    try {
        /* Number end = */ tsc.getEndValue(0, 3);
        assertTrue(false);
    } catch (IndexOutOfBoundsException e) {
        // expected
    }
    try {
        /* int count = */ tsc.getSubIntervalCount(0, 3);
        assertTrue(false);
    } catch (IndexOutOfBoundsException e) {
        // expected
    }
}