Revamped component on timesheet lines report to show found tasks information

The grid had a lot of duplicated information, only the label with number
of tasks and total hours was neccessary.

FEA: ItEr76S04BugFixing
This commit is contained in:
Lorenzo Tilve Álvaro 2012-06-25 13:28:12 +02:00
parent 54835bce69
commit fc0db6ce82
2 changed files with 17 additions and 89 deletions

View file

@ -3,7 +3,7 @@
*
* Copyright (C) 2009-2010 Fundación para o Fomento da Calidade Industrial e
* Desenvolvemento Tecnolóxico de Galicia
* Copyright (C) 2010-2011 Igalia, S.L.
* Copyright (C) 2010-2012 Igalia, S.L.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
@ -59,7 +59,7 @@ import org.zkoss.zul.Comboitem;
import org.zkoss.zul.Constraint;
import org.zkoss.zul.Datebox;
import org.zkoss.zul.Grid;
import org.zkoss.zul.Row;
import org.zkoss.zul.Label;
import org.zkoss.zul.SimpleListModel;
import org.zkoss.zul.api.Window;
@ -97,7 +97,7 @@ public class WorkReportQueryController extends GenericForwardComposer {
private Grid gridListQuery;
private Grid gridSummary;
private Label gridSummary;
private Window listQueryWindow;
@ -193,11 +193,7 @@ public class WorkReportQueryController extends GenericForwardComposer {
WorkReportLineSummary summary = new WorkReportLineSummary(
totalTasks(workReportLines), totalHours(workReportLines));
// Remove row if it exists
if (gridSummary.getRows().getFirstChild() != null) {
gridSummary.getRows().getFirstChild().detach();
}
gridSummary.getRows().appendChild(summary.toRow());
gridSummary.setValue(summary.toString());
}
private Integer totalTasks(List<WorkReportLine> workReportLines) {
@ -355,58 +351,16 @@ public class WorkReportQueryController extends GenericForwardComposer {
*/
class WorkReportLineSummary {
private Resource resource;
private OrderElement task;
private Date startDate;
private Date finishDate;
private TypeOfWorkHours hoursType;
private String type;
private Integer totalTasks;
private EffortDuration totalHours;
private WorkReportLineSummary(Integer totalTasks,
EffortDuration totalHours) {
this.resource = getSelectedResource();
this.task = getSelectedOrderElement();
this.startDate = filterStartDateLine.getValue();
this.finishDate = filterFinishDateLine.getValue();
this.hoursType = getSelectedHoursType();
this.type = filterType.getValue();
this.totalTasks = totalTasks;
this.totalHours = totalHours;
}
public String getResource() {
return resource != null ? resource.getShortDescription() : "";
}
public String getTask() {
return task != null ? task.getName() : "";
}
public String getStartDate() {
return startDate != null ? startDate.toString() : "";
}
public String getFinishDate() {
return finishDate != null ? finishDate.toString() : "";
}
public String getHoursType() {
return hoursType != null ? hoursType.getName() : "";
}
public String getType() {
return type;
}
public String getTotalTasks() {
return totalTasks.toString();
}
@ -415,21 +369,9 @@ public class WorkReportQueryController extends GenericForwardComposer {
return totalHours.toFormattedString();
}
public Row toRow() {
Row result = new Row();
result.appendChild(label(getResource()));
result.appendChild(label(getTask()));
result.appendChild(label(getStartDate()));
result.appendChild(label(getFinishDate()));
result.appendChild(label(getHoursType()));
result.appendChild(label(getType()));
result.appendChild(label(getTotalTasks()));
result.appendChild(label(getTotalHours()));
return result;
}
private org.zkoss.zul.Label label(String value) {
return new org.zkoss.zul.Label(value);
public String toString() {
return _("Tasks") + " " + getTotalTasks() + ". "
+ _("Total hours") + " " + getTotalHours() + ".";
}
}

View file

@ -3,7 +3,7 @@
Copyright (C) 2009-2010 Fundación para o Fomento da Calidade Industrial e
Desenvolvemento Tecnolóxico de Galicia
Copyright (C) 2010-2011 Igalia, S.L.
Copyright (C) 2010-2012 Igalia, S.L.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
@ -33,14 +33,13 @@
<vbox id="messagesContainer"></vbox>
<panel title="${i18n:_('Filter timesheet lines by')}" border="normal"
style="overflow:auto">
<panelchildren>
<separator bar="false" spacing="5px" orient="horizontal"/>
<groupbox closable="false">
<caption label="${i18n:_('Filter timesheet lines by')}" />
<div align="center">
<!-- Filter work report lines -->
<hbox>
<hbox align="pack">
<!-- Resource -->
<label value="${i18n:_('Resource')}"/>
<autocomplete id="filterResource" buttonVisible="true"
@ -58,6 +57,7 @@
<!-- To -->
<label value="${i18n:_('to')}"/>
<datebox id="filterFinishDateLine" constraint = "@{controller.checkConstraintFinishDateLine}"/>
</hbox>
<!-- More options -->
<groupbox sclass="filter-more-options" mold="3d" width="120px" open="false"
@ -80,15 +80,15 @@
</hbox>
</groupbox>
<button label="${i18n:_('Filter')}" style="margin-top: -4px"
<button label="${i18n:_('Filter')}"
onClick="controller.onApplyFilterWorkReportLines(event)"/>
</hbox>
</div>
</groupbox>
<separator bar="false" spacing="5px" orient="horizontal"/>
</panelchildren>
</panel>
<separator bar="false" spacing="20px" orient="horizontal"/>
<hbox style="padding:10px;">
<label id="gridSummary" sclass="remarked"/>
</hbox>
<grid id="gridListQuery" mold="paging" pageSize="15"
model="@{controller.queryWorkReportLines}"
@ -140,20 +140,6 @@
<separator bar="false" spacing="20px" orient="horizontal"/>
<grid id="gridSummary">
<columns>
<column label="${i18n:_('Resource')}" align="center"/>
<column label="${i18n:_('Task')}" align="center"/>
<column label="${i18n:_('From')}" align="center"/>
<column label="${i18n:_('To')}" align="center"/>
<column label="${i18n:_('Hours type')}" align="center"/>
<column label="${i18n:_('Type')}" align="center"/>
<column label="${i18n:_('Total tasks')}" align="center"/>
<column label="${i18n:_('Total hours')}" align="center"/>
</columns>
<rows>
</rows>
</grid>
</window>