Ejemplo n.º 1
0
    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;
    }