Examples of HourCost


Examples of org.libreplan.business.costcategories.entities.HourCost

    /**
     * Append a textbox @{link code} to row
     * @param row
     */
    private void appendTextboxCode(final Row row) {
        final HourCost hourCost = ((HourCost) row.getValue());
        final Textbox txtCode = new Textbox();
        txtCode.setWidth("200px");
        if (hourCost != null) {
            CostCategory costCategory = hourCost.getCategory();
            txtCode.setDisabled(costCategory.isCodeAutogenerated());
            Util.bind(txtCode, new Util.Getter<String>() {
                @Override
                public String get() {
                    return hourCost.getCode();
                }
            }, new Util.Setter<String>() {

                @Override
                public void set(String value) {
                    hourCost.setCode(value);
                }
            });

            if (!hourCost.getCategory().isCodeAutogenerated()) {
                txtCode.setConstraint("no empty:"
                        + _("cannot be empty"));
            } else {
                txtCode.setConstraint("");
            }
View Full Code Here

Examples of org.libreplan.business.costcategories.entities.HourCost

     * Append Selectbox of @{link TypeOfWorkHours} to row
     *
     * @param row
     */
    private void appendHoursType(final Row row) {
        final HourCost hourCost = (HourCost) row.getValue();
        final Listbox lbHoursType = new Listbox();
        lbHoursType.setMold("select");
        lbHoursType.setModel(allHoursType);
        lbHoursType.renderAll();
        lbHoursType.applyProperties();

        if (lbHoursType.getItems().isEmpty()) {
            row.appendChild(lbHoursType);
            return;
        }

        // First time is rendered, select first item
        TypeOfWorkHours type = hourCost.getType();
        if (hourCost.isNewObject() && type == null) {
            Listitem item = lbHoursType.getItemAtIndex(0);
            item.setSelected(true);
            setHoursType(hourCost, item);
        } else {
            // If hoursCost has a type, select item with that type
View Full Code Here

Examples of org.libreplan.business.costcategories.entities.HourCost

     */
    public class HourCostListRenderer implements RowRenderer {

        @Override
        public void render(Row row, Object data) {
            HourCost hourCost = (HourCost) data;

            row.setValue(hourCost);

            // Create boxes
            appendTextboxCode(row);
View Full Code Here

Examples of org.libreplan.business.costcategories.entities.HourCost

    public void testInSpringContainer() {
        assertNotNull(hourCostDAO);
    }

    private HourCost createValidHourCost() {
        HourCost hourCost = HourCost.create(BigDecimal.ONE, new LocalDate());

        TypeOfWorkHours type =
                TypeOfWorkHours.create(UUID.randomUUID().toString(), UUID.randomUUID().toString());
        type.setDefaultPrice(BigDecimal.TEN);
        hourCost.setType(type);
        typeOfWorkHoursDAO.save(type);

        CostCategory costCategory = CostCategory.create(UUID.randomUUID().toString());
        hourCost.setCategory(costCategory);
        costCategoryDAO.save(costCategory);

        return hourCost;
    }
View Full Code Here

Examples of org.libreplan.business.costcategories.entities.HourCost

    }

    @Test
    @Transactional
    public void testSaveHourCost() {
        HourCost hourCost = createValidHourCost();
        hourCostDAO.save(hourCost);
        assertTrue(hourCost.getId() != null);
    }
View Full Code Here

Examples of org.libreplan.business.costcategories.entities.HourCost

    }

    @Test
    @Transactional
    public void testRemoveHourCost() throws InstanceNotFoundException {
        HourCost hourCost = createValidHourCost();
        hourCostDAO.save(hourCost);
        hourCostDAO.remove(hourCost.getId());
        assertFalse(hourCostDAO.exists(hourCost.getId()));
    }
View Full Code Here

Examples of org.libreplan.business.costcategories.entities.HourCost

    @Test
    @Transactional
    public void testListHourCost() {
        int previous = hourCostDAO.list(HourCost.class).size();
        HourCost hourCost = createValidHourCost();
        hourCostDAO.save(hourCost);
        List<HourCost> list = hourCostDAO.list(HourCost.class);
        assertEquals(previous + 1, list.size());
    }
View Full Code Here

Examples of org.libreplan.business.costcategories.entities.HourCost

    }

    @Test
    @Transactional
    public void testCategoryNavigation() {
        HourCost hourCost = createValidHourCost();
        assertTrue(hourCost.getCategory().getHourCosts().contains(hourCost));
    }
View Full Code Here

Examples of org.libreplan.business.costcategories.entities.HourCost

    }

    @Test
    @Transactional
    public void testHourCostNotInTwoCategories() {
        HourCost hourCost = createValidHourCost();
        CostCategory costCategory1 = CostCategory.create(UUID.randomUUID().toString());
        CostCategory costCategory2 = CostCategory.create(UUID.randomUUID().toString());

        hourCost.setCategory(costCategory1);
        hourCost.setCategory(costCategory2);
        hourCostDAO.save(hourCost);

        assertFalse(costCategory1.getHourCosts().contains(hourCost));
        assertTrue(costCategory2.getHourCosts().contains(hourCost));
View Full Code Here

Examples of org.libreplan.business.costcategories.entities.HourCost

    }

    @Test(expected=ValidationException.class)
    @Transactional
    public void testPositiveTimeInterval() {
        HourCost hourCost = createValidHourCost();
        hourCost.setInitDate(new LocalDate(2000,12,31));
        hourCost.setEndDate(new LocalDate(2000,12,1));

        hourCostDAO.save(hourCost);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.