From 7fe5eb2350b4c9d4058c130eba1c101416081df3 Mon Sep 17 00:00:00 2001 From: Manuel Rego Casasnovas Date: Fri, 8 Feb 2013 13:46:43 +0100 Subject: [PATCH] Keep tasks converted into containers also in the filtered WBS This allows to add a task over a leaf in a filtered WBS, and being able to keep seeing the 3 elements: the new container (with the name of the previous leaf), the previous leaf without name and the new task added. It's easier to understand with an example. Imagine you have the following WBS: * Task 1 * Task 2 And you filter by task name using "2", then you'll have: * Task 2 Then you select "Task 2" and add a new task called "Subtask A". Without this patch you'll only see: * Task 2 (the new container using the name of the old leaf) |- Subtask A (the new task) However, it's better you see the following * Task 2 (the new container using the name of the old leaf) |- (empty task) (the old leaf that you should rename) |- Subtask A (the new task) FEA: ItEr77S15FilteringEnhancements --- .../libreplan/business/orders/entities/OrderElement.java | 4 ++++ .../org/libreplan/business/orders/entities/OrderLine.java | 8 ++++++++ .../org/libreplan/web/orders/OrderElementPredicate.java | 2 +- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/libreplan-business/src/main/java/org/libreplan/business/orders/entities/OrderElement.java b/libreplan-business/src/main/java/org/libreplan/business/orders/entities/OrderElement.java index 5699c51ab..2e3b760e6 100644 --- a/libreplan-business/src/main/java/org/libreplan/business/orders/entities/OrderElement.java +++ b/libreplan-business/src/main/java/org/libreplan/business/orders/entities/OrderElement.java @@ -1662,4 +1662,8 @@ public abstract class OrderElement extends IntegrationEntity implements return effort.toFormattedString(); } + public boolean isConvertedToContainer() { + return false; + } + } diff --git a/libreplan-business/src/main/java/org/libreplan/business/orders/entities/OrderLine.java b/libreplan-business/src/main/java/org/libreplan/business/orders/entities/OrderLine.java index fac42a838..854f3a347 100644 --- a/libreplan-business/src/main/java/org/libreplan/business/orders/entities/OrderLine.java +++ b/libreplan-business/src/main/java/org/libreplan/business/orders/entities/OrderLine.java @@ -88,6 +88,8 @@ public class OrderLine extends OrderElement { private Integer lastHoursGroupSequenceCode = 0; + private boolean convertedToContainer = false; + @Override public Integer getWorkHours() { return hoursGroupOrderLineHandler.calculateTotalHours(hoursGroups); @@ -156,6 +158,7 @@ public class OrderLine extends OrderElement { result.setName(getName()); setCode(""); setName(""); + convertedToContainer = true; return result; } @@ -392,4 +395,9 @@ public class OrderLine extends OrderElement { return budget; } + @Override + public boolean isConvertedToContainer() { + return convertedToContainer; + } + } diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/orders/OrderElementPredicate.java b/libreplan-webapp/src/main/java/org/libreplan/web/orders/OrderElementPredicate.java index 50df9803f..450b3b19e 100644 --- a/libreplan-webapp/src/main/java/org/libreplan/web/orders/OrderElementPredicate.java +++ b/libreplan-webapp/src/main/java/org/libreplan/web/orders/OrderElementPredicate.java @@ -71,7 +71,7 @@ public class OrderElementPredicate implements IPredicate { if (orderElement == null) { return false; } - if (orderElement.isNewObject()) { + if (orderElement.isNewObject() || orderElement.isConvertedToContainer()) { return true; } if (acceptFilters(orderElement) && acceptFiltersDates(orderElement)