Java Code Examples for net.sf.mpxj.Task#getName()

The following examples show how to use net.sf.mpxj.Task#getName() . 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: ProjectTreeController.java    From mpxj with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * Add tasks to the tree.
 *
 * @param parentNode parent tree node
 * @param parent parent task container
 */
private void addTasks(MpxjTreeNode parentNode, ChildTaskContainer parent)
{
   for (Task task : parent.getChildTasks())
   {
      final Task t = task;
      MpxjTreeNode childNode = new MpxjTreeNode(task, TASK_EXCLUDED_METHODS)
      {
         @Override public String toString()
         {
            return t.getName();
         }
      };
      parentNode.add(childNode);
      addTasks(childNode, task);
   }
}
 
Example 2
Source File: ProjectTreeController.java    From mpxj with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * Add assignments to the tree.
 *
 * @param parentNode parent tree node
 * @param file assignments container
 */
private void addAssignments(MpxjTreeNode parentNode, ProjectFile file)
{
   for (ResourceAssignment assignment : file.getResourceAssignments())
   {
      final ResourceAssignment a = assignment;
      MpxjTreeNode childNode = new MpxjTreeNode(a)
      {
         @Override public String toString()
         {
            Resource resource = a.getResource();
            String resourceName = resource == null ? "(unknown resource)" : resource.getName();
            Task task = a.getTask();
            String taskName = task == null ? "(unknown task)" : task.getName();
            return resourceName + "->" + taskName;
         }
      };
      parentNode.add(childNode);
   }
}
 
Example 3
Source File: AstaReader.java    From mpxj with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * Adds a leaf node, which could be a task or a milestone.
 *
 * @param parentName parent bar name
 * @param row row to add
 * @param task task to populate with data from the row
 */
private void populateLeaf(String parentName, Row row, Task task)
{
   if (row.getInteger("TASKID") != null)
   {
      populateTask(row, task);
   }
   else
   {
      populateMilestone(row, task);
   }

   String name = task.getName();
   if (name == null || name.isEmpty())
   {
      task.setName(parentName);
   }
}
 
Example 4
Source File: TurboProjectReader.java    From mpxj with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * Read data for an individual task from the tables in a PEP file.
 *
 * @param parent parent task
 * @param id task ID
 * @return task instance
 */
private Task readTask(ChildTaskContainer parent, Integer id)
{
   Table a0 = getTable("A0TAB");
   Table a1 = getTable("A1TAB");
   Table a2 = getTable("A2TAB");
   Table a3 = getTable("A3TAB");
   Table a4 = getTable("A4TAB");

   Task task = parent.addTask();
   MapRow a1Row = a1.find(id);
   MapRow a2Row = a2.find(id);

   setFields(A0TAB_FIELDS, a0.find(id), task);
   setFields(A1TAB_FIELDS, a1Row, task);
   setFields(A2TAB_FIELDS, a2Row, task);
   setFields(A3TAB_FIELDS, a3.find(id), task);
   setFields(A5TAB_FIELDS, a4.find(id), task);

   task.setStart(task.getEarlyStart());
   task.setFinish(task.getEarlyFinish());
   if (task.getName() == null)
   {
      task.setName(task.getText(1));
   }

   m_eventManager.fireTaskReadEvent(task);

   return task;
}
 
Example 5
Source File: MpxjQuery.java    From mpxj with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * This method lists all resource assignments defined in the file.
 *
 * @param file MPX file
 */
private static void listAssignments(ProjectFile file)
{
   Task task;
   Resource resource;
   String taskName;
   String resourceName;

   for (ResourceAssignment assignment : file.getResourceAssignments())
   {
      task = assignment.getTask();
      if (task == null)
      {
         taskName = "(null task)";
      }
      else
      {
         taskName = task.getName();
      }

      resource = assignment.getResource();
      if (resource == null)
      {
         resourceName = "(null resource)";
      }
      else
      {
         resourceName = resource.getName();
      }

      System.out.println("Assignment: Task=" + taskName + " Resource=" + resourceName);
      if (task != null)
      {
         listTimephasedWork(assignment);
      }
   }

   System.out.println();
}