コード例 #1
0
    private TaskGroupPredicate createPredicate() {
        List<FilterPair> listFilters = (List<FilterPair>) bdFilters
                .getSelectedElements();
        Date startDate = filterStartDate.getValue();
        Date finishDate = filterFinishDate.getValue();
        Boolean includeOrderElements = checkIncludeOrderElements.isChecked();

        if (startDate == null && finishDate == null) {
            TaskGroupPredicate predicate = model
                    .getDefaultPredicate(includeOrderElements);
            //show filter dates calculated by default on screen
            if (model.getFilterStartDate() != null
                    && !FilterUtils.hasProjectsStartDateChanged()) {
                filterStartDate.setValue(model.getFilterStartDate());
            }
            if (model.getFilterFinishDate() != null
                    && !FilterUtils.hasProjectsEndDateChanged()) {
                filterFinishDate.setValue(model.getFilterFinishDate());
            }
            predicate.setFilters(listFilters);
            return predicate;
        }
        return new TaskGroupPredicate(listFilters, startDate, finishDate,
                includeOrderElements);
    }
コード例 #2
0
    private void loadPredefinedBandboxFilter() {
        User user = model.getUser();
        List<FilterPair> sessionFilterPairs = FilterUtils
                .readProjectsParameters();
        if (sessionFilterPairs != null) {
            bdFilters.addSelectedElements(sessionFilterPairs);
        } else if ((user != null) && (user.getProjectsFilterLabel() != null)) {
            bdFilters.clear();
            bdFilters.addSelectedElement(new FilterPair(
                    TaskGroupFilterEnum.Label, user.getProjectsFilterLabel()
                            .getFinderPattern(), user
                            .getProjectsFilterLabel()));
        }

        // Calculate filter based on user preferences
        if (user != null) {
            if ((filterStartDate.getValue() == null)
                    && !FilterUtils.hasProjectsStartDateChanged()
                    && (user.getProjectsFilterPeriodSince() != null)) {
                filterStartDate.setValue(new LocalDate()
                        .minusMonths(user.getProjectsFilterPeriodSince())
                        .toDateTimeAtStartOfDay().toDate());
            }
            if (filterFinishDate.getValue() == null
                    && !FilterUtils.hasProjectsEndDateChanged()
                    && (user.getProjectsFilterPeriodTo() != null)) {
                filterFinishDate.setValue(new LocalDate()
                        .plusMonths(user.getProjectsFilterPeriodTo())
                        .toDateMidnight().toDate());
            }
        }

    }
コード例 #3
0
 public void loadSessionFiltersIntoBandbox() {
     bdFilters.addSelectedElements(FilterUtils.readProjectsParameters());
 }
コード例 #4
0
 public void onApplyFilter() {
     FilterUtils.writeProjectsFilter(filterStartDate.getValue(),
             filterFinishDate.getValue(), bdFilters.getSelectedElements());
     FilterUtils.writeProjectPlanningFilterChanged(true);
     filterByPredicate(createPredicate());
 }
コード例 #5
0
 public void readSessionVariablesIntoComponents() {
     filterStartDate.setValue(FilterUtils.readProjectsStartDate());
     filterFinishDate.setValue(FilterUtils.readProjectsEndDate());
     loadPredefinedBandboxFilter();
 }