Package net.sourceforge.processdash.ev

Examples of net.sourceforge.processdash.ev.EVSchedule$NumericRange


    private void addIndivDateSamples() {
        for (int i = 0;  i < randomObjects.size(); i++) {
            Object o = randomObjects.get(i);
            if (o instanceof EVSchedule) {
                EVSchedule s = (EVSchedule) o;
                Date forecast = s.getMetrics().independentForecastDate();
                indivDates[i].addSample(getTime(forecast));
            }
        }
    }
View Full Code Here


public class EVMetricsWidget implements SnippetWidget {
   
    private static final Resources resources = AbstractEVChart.getResources();
   
    public Component getWidgetComponent(Map environment, Map parameters) {
        EVSchedule schedule = (EVSchedule) environment
                .get(EVSnippetEnvironment.SCHEDULE_KEY);
        EVMetrics m = schedule.getMetrics();

        JTable table = new JTable(m);
        table.removeColumn(table.getColumnModel().getColumn(3));
        JScrollPane scrollPane = new JScrollPane(table);
        scrollPane.setPreferredSize(new Dimension(100, 100));
View Full Code Here

        String taskListDisplayName = EVTaskList.cleanupName(taskListName);
        String taskListHTML = HTMLUtils.escapeEntities(taskListDisplayName);
        String title = resources.format("Report.Title_FMT", taskListHTML);
       
        EVTaskFilter taskFilter = settings.getEffectiveFilter(evModel);
        EVSchedule s = getEvSchedule(taskFilter);

        EVTaskDataWriter taskDataWriter = getEffectiveTaskDataWriter();

        StringBuffer header = new StringBuffer(HEADER_HTML);
        StringUtils.findAndReplace(header, TITLE_VAR, title);
        if (taskFilter != null && isSnippet == false)
            header.append(FILTER_HEADER_HTML);
        out.print(header);
        out.print(taskDataWriter.getHeaderItems());
        out.print("</head><body>");

        out.print(isSnippet ? "<h2>" : "<h1>");
        out.print(title);
        if (!exportingToExcel()) {
            interpOutLink(SHOW_WEEK_LINK, EVReportSettings.PURPOSE_WEEK);
            printAlternateViewLinks();
            interpOutLink(SHOW_CHARTS_LINK, EVReportSettings.PURPOSE_OTHER);
        }
        printCustomizationLink();
        out.print(isSnippet ? "</h2>" : "</h1>");
       
        if (!isSnippet)
            printFilterInfo(out, taskFilter, exportingToExcel());

        if (!exportingToExcel()) {
            writeImageHtml(taskFilter != null);
            out.print("<div style='clear:both'></div>");
            writeCharts(evModel, s, taskFilter,
                settings.getBool(CUSTOMIZE_HIDE_NAMES), 350, 300,
                ChartListPurpose.ReportMain, null, null);
            out.print("<div style='clear:both'>&nbsp;</div>");
            out.print(HTMLTreeTableWriter.TREE_ICON_HEADER);
        }

        EVMetrics m = s.getMetrics();

        printScheduleErrors(out, m.getErrors());

        boolean hidePlan = settings.getBool(CUSTOMIZE_HIDE_PLAN_LINE);
        boolean hideForecast = settings.getBool(CUSTOMIZE_HIDE_FORECAST_LINE);
View Full Code Here

        super.writeContents();
    }

    public void writeCombinedChart() throws IOException {
        // Create the data for the chart to draw.
        EVSchedule s = getEvSchedule(settings.getEffectiveFilter(evModel));
        xydata = s.getCombinedChartData();

        // possibly hide lines on the chart, at user request.
        boolean hidePlan = settings.getBool(CUSTOMIZE_HIDE_PLAN_LINE);
        if (hidePlan)
            xydata = new XYDatasetFilter(xydata)
View Full Code Here

        out.print("<h1>");
        out.print(title);
        out.print("</h1>");
        printFilterInfo(out, taskFilter, false);

        EVSchedule s = getEvSchedule(taskFilter);

        String singleChartId = getParameter(SINGLE_CHART_PARAM);
        if (singleChartId == null)
            writeChartsGalleryPage(taskFilter, hideNames, s);
        else
View Full Code Here

            writeFakeChartData("Plan", "Actual", "Forecast", null);
    }

    public void writeValueTable2() {
        if (evModel != null) {
            EVSchedule s = evModel.getSchedule();
            int maxSeries = 3;
            if (s instanceof EVScheduleRollup) maxSeries = 4;
            writeChartData(s.getValueChartData(), maxSeries);
        } else
            writeFakeChartData("Plan", "Actual", "Forecast", "Optimized");
    }
View Full Code Here

                getDataRepository(), getPSPProperties(), getObjectCache());
        evModel.setDependencyCalculator(depCalc);
        evModel.setTaskLabeler(new DefaultTaskLabeler(getDashboardContext()));
       
        evModel.recalc();
        EVSchedule schedule = evModel.getSchedule();

        String effDateParam = getParameter(EFF_DATE_PARAM);
        Date effDate = null;
        if (effDateParam != null) try {
            effDate = new Date(Long.parseLong(effDateParam));
        } catch (Exception e) {}
       
        if (effDate == null || parameters.containsKey(ADJ_EFF_DATE_PARAM)) {
            // if the user hasn't specified an effective date, then use the
            // current time to round the effective date to the nearest week.
            // With a Sunday - Saturday schedule, the following line will show
            // the report for the previous week through Tuesday, and will
            // start showing the next week's report on Wednesday.
            Date now = effDate;
            if (now == null) now = EVCalculator.getFixedEffectiveDate();
            if (now == null) now = new Date();
            int dayOffset = (effDate == null ? 3 : 7);
            Date effDateTime = new Date(now.getTime()
                    + EVSchedule.WEEK_MILLIS * dayOffset / 7);
           
            // now, identify the schedule boundary that precedes the effective
            // date and time; use that as the effective date.
            Date scheduleEnd = schedule.getLast().getEndDate();
            Date firstPeriodEnd = schedule.get(1).getEndDate();
            if (effDateTime.compareTo(scheduleEnd) >= 0) {
                if (effDate == null)
                    effDate = scheduleEnd;
                else
                    effDate = extrapolateWeekAfterScheduleEnd(effDateTime,
                        scheduleEnd);
            } else if (effDateTime.compareTo(firstPeriodEnd) <= 0)
                effDate = firstPeriodEnd;
            else
                effDate = schedule.getPeriodStart(effDateTime);

            // make certain we have an effective date to proceed with.
            if (effDate == null)
                effDate = new Date();
        }
View Full Code Here

   
    private void writeReport(String taskListName, EVTaskList evModel,
            Date effDate, EVReportSettings settings, EVTaskFilter taskFilter,
            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);

        // Calculate the dates one week before and after the effective date.
        Date lastWeek = adjustDate(effDate, -EVSchedule.WEEK_MILLIS);
        Date 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", 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;

        for (int i = 0;   i < taskListLen;   i++) {
            Date completed =
                (Date) tasks.getValueAt(i, EVTaskList.DATE_COMPLETE_COLUMN);
           
            if (completed != null && completed.before(effDate)) {
                    completedTasksTotalPlanTime += parseTime
                        (tasks.getValueAt(i, -EVTaskList.PLAN_DTIME_COLUMN));
                    completedTasksTotalActualTime += parseTime
                        (tasks.getValueAt(i, -EVTaskList.ACT_DTIME_COLUMN));

                    if (!completed.before(lastWeek) &&
                        completed.before(nextWeek)) {
                        completedLastWeek[i] = oneCompletedLastWeek = true;
                        completedTasksTimeThisWeek += actualTimeThisWeek[i];

                    } 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 due =
                    (Date) tasks.getValueAt(i, EVTaskList.PLAN_DATE_COLUMN);
                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);
                // don't search for reverse dependencies when we're hiding the
                // names of individuals.  After all, the only thing we display
                // about a reverse dependency is the names of the waiting
                // people.  If we can't display their names, then we won't
                // have any identifying data to show, so there would be no
                // 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);

        /*
         * Okay, we have all the data we need.  Lets generate the HTML.
         */

        if (isTopLevel(purpose)) {
            String taskListDisplayName = EVTaskList.cleanupName(taskListName);
            String titleHTML = resources.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 = encodeHTML(effDateDisplay);
            out.print(resources.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, isExportingToExcel());
   
            EVReport.printScheduleErrors(out, filteredSchedule.getMetrics().getErrors());

        } else {
            out.print("<div class='");
            out.print(purpose == LEAF_REPORT ? "collapsed" : "expanded");
            out.print("'><h2>");
View Full Code Here

TOP

Related Classes of net.sourceforge.processdash.ev.EVSchedule$NumericRange

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.