Merge pull request #133 from PaulLuchyn/master

Removed subelements checkbox
This commit is contained in:
Jeroen Baten 2016-11-30 17:32:12 +01:00 committed by GitHub
commit 20bf076ae1
7 changed files with 9 additions and 73 deletions

View file

@ -180,8 +180,6 @@ public class OrderCRUDController extends GenericForwardComposer {
private BandboxMultipleSearch bdFilters;
private Checkbox checkIncludeOrderElements;
private BandboxSearch bdExternalCompanies;
private OnlyOneVisible cachedOnlyOneVisible;
@ -247,7 +245,6 @@ public class OrderCRUDController extends GenericForwardComposer {
filterStartDate = (Datebox) filterComponent.getFellow("filterStartDate");
filterFinishDate = (Datebox) filterComponent.getFellow("filterFinishDate");
bdFilters = (BandboxMultipleSearch) filterComponent.getFellow("bdFilters");
checkIncludeOrderElements = (Checkbox) filterComponent.getFellow("checkIncludeOrderElements");
filterProjectName = (Textbox) filterComponent.getFellow("filterProjectName");
@ -781,10 +778,6 @@ public class OrderCRUDController extends GenericForwardComposer {
}
public List<Order> getOrders() {
if ( checkIncludeOrderElements.isChecked() ) {
return orderModel.getOrders();
}
return getOrdersFiltered();
}
@ -1471,12 +1464,11 @@ public class OrderCRUDController extends GenericForwardComposer {
Date startDate = filterStartDate.getValue();
Date finishDate = filterFinishDate.getValue();
Boolean includeOrderElements = checkIncludeOrderElements.isChecked();
String name = filterProjectName.getValue();
return listFilters.isEmpty() && startDate == null && finishDate == null && name == null
? null
: new OrderPredicate(listFilters, startDate, finishDate, includeOrderElements, name);
: new OrderPredicate(listFilters, startDate, finishDate, name);
}
private void filterByPredicate(OrderPredicate predicate) {

View file

@ -54,15 +54,12 @@ public class OrderPredicate implements IPredicate {
private String name;
private Boolean includeOrderElements;
public OrderPredicate(List<FilterPair> filters, Date startDate,
Date finishDate, Boolean includeOrderElements, String name) {
Date finishDate, String name) {
this.filters = filters;
this.startDate = startDate;
this.finishDate = finishDate;
this.name = name;
this.includeOrderElements = includeOrderElements;
}
@Override
@ -117,13 +114,6 @@ public class OrderPredicate implements IPredicate {
if (existCriterionInOrderElement(filterCriterion, order)) {
return true;
}
if (includeOrderElements) {
for (OrderElement orderElement : order.getAllOrderElements()) {
if (existCriterionInOrderElement(filterCriterion, orderElement)) {
return true;
}
}
}
return false;
}
@ -149,13 +139,6 @@ public class OrderPredicate implements IPredicate {
if (existLabelInOrderElement(filterLabel, order)) {
return true;
}
if (this.includeOrderElements) {
for (OrderElement orderElement : order.getAllOrderElements()) {
if (existLabelInOrderElement(filterLabel, orderElement)) {
return true;
}
}
}
return false;
}

View file

@ -56,14 +56,11 @@ public class TaskGroupPredicate implements IPredicate {
private String name;
private Boolean includeChildren;
public TaskGroupPredicate(List<FilterPair> filters, Date startDate,
Date finishDate, Boolean includeChildren, String name) {
Date finishDate, String name) {
this.filters = filters;
this.startDate = startDate;
this.finishDate = finishDate;
this.includeChildren = includeChildren;
this.name = name;
}
@ -122,14 +119,6 @@ public class TaskGroupPredicate implements IPredicate {
taskElement)) {
return true;
}
if (includeChildren) {
for (TaskElement each : taskElement.getAllChildren()) {
if (existCriterionInTaskElementResourceAllocations(
filterCriterion, each)) {
return true;
}
}
}
return false;
}
@ -164,13 +153,6 @@ public class TaskGroupPredicate implements IPredicate {
if (existLabelInOrderElement(filterLabel, order)) {
return true;
}
if (this.includeChildren) {
for (OrderElement orderElement : order.getAllOrderElements()) {
if (existLabelInOrderElement(filterLabel, orderElement)) {
return true;
}
}
}
return false;
}
@ -288,10 +270,6 @@ public class TaskGroupPredicate implements IPredicate {
return false;
}
public boolean isIncludeChildren() {
return includeChildren;
}
public List<FilterPair> getFilters() {
if (filters == null) {
return Collections.emptyList();

View file

@ -93,8 +93,6 @@ public class CompanyPlanningController implements Composer {
private BandboxMultipleSearch bdFilters;
private Checkbox checkIncludeOrderElements;
private ICommandOnTask<TaskElement> doubleClickCommand;
private Map<String, String[]> parameters;
@ -143,7 +141,6 @@ public class CompanyPlanningController implements Composer {
loadPredefinedBandboxFilter();
checkIncludeOrderElements = (Checkbox) filterComponent.getFellow("checkIncludeOrderElements");
filterComponent.setVisible(true);
checkCreationPermissions();
@ -336,14 +333,13 @@ public class CompanyPlanningController implements Composer {
List<FilterPair> listFilters = (List<FilterPair>) bdFilters.getSelectedElements();
Date startDate = filterStartDate.getValue();
Date finishDate = filterFinishDate.getValue();
Boolean includeOrderElements = checkIncludeOrderElements.isChecked();
String name = filterProjectName.getValue();
filterProjectName.setValue(name);
if ( startDate == null && finishDate == null ) {
TaskGroupPredicate predicate = model.getDefaultPredicate(includeOrderElements);
TaskGroupPredicate predicate = model.getDefaultPredicate();
// Show filter dates calculated by default on screen
if ( model.getFilterStartDate() != null && !FilterUtils.hasProjectsStartDateChanged()) {
@ -358,7 +354,7 @@ public class CompanyPlanningController implements Composer {
return predicate;
}
return new TaskGroupPredicate(listFilters, startDate, finishDate, includeOrderElements, name);
return new TaskGroupPredicate(listFilters, startDate, finishDate, name);
}
private void filterByPredicate(TaskGroupPredicate predicate) {

View file

@ -673,15 +673,11 @@ public class CompanyPlanningModel implements ICompanyPlanningModel {
if (associatedTaskElement != null) {
if (predicate != null) {
// If predicate includeChildren then we check if it accepts the element
if (!predicate.accepts(associatedTaskElement)) {
// If it doesn't accept the element we move on to the next order
// If predicate doesn't accept the element we move on to the next order
continue;
}
}
// If predicate doesn't includeChildren then the orders where already filtered in the DB query.
// Otherwise they've been filtered with the predicate above, and
// if they didn't pass the filter the execution doesn't reach this point.
associatedTaskElement.setSimplifiedAssignedStatusCalculationEnabled(true);
result.add(associatedTaskElement);
}
@ -694,10 +690,6 @@ public class CompanyPlanningModel implements ICompanyPlanningModel {
private List<Order> getOrders(TaskGroupPredicate predicate) {
String username = SecurityUtils.getSessionUserLoginName();
if (predicate.isIncludeChildren()) {
return orderDAO.getOrdersByReadAuthorizationByScenario(username, currentScenario);
}
Date startDate = predicate.getStartDate();
Date endDate = predicate.getFinishDate();
List<org.libreplan.business.labels.entities.Label> labels = new ArrayList<>();
@ -745,7 +737,7 @@ public class CompanyPlanningModel implements ICompanyPlanningModel {
@Override
@Transactional(readOnly = true)
public TaskGroupPredicate getDefaultPredicate(Boolean includeOrderElements) {
public TaskGroupPredicate getDefaultPredicate() {
Date startDate = FilterUtils.readProjectsStartDate();
Date endDate = FilterUtils.readProjectsEndDate();
@ -785,7 +777,7 @@ public class CompanyPlanningModel implements ICompanyPlanningModel {
filterStartDate = startDate != null ? LocalDate.fromDateFields(startDate) : null;
filterFinishDate = endDate != null ? LocalDate.fromDateFields(endDate) : null;
return new TaskGroupPredicate(null, startDate, endDate, includeOrderElements, name);
return new TaskGroupPredicate(null, startDate, endDate, name);
}
private static <T> List<T> notNull(T... values) {

View file

@ -52,7 +52,7 @@ public interface ICompanyPlanningModel {
ProgressType getProgressTypeFromConfiguration();
TaskGroupPredicate getDefaultPredicate(Boolean includeOrderElements);
TaskGroupPredicate getDefaultPredicate();
User getUser();
}

View file

@ -41,11 +41,6 @@
<datebox id="filterFinishDate" constraint = "@{orderFilterController.checkConstraintFinishDate}"
onChange="orderFilterController.onApplyFilter()"/>
<label value="${i18n:_('subelements')}"/>
<!-- TODO Jeroen is thinking about tooltip for this checkbox -->
<checkbox id="checkIncludeOrderElements"/>
<button mold="trendy" image="/common/img/ico_filter.png" style="margin-top: -4px"
tooltiptext="${i18n:_('Apply filtering to tasks satisfying required criteria')}"
onClick="orderFilterController.onApplyFilter()"/>