Example usage for org.jfree.data.gantt Task setDuration

List of usage examples for org.jfree.data.gantt Task setDuration

Introduction

In this page you can find the example usage for org.jfree.data.gantt Task setDuration.

Prototype

public void setDuration(TimePeriod duration) 

Source Link

Document

Sets the task duration (actual or estimated).

Usage

From source file:pt.lsts.neptus.plugins.trex.TrexTimelinePanel.java

private Task setEndTime(Task t, double time) {
    TimePeriod tp = t.getDuration();//ww w.  j a  va  2 s. c  om
    t.setDuration(new SimpleTimePeriod(tp.getStart(), new Date((long) (time * 1000))));
    return t;
}

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

/**
 * Confirm that the equals method can distinguish all the required fields.
 *//*from w  ww  .  j a  v a2 s.  co  m*/
@Test
public void testEquals() {
    Task t1 = new Task("T", new Date(1), new Date(2));
    Task t2 = new Task("T", new Date(1), new Date(2));
    assertTrue(t1.equals(t2));
    assertTrue(t2.equals(t1));

    t1.setDescription("X");
    assertFalse(t1.equals(t2));
    t2.setDescription("X");
    assertTrue(t1.equals(t2));

    t1.setDuration(new SimpleTimePeriod(new Date(2), new Date(3)));
    assertFalse(t1.equals(t2));
    t2.setDuration(new SimpleTimePeriod(new Date(2), new Date(3)));
    assertTrue(t1.equals(t2));

    t1.setPercentComplete(0.5);
    assertFalse(t1.equals(t2));
    t2.setPercentComplete(0.5);
    assertTrue(t1.equals(t2));

    t1.addSubtask(new Task("T", new Date(22), new Date(33)));
    assertFalse(t1.equals(t2));
    t2.addSubtask(new Task("T", new Date(22), new Date(33)));
    assertTrue(t1.equals(t2));

}