ItEr29S08CUCreacionProxectoPlanificacionItEr28S09: Show associated labels inside task tooltips
This commit is contained in:
parent
1aa1ca5dc4
commit
0975c8812e
3 changed files with 41 additions and 4 deletions
|
|
@ -18,6 +18,8 @@
|
|||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
|
||||
<div>
|
||||
<div height="22px"></div>
|
||||
<tree id="tasksTree">
|
||||
<treecols sizable="false">
|
||||
<treecol label="Name"/>
|
||||
|
|
@ -25,3 +27,4 @@
|
|||
<treecol label="End"/>
|
||||
</treecols>
|
||||
</tree>
|
||||
</div>
|
||||
|
|
@ -209,6 +209,7 @@ public abstract class OrderPlanningModel implements IOrderPlanningModel {
|
|||
.getAssociatedTasks()), resourceDAO.list(Resource.class));
|
||||
forceLoadOfDependenciesCollections(planningState.getInitial());
|
||||
forceLoadOfWorkingHours(planningState.getInitial());
|
||||
forceLoadOfLabels(planningState.getInitial());
|
||||
return new PlannerConfiguration<TaskElement>(taskElementAdapter,
|
||||
new TaskElementNavigator(), planningState.getInitial());
|
||||
}
|
||||
|
|
@ -263,6 +264,12 @@ public abstract class OrderPlanningModel implements IOrderPlanningModel {
|
|||
task.getDependenciesWithThisDestination().size();
|
||||
}
|
||||
|
||||
private void forceLoadOfLabels(List<TaskElement> initial) {
|
||||
for (TaskElement taskElement : initial) {
|
||||
taskElement.getOrderElement().getLabels().size();
|
||||
}
|
||||
}
|
||||
|
||||
// spring method injection
|
||||
protected abstract ITaskElementAdapter getTaskElementAdapter();
|
||||
|
||||
|
|
|
|||
|
|
@ -29,8 +29,11 @@ import java.util.Collection;
|
|||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.joda.time.LocalDate;
|
||||
import org.navalplanner.business.labels.daos.ILabelDAO;
|
||||
import org.navalplanner.business.labels.entities.Label;
|
||||
import org.navalplanner.business.orders.daos.IOrderElementDAO;
|
||||
import org.navalplanner.business.orders.entities.Order;
|
||||
import org.navalplanner.business.orders.entities.OrderElement;
|
||||
|
|
@ -42,6 +45,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.zkoss.ganttz.adapters.DomainDependency;
|
||||
import org.zkoss.ganttz.data.DependencyType;
|
||||
import org.zkoss.ganttz.data.ITaskFundamentalProperties;
|
||||
|
|
@ -65,6 +69,9 @@ public class TaskElementAdapter implements ITaskElementAdapter {
|
|||
@Autowired
|
||||
private IDayAssignmentDAO dayAssignmentDAO;
|
||||
|
||||
@Autowired
|
||||
private ILabelDAO labelDAO;
|
||||
|
||||
@Override
|
||||
public void setOrder(Order order) {
|
||||
this.order = order;
|
||||
|
|
@ -224,12 +231,32 @@ public class TaskElementAdapter implements ITaskElementAdapter {
|
|||
}
|
||||
|
||||
@Override
|
||||
@Transactional(readOnly = true)
|
||||
public String getTooltipText() {
|
||||
|
||||
return "Advance percentage : " + getAdvancePercentage().multiply(new BigDecimal(100)).toString()
|
||||
+ "% <br/>"
|
||||
+ "Hours advance percentage : "
|
||||
+ getHoursAdvancePercentage().multiply(new BigDecimal(100)).toString() + "%";
|
||||
Set<Label> labels;
|
||||
|
||||
String tooltip = "Advance: "
|
||||
+ getAdvancePercentage().multiply(new BigDecimal(100))
|
||||
.toString() + "% , ";
|
||||
tooltip += "Hours invested: "
|
||||
+ getHoursAdvancePercentage().multiply(new BigDecimal(100))
|
||||
.toString() + "% <br/>";
|
||||
|
||||
if (taskElement.getOrderElement() != null) {
|
||||
labels = taskElement.getOrderElement().getLabels();
|
||||
|
||||
if (labels.size() != 0) {
|
||||
tooltip += "Labels: ";
|
||||
for (Label label : labels) {
|
||||
tooltip += label.getName() + ", ";
|
||||
}
|
||||
tooltip = (tooltip.substring(0, tooltip.length() - 2))
|
||||
+ ".";
|
||||
}
|
||||
}
|
||||
|
||||
return tooltip;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue