Package org.libreplan.business.calendars.entities

Examples of org.libreplan.business.calendars.entities.BaseCalendar


    public BaseCalendar getDefaultCalendar() {
        Configuration configuration = configurationDAO.getConfiguration();
        if (configuration == null) {
            return null;
        }
        BaseCalendar defaultCalendar = configuration
                .getDefaultCalendar();
        forceLoadCalendar(defaultCalendar);
        return defaultCalendar;
    }
View Full Code Here


                IntraDayDate start = taskElement.getIntraDayStartDate();
                return toGantt(start);
            }

            private GanttDate toGantt(IntraDayDate date) {
                BaseCalendar calendar = taskElement.getCalendar();
                if (calendar == null) {
                    return TaskElementAdapter.toGantt(date);
                }
                return TaskElementAdapter.toGantt(date, calendar
                        .getCapacityOn(PartialDay.wholeDay(date.getDate())));
            }
View Full Code Here

    private class BaseCalendarsComboitemRenderer implements ComboitemRenderer {

        @Override
        public void render(Comboitem item, Object data) {
            BaseCalendar calendar = (BaseCalendar) data;
            item.setLabel(calendar.getName());
            item.setValue(calendar);

            if (isDefaultCalendar(calendar)) {
                Combobox combobox = (Combobox) item.getParent();
                combobox.setSelectedItem(item);
View Full Code Here

                combobox.setSelectedItem(item);
            }
        }

        private boolean isDefaultCalendar(BaseCalendar calendar) {
            BaseCalendar defaultCalendar = machineModel.getDefaultCalendar();
            return defaultCalendar.getId().equals(calendar.getId());
        }
View Full Code Here

        }
    }

    private void fillCalendarComboAndMarkSelected() {
        calendarCombo.getChildren().clear();
        BaseCalendar assignedCalendar = calendarAllocationModel
                .getAssignedCalendar();

        List<BaseCalendar> calendars = calendarAllocationModel
                .getBaseCalendars();
        for (BaseCalendar calendar : calendars) {
            Comboitem item = new org.zkoss.zul.Comboitem(calendar.getName());
            item.setValue(calendar);
            calendarCombo.appendChild(item);
            if ((assignedCalendar != null)
                    && calendar.getId().equals(assignedCalendar.getId())) {
                calendarCombo.setSelectedItem(item);
            }
        }
    }
View Full Code Here

            }
        }
    }

    public void assign(Comboitem comboitem) {
        BaseCalendar calendar = (BaseCalendar) comboitem.getValue();
        calendarAllocationModel.confirmAssignCalendar(calendar);
        window.setVisible(false);
    }
View Full Code Here

        Comboitem selectedItem = combobox.getSelectedItem();
        if (selectedItem == null) {
            throw new WrongValueException(combobox,
                    "You should select one calendar");
        }
        BaseCalendar parentCalendar = (BaseCalendar) combobox.getSelectedItem()
                .getValue();
        if (parentCalendar == null) {
            parentCalendar = workerModel.getDefaultCalendar();
        }
View Full Code Here

    }

    @Test
    @Transactional
    public void saveBasicCalendar() {
        BaseCalendar calendar = BaseCalendarTest.createBasicCalendar();
        baseCalendarDAO.save(calendar);
        assertTrue(baseCalendarDAO.exists(calendar.getId()));
    }
View Full Code Here

    }

    @Test
    @Transactional
    public void saveBasicCalendarWithExceptionDay() {
        BaseCalendar calendar = BaseCalendarTest.createBasicCalendar();
        addChristmasAsExceptionDay(calendar);

        baseCalendarDAO.save(calendar);
        assertTrue(baseCalendarDAO.exists(calendar.getId()));

        try {
            BaseCalendar savedCalendar = baseCalendarDAO.find(calendar.getId());
            assertThat(savedCalendar.getExceptions().size(), equalTo(1));
        } catch (InstanceNotFoundException e) {
            fail("It should not throw an exception");
        }
    }
View Full Code Here

    }

    @Test
    @Transactional
    public void saveDerivedCalendar() {
        BaseCalendar calendar = BaseCalendarTest.createBasicCalendar();
        baseCalendarDAO.save(calendar);

        BaseCalendar derivedCalendar = calendar.newDerivedCalendar();
        derivedCalendar.setName("derived");
        baseCalendarDAO.save(derivedCalendar);

        try {

            BaseCalendar savedCalendar = baseCalendarDAO.find(calendar.getId());
            assertFalse(savedCalendar.isDerived());

            BaseCalendar savedDerivedCalendar = baseCalendarDAO
                    .find(derivedCalendar.getId());
            assertTrue(savedDerivedCalendar.isDerived());

        } catch (InstanceNotFoundException e) {
            fail("It should not throw an exception");
        }
View Full Code Here

TOP

Related Classes of org.libreplan.business.calendars.entities.BaseCalendar

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.