Java Code Examples for org.jfree.data.gantt.TaskSeriesCollection#add()

The following examples show how to use org.jfree.data.gantt.TaskSeriesCollection#add() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TaskSeriesCollectionTests.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Some basic tests for the getSeries() methods.
 */
public void testGetSeries() {
    TaskSeries s1 = new TaskSeries("S1");
    TaskSeries s2 = new TaskSeries("S2");
    TaskSeriesCollection c = new TaskSeriesCollection();
    c.add(s1);

    assertEquals(c.getSeries(0), s1);
    assertEquals(c.getSeries("S1"), s1);
    assertEquals(c.getSeries("XX"), null);

    c.add(s2);
    assertEquals(c.getSeries(1), s2);
    assertEquals(c.getSeries("S2"), s2);

    boolean pass = false;
    try {
        c.getSeries(null);
    }
    catch (NullPointerException e) {
        pass = true;
    }
    assertTrue(pass);
}
 
Example 2
Source File: TaskSeriesCollectionTests.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Creates a sample collection for testing purposes.
 * 
 * @return A sample collection.
 */
private TaskSeriesCollection createCollection2() {
    TaskSeriesCollection result = new TaskSeriesCollection();
    TaskSeries s1 = new TaskSeries("S1");
    Task t1 = new Task("Task 1", new Date(10), new Date(20));
    t1.addSubtask(new Task("Task 1A", new Date(10), new Date(15)));
    t1.addSubtask(new Task("Task 1B", new Date(16), new Date(20)));
    t1.setPercentComplete(0.10);
    s1.add(t1);
    Task t2 = new Task("Task 2", new Date(30), new Date(40));
    t2.addSubtask(new Task("Task 2A", new Date(30), new Date(35)));
    t2.addSubtask(new Task("Task 2B", new Date(36), new Date(40)));
    t2.setPercentComplete(0.20);
    s1.add(t2);
    result.add(s1);
    TaskSeries s2 = new TaskSeries("S2");
    Task t3 = new Task("Task 3", new Date(50), new Date(60));
    t3.addSubtask(new Task("Task 3A", new Date(50), new Date(55)));
    t3.addSubtask(new Task("Task 3B", new Date(56), new Date(60)));
    t3.setPercentComplete(0.30);
    s2.add(t3);
    result.add(s2);
    return result;
}
 
Example 3
Source File: TaskSeriesCollectionTests.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Creates a sample collection for testing purposes.
 *
 * @return A sample collection.
 */
private TaskSeriesCollection createCollection2() {
    TaskSeriesCollection result = new TaskSeriesCollection();
    TaskSeries s1 = new TaskSeries("S1");
    Task t1 = new Task("Task 1", new Date(10), new Date(20));
    t1.addSubtask(new Task("Task 1A", new Date(10), new Date(15)));
    t1.addSubtask(new Task("Task 1B", new Date(16), new Date(20)));
    t1.setPercentComplete(0.10);
    s1.add(t1);
    Task t2 = new Task("Task 2", new Date(30), new Date(40));
    t2.addSubtask(new Task("Task 2A", new Date(30), new Date(35)));
    t2.addSubtask(new Task("Task 2B", new Date(36), new Date(40)));
    t2.setPercentComplete(0.20);
    s1.add(t2);
    result.add(s1);
    TaskSeries s2 = new TaskSeries("S2");
    Task t3 = new Task("Task 3", new Date(50), new Date(60));
    t3.addSubtask(new Task("Task 3A", new Date(50), new Date(55)));
    t3.addSubtask(new Task("Task 3B", new Date(56), new Date(60)));
    t3.setPercentComplete(0.30);
    s2.add(t3);
    result.add(s2);
    return result;
}
 
Example 4
Source File: XYTaskDatasetTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Serialize an instance, restore it, and check for equality.
 */
public void testSerialization() {
    TaskSeries s1 = new TaskSeries("Series");
    s1.add(new Task("Task 1", new Date(0L), new Date(1L)));
    TaskSeriesCollection u1 = new TaskSeriesCollection();
    u1.add(s1);
    XYTaskDataset d1 = new XYTaskDataset(u1);
    XYTaskDataset d2 = null;
    try {
        ByteArrayOutputStream buffer = new ByteArrayOutputStream();
        ObjectOutput out = new ObjectOutputStream(buffer);
        out.writeObject(d1);
        out.close();

        ObjectInput in = new ObjectInputStream(
                new ByteArrayInputStream(buffer.toByteArray()));
        d2 = (XYTaskDataset) in.readObject();
        in.close();
    }
    catch (Exception e) {
        e.printStackTrace();
    }
    assertEquals(d1, d2);

    // basic check for independence
    s1.add(new Task("Task 2", new Date(10L), new Date(11L)));
    assertFalse(d1.equals(d2));
    TaskSeriesCollection u2 = d2.getTasks();
    TaskSeries s2 = u2.getSeries("Series");
    s2.add(new Task("Task 2", new Date(10L), new Date(11L)));
    assertTrue(d1.equals(d2));
}
 
Example 5
Source File: XYTaskDatasetTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Some checks for the equals() method.
 */
public void testEquals() {
    TaskSeries s1 = new TaskSeries("Series");
    s1.add(new Task("Task 1", new Date(0L), new Date(1L)));
    s1.add(new Task("Task 2", new Date(10L), new Date(11L)));
    s1.add(new Task("Task 3", new Date(20L), new Date(21L)));
    TaskSeriesCollection u1 = new TaskSeriesCollection();
    u1.add(s1);
    XYTaskDataset d1 = new XYTaskDataset(u1);
    TaskSeries s2 = new TaskSeries("Series");
    s2.add(new Task("Task 1", new Date(0L), new Date(1L)));
    s2.add(new Task("Task 2", new Date(10L), new Date(11L)));
    s2.add(new Task("Task 3", new Date(20L), new Date(21L)));
    TaskSeriesCollection u2 = new TaskSeriesCollection();
    u2.add(s2);
    XYTaskDataset d2 = new XYTaskDataset(u2);
    assertTrue(d1.equals(d2));

    d1.setSeriesWidth(0.123);
    assertFalse(d1.equals(d2));
    d2.setSeriesWidth(0.123);
    assertTrue(d1.equals(d2));

    d1.setTransposed(true);
    assertFalse(d1.equals(d2));
    d2.setTransposed(true);
    assertTrue(d1.equals(d2));

    s1.add(new Task("Task 2", new Date(10L), new Date(11L)));
    assertFalse(d1.equals(d2));
    s2.add(new Task("Task 2", new Date(10L), new Date(11L)));
    assertTrue(d1.equals(d2));
}
 
Example 6
Source File: TaskSeriesCollectionTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * A test for bug report 697153.
 */
public void test697153() {

    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())));

    TaskSeries s2 = new TaskSeries("S2");
    s2.add(new Task("Task 2", new SimpleTimePeriod(new Date(),
            new Date())));
    s2.add(new Task("Task 3", new SimpleTimePeriod(new Date(),
            new Date())));
    s2.add(new Task("Task 4", new SimpleTimePeriod(new Date(),
            new Date())));

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

    s1.removeAll();

    int taskCount = tsc.getColumnCount();

    assertEquals(3, taskCount);

}
 
Example 7
Source File: TaskSeriesCollectionTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * A test for bug report 697153.
 */
public void test697153() {

    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())));

    TaskSeries s2 = new TaskSeries("S2");
    s2.add(new Task("Task 2", new SimpleTimePeriod(new Date(), 
            new Date())));
    s2.add(new Task("Task 3", new SimpleTimePeriod(new Date(), 
            new Date())));
    s2.add(new Task("Task 4", new SimpleTimePeriod(new Date(), 
            new Date())));

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

    s1.removeAll();

    int taskCount = tsc.getColumnCount();

    assertEquals(3, taskCount);

}
 
Example 8
Source File: TaskSeriesCollectionTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * A check for a null task duration.
 */
public void testGetStartValue3() {
    TaskSeriesCollection c = new TaskSeriesCollection();
    TaskSeries s = new TaskSeries("Series 1");
    s.add(new Task("Task with null duration", null));
    c.add(s);
    Number millis = c.getStartValue("Series 1", "Task with null duration");
    assertTrue(millis == null);
}
 
Example 9
Source File: TaskSeriesCollectionTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a sample collection for testing purposes.
 *
 * @return A sample collection.
 */
private TaskSeriesCollection createCollection1() {
    TaskSeriesCollection result = new TaskSeriesCollection();
    TaskSeries s1 = new TaskSeries("S1");
    s1.add(new Task("Task 1", new Date(1), new Date(2)));
    s1.add(new Task("Task 2", new Date(3), new Date(4)));
    result.add(s1);
    TaskSeries s2 = new TaskSeries("S2");
    s2.add(new Task("Task 3", new Date(5), new Date(6)));
    result.add(s2);
    return result;
}
 
Example 10
Source File: TaskSeriesCollectionTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * A check for a null task duration.
 */
public void testGetStartValue3() {
    TaskSeriesCollection c = new TaskSeriesCollection();
    TaskSeries s = new TaskSeries("Series 1");
    s.add(new Task("Task with null duration", null));
    c.add(s);
    Number millis = c.getStartValue("Series 1", "Task with null duration");
    assertTrue(millis == null);
}
 
Example 11
Source File: TaskSeriesCollectionTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * A check for a null task duration.
 */
public void testGetEndValue3() {
    TaskSeriesCollection c = new TaskSeriesCollection();
    TaskSeries s = new TaskSeries("Series 1");
    s.add(new Task("Task with null duration", null));
    c.add(s);
    Number millis = c.getEndValue("Series 1", "Task with null duration");
    assertTrue(millis == null);
}
 
Example 12
Source File: TaskSeriesCollectionTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Confirm that the equals method can distinguish all the required fields.
 */
public void testEquals() {
    
    TaskSeries s1 = new TaskSeries("S");
    s1.add(new Task("T1", new Date(1), new Date(2)));
    s1.add(new Task("T2", new Date(11), new Date(22)));
    TaskSeries s2 = new TaskSeries("S");
    s2.add(new Task("T1", new Date(1), new Date(2)));
    s2.add(new Task("T2", new Date(11), new Date(22)));
    TaskSeriesCollection c1 = new TaskSeriesCollection();
    c1.add(s1);
    c1.add(s2);
    
    TaskSeries s1b = new TaskSeries("S");
    s1b.add(new Task("T1", new Date(1), new Date(2)));
    s1b.add(new Task("T2", new Date(11), new Date(22)));
    TaskSeries s2b = new TaskSeries("S");
    s2b.add(new Task("T1", new Date(1), new Date(2)));
    s2b.add(new Task("T2", new Date(11), new Date(22)));
    TaskSeriesCollection c2 = new TaskSeriesCollection();
    c2.add(s1b);
    c2.add(s2b);
    
    assertTrue(c1.equals(c2));
    assertTrue(c2.equals(c1));

}
 
Example 13
Source File: JRFillGanttDataset.java    From jasperreports with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public Dataset getCustomDataset()
{
	TaskSeriesCollection dataset = new TaskSeriesCollection();
	if (seriesNames != null)
	{
		for(int i = 0; i < seriesNames.size(); i++)
		{
			Comparable<?> seriesName = seriesNames.get(i);
			dataset.add(seriesMap.get(seriesName));
		}
	}
	return dataset;
}
 
Example 14
Source File: TaskSeriesCollectionTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a sample collection for testing purposes.
 * 
 * @return A sample collection.
 */
private TaskSeriesCollection createCollection1() {
    TaskSeriesCollection result = new TaskSeriesCollection();
    TaskSeries s1 = new TaskSeries("S1");
    s1.add(new Task("Task 1", new Date(1), new Date(2)));
    s1.add(new Task("Task 2", new Date(3), new Date(4)));
    result.add(s1);
    TaskSeries s2 = new TaskSeries("S2");
    s2.add(new Task("Task 3", new Date(5), new Date(6)));
    result.add(s2);
    return result;
}
 
Example 15
Source File: GanttChartTests.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Creates a sample dataset for a Gantt chart.
 *
 * @return The dataset.
 */
public static IntervalCategoryDataset createDataset() {

    TaskSeries s1 = new TaskSeries("Scheduled");
    s1.add(new Task("Write Proposal",
           new SimpleTimePeriod(date(1, Calendar.APRIL, 2001),
                                date(5, Calendar.APRIL, 2001))));
    s1.add(new Task("Obtain Approval",
           new SimpleTimePeriod(date(9, Calendar.APRIL, 2001),
                                date(9, Calendar.APRIL, 2001))));
    s1.add(new Task("Requirements Analysis",
           new SimpleTimePeriod(date(10, Calendar.APRIL, 2001),
                                date(5, Calendar.MAY, 2001))));
    s1.add(new Task("Design Phase",
           new SimpleTimePeriod(date(6, Calendar.MAY, 2001),
                                date(30, Calendar.MAY, 2001))));
    s1.add(new Task("Design Signoff",
           new SimpleTimePeriod(date(2, Calendar.JUNE, 2001),
                                date(2, Calendar.JUNE, 2001))));
    s1.add(new Task("Alpha Implementation",
           new SimpleTimePeriod(date(3, Calendar.JUNE, 2001),
                                date(31, Calendar.JULY, 2001))));
    s1.add(new Task("Design Review",
           new SimpleTimePeriod(date(1, Calendar.AUGUST, 2001),
                                date(8, Calendar.AUGUST, 2001))));
    s1.add(new Task("Revised Design Signoff",
           new SimpleTimePeriod(date(10, Calendar.AUGUST, 2001),
                                date(10, Calendar.AUGUST, 2001))));
    s1.add(new Task("Beta Implementation",
           new SimpleTimePeriod(date(12, Calendar.AUGUST, 2001),
                                date(12, Calendar.SEPTEMBER, 2001))));
    s1.add(new Task("Testing",
           new SimpleTimePeriod(date(13, Calendar.SEPTEMBER, 2001),
                                date(31, Calendar.OCTOBER, 2001))));
    s1.add(new Task("Final Implementation",
           new SimpleTimePeriod(date(1, Calendar.NOVEMBER, 2001),
                                date(15, Calendar.NOVEMBER, 2001))));
    s1.add(new Task("Signoff",
           new SimpleTimePeriod(date(28, Calendar.NOVEMBER, 2001),
                                date(30, Calendar.NOVEMBER, 2001))));

    TaskSeries s2 = new TaskSeries("Actual");
    s2.add(new Task("Write Proposal",
           new SimpleTimePeriod(date(1, Calendar.APRIL, 2001),
                                date(5, Calendar.APRIL, 2001))));
    s2.add(new Task("Obtain Approval",
           new SimpleTimePeriod(date(9, Calendar.APRIL, 2001),
                                date(9, Calendar.APRIL, 2001))));
    s2.add(new Task("Requirements Analysis",
           new SimpleTimePeriod(date(10, Calendar.APRIL, 2001),
                                date(15, Calendar.MAY, 2001))));
    s2.add(new Task("Design Phase",
           new SimpleTimePeriod(date(15, Calendar.MAY, 2001),
                                date(17, Calendar.JUNE, 2001))));
    s2.add(new Task("Design Signoff",
           new SimpleTimePeriod(date(30, Calendar.JUNE, 2001),
                                date(30, Calendar.JUNE, 2001))));
    s2.add(new Task("Alpha Implementation",
           new SimpleTimePeriod(date(1, Calendar.JULY, 2001),
                                date(12, Calendar.SEPTEMBER, 2001))));
    s2.add(new Task("Design Review",
           new SimpleTimePeriod(date(12, Calendar.SEPTEMBER, 2001),
                                date(22, Calendar.SEPTEMBER, 2001))));
    s2.add(new Task("Revised Design Signoff",
           new SimpleTimePeriod(date(25, Calendar.SEPTEMBER, 2001),
                                date(27, Calendar.SEPTEMBER, 2001))));
    s2.add(new Task("Beta Implementation",
           new SimpleTimePeriod(date(27, Calendar.SEPTEMBER, 2001),
                                date(30, Calendar.OCTOBER, 2001))));
    s2.add(new Task("Testing",
           new SimpleTimePeriod(date(31, Calendar.OCTOBER, 2001),
                                date(17, Calendar.NOVEMBER, 2001))));
    s2.add(new Task("Final Implementation",
           new SimpleTimePeriod(date(18, Calendar.NOVEMBER, 2001),
                                date(5, Calendar.DECEMBER, 2001))));
    s2.add(new Task("Signoff",
           new SimpleTimePeriod(date(10, Calendar.DECEMBER, 2001),
                                date(11, Calendar.DECEMBER, 2001))));

    TaskSeriesCollection collection = new TaskSeriesCollection();
    collection.add(s1);
    collection.add(s2);

    return collection;
}
 
Example 16
Source File: GanttChartTest.java    From ECG-Viewer with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Creates a sample dataset for a Gantt chart.
 *
 * @return The dataset.
 */
public static IntervalCategoryDataset createDataset() {

    TaskSeries s1 = new TaskSeries("Scheduled");
    s1.add(new Task("Write Proposal",
           new SimpleTimePeriod(date(1, Calendar.APRIL, 2001),
                                date(5, Calendar.APRIL, 2001))));
    s1.add(new Task("Obtain Approval",
           new SimpleTimePeriod(date(9, Calendar.APRIL, 2001),
                                date(9, Calendar.APRIL, 2001))));
    s1.add(new Task("Requirements Analysis",
           new SimpleTimePeriod(date(10, Calendar.APRIL, 2001),
                                date(5, Calendar.MAY, 2001))));
    s1.add(new Task("Design Phase",
           new SimpleTimePeriod(date(6, Calendar.MAY, 2001),
                                date(30, Calendar.MAY, 2001))));
    s1.add(new Task("Design Signoff",
           new SimpleTimePeriod(date(2, Calendar.JUNE, 2001),
                                date(2, Calendar.JUNE, 2001))));
    s1.add(new Task("Alpha Implementation",
           new SimpleTimePeriod(date(3, Calendar.JUNE, 2001),
                                date(31, Calendar.JULY, 2001))));
    s1.add(new Task("Design Review",
           new SimpleTimePeriod(date(1, Calendar.AUGUST, 2001),
                                date(8, Calendar.AUGUST, 2001))));
    s1.add(new Task("Revised Design Signoff",
           new SimpleTimePeriod(date(10, Calendar.AUGUST, 2001),
                                date(10, Calendar.AUGUST, 2001))));
    s1.add(new Task("Beta Implementation",
           new SimpleTimePeriod(date(12, Calendar.AUGUST, 2001),
                                date(12, Calendar.SEPTEMBER, 2001))));
    s1.add(new Task("Testing",
           new SimpleTimePeriod(date(13, Calendar.SEPTEMBER, 2001),
                                date(31, Calendar.OCTOBER, 2001))));
    s1.add(new Task("Final Implementation",
           new SimpleTimePeriod(date(1, Calendar.NOVEMBER, 2001),
                                date(15, Calendar.NOVEMBER, 2001))));
    s1.add(new Task("Signoff",
           new SimpleTimePeriod(date(28, Calendar.NOVEMBER, 2001),
                                date(30, Calendar.NOVEMBER, 2001))));

    TaskSeries s2 = new TaskSeries("Actual");
    s2.add(new Task("Write Proposal",
           new SimpleTimePeriod(date(1, Calendar.APRIL, 2001),
                                date(5, Calendar.APRIL, 2001))));
    s2.add(new Task("Obtain Approval",
           new SimpleTimePeriod(date(9, Calendar.APRIL, 2001),
                                date(9, Calendar.APRIL, 2001))));
    s2.add(new Task("Requirements Analysis",
           new SimpleTimePeriod(date(10, Calendar.APRIL, 2001),
                                date(15, Calendar.MAY, 2001))));
    s2.add(new Task("Design Phase",
           new SimpleTimePeriod(date(15, Calendar.MAY, 2001),
                                date(17, Calendar.JUNE, 2001))));
    s2.add(new Task("Design Signoff",
           new SimpleTimePeriod(date(30, Calendar.JUNE, 2001),
                                date(30, Calendar.JUNE, 2001))));
    s2.add(new Task("Alpha Implementation",
           new SimpleTimePeriod(date(1, Calendar.JULY, 2001),
                                date(12, Calendar.SEPTEMBER, 2001))));
    s2.add(new Task("Design Review",
           new SimpleTimePeriod(date(12, Calendar.SEPTEMBER, 2001),
                                date(22, Calendar.SEPTEMBER, 2001))));
    s2.add(new Task("Revised Design Signoff",
           new SimpleTimePeriod(date(25, Calendar.SEPTEMBER, 2001),
                                date(27, Calendar.SEPTEMBER, 2001))));
    s2.add(new Task("Beta Implementation",
           new SimpleTimePeriod(date(27, Calendar.SEPTEMBER, 2001),
                                date(30, Calendar.OCTOBER, 2001))));
    s2.add(new Task("Testing",
           new SimpleTimePeriod(date(31, Calendar.OCTOBER, 2001),
                                date(17, Calendar.NOVEMBER, 2001))));
    s2.add(new Task("Final Implementation",
           new SimpleTimePeriod(date(18, Calendar.NOVEMBER, 2001),
                                date(5, Calendar.DECEMBER, 2001))));
    s2.add(new Task("Signoff",
           new SimpleTimePeriod(date(10, Calendar.DECEMBER, 2001),
                                date(11, Calendar.DECEMBER, 2001))));

    TaskSeriesCollection collection = new TaskSeriesCollection();
    collection.add(s1);
    collection.add(s2);

    return collection;
}
 
Example 17
Source File: GanttChartTest.java    From buffer_bci with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Creates a sample dataset for a Gantt chart.
 *
 * @return The dataset.
 */
public static IntervalCategoryDataset createDataset() {

    TaskSeries s1 = new TaskSeries("Scheduled");
    s1.add(new Task("Write Proposal",
           new SimpleTimePeriod(date(1, Calendar.APRIL, 2001),
                                date(5, Calendar.APRIL, 2001))));
    s1.add(new Task("Obtain Approval",
           new SimpleTimePeriod(date(9, Calendar.APRIL, 2001),
                                date(9, Calendar.APRIL, 2001))));
    s1.add(new Task("Requirements Analysis",
           new SimpleTimePeriod(date(10, Calendar.APRIL, 2001),
                                date(5, Calendar.MAY, 2001))));
    s1.add(new Task("Design Phase",
           new SimpleTimePeriod(date(6, Calendar.MAY, 2001),
                                date(30, Calendar.MAY, 2001))));
    s1.add(new Task("Design Signoff",
           new SimpleTimePeriod(date(2, Calendar.JUNE, 2001),
                                date(2, Calendar.JUNE, 2001))));
    s1.add(new Task("Alpha Implementation",
           new SimpleTimePeriod(date(3, Calendar.JUNE, 2001),
                                date(31, Calendar.JULY, 2001))));
    s1.add(new Task("Design Review",
           new SimpleTimePeriod(date(1, Calendar.AUGUST, 2001),
                                date(8, Calendar.AUGUST, 2001))));
    s1.add(new Task("Revised Design Signoff",
           new SimpleTimePeriod(date(10, Calendar.AUGUST, 2001),
                                date(10, Calendar.AUGUST, 2001))));
    s1.add(new Task("Beta Implementation",
           new SimpleTimePeriod(date(12, Calendar.AUGUST, 2001),
                                date(12, Calendar.SEPTEMBER, 2001))));
    s1.add(new Task("Testing",
           new SimpleTimePeriod(date(13, Calendar.SEPTEMBER, 2001),
                                date(31, Calendar.OCTOBER, 2001))));
    s1.add(new Task("Final Implementation",
           new SimpleTimePeriod(date(1, Calendar.NOVEMBER, 2001),
                                date(15, Calendar.NOVEMBER, 2001))));
    s1.add(new Task("Signoff",
           new SimpleTimePeriod(date(28, Calendar.NOVEMBER, 2001),
                                date(30, Calendar.NOVEMBER, 2001))));

    TaskSeries s2 = new TaskSeries("Actual");
    s2.add(new Task("Write Proposal",
           new SimpleTimePeriod(date(1, Calendar.APRIL, 2001),
                                date(5, Calendar.APRIL, 2001))));
    s2.add(new Task("Obtain Approval",
           new SimpleTimePeriod(date(9, Calendar.APRIL, 2001),
                                date(9, Calendar.APRIL, 2001))));
    s2.add(new Task("Requirements Analysis",
           new SimpleTimePeriod(date(10, Calendar.APRIL, 2001),
                                date(15, Calendar.MAY, 2001))));
    s2.add(new Task("Design Phase",
           new SimpleTimePeriod(date(15, Calendar.MAY, 2001),
                                date(17, Calendar.JUNE, 2001))));
    s2.add(new Task("Design Signoff",
           new SimpleTimePeriod(date(30, Calendar.JUNE, 2001),
                                date(30, Calendar.JUNE, 2001))));
    s2.add(new Task("Alpha Implementation",
           new SimpleTimePeriod(date(1, Calendar.JULY, 2001),
                                date(12, Calendar.SEPTEMBER, 2001))));
    s2.add(new Task("Design Review",
           new SimpleTimePeriod(date(12, Calendar.SEPTEMBER, 2001),
                                date(22, Calendar.SEPTEMBER, 2001))));
    s2.add(new Task("Revised Design Signoff",
           new SimpleTimePeriod(date(25, Calendar.SEPTEMBER, 2001),
                                date(27, Calendar.SEPTEMBER, 2001))));
    s2.add(new Task("Beta Implementation",
           new SimpleTimePeriod(date(27, Calendar.SEPTEMBER, 2001),
                                date(30, Calendar.OCTOBER, 2001))));
    s2.add(new Task("Testing",
           new SimpleTimePeriod(date(31, Calendar.OCTOBER, 2001),
                                date(17, Calendar.NOVEMBER, 2001))));
    s2.add(new Task("Final Implementation",
           new SimpleTimePeriod(date(18, Calendar.NOVEMBER, 2001),
                                date(5, Calendar.DECEMBER, 2001))));
    s2.add(new Task("Signoff",
           new SimpleTimePeriod(date(10, Calendar.DECEMBER, 2001),
                                date(11, Calendar.DECEMBER, 2001))));

    TaskSeriesCollection collection = new TaskSeriesCollection();
    collection.add(s1);
    collection.add(s2);

    return collection;
}
 
Example 18
Source File: GanttChartTests.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Creates a sample dataset for a Gantt chart.
 *
 * @return The dataset.
 */
public static IntervalCategoryDataset createDataset() {

    TaskSeries s1 = new TaskSeries("Scheduled");
    s1.add(new Task("Write Proposal",
           new SimpleTimePeriod(date(1, Calendar.APRIL, 2001),
                                date(5, Calendar.APRIL, 2001))));
    s1.add(new Task("Obtain Approval",
           new SimpleTimePeriod(date(9, Calendar.APRIL, 2001),
                                date(9, Calendar.APRIL, 2001))));
    s1.add(new Task("Requirements Analysis",
           new SimpleTimePeriod(date(10, Calendar.APRIL, 2001),
                                date(5, Calendar.MAY, 2001))));
    s1.add(new Task("Design Phase",
           new SimpleTimePeriod(date(6, Calendar.MAY, 2001),
                                date(30, Calendar.MAY, 2001))));
    s1.add(new Task("Design Signoff",
           new SimpleTimePeriod(date(2, Calendar.JUNE, 2001),
                                date(2, Calendar.JUNE, 2001))));
    s1.add(new Task("Alpha Implementation",
           new SimpleTimePeriod(date(3, Calendar.JUNE, 2001),
                                date(31, Calendar.JULY, 2001))));
    s1.add(new Task("Design Review",
           new SimpleTimePeriod(date(1, Calendar.AUGUST, 2001),
                                date(8, Calendar.AUGUST, 2001))));
    s1.add(new Task("Revised Design Signoff",
           new SimpleTimePeriod(date(10, Calendar.AUGUST, 2001),
                                date(10, Calendar.AUGUST, 2001))));
    s1.add(new Task("Beta Implementation",
           new SimpleTimePeriod(date(12, Calendar.AUGUST, 2001),
                                date(12, Calendar.SEPTEMBER, 2001))));
    s1.add(new Task("Testing",
           new SimpleTimePeriod(date(13, Calendar.SEPTEMBER, 2001),
                                date(31, Calendar.OCTOBER, 2001))));
    s1.add(new Task("Final Implementation",
           new SimpleTimePeriod(date(1, Calendar.NOVEMBER, 2001),
                                date(15, Calendar.NOVEMBER, 2001))));
    s1.add(new Task("Signoff",
           new SimpleTimePeriod(date(28, Calendar.NOVEMBER, 2001),
                                date(30, Calendar.NOVEMBER, 2001))));

    TaskSeries s2 = new TaskSeries("Actual");
    s2.add(new Task("Write Proposal",
           new SimpleTimePeriod(date(1, Calendar.APRIL, 2001),
                                date(5, Calendar.APRIL, 2001))));
    s2.add(new Task("Obtain Approval",
           new SimpleTimePeriod(date(9, Calendar.APRIL, 2001),
                                date(9, Calendar.APRIL, 2001))));
    s2.add(new Task("Requirements Analysis",
           new SimpleTimePeriod(date(10, Calendar.APRIL, 2001),
                                date(15, Calendar.MAY, 2001))));
    s2.add(new Task("Design Phase",
           new SimpleTimePeriod(date(15, Calendar.MAY, 2001),
                                date(17, Calendar.JUNE, 2001))));
    s2.add(new Task("Design Signoff",
           new SimpleTimePeriod(date(30, Calendar.JUNE, 2001),
                                date(30, Calendar.JUNE, 2001))));
    s2.add(new Task("Alpha Implementation",
           new SimpleTimePeriod(date(1, Calendar.JULY, 2001),
                                date(12, Calendar.SEPTEMBER, 2001))));
    s2.add(new Task("Design Review",
           new SimpleTimePeriod(date(12, Calendar.SEPTEMBER, 2001),
                                date(22, Calendar.SEPTEMBER, 2001))));
    s2.add(new Task("Revised Design Signoff",
           new SimpleTimePeriod(date(25, Calendar.SEPTEMBER, 2001),
                                date(27, Calendar.SEPTEMBER, 2001))));
    s2.add(new Task("Beta Implementation",
           new SimpleTimePeriod(date(27, Calendar.SEPTEMBER, 2001),
                                date(30, Calendar.OCTOBER, 2001))));
    s2.add(new Task("Testing",
           new SimpleTimePeriod(date(31, Calendar.OCTOBER, 2001),
                                date(17, Calendar.NOVEMBER, 2001))));
    s2.add(new Task("Final Implementation",
           new SimpleTimePeriod(date(18, Calendar.NOVEMBER, 2001),
                                date(5, Calendar.DECEMBER, 2001))));
    s2.add(new Task("Signoff",
           new SimpleTimePeriod(date(10, Calendar.DECEMBER, 2001),
                                date(11, Calendar.DECEMBER, 2001))));

    TaskSeriesCollection collection = new TaskSeriesCollection();
    collection.add(s1);
    collection.add(s2);

    return collection;
}
 
Example 19
Source File: TaskSeriesCollectionTests.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Creates a sample collection for testing purposes.
 * 
 * @return A sample collection.
 */
private TaskSeriesCollection createCollection3() {
    
    // define subtasks
    Task sub1 = new Task("Sub1", new Date(11), new Date(111));
    Task sub2 = new Task("Sub2", new Date(22), new Date(222));
    Task sub3 = new Task("Sub3", new Date(33), new Date(333));
    Task sub4 = new Task("Sub4", new Date(44), new Date(444));
    Task sub5 = new Task("Sub5", new Date(55), new Date(555));
    Task sub6 = new Task("Sub6", new Date(66), new Date(666));
    sub1.setPercentComplete(0.111);
    sub2.setPercentComplete(0.222);
    sub3.setPercentComplete(0.333);
    sub4.setPercentComplete(0.444);
    sub5.setPercentComplete(0.555);
    sub6.setPercentComplete(0.666);
    
    TaskSeries seriesA = new TaskSeries("Series A");
    Task taskA1 = new Task("Task 1", new SimpleTimePeriod(new Date(100), 
            new Date(200)));
    taskA1.setPercentComplete(0.1);
    taskA1.addSubtask(sub1);
    Task taskA2 = new Task("Task 2", new SimpleTimePeriod(new Date(220), 
            new Date(350)));
    taskA2.setPercentComplete(0.2);
    taskA2.addSubtask(sub2);
    taskA2.addSubtask(sub3);
    seriesA.add(taskA1);
    seriesA.add(taskA2);
     
    TaskSeries seriesB = new TaskSeries("Series B");
    // note that we don't define taskB1
    Task taskB2 = new Task("Task 2", new SimpleTimePeriod(new Date(2220), 
            new Date(3350)));
    taskB2.setPercentComplete(0.3);
    taskB2.addSubtask(sub4);
    taskB2.addSubtask(sub5);
    taskB2.addSubtask(sub6);
    seriesB.add(taskB2);

    TaskSeriesCollection tsc = new TaskSeriesCollection();
    tsc.add(seriesA);
    tsc.add(seriesB);        
    
    return tsc;
}
 
Example 20
Source File: GanttChartTest.java    From openstock with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Creates a sample dataset for a Gantt chart.
 *
 * @return The dataset.
 */
public static IntervalCategoryDataset createDataset() {

    TaskSeries s1 = new TaskSeries("Scheduled");
    s1.add(new Task("Write Proposal",
           new SimpleTimePeriod(date(1, Calendar.APRIL, 2001),
                                date(5, Calendar.APRIL, 2001))));
    s1.add(new Task("Obtain Approval",
           new SimpleTimePeriod(date(9, Calendar.APRIL, 2001),
                                date(9, Calendar.APRIL, 2001))));
    s1.add(new Task("Requirements Analysis",
           new SimpleTimePeriod(date(10, Calendar.APRIL, 2001),
                                date(5, Calendar.MAY, 2001))));
    s1.add(new Task("Design Phase",
           new SimpleTimePeriod(date(6, Calendar.MAY, 2001),
                                date(30, Calendar.MAY, 2001))));
    s1.add(new Task("Design Signoff",
           new SimpleTimePeriod(date(2, Calendar.JUNE, 2001),
                                date(2, Calendar.JUNE, 2001))));
    s1.add(new Task("Alpha Implementation",
           new SimpleTimePeriod(date(3, Calendar.JUNE, 2001),
                                date(31, Calendar.JULY, 2001))));
    s1.add(new Task("Design Review",
           new SimpleTimePeriod(date(1, Calendar.AUGUST, 2001),
                                date(8, Calendar.AUGUST, 2001))));
    s1.add(new Task("Revised Design Signoff",
           new SimpleTimePeriod(date(10, Calendar.AUGUST, 2001),
                                date(10, Calendar.AUGUST, 2001))));
    s1.add(new Task("Beta Implementation",
           new SimpleTimePeriod(date(12, Calendar.AUGUST, 2001),
                                date(12, Calendar.SEPTEMBER, 2001))));
    s1.add(new Task("Testing",
           new SimpleTimePeriod(date(13, Calendar.SEPTEMBER, 2001),
                                date(31, Calendar.OCTOBER, 2001))));
    s1.add(new Task("Final Implementation",
           new SimpleTimePeriod(date(1, Calendar.NOVEMBER, 2001),
                                date(15, Calendar.NOVEMBER, 2001))));
    s1.add(new Task("Signoff",
           new SimpleTimePeriod(date(28, Calendar.NOVEMBER, 2001),
                                date(30, Calendar.NOVEMBER, 2001))));

    TaskSeries s2 = new TaskSeries("Actual");
    s2.add(new Task("Write Proposal",
           new SimpleTimePeriod(date(1, Calendar.APRIL, 2001),
                                date(5, Calendar.APRIL, 2001))));
    s2.add(new Task("Obtain Approval",
           new SimpleTimePeriod(date(9, Calendar.APRIL, 2001),
                                date(9, Calendar.APRIL, 2001))));
    s2.add(new Task("Requirements Analysis",
           new SimpleTimePeriod(date(10, Calendar.APRIL, 2001),
                                date(15, Calendar.MAY, 2001))));
    s2.add(new Task("Design Phase",
           new SimpleTimePeriod(date(15, Calendar.MAY, 2001),
                                date(17, Calendar.JUNE, 2001))));
    s2.add(new Task("Design Signoff",
           new SimpleTimePeriod(date(30, Calendar.JUNE, 2001),
                                date(30, Calendar.JUNE, 2001))));
    s2.add(new Task("Alpha Implementation",
           new SimpleTimePeriod(date(1, Calendar.JULY, 2001),
                                date(12, Calendar.SEPTEMBER, 2001))));
    s2.add(new Task("Design Review",
           new SimpleTimePeriod(date(12, Calendar.SEPTEMBER, 2001),
                                date(22, Calendar.SEPTEMBER, 2001))));
    s2.add(new Task("Revised Design Signoff",
           new SimpleTimePeriod(date(25, Calendar.SEPTEMBER, 2001),
                                date(27, Calendar.SEPTEMBER, 2001))));
    s2.add(new Task("Beta Implementation",
           new SimpleTimePeriod(date(27, Calendar.SEPTEMBER, 2001),
                                date(30, Calendar.OCTOBER, 2001))));
    s2.add(new Task("Testing",
           new SimpleTimePeriod(date(31, Calendar.OCTOBER, 2001),
                                date(17, Calendar.NOVEMBER, 2001))));
    s2.add(new Task("Final Implementation",
           new SimpleTimePeriod(date(18, Calendar.NOVEMBER, 2001),
                                date(5, Calendar.DECEMBER, 2001))));
    s2.add(new Task("Signoff",
           new SimpleTimePeriod(date(10, Calendar.DECEMBER, 2001),
                                date(11, Calendar.DECEMBER, 2001))));

    TaskSeriesCollection collection = new TaskSeriesCollection();
    collection.add(s1);
    collection.add(s2);

    return collection;
}