Search in sources :

Example 16 with Resources

use of net.sourceforge.processdash.i18n.Resources in project processdash by dtuma.

the class EstErrorScatterChartSnippet method writeContents.

@Override
protected void writeContents() throws IOException {
    StringBuffer args = new StringBuffer();
    Resources res = (Resources) env.get(SnippetEnvironment.RESOURCES);
    appendParam(args, "title", res.getString("Title"));
    copyParam(args, "TargetPercent", "pct");
    copyParam(args, "CutoffPercent", "cut");
    buildData(res);
    appendParam(args, "useData", DATA_NAME);
    writeSmallChart("estErrorScatter", args.toString(), SMALL_ARGS);
}
Also used : Resources(net.sourceforge.processdash.i18n.Resources)

Example 17 with Resources

use of net.sourceforge.processdash.i18n.Resources in project processdash by dtuma.

the class WBSEditor method displayStartupPermissionError.

private static void displayStartupPermissionError(String resourceKey) {
    Resources res = Resources.getDashBundle("Authentication.Errors");
    String title = res.getString(resourceKey + ".Title");
    Object message = res.getStrings(resourceKey + ".Message");
    if (isDumpAndExitMode())
        System.err.println(title);
    else
        JOptionPane.showMessageDialog(null, message, title, JOptionPane.ERROR_MESSAGE);
}
Also used : Resources(net.sourceforge.processdash.i18n.Resources)

Example 18 with Resources

use of net.sourceforge.processdash.i18n.Resources in project processdash by dtuma.

the class TemplateLoader method logTemplateError.

public static synchronized void logTemplateError(String error) {
    if (errorReporter == null) {
        Resources r = Resources.getDashBundle("Templates");
        errorReporter = new ErrorReporter(r.getString("Error_Title"), r.getStrings("Error_Header"), r.getStrings("Error_Footer"));
    }
    errorReporter.logError(error);
}
Also used : ErrorReporter(net.sourceforge.processdash.ui.lib.ErrorReporter) Resources(net.sourceforge.processdash.i18n.Resources)

Example 19 with Resources

use of net.sourceforge.processdash.i18n.Resources in project processdash by dtuma.

the class TemplateLoader method loadXMLProcessTemplate.

private static void loadXMLProcessTemplate(DashHierarchy templates, DataRepository data, String filename, URL baseUrl, long modTime, InputStream in, boolean close) throws IOException {
    Element root = null;
    try {
        if (!close)
            in = new NonclosingInputStream(in);
        // this closes the file without our permission.
        Document doc = XMLUtils.parse(in);
        ExtensionManager.addXmlDoc(doc, filename, baseUrl, modTime);
        root = doc.getDocumentElement();
    } catch (SAXException se) {
        String message = XMLUtils.exceptionMessage(se);
        Resources r = Resources.getDashBundle("Templates");
        if (message == null)
            message = r.format("Error_FMT", filename);
        else
            message = r.format("Error_Message_FMT", filename, message);
        logTemplateError(message);
        return;
    }
    AutoData.registerTemplates(root, data);
    createScriptMaps(root);
    try {
        DashHierarchy template = new DashHierarchy(null);
        template.loadXMLTemplate(root);
        template.premove(PropertyKey.ROOT);
        createScriptMaps(template);
        templates.putAll(template);
    } catch (SAXException se) {
    // Can this happen?
    }
    generateDefaultScriptMaps(root);
}
Also used : Element(org.w3c.dom.Element) DashHierarchy(net.sourceforge.processdash.hier.DashHierarchy) NonclosingInputStream(net.sourceforge.processdash.util.NonclosingInputStream) Resources(net.sourceforge.processdash.i18n.Resources) Document(org.w3c.dom.Document) SAXException(org.xml.sax.SAXException)

Example 20 with Resources

use of net.sourceforge.processdash.i18n.Resources in project processdash by dtuma.

the class EVWeekReport method writeReport.

private void writeReport(String taskListName, EVTaskList evModel, Date effDate, EVReportSettings settings, EVTaskFilter taskFilter, EVTaskListFilter privacyFilter, int purpose) throws IOException {
    EVSchedule schedule = evModel.getSchedule();
    double totalPlanTime = schedule.getMetrics().totalPlan();
    boolean hideNames = settings.getBool(EVReport.CUSTOMIZE_HIDE_NAMES);
    boolean showAssignedTo = (evModel instanceof EVTaskListRollup) && !hideNames;
    boolean showTimingIcons = (evModel instanceof EVTaskListData && !isExporting() && purpose == PLAIN_REPORT);
    boolean showMilestones = evModel.showMilestoneColumn();
    boolean showLabels = evModel.showLabelsColumn();
    int numOptionalCols = //
    (showAssignedTo ? 1 : 0) + (showMilestones ? 1 : 0) + (showLabels ? 1 : 0);
    boolean monthly = isMonthly(settings);
    Resources effRes = (monthly ? monthRes : resources);
    // Calculate the dates one week/month before and after the effective date.
    Date lastWeek, nextWeek;
    if (monthly) {
        long eff = effDate.getTime();
        lastWeek = roundToMonthEnd(new Date(eff - 5 * MILLIS_PER_WEEK));
        nextWeek = roundToMonthEnd(new Date(eff + MILLIS_PER_WEEK));
    } else {
        lastWeek = adjustDate(effDate, -EVSchedule.WEEK_MILLIS);
        nextWeek = adjustDate(effDate, EVSchedule.WEEK_MILLIS);
    }
    Date startDate = schedule.getStartDate();
    if (lastWeek.before(startDate))
        lastWeek = startDate;
    Date effDateDisplay = new Date(effDate.getTime() - 1000);
    Date nextWeekDisplay = new Date(nextWeek.getTime() - 1000);
    // calculate flags describing whether the actual current date falls
    // within our reporting period
    long now = System.currentTimeMillis();
    boolean reportingPeriodIncludesToday = (lastWeek.getTime() < now && now <= effDate.getTime());
    boolean reportingPeriodPrecedesToday = (effDate.getTime() < now && now <= nextWeek.getTime());
    // Calculate future cutoff dates for task dependency display
    Date dependDate = getFutureCutoffDate(effDate, Settings.getInt("ev.numDependencyWeeks", monthly ? 5 : 3));
    Date revDependDate = getFutureCutoffDate(effDate, Settings.getInt("ev.numReverseDependencyWeeks", 6));
    // Get a slice of the schedule representing the previous week.
    EVSchedule filteredSchedule = getEvSchedule(evModel, taskFilter);
    EVSchedule.Period weekSlice = EVScheduleRollup.getSlice(filteredSchedule, lastWeek, effDate);
    // Now scan the task list looking for information we need.
    TableModel tasks = evModel.getSimpleTableModel(taskFilter);
    int taskListLen = tasks.getRowCount();
    // keep track of tasks that should be displayed in the three lists.
    boolean[] completedLastWeek = new boolean[taskListLen];
    boolean[] inProgressThisWeek = new boolean[taskListLen];
    boolean[] dueThroughNextWeek = new boolean[taskListLen];
    byte[] progress = new byte[taskListLen];
    Map<String, DependencyForCoord> upcomingDependencies = new HashMap<String, DependencyForCoord>();
    List<RevDependencyForCoord> reverseDependencies = new ArrayList<RevDependencyForCoord>();
    Arrays.fill(completedLastWeek, false);
    Arrays.fill(inProgressThisWeek, false);
    Arrays.fill(dueThroughNextWeek, false);
    boolean oneCompletedLastWeek = false;
    boolean oneInProgressThisWeek = false;
    boolean oneDueNextWeek = false;
    // keep track of the people assigned to the current schedule
    Set allIndividuals = new HashSet();
    String ignoreIndividual = null;
    if (evModel instanceof EVTaskListData && purpose == PLAIN_REPORT)
        allIndividuals.add(ignoreIndividual = getOwner());
    // retrieve information about the actual time that was logged to tasks
    // during the effective time period
    double[] actualTimeThisWeek = getActualTimeSpent(tasks, lastWeek, effDate);
    double completedTasksTimeThisWeek = 0;
    double inProgressTasksTimeThisWeek = 0;
    // keep track of the two total plan/actual time to date for
    // completed tasks.
    double completedTasksTotalPlanTime = 0;
    double completedTasksTotalActualTime = 0;
    // keep track of plan and actual value, this week and to date
    double planValueThisWeek = 0;
    double valueEarnedThisWeek = 0;
    double planValueToDate = 0;
    double valueEarnedToDate = 0;
    for (int i = 0; i < taskListLen; i++) {
        double taskValue = parseTime(tasks.getValueAt(i, -EVTaskList.PLAN_DTIME_COLUMN));
        Date completed = (Date) tasks.getValueAt(i, EVTaskList.DATE_COMPLETE_COLUMN);
        // check to see if the task was due this week, or in the past
        Date due = (Date) tasks.getValueAt(i, EVTaskList.PLAN_DATE_COLUMN);
        if (due != null && due.before(effDate)) {
            planValueToDate += taskValue;
            if (!due.before(lastWeek))
                planValueThisWeek += taskValue;
        }
        if (completed != null && completed.before(effDate)) {
            completedTasksTotalPlanTime += taskValue;
            completedTasksTotalActualTime += parseTime(tasks.getValueAt(i, -EVTaskList.ACT_DTIME_COLUMN));
            valueEarnedToDate += taskValue;
            if (!completed.before(lastWeek) && completed.before(nextWeek)) {
                completedLastWeek[i] = oneCompletedLastWeek = true;
                completedTasksTimeThisWeek += actualTimeThisWeek[i];
                valueEarnedThisWeek += taskValue;
            } else if (actualTimeThisWeek[i] > 0) {
                // if the task was marked complete in the past, but
                // someone logged time against it this week, display
                // it in the "in progress" table.
                inProgressThisWeek[i] = oneInProgressThisWeek = true;
                inProgressTasksTimeThisWeek += actualTimeThisWeek[i];
            }
        } else {
            Date replannedDue = (Date) tasks.getValueAt(i, EVTaskList.REPLAN_DATE_COLUMN);
            Date taskStarted = (Date) tasks.getValueAt(i, EVTaskList.ACT_START_DATE_COLUMN);
            // Check to see if the task was in progress this week
            if (taskStarted != null && taskStarted.before(effDate) && (completed == null || completed.after(effDate))) {
                inProgressThisWeek[i] = oneInProgressThisWeek = true;
                inProgressTasksTimeThisWeek += actualTimeThisWeek[i];
            }
            // Check to see if the task is due next week
            if ((due != null && due.after(startDate) && due.before(nextWeek)) || (replannedDue != null && replannedDue.after(startDate) && replannedDue.before(nextWeek))) {
                dueThroughNextWeek[i] = oneDueNextWeek = true;
            }
            if ((inProgressThisWeek[i] || dueThroughNextWeek[i]) && (due != null)) {
                if (!due.after(effDate))
                    progress[i] = BEHIND_SCHEDULE;
                else if (due.after(nextWeek))
                    progress[i] = AHEAD_OF_SCHEDULE;
            }
            Date projectedDate = (Date) tasks.getValueAt(i, EVTaskList.PROJ_DATE_COLUMN);
            findUpcomingDependencies(tasks, upcomingDependencies, i, projectedDate, dependDate, ignoreIndividual);
            // point in collecting reverse dependencies.
            if (!hideNames)
                findReverseDependencies(tasks, reverseDependencies, revDependDate, i);
        }
        List assignedTo = (List) tasks.getValueAt(i, -EVTaskList.ASSIGNED_TO_COLUMN);
        if (assignedTo != null)
            allIndividuals.addAll(assignedTo);
    }
    double cpi = completedTasksTotalPlanTime / completedTasksTotalActualTime;
    boolean showTimeThisWeek = (completedTasksTimeThisWeek > 0 || inProgressTasksTimeThisWeek > 0);
    // look up planned values from the schedule, if appropriate
    if (!monthly || Settings.getBool("ev.month.extrapolatePV", true)) {
        planValueThisWeek = weekSlice.planValue();
        planValueToDate = weekSlice.getCumPlanValue();
    }
    // look up earned values from the schedule, if not in monthly mode
    if (!monthly) {
        valueEarnedThisWeek = weekSlice.earnedValue();
        valueEarnedToDate = weekSlice.getCumEarnedValue();
    }
    if (isTopLevel(purpose)) {
        String taskListDisplayName = EVTaskList.cleanupName(taskListName);
        String titleHTML = effRes.format("Title_FMT", taskListDisplayName);
        titleHTML = HTMLUtils.escapeEntities(titleHTML);
        StringBuffer header = new StringBuffer(HEADER_HTML);
        StringUtils.findAndReplace(header, TITLE_VAR, titleHTML);
        if (taskFilter != null)
            header.insert(header.indexOf("</head>"), FILTER_HEADER_HTML);
        if (isExportingToExcel())
            StringUtils.findAndReplace(header, "hideIfCollapsed", "ignore");
        out.print(header);
        out.print("<h2>");
        String endDateStr = monthly ? formatMonth(effDateDisplay) : encodeHTML(effDateDisplay);
        out.print(effRes.format("Header_HTML_FMT", endDateStr));
        if (!isExporting() || getParameter(EFF_DATE_PARAM) == null) {
            if (lastWeek.compareTo(startDate) > 0)
                printNavLink(lastWeek, "Previous", settings, purpose);
            printNavLink(nextWeek, "Next", settings, purpose);
            if (!isExporting())
                printGoToDateLink(effDate, schedule, settings, purpose);
        }
        out.print("</h2>\n");
        EVReport.printFilterInfo(out, taskFilter, settings, isExporting(), isExportingToExcel());
        EVReport.printScheduleErrors(out, filteredSchedule.getMetrics().getErrors());
    } else {
        out.print("<div class='");
        out.print(purpose == LEAF_REPORT ? "collapsed" : "expanded");
        out.print("'><h2>");
        printExpansionIcon();
        out.print(encodeHTML(taskListName));
        out.print("</h2>\n");
        out.print("<div class='subsection");
        if (purpose != LEAF_REPORT)
            out.print(" hideIfCollapsed");
        out.print("'>");
    }
    String indivDetail = "";
    if (purpose == LEAF_REPORT)
        indivDetail = " class='hideIfCollapsed'";
    String hh = (purpose == SPLIT_REPORT ? "h2" : "h3");
    String personalDataID = evModel.getPersonalDataID();
    boolean shouldHideSummary = (privacyFilter != null && personalDataID != null && privacyFilter.include(personalDataID) == false);
    if (!shouldHideSummary) {
        interpOut("<" + hh + indivDetail + ">${Summary.Header}");
        if (isTopLevel(purpose) && showAssignedTo && !isExporting()) {
            String splitLink = (String) env.get("REQUEST_URI");
            if (purpose == PLAIN_REPORT)
                splitLink = HTMLUtils.appendQuery(splitLink, SPLIT_PARAM, "t");
            else
                splitLink = HTMLUtils.removeParam(splitLink, SPLIT_PARAM);
            out.print("&nbsp;&nbsp;<span class='nav'><a href='");
            out.print(splitLink);
            out.print("'>");
            out.print(resources.getHTML(purpose == PLAIN_REPORT ? "Show_Split" : "Show_Rollup"));
            out.print("</a></span>");
        }
        out.print("</" + hh + ">");
        out.print("<table border=1 name='summary'><tr><td></td><td></td>");
        if (taskFilter == null)
            interpOut("<td class=header colspan=3>${Summary.Direct_Hours}" + "</td><td></td>");
        interpOut("<td class=header colspan=3>${Summary.Earned_Value}" + //
        "</td></tr>\n" + "<tr><td></td><td></td>");
        if (taskFilter == null)
            interpOut("<td class=header>${Summary.Plan}</td>" + "<td class=header>${Summary.Actual}</td>" + "<td class=header>${Summary.Ratio}</td><td></td>");
        interpOut("<td class=header>${Summary.Plan}</td>" + "<td class=header>${Summary.Actual}</td>" + "<td class=header>${Summary.Ratio}</td></tr>\n");
        String thisWeekKey;
        String keySuffix = (monthly ? "_Month" : "_Week");
        if (reportingPeriodIncludesToday)
            thisWeekKey = "This" + keySuffix;
        else if (reportingPeriodPrecedesToday)
            thisWeekKey = "Last" + keySuffix;
        else
            thisWeekKey = "This_Period";
        out.print("<tr><td class=left>" + effRes.getHTML("Summary." + thisWeekKey) + "</td><td></td>");
        if (taskFilter == null) {
            double directTimeThisWeek;
            if (monthly)
                directTimeThisWeek = sumActualTime(actualTimeThisWeek);
            else
                directTimeThisWeek = weekSlice.getActualDirectTime();
            printTimeData(weekSlice.getPlanDirectTime(), directTimeThisWeek);
            out.print("<td></td>");
        }
        printPctData(//
        planValueThisWeek / totalPlanTime, valueEarnedThisWeek / totalPlanTime);
        out.print("</tr>\n");
        out.print("<tr><td class=left>" + encodeHTML(resources.format("Summary.To_Date_FMT", effDateDisplay)) + "</td><td></td>");
        double directTimeToDate = 0;
        if (taskFilter == null) {
            if (monthly)
                directTimeToDate = schedule.get(0).getActualDirectTime() + sumActualTime(getActualTimeSpent(tasks, startDate, effDate));
            else
                directTimeToDate = weekSlice.getCumActualDirectTime();
            printTimeData(weekSlice.getCumPlanDirectTime(), directTimeToDate);
            out.print("<td></td>");
        }
        printPctData(//
        planValueToDate / totalPlanTime, valueEarnedToDate / totalPlanTime);
        out.print("</tr>\n");
        double numWeeks = Double.NaN;
        if (startDate != null)
            numWeeks = (effDate.getTime() - startDate.getTime() - EVSchedule.dstDifference(startDate.getTime(), effDate.getTime())) / (double) MILLIS_PER_WEEK;
        if (monthly) {
            numWeeks = numWeeks / WEEKS_PER_MONTH;
            interpOut("<tr" + indivDetail + "><td class=left>" + "${Month.Summary.Average_per_Month}</td><td></td>");
        } else {
            interpOut("<tr" + indivDetail + "><td class=left>${Summary.Average_per_Week}</td><td></td>");
        }
        if (taskFilter == null) {
            double planTimePerWeek = weekSlice.getCumPlanDirectTime() / numWeeks;
            double actualTimePerWeek = directTimeToDate / numWeeks;
            printTimeData(planTimePerWeek, actualTimePerWeek);
            out.print("<td></td>");
        }
        double planEVPerWeek = planValueToDate / (totalPlanTime * numWeeks);
        double actualEVPerWeek = valueEarnedToDate / (totalPlanTime * numWeeks);
        printPctData(planEVPerWeek, actualEVPerWeek);
        out.print("</tr>\n");
        if (taskFilter == null) {
            interpOut("<tr" + indivDetail + "><td class=left>${Summary.Completed_Tasks_To_Date}" + "</td><td></td>");
            printData(formatTime(completedTasksTotalPlanTime), formatTime(completedTasksTotalActualTime), 1.0 / cpi, "timeFmt");
            out.print("<td></td><td></td><td></td><td></td></tr>\n");
        }
        out.print("</table>\n");
    }
    if (purpose == PLAIN_REPORT || purpose == LEAF_REPORT) {
        out.print("<div class='hideIfCollapsed'>\n");
        // create a table writer with appropriate renderers.
        HTMLTableWriter tableWriter = createTableWriter(evModel, hideNames, showTimingIcons);
        // to draw the completed tasks table, remove the "task with timing
        // icons" renderer if it happens to be in use.
        HTMLTableWriter.CellRenderer taskRenderer = tableWriter.getCellRenderer(EVTaskList.TASK_COLUMN);
        tableWriter.setCellRenderer(EVTaskList.TASK_COLUMN, EVReport.EV_CELL_RENDERER);
        String completedTasksTooltip = encodeHTML(resources.format("Completed_Tasks.Header_Tip_FMT", lastWeek, effDateDisplay));
        String completedTasksHeader;
        if (reportingPeriodIncludesToday)
            completedTasksHeader = effRes.getHTML("Completed_Tasks.Header");
        else if (reportingPeriodPrecedesToday)
            completedTasksHeader = effRes.getHTML("Completed_Tasks.Header_Last");
        else if (monthly)
            completedTasksHeader = effRes.format("Completed_Tasks.Header_Month_HTML_FMT", formatMonth(effDateDisplay));
        else
            completedTasksHeader = completedTasksTooltip;
        out.print("<h3 title='" + completedTasksTooltip + "'>" + completedTasksHeader + "</h3>\n");
        if (!oneCompletedLastWeek)
            interpOut("<p><i>${None}</i>\n");
        else {
            printCompletedTaskTableHeader(showTimeThisWeek, showAssignedTo, showMilestones, showLabels, monthly);
            double totalPlannedTime = 0;
            double totalActualTime = 0;
            double totalPlannedValue = 0;
            for (int i = 0; i < taskListLen; i++) {
                if (!completedLastWeek[i])
                    continue;
                double taskPlannedTime = parseTime(tasks.getValueAt(i, -EVTaskList.PLAN_TIME_COLUMN));
                double taskActualTime = parseTime(tasks.getValueAt(i, -EVTaskList.ACT_TIME_COLUMN));
                double taskPlannedValue = ((Double) tasks.getValueAt(i, -EVTaskList.PLAN_VALUE_COLUMN)).doubleValue();
                totalPlannedTime += taskPlannedTime;
                totalActualTime += taskActualTime;
                totalPlannedValue += taskPlannedValue;
                printCompletedLine(tableWriter, tasks, i, showTimeThisWeek ? actualTimeThisWeek : null, showAssignedTo, showMilestones, showLabels);
            }
            interpOut("<tr class='sortbottom'><td><b>${Completed_Tasks.Total}" + "&nbsp;</b></td><td class='timeFmt'>");
            out.print(formatTime(totalPlannedTime) + "</td>");
            out.print("<td class='timeFmt'>");
            out.print(formatTime(totalActualTime) + "</td>");
            if (showTimeThisWeek) {
                out.print("<td class='timeFmt'>");
                out.print(formatTime(completedTasksTimeThisWeek) + "</td>");
            }
            if (totalPlannedTime > 0) {
                double totalPctSpent = totalActualTime / totalPlannedTime;
                out.print("<td>" + EVSchedule.formatPercent(totalPctSpent) + "</td>");
            } else {
                out.print("<td>&nbsp;</td>");
            }
            // Empty td for assigned to, planned date, and labels columns
            int noSumCol = 1 + numOptionalCols;
            for (int i = 0; i < noSumCol; ++i) out.print("<td>&nbsp;</td>");
            out.print("<td>" + EVSchedule.formatPercent(totalPlannedValue) + "</td></tr>\n");
            out.println("</table>");
        }
        // put the "task with timing icons" renderer back in place if necessary
        tableWriter.setCellRenderer(EVTaskList.TASK_COLUMN, taskRenderer);
        String inProgressTooltip = encodeHTML(resources.format("Tasks_In_Progress.Header_Tip_FMT", effDateDisplay));
        String inProgressHeader;
        if (reportingPeriodIncludesToday || reportingPeriodPrecedesToday)
            inProgressHeader = effRes.getHTML("Tasks_In_Progress.Header");
        else
            inProgressHeader = encodeHTML(resources.format("Tasks_In_Progress.Header_Long_FMT", effDateDisplay));
        out.print("<h3 title='" + inProgressTooltip + "'>" + inProgressHeader + "</h3>\n");
        if (!oneInProgressThisWeek)
            interpOut("<p><i>${None}</i>\n");
        else {
            printUncompletedTaskTableHeader(showTimeThisWeek, showAssignedTo, showMilestones, showLabels, true, monthly);
            double totalPlannedTime = 0;
            double totalActualTime = 0;
            double totalPlannedValue = 0;
            double totalPlannedTimeRemaining = 0;
            double totalUnearnedValue = 0;
            for (int i = 0; i < taskListLen; ++i) {
                if (!inProgressThisWeek[i])
                    continue;
                double taskPlannedTime = parseTime(tasks.getValueAt(i, -EVTaskList.PLAN_TIME_COLUMN));
                double taskActualTime = parseTime(tasks.getValueAt(i, -EVTaskList.ACT_TIME_COLUMN));
                double taskPlannedValue = ((Double) tasks.getValueAt(i, -EVTaskList.PLAN_VALUE_COLUMN)).doubleValue();
                double taskPlannedTimeRemaining = taskPlannedTime - taskActualTime;
                double taskUnearnedValue = computeUnearnedValue(tasks, i);
                totalPlannedTime += taskPlannedTime;
                totalActualTime += taskActualTime;
                totalPlannedValue += taskPlannedValue;
                totalPlannedTimeRemaining += (taskPlannedTimeRemaining > 0) ? taskPlannedTimeRemaining : 0;
                totalUnearnedValue += taskUnearnedValue;
                printInProgressLine(tableWriter, tasks, progress[i], i, taskPlannedTimeRemaining, showTimeThisWeek ? actualTimeThisWeek : null, showAssignedTo, showMilestones, showLabels, taskUnearnedValue);
            }
            interpOut("<tr class='sortbottom'><td><b>${Tasks_In_Progress.Total}" + "&nbsp;</b></td><td class='timeFmt'>");
            out.print(formatTime(totalPlannedTime) + "</td>");
            out.print("<td class='timeFmt'>");
            out.print(formatTime(totalActualTime) + "</td>");
            if (showTimeThisWeek) {
                out.print("<td class='timeFmt'>");
                out.print(formatTime(inProgressTasksTimeThisWeek) + "</td>");
            }
            out.print("<td>" + EVSchedule.formatPercent(totalPlannedValue) + "</td>");
            if (totalPlannedTime > 0) {
                double totalPctSpent = totalActualTime / totalPlannedTime;
                out.print("<td>" + EVSchedule.formatPercent(totalPctSpent) + "</td>");
            } else {
                out.print("<td>&nbsp;</td>");
            }
            // Empty td because there is no total for Planned Date and Dep.
            int noSumCol = 2 + numOptionalCols;
            for (int i = 0; i < noSumCol; ++i) out.print("<td>&nbsp;</td>");
            out.print("<td class='timeFmt'>");
            out.print(formatTime(totalPlannedTimeRemaining) + "</td>");
            out.println("<td>" + EVSchedule.formatPercent(totalUnearnedValue) + "</td>");
            out.println("</tr>\n</table>");
        }
        String dueTasksTooltip = encodeHTML(resources.format("Due_Tasks.Header_Tip_FMT", effDateDisplay, nextWeekDisplay));
        String dueTasksHeader;
        if (reportingPeriodIncludesToday)
            dueTasksHeader = effRes.getHTML("Due_Tasks.Header");
        else if (reportingPeriodPrecedesToday)
            dueTasksHeader = effRes.getHTML("Due_Tasks.Header_This");
        else
            dueTasksHeader = encodeHTML(resources.format("Due_Tasks.Header_Long_FMT", nextWeekDisplay));
        out.print("<h3 title='" + dueTasksTooltip + "'>" + dueTasksHeader + "</h3>\n");
        if (!oneDueNextWeek)
            interpOut("<p><i>${None}</i>\n");
        else {
            printUncompletedTaskTableHeader(false, showAssignedTo, showMilestones, showLabels, false, monthly);
            double timeRemaining = 0;
            for (int i = 0; i < taskListLen; i++) if (dueThroughNextWeek[i]) {
                double forecastTimeRemaining = computeTaskForecastTimeRemaining(tasks, i, cpi);
                printDueLine(tableWriter, tasks, progress[i], i, cpi, forecastTimeRemaining, showAssignedTo, showMilestones, showLabels);
                if (progress[i] != AHEAD_OF_SCHEDULE && forecastTimeRemaining > 0)
                    timeRemaining += forecastTimeRemaining;
            }
            out.print("<tr class='sortbottom'><td align=right colspan=");
            int colspan = 6 + numOptionalCols;
            out.print(Integer.toString(colspan));
            interpOut("><b>${Due_Tasks.Total}" + "&nbsp;</b></td><td class='timeFmt'>");
            out.print(formatTime(timeRemaining));
            out.println("</td></tr>\n</table>");
        }
        out.print("</div>\n");
    } else {
        EVTaskListRollup parentEVModel = (EVTaskListRollup) evModel;
        for (int i = 0; i < parentEVModel.getSubScheduleCount(); i++) {
            EVTaskList childModel = parentEVModel.getSubSchedule(i);
            String childName = EVTaskList.cleanupName(childModel.getTaskListName());
            int childPurpose = (childModel instanceof EVTaskListRollup ? SUB_REPORT : LEAF_REPORT);
            writeReport(childName, childModel, effDate, settings, taskFilter, privacyFilter, childPurpose);
        }
    }
    if (!isTopLevel(purpose)) {
        // end the "subsection" div we started earlier.
        out.print("</div></div>");
    } else {
        interpOut("<" + hh + ">${Dependencies.Header}</" + hh + ">\n");
        discardInternalReverseDependencies(upcomingDependencies, reverseDependencies, allIndividuals);
        if (upcomingDependencies.isEmpty() && reverseDependencies.isEmpty())
            interpOut("<p><i>${None}</i>\n");
        else {
            if (!hideNames && !reverseDependencies.isEmpty())
                printReverseDependencyTable(tasks, reverseDependencies, showAssignedTo);
            List<DependencyForCoord> depsForCoord = new ArrayList<DependencyForCoord>(upcomingDependencies.values());
            Collections.sort(depsForCoord);
            int pos = 0;
            for (DependencyForCoord coord : depsForCoord) {
                printUpcomingDependencies(coord, tasks, showAssignedTo, hideNames, showMilestones, showLabels, pos++);
            }
        }
        if (isExporting())
            EVReport.writeExportFooter(out);
        if (!isExportingToExcel())
            interpOut(EXPORT_HTML);
        out.print(FOOTER_HTML);
    }
}
Also used : HTMLTableWriter(net.sourceforge.processdash.ui.lib.HTMLTableWriter) EVTaskListData(net.sourceforge.processdash.ev.EVTaskListData) HashSet(java.util.HashSet) Set(java.util.Set) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) EVTaskList(net.sourceforge.processdash.ev.EVTaskList) List(java.util.List) HashSet(java.util.HashSet) EVSchedule(net.sourceforge.processdash.ev.EVSchedule) EVTaskListRollup(net.sourceforge.processdash.ev.EVTaskListRollup) Date(java.util.Date) EVTaskList(net.sourceforge.processdash.ev.EVTaskList) Resources(net.sourceforge.processdash.i18n.Resources) TableModel(javax.swing.table.TableModel)

Aggregations

Resources (net.sourceforge.processdash.i18n.Resources)20 MissingResourceException (java.util.MissingResourceException)5 Document (org.w3c.dom.Document)3 File (java.io.File)2 IOException (java.io.IOException)2 MalformedURLException (java.net.MalformedURLException)2 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 List (java.util.List)2 ErrorReporter (net.sourceforge.processdash.ui.lib.ErrorReporter)2 SAXException (org.xml.sax.SAXException)2 ByteArrayInputStream (java.io.ByteArrayInputStream)1 FileNotFoundException (java.io.FileNotFoundException)1 URL (java.net.URL)1 MessageFormat (java.text.MessageFormat)1 Date (java.util.Date)1 HashSet (java.util.HashSet)1 LinkedList (java.util.LinkedList)1 Map (java.util.Map)1 Set (java.util.Set)1