Search in sources :

Example 11 with EVTask

use of net.sourceforge.processdash.ev.EVTask in project processdash by dtuma.

the class EVReport method createCsvColumns.

private List createCsvColumns() {
    List result = new LinkedList();
    final Map idNumbers = new HashMap();
    final Map taskIDs = new HashMap();
    result.add(new CsvColumn("ID") {

        int id = 1;

        public void doPrepWork(EVTask root, EVTask node, int depth) {
            idNumbers.put(node, new Integer(id++));
        }

        public void write(EVTask node, int depth) {
            out.print(idNumbers.get(node));
        }
    });
    result.add(new CsvColumn("Name") {

        public void write(EVTask node, int depth) {
            writeStringCsvField(node.getName());
        }
    });
    result.add(new CsvColumn("Outline_Level") {

        public void write(EVTask node, int depth) {
            out.print(depth);
        }
    });
    result.add(new CsvColumn("Predecessors") {

        public void doPrepWork(EVTask root, EVTask node, int depth) {
            // populate the taskIDs map so we can look up dashboard tasks
            // by their taskID later.
            List nodeIDs = node.getTaskIDs();
            if (nodeIDs != null)
                for (Iterator i = nodeIDs.iterator(); i.hasNext(); ) {
                    String id = (String) i.next();
                    taskIDs.put(id, node);
                }
        }

        public void write(EVTask node, int depth) {
            List dependencies = node.getDependencies();
            if (dependencies == null || dependencies.isEmpty())
                return;
            List predIDs = new LinkedList();
            for (Iterator i = dependencies.iterator(); i.hasNext(); ) {
                // find the dashboard task named by each dependency.
                EVTaskDependency d = (EVTaskDependency) i.next();
                String dashTaskID = d.getTaskID();
                Object predTask = taskIDs.get(dashTaskID);
                if (predTask == null)
                    continue;
                // look up the ID number we assigned to it in this CSV
                // export file, and add that ID number to our list.
                Object csvIdNumber = idNumbers.get(predTask);
                if (csvIdNumber == null)
                    continue;
                predIDs.add(csvIdNumber);
            }
            if (!predIDs.isEmpty())
                writeStringCsvField(StringUtils.join(predIDs, ","));
        }
    });
    //        result.add(new CsvDateColumn("Start_Date") {
    //            public Date getNodeDate(EVTask node) {
    //                return node.getPlanStartDate();
    //            }
    //        });
    result.add(new CsvDateColumn("Finish_Date") {

        public Date getNodeDate(EVTask node) {
            Date result = node.getActualDate();
            if (result == null)
                result = node.getPlanDate();
            return result;
        }
    });
    result.add(new CsvColumn("Percent_Complete") {

        public void writeNode(EVTask node, int depth) {
            out.print("0");
        }

        public void writeLeaf(EVTask node, int depth) {
            out.print(cleanupPercentComplete(node.getPercentCompleteText()));
        }
    });
    //        result.add(new CsvDateColumn("Actual_Start") {
    //            public Date getNodeDate(EVTask node) {
    //                return nullToNA(node.getActualStartDate());
    //            }
    //        });
    //
    //        result.add(new CsvDateColumn("Actual_Finish") {
    //            public Date getNodeDate(EVTask node) {
    //                return nullToNA(node.getActualDate());
    //            }
    //        });
    result.add(new // "Scheduled_Work") {
    CsvHoursColumn(// "Scheduled_Work") {
    "Duration") {

        public double getNodeMinutes(EVTask node) {
            return node.getPlanValue();
        }
    });
    result.add(new // "Actual_Work") {
    CsvHoursColumn(// "Actual_Work") {
    "Actual_Duration") {

        public double getNodeMinutes(EVTask node) {
            return node.getActualDirectTime();
        }
    });
    result.add(new CsvColumn("Resource_Names") {

        public void writeLeaf(EVTask node, int depth) {
            writeStringCsvField(node.getAssignedToText());
        }
    });
    return result;
}
Also used : HashMap(java.util.HashMap) LinkedList(java.util.LinkedList) Date(java.util.Date) EVTask(net.sourceforge.processdash.ev.EVTask) EVTaskDependency(net.sourceforge.processdash.ev.EVTaskDependency) Iterator(java.util.Iterator) List(java.util.List) ArrayList(java.util.ArrayList) MilestoneList(net.sourceforge.processdash.ev.MilestoneList) LinkedList(java.util.LinkedList) EVTaskList(net.sourceforge.processdash.ev.EVTaskList) CachedURLObject(net.sourceforge.processdash.net.cache.CachedURLObject) Map(java.util.Map) HashMap(java.util.HashMap) TreeMap(java.util.TreeMap)

Example 12 with EVTask

use of net.sourceforge.processdash.ev.EVTask in project processdash by dtuma.

the class EVCostConfidenceInterval method getTasksForTaskLists.

private static List getTasksForTaskLists(Object[] taskLists) {
    Map<String, EVTaskList> uniqueLists = new HashMap<String, EVTaskList>();
    getUniqueTaskLists(taskLists, uniqueLists);
    ArrayList result = new ArrayList();
    for (EVTaskList taskList : uniqueLists.values()) {
        List<EVTask> evLeaves = taskList.getFilteredLeaves(null);
        result.addAll(evLeaves);
    }
    return result;
}
Also used : HashMap(java.util.HashMap) EVTask(net.sourceforge.processdash.ev.EVTask) ArrayList(java.util.ArrayList) EVTaskList(net.sourceforge.processdash.ev.EVTaskList)

Example 13 with EVTask

use of net.sourceforge.processdash.ev.EVTask in project processdash by dtuma.

the class EVReport method writeCsv.

/** Generate a file of comma-separated data for use by MS Project.
     */
private void writeCsv() throws IOException {
    if (evModel == null || evModel.isEmpty()) {
        out.print("Status: 404 Not Found\r\n\r\n");
        out.flush();
        return;
    }
    writeContentDispositionHeader(".csv");
    out.print("Content-type: text/plain\r\n\r\n");
    boolean simpleCsv = Settings.getBool("ev.simpleCsvOutput", false);
    List columns = null;
    if (simpleCsv) {
        columns = createSimpleCsvColumns();
    } else {
        columns = createCsvColumns();
        writeCsvColumnHeaders(columns);
    }
    TreeTableModel merged = evModel.getMergedModel(false, false, null);
    EVTask root = (EVTask) merged.getRoot();
    prepCsvColumns(columns, root, root, 1);
    writeCsvRows(columns, root, 1);
}
Also used : EVTask(net.sourceforge.processdash.ev.EVTask) List(java.util.List) ArrayList(java.util.ArrayList) MilestoneList(net.sourceforge.processdash.ev.MilestoneList) LinkedList(java.util.LinkedList) EVTaskList(net.sourceforge.processdash.ev.EVTaskList) TreeTableModel(net.sourceforge.processdash.ui.lib.TreeTableModel)

Example 14 with EVTask

use of net.sourceforge.processdash.ev.EVTask in project processdash by dtuma.

the class EVWeekReport method getActualTimeForTask.

private double getActualTimeForTask(TableModel tasks, int i, Map<String, Map<String, Double>> actualTime) {
    Object assignedTo = tasks.getValueAt(i, EVTaskList.ASSIGNED_TO_COLUMN);
    Map<String, Double> timeForPerson = actualTime.get(assignedTo);
    if (timeForPerson == null)
        return 0;
    try {
        if (Settings.isPersonalMode()) {
            Object taskPath = tasks.getValueAt(i, EVTaskList.TASK_FULLNAME_COLUMN);
            Double timeFromPath = timeForPerson.remove(taskPath);
            if (timeFromPath != null)
                return timeFromPath;
        }
        EVTask task = (EVTask) tasks.getValueAt(i, EVTaskList.EVTASK_NODE_COLUMN);
        String taskId = task.getFullTaskID();
        Double timeFromId = timeForPerson.remove(taskId);
        return (timeFromId == null ? 0 : timeFromId);
    } finally {
        if (timeForPerson.isEmpty())
            actualTime.remove(assignedTo);
    }
}
Also used : EVTask(net.sourceforge.processdash.ev.EVTask)

Example 15 with EVTask

use of net.sourceforge.processdash.ev.EVTask in project processdash by dtuma.

the class TaskScheduleDialog method getSelectedTasks.

private List<EVTask> getSelectedTasks() {
    List<EVTask> result = new ArrayList<EVTask>();
    TreePath[] selectedPaths = treeTable.getTree().getSelectionPaths();
    if (selectedPaths != null) {
        for (TreePath path : selectedPaths) result.add((EVTask) path.getLastPathComponent());
    }
    return result;
}
Also used : TreePath(javax.swing.tree.TreePath) EVTask(net.sourceforge.processdash.ev.EVTask) ArrayList(java.util.ArrayList)

Aggregations

EVTask (net.sourceforge.processdash.ev.EVTask)24 TreePath (javax.swing.tree.TreePath)12 EVTaskList (net.sourceforge.processdash.ev.EVTaskList)8 Point (java.awt.Point)6 ArrayList (java.util.ArrayList)6 Iterator (java.util.Iterator)4 LinkedList (java.util.LinkedList)3 List (java.util.List)3 MilestoneList (net.sourceforge.processdash.ev.MilestoneList)3 Date (java.util.Date)2 HashMap (java.util.HashMap)2 EVTaskDependency (net.sourceforge.processdash.ev.EVTaskDependency)2 Component (java.awt.Component)1 Collection (java.util.Collection)1 EventObject (java.util.EventObject)1 HashSet (java.util.HashSet)1 Map (java.util.Map)1 TreeMap (java.util.TreeMap)1 JLabel (javax.swing.JLabel)1 JTree (javax.swing.JTree)1