Package org.libreplan.business.resources.entities

Examples of org.libreplan.business.resources.entities.CriterionWithItsType


        Interval intervalA = Interval.range(date(2009,10,14),date(2009,10,26));
        Interval intervalB = Interval.range(date(2009,10,15),date(2009,10,24));
        Interval intervalC = Interval.range(date(2009,10,12),date(2009,10,16));
        Interval intervalE = Interval.range(date(2009,10,26),date(2009,10,30));
        worker.addSatisfaction(new CriterionWithItsType(criterionType,
                criterion), intervalA);
        //Same Criterion
        assertFalse(worker.canAddSatisfaction(new CriterionWithItsType(
                criterionType, criterion), intervalB));
        assertFalse(worker.canAddSatisfaction(new CriterionWithItsType(
                criterionType, criterion), intervalC));
        //Distict Criterion
        assertFalse(worker.canAddSatisfaction(new CriterionWithItsType(
                criterionType, otherCriterion), intervalC));
        assertTrue(worker.canAddSatisfaction(new CriterionWithItsType(
                criterionType, criterion), intervalE));
    }
View Full Code Here


        Interval intervalA = Interval.range(date(2009,10,8),date(2009,10,25));
        Interval intervalB = Interval.range(date(2009,10,5),date(2009,10,9));
        Interval intervalC = Interval.range(date(2009,11,12),date(2009,11,16));
        Interval intervalE = Interval.range(date(2009,10,26),date(2009,10,30));
        worker.addSatisfaction(new CriterionWithItsType(criterionType,
                criterion), intervalA);
        //Same Criterion
        assertFalse(worker.canAddSatisfaction(new CriterionWithItsType(
                criterionType, criterion), intervalB));
        //Distinct Criterion
        assertTrue(worker.canAddSatisfaction(new CriterionWithItsType(
                criterionType, otherCriterion), intervalC));
        //without overlap
        assertTrue(worker.canAddSatisfaction(new CriterionWithItsType(
                criterionType, criterion), intervalE));
    }
View Full Code Here

            @Override
            public Criterion createCriterionWithoutNameYet() {
                return null;
            }
        };
        CriterionWithItsType criterionWithItsType = new CriterionWithItsType(
                type, criterion);
        LocalDate today = new LocalDate();
        assertFalse(worker.canAddSatisfaction(criterionWithItsType,
                Interval.from(today)));
        worker.addSatisfaction(criterionWithItsType);
View Full Code Here

    }

    public void changeCriterionAndType(
            CriterionRequirementWrapper requirementWrapper,
            CriterionWithItsType newCriterionAndType) {
        CriterionWithItsType oldCriterionAndType = requirementWrapper
                .getCriterionWithItsType();
        if ((oldCriterionAndType == null)
                || (!oldCriterionAndType.equals(newCriterionAndType))) {
            removeOldCriterionAndType(requirementWrapper);
            requirementWrapper.setCriterionWithItsType(newCriterionAndType);
            addNewCriterionAndType(requirementWrapper);
            updateExceptionInHoursGroups();
        }
View Full Code Here

    private void selectCriterionToDirectRequirementWrapper(
            HoursGroupWrapper hoursGroupWrapper,
            CriterionRequirementWrapper direct,
            CriterionWithItsType newCriterionAndType) {

        CriterionWithItsType oldCriterionAndType = direct
                .getCriterionWithItsType();
        if ((oldCriterionAndType == null)
                || (!oldCriterionAndType.equals(newCriterionAndType))) {
            hoursGroupWrapper.removeDirectCriterionRequirement(direct);
            direct.setCriterionWithItsType(newCriterionAndType);
            hoursGroupWrapper.addDirectCriterionToHoursGroup(direct);
        }
    }
View Full Code Here

            CriterionWithItsType newCriterionAndType);

    public void selectCriterionAndType(Listitem item, Bandbox bandbox,
            CriterionRequirementWrapper requirementWrapper) {
        if (item != null) {
            CriterionWithItsType newCriterionAndType = (CriterionWithItsType) item
                    .getValue();
            try {
                bandbox.setValue(newCriterionAndType.getNameAndType());
                changeCriterionAndType(requirementWrapper, newCriterionAndType);
            } catch (IllegalStateException e) {
                showInvalidConstraint(bandbox, e);
                requirementWrapper.setCriterionWithItsType(null);
            }
View Full Code Here

        listbox.setModel(new SimpleListModel(getCriterionWithItsTypes()));

        if (item != null) {

            Row row = (Row) bandbox.getParent().getParent();
            CriterionWithItsType criterionAndType = (CriterionWithItsType) item
                    .getValue();
            HoursGroupWrapper hoursGroupWrapper = getHoursGroupOfRequirementWrapper(row);
            bandbox.setValue(criterionAndType.getNameAndType());

            try {
                selectCriterionToHoursGroup(hoursGroupWrapper,
                        requirementWrapper, criterionAndType);
            } catch (IllegalStateException e) {
View Full Code Here

            Button button) {
        Bandbox bandbox = (Bandbox) button.getPreviousSibling();
        Listitem item = ((Listbox) bandbox.getFirstChild().getFirstChild())
                .getSelectedItem();
        if (item != null) {
            CriterionWithItsType criterionAndType = (CriterionWithItsType) item
                    .getValue();
            bandbox.setValue(criterionAndType.getNameAndType());
            if (checkExistingCriterion(unit, criterionAndType.getCriterion())) {
                messages.showMessage(Level.ERROR,
                        _("Criterion previously selected"));
            } else {
                machineModel.addCriterionRequirementToConfigurationUnit(unit,
                        criterionAndType.getCriterion());
                bandbox.setValue("");
            }
        }
        Util.reloadBindings(button.getNextSibling());
    }
View Full Code Here

        Util.reloadBindings(button.getNextSibling());
    }

    public void selectCriterionRequirement(Listitem item, Bandbox bandbox) {
        if (item != null) {
            CriterionWithItsType criterionAndType = (CriterionWithItsType) item
                    .getValue();
            bandbox.setValue(criterionAndType.getNameAndType());
        } else {
            bandbox.setValue("");
        }
        bandbox.close();
        Util.reloadBindings(bandbox.getNextSibling().getNextSibling());
View Full Code Here

    }

    public void selectCriterionAndType(Listitem item,Bandbox bandbox,
        CriterionSatisfactionDTO criterionSatisfactionDTO){
        if(item != null){
            CriterionWithItsType criterionAndType = (CriterionWithItsType)item.getValue();
            bandbox.setValue(criterionAndType.getNameAndType());
            setCriterionWithItsType(criterionAndType,criterionSatisfactionDTO,bandbox);
        }else{
            bandbox.setValue("");
        }
    }
View Full Code Here

TOP

Related Classes of org.libreplan.business.resources.entities.CriterionWithItsType

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.