private static Div generateCompletionShade(IDatesMapper datesMapper, LimitingResourceQueueElement queueElement) { int workableHours = queueElement .getLimitingResourceQueue() .getResource() .getCalendar() .getCapacityOn(PartialDay.wholeDay(queueElement.getEndDate())) .roundToHours(); Long shadeWidth = (24 - workableHours) * DatesMapperOnInterval.MILISECONDS_PER_HOUR / datesMapper.getMilisecondsPerPixel(); Long lShadeLeft = (workableHours - queueElement.getEndHour()) * DatesMapperOnInterval.MILISECONDS_PER_HOUR / datesMapper.getMilisecondsPerPixel(); int shadeLeft = lShadeLeft.intValue() + shadeWidth.intValue(); Div notWorkableHoursShade = new Div(); notWorkableHoursShade.setContext(""); notWorkableHoursShade.setSclass("limiting-completion"); notWorkableHoursShade.setStyle("left: " + shadeLeft + "px; width: " + shadeWidth.intValue() + "px;"); return notWorkableHoursShade; }
@Override public List<GenericDayAssignment> distributeForDay(PartialDay day, EffortDuration effort) { List<GenericDayAssignment> result = new ArrayList<GenericDayAssignment>(); for (ResourceWithAssignedDuration each : hoursDistributor.distributeForDay(day, effort)) { result.add(GenericDayAssignment.create(day.getDate(), each.duration, each.resource)); } return result; }
@Override public EffortDuration getWorkableTime() { if (getBaseCalendar() == null) { return null; } return getBaseCalendar().getCapacityOn( PartialDay.wholeDay(selectedDate)); }
private void reattachAndLoadCalendar(TaskElement taskElement) { BaseCalendar calendar = taskElement.getCalendar(); if (calendar == null) { return; } baseCalendarDAO.reattach(calendar); forceLoadCalendar(calendar); calendar.getCapacityOn(PartialDay.wholeDay(taskElement.getIntraDayStartDate().getDate())); }