GanttProjectAPI

I. Description

This package is to get and set some Data from GanttProject-XML-File.

It supports the following features:

  • Read data from GanttDiagram-Charts
  • Write data into GanttDiagram-Charts
  • Modify data from GanttDiagram-Charts
  • Test itself with JUnit


  • not finished yet

II. File List

Java-Classes:

  • GanttDiagram.java - Wrapper-class for GanttDiagramms
  • Task.java - Handles GanttDiagram-Tasks
  • Resource.java - Handles GanttDiagram-Resources
  • Role.java - Handles GanttDiagram-Roles
  • TaskProperty.java - Handles GanttDiagram-Task-Properties
  • ResourceAllocation.java - Handles GanttDiagram-Resource-Allocations
  • Depend.java - Handles GanttDiagram-Task-Dependencies
  • XMLHelper.java - Read XMLFile and parse it into dom

For testing:

  • Test1.java - Read data from gantt-xml-file - for testing
  • Test2.java - Read and modify data from gantt-xml-file - for testing
  • Test3.java - Read and delete data from gantt-xml-file - for testing
  • GanttProjectAPIJUnitReadTest.java - Some JUnit-Tests
  • Demo1.gan - GanttChart from GanttProject for Test1.java and JUnitTest
  • Demo1b.gan - GanttChart from GanttProject for Test2.java
  • Demo1b_orig.gan - original file from Demo1b.gan
  • Demo2.gan - GanttChart from GanttProject for some other tests
  • Demo3.gan - GanttChart from GanttProject for the delete tests
  • Demo3_orig.gan - original file from Demo3.gan

libraries:

  • junit-4.8.2.jar
  • log4j.jar
  • org.hamcrest.core_1.1.0.v20090501071000.jar
  • xml-apis.jar

Other:

  • readme.txt
  • index.html

Executable files:

  • Test1.sh - Use this to test Test1.java without an IDE under Unix-systems (i.e. sh Test1.sh)
  • Test1.bat - Use this to test Test1.java without an IDE under Windows-systems
  • Test2.sh - Use this to test Test2.java without an IDE under Unix-systems (i.e. sh Test2.sh)
  • Test2.bat - Use this to test Test2.java without an IDE under Windows-systems
  • Test3.sh - Use this to test Test3.java without an IDE under Unix-systems (i.e. sh Test2.sh)
  • Test3.bat - Use this to test Test3.java without an IDE under Windows-systems
  • JUnittest1.sh - Use this to test GanttDiagram.java with JUnit without an IDE under Unix-systems (i.e. sh Test1.sh)
  • JUnittest1.bat - Use this to test GanttDiagram.java with JUnit without an IDE under Windows-systems
  • JUnittest2.sh - Use this to test GanttDiagram.java with JUnit (write-tests) without an IDE under Unix-systems (i.e. sh Test1.sh)
  • JUnittest2.bat - Use this to test GanttDiagram.java with JUnit (write-tests) without an IDE under Windows-systems

III. Requirements

  1. check out all Files
  2. To test, make sure the absolute path for the test-gantt-charts (Demo1.gan, Demo1b.gan or Demo2.gan) in the TestX.java or/and GanttProjectAPIJUnitTest.java is correct

    i.e. on Windows : C:\\Projects\\GanttProjectAPI\\data\\Demo1.gan

    i.e. on Linux/unix : /home/user/workspace/GanttProjectAPI/data/Demo1b.gan

    Would be easier to use Eclipse or another IDE, but not necessary

IV. How to Use

  • Test the read-function from GanttProjectAPI:
    • For a general test, use one of the executable files (Win: Test1.bat or Unix: Test1.sh)
    • normally you have to change some paths in the .sh or .bat files
      • Update CP="CLASSPATH"
      • Update JAVAHOME="JAVAPATH"
    • It use the Test1.java and Demo1.gan
    • If you want you can edit the Test1.java for your own tests

  • Test the write-function from GanttProjectAPI
    • For a general test, use one of the executable files (Win: Test2.bat or Unix: Test2.sh)
    • normally you have to change some paths in the .sh or .bat files
    • It use the Test2.java and Demo1b.gan
    • If you want you can edit the Test2.java for your own tests
    • After the first launch the Demo1b.gen witch is used by Test2.java is overwritten with the new (changed) data you have to edit Test2.java to see effects of a next launch

  • Use the API (first steps, examples):

    • read out data from *.gan:

    • String ganttDiagramFile = "/home/objectcode/workspace/GanttProjectAPI/data/Demo1.gan"; //Use this or an equal path for Unix-systems
      or
      String ganttDiagramFile = "C:\\Projects\\GanttProjectAPI\\data\\Demo1.gan"; //Use this or an equal path for Windows-systems

      GanttDiagram ganttDiagram = new GanttDiagram(ganttDiagramFile);
      ganttDiagram.loadGanttDiagram();

      log("Project-Name: "+ganttDiagram.getName());
      log("Task with Id=4: " + ganttDiagram.getTaskById("4").toString());
      log("Name from Task with Id=5: " + ganttDiagram.getTaskName("5")
      log("Funkion of Resource with Id=3: " + ganttDiagram.getResourceFunction("3"));
      log("Taskproperty tpd0 Name: " + ganttDiagram.getTaskPropertyName("tpd0"));
      ...

    • edit data from *.gan

    • ...
      ganttDiagram.modifyDiagram_setProjectName("Demo1b new");
      ganttDiagram.modifyDiagram_setVersion("2.1");
      ganttDiagram.modifyDiagram_addTask("101", "3", "7", "NewTask", 0, 1, false, "1", new java.util.Date(), "created by Test2.java");
      ganttDiagram.modifyDiagram_setTaskName("1", "new TaskName");
      ganttDiagram.modifyDiagram_setTaskMeeting("1", "true");
      ...

      ganttDiagram.modifyDiagram_deleteTask("1");
      ...

V. History:

VI. Compatibility

Compatible with Java-JDK 1.6

VII. Known Issues

see Bug-Trac on the Projectpage

VIII. Additional Resources