Remove 'Overall progress' tab

FEA: ItEr76S15OrganizingPerProjectDashboard
This commit is contained in:
Diego Pino 2012-05-08 00:03:45 +02:00
parent 963217996e
commit 2e1a1fcbf1
4 changed files with 42 additions and 332 deletions

View file

@ -141,65 +141,64 @@ public class DashboardModel implements IDashboardModel {
/* Progress KPI: "Global Progress of the Project" */
@Override
public BigDecimal getAdvancePercentageByHours() {
TaskGroup rootAsTaskGroup = (TaskGroup) getRootTask();
if (this.getRootTask() == null) {
TaskGroup rootTask = (TaskGroup) getRootTask();
if (rootTask == null) {
throw new RuntimeException("Root task is null");
}
BigDecimal ratio = rootAsTaskGroup.getProgressAllByNumHours();
return ratio.multiply(BigDecimal.TEN).multiply(BigDecimal.TEN);
return asPercentage(rootTask.getProgressAllByNumHours());
}
private BigDecimal asPercentage(BigDecimal value) {
return value != null ? value.multiply(BigDecimal.valueOf(100))
: BigDecimal.ZERO;
}
@Override
public BigDecimal getExpectedAdvancePercentageByHours() {
TaskGroup rootAsTaskGroup = (TaskGroup) getRootTask();
if (this.getRootTask() == null) {
TaskGroup rootTask = (TaskGroup) getRootTask();
if (rootTask == null) {
throw new RuntimeException("Root task is null");
}
BigDecimal ratio = rootAsTaskGroup
.getTheoreticalProgressByNumHoursForAllTasksUntilNow();
return ratio.multiply(BigDecimal.TEN).multiply(BigDecimal.TEN);
return asPercentage(rootTask
.getTheoreticalProgressByNumHoursForAllTasksUntilNow());
}
@Override
public BigDecimal getCriticalPathProgressByNumHours() {
TaskGroup rootAsTaskGroup = (TaskGroup) getRootTask();
if (this.getRootTask() == null) {
TaskGroup rootTask = (TaskGroup) getRootTask();
if (rootTask == null) {
throw new RuntimeException("Root task is null");
}
BigDecimal ratio = rootAsTaskGroup.getCriticalPathProgressByNumHours();
return ratio.multiply(BigDecimal.TEN).multiply(BigDecimal.TEN);
return asPercentage(rootTask.getCriticalPathProgressByNumHours());
}
@Override
public BigDecimal getExpectedCriticalPathProgressByNumHours() {
TaskGroup rootAsTaskGroup = (TaskGroup) getRootTask();
if (this.getRootTask() == null) {
TaskGroup rootTask = (TaskGroup) getRootTask();
if (rootTask == null) {
throw new RuntimeException("Root task is null");
}
BigDecimal ratio = rootAsTaskGroup
.getTheoreticalProgressByNumHoursForCriticalPathUntilNow();
return ratio.multiply(BigDecimal.TEN).multiply(BigDecimal.TEN);
return asPercentage(rootTask
.getTheoreticalProgressByNumHoursForCriticalPathUntilNow());
}
@Override
public BigDecimal getCriticalPathProgressByDuration() {
TaskGroup rootAsTaskGroup = (TaskGroup) getRootTask();
if (this.getRootTask() == null) {
TaskGroup rootTask = (TaskGroup) getRootTask();
if (rootTask == null) {
throw new RuntimeException("Root task is null");
}
BigDecimal ratio = rootAsTaskGroup.getCriticalPathProgressByDuration();
return ratio.multiply(BigDecimal.TEN).multiply(BigDecimal.TEN);
return asPercentage(rootTask.getCriticalPathProgressByDuration());
}
@Override
public BigDecimal getExpectedCriticalPathProgressByDuration() {
TaskGroup rootAsTaskGroup = (TaskGroup) getRootTask();
if (this.getRootTask() == null) {
TaskGroup rootTask = (TaskGroup) getRootTask();
if (rootTask == null) {
throw new RuntimeException("Root task is null");
}
BigDecimal ratio = rootAsTaskGroup
.getTheoreticalProgressByDurationForCriticalPathUntilNow();
return ratio.multiply(BigDecimal.TEN).multiply(BigDecimal.TEN);
return asPercentage(rootTask
.getTheoreticalProgressByDurationForCriticalPathUntilNow());
}
/* Time KPI: Margin with deadline */

View file

@ -49,7 +49,6 @@ import org.libreplan.business.common.AdHocTransactionService;
import org.libreplan.business.common.IAdHocTransactionService;
import org.libreplan.business.common.IOnTransaction;
import org.libreplan.business.common.Registry;
import org.libreplan.business.common.entities.ProgressType;
import org.libreplan.business.common.exceptions.InstanceNotFoundException;
import org.libreplan.business.orders.daos.IOrderDAO;
import org.libreplan.business.orders.entities.HoursGroup;
@ -138,7 +137,6 @@ import org.zkoss.zul.Div;
import org.zkoss.zul.Hbox;
import org.zkoss.zul.Label;
import org.zkoss.zul.Messagebox;
import org.zkoss.zul.Progressmeter;
import org.zkoss.zul.Tab;
import org.zkoss.zul.Tabbox;
import org.zkoss.zul.Tabpanel;
@ -150,6 +148,7 @@ import org.zkoss.zul.Vbox;
* @author Óscar González Fernández <ogonzalez@igalia.com>
* @author Manuel Rego Casasnovas <rego@igalia.com>
* @author Lorenzo Tilve Álvaro <ltilve@igalia.com>
* @author Diego Pino García <dpino@igalia.com>
*/
@Component
@Scope(BeanDefinition.SCOPE_PROTOTYPE)
@ -269,8 +268,6 @@ public class OrderPlanningModel implements IOrderPlanningModel {
private Planner planner;
private OverAllProgressContent overallProgressContent;
private String tabSelected = "load_tab";
private static class NullSeparatorCommandOnTask<T> implements
@ -388,11 +385,6 @@ public class OrderPlanningModel implements IOrderPlanningModel {
this.earnedValueChartFiller = createOrderEarnedValueChartFiller(planner.getTimeTracker());
chartTabpanels.appendChild(createEarnedValueTab(chartEarnedValueTimeplot, earnedValueChartFiller));
// Create 'Overall progress' tab
Hbox chartOverallProgressTimeplot = new Hbox();
Tabpanel overallProgressTab = createOverallProgressTab(chartOverallProgressTimeplot);
chartTabpanels.appendChild(overallProgressTab);
// Append tab panels
chartComponent.appendChild(chartTabpanels);
ChangeHooker changeHooker = new ChangeHooker(configuration, saveCommand);
@ -400,45 +392,38 @@ public class OrderPlanningModel implements IOrderPlanningModel {
setupLoadChart(chartLoadTimeplot, planner, changeHooker);
setupEarnedValueChart(chartEarnedValueTimeplot, earnedValueChartFiller,
planner, changeHooker);
setupOverallProgress(planner, changeHooker);
setupAdvanceAssignmentPlanningController(planner, advanceAssignmentPlanningController);
PROFILING_LOG
.info("preparing charts and miscellaneous took: "
+ (System.currentTimeMillis() - preparingChartsAndMisc)
+ " ms");
// Calculate critical path progress, needed for 'Project global progress' chart in Dashboard view
planner.addGraphChangeListenersFromConfiguration(configuration);
updateCriticalPathProgress();
long overalProgressContentTime = System.currentTimeMillis();
overallProgressContent = new OverAllProgressContent(overallProgressTab);
overallProgressContent.updateAndRefresh();
PROFILING_LOG.info("overalProgressContent took: "
+ (System.currentTimeMillis() - overalProgressContentTime));
}
/**
* First time a project is loaded, it's needed to calculate the theoretical
* critical path progress and real critical path progress. These values are
* later updated whenever the project is saved
*/
private void updateCriticalPathProgress() {
if (planningState.isEmpty() || planner == null) {
return;
}
TaskGroup rootTask = planningState.getRootTask();
rootTask.updateCriticalPathProgress(planner.getCriticalPath());
}
private OrderEarnedValueChartFiller earnedValueChartFiller;
private void setupAdvanceAssignmentPlanningController(final Planner planner,
AdvanceAssignmentPlanningController advanceAssignmentPlanningController) {
advanceAssignmentPlanningController.reloadOverallProgressListener(new IReloadChartListener() {
@Override
public void reloadChart() {
Registry.getTransactionService().runOnReadOnlyTransaction(new IOnTransaction<Void>() {
@Override
public Void execute() {
if (isExecutingOutsideZKExecution()) {
return null;
}
if (planner.isVisibleChart()) {
overallProgressContent.updateAndRefresh();
}
return null;
}
});
}
});
advanceAssignmentPlanningController.setReloadEarnedValueListener(new IReloadChartListener() {
@Override
@ -463,15 +448,6 @@ public class OrderPlanningModel implements IOrderPlanningModel {
});
}
private Tabpanel createOverallProgressTab(
Hbox chartOverallProgressTimeplot) {
Tabpanel result = new Tabpanel();
org.zkoss.zk.ui.Component component = Executions.createComponents(
"/planner/_tabPanelOverallProgress.zul", result, null);
component.setParent(result);
return result;
}
private Timeplot createEmptyTimeplot() {
Timeplot timeplot = new Timeplot();
timeplot.appendChild(new Plotinfo());
@ -577,24 +553,6 @@ public class OrderPlanningModel implements IOrderPlanningModel {
setEventListenerConfigurationCheckboxes(earnedValueChart);
}
private void setupOverallProgress(final Planner planner,
ChangeHooker changeHooker) {
changeHooker.withReadOnlyTransactionWraping().hookInto(
EnumSet.allOf(ChangeTypes.class), new IReloadChartListener() {
@Override
public void reloadChart() {
if (isExecutingOutsideZKExecution()) {
return;
}
if (planner.isVisibleChart()) {
overallProgressContent.updateAndRefresh();
}
}
});
}
enum ChangeTypes {
ON_SAVE, ON_RELOAD_CHART_REQUESTED, ON_GRAPH_CHANGED;
}
@ -764,8 +722,6 @@ public class OrderPlanningModel implements IOrderPlanningModel {
Tabs chartTabs = new Tabs();
chartTabs.appendChild(createTab(_("Load"), "load_tab"));
chartTabs.appendChild(createTab(_("Earned value"), "earned_value_tab"));
chartTabs.appendChild(createTab(_("Overall progress"),
"overall_progress_tab"));
chartComponent.appendChild(chartTabs);
chartTabs.setSclass("charts-tabbox");
@ -1544,149 +1500,4 @@ public class OrderPlanningModel implements IOrderPlanningModel {
}
}
/**
*
* @author Diego Pino García<dpino@igalia.com>
*
* Helper class to show the content of a OverallProgress panel
*
*/
private class OverAllProgressContent {
private Progressmeter progressCriticalPathByDuration;
private Label lbCriticalPathByDuration;
private Progressmeter progressCriticalPathByNumHours;
private Label lbCriticalPathByNumHours;
private Progressmeter progressSpread;
private Label lbProgressSpread;
private Progressmeter progressAllByNumHours;
private Label lbProgressAllByNumHours;
public OverAllProgressContent(Tabpanel tabpanel) {
initializeProgressCriticalPathByDuration(tabpanel);
initializeProgressCriticalPathByNumHours(tabpanel);
initializeProgressSpread(tabpanel);
initializeProgressAllByNumHours(tabpanel);
tabpanel.setVariable("overall_progress_content", this, true);
}
private void initializeProgressCriticalPathByNumHours(Tabpanel tabpanel) {
progressCriticalPathByNumHours = (Progressmeter) tabpanel
.getFellow("progressCriticalPathByNumHours");
lbCriticalPathByNumHours = (Label) tabpanel
.getFellow("lbCriticalPathByNumHours");
((Label) tabpanel.getFellow("textCriticalPathByNumHours"))
.setValue(_(ProgressType.CRITICAL_PATH_NUMHOURS.toString()));
}
private void initializeProgressCriticalPathByDuration(Tabpanel tabpanel) {
progressCriticalPathByDuration = (Progressmeter) tabpanel
.getFellow("progressCriticalPathByDuration");
lbCriticalPathByDuration = (Label) tabpanel
.getFellow("lbCriticalPathByDuration");
((Label) tabpanel.getFellow("textCriticalPathByDuration"))
.setValue(_(ProgressType.CRITICAL_PATH_DURATION.toString()));
}
public void initializeProgressSpread(Tabpanel tabpanel) {
progressSpread = (Progressmeter) tabpanel
.getFellow("progressSpread");
lbProgressSpread = (Label) tabpanel.getFellow("lbProgressSpread");
((Label) tabpanel.getFellow("textProgressSpread"))
.setValue(_(ProgressType.SPREAD_PROGRESS.toString()));
}
public void initializeProgressAllByNumHours(Tabpanel tabpanel) {
progressAllByNumHours = (Progressmeter) tabpanel
.getFellow("progressAllByNumHours");
lbProgressAllByNumHours = (Label) tabpanel
.getFellow("lbProgressAllByNumHours");
((Label) tabpanel.getFellow("textProgressAllByNumHours"))
.setValue(_(ProgressType.ALL_NUMHOURS.toString()));
}
public void refresh() {
if (planningState.isEmpty()) {
return;
}
TaskGroup rootTask = planningState.getRootTask();
setProgressSpread(rootTask.getAdvancePercentage());
setProgressAllByNumHours(rootTask.getProgressAllByNumHours());
setCriticalPathByDuration(rootTask
.getCriticalPathProgressByDuration());
setCriticalPathByNumHours(rootTask
.getCriticalPathProgressByNumHours());
}
private void updateAndRefresh() {
if (planningState.isEmpty()) {
return;
}
update();
refresh();
}
private void update() {
TaskGroup rootTask = planningState.getRootTask();
updateCriticalPathProgress(rootTask);
}
private void updateCriticalPathProgress(TaskGroup rootTask) {
if (planner != null) {
rootTask.updateCriticalPathProgress(planner
.getCriticalPath());
}
}
private void setProgressSpread(BigDecimal value) {
if (value == null) {
value = BigDecimal.ZERO;
}
value = value.multiply(BigDecimal.valueOf(100));
value = value.setScale(2, BigDecimal.ROUND_HALF_EVEN);
lbProgressSpread.setValue(value.toString() + " %");
progressSpread.setValue(value.intValue());
}
private void setProgressAllByNumHours(BigDecimal value) {
if (value == null) {
value = BigDecimal.ZERO;
}
value = value.multiply(BigDecimal.valueOf(100));
value = value.setScale(2, BigDecimal.ROUND_HALF_EVEN);
lbProgressAllByNumHours.setValue(value.toString() + " %");
progressAllByNumHours.setValue(value.intValue());
}
public void setCriticalPathByDuration(BigDecimal value) {
if (value == null) {
value = BigDecimal.ZERO;
}
value = value.multiply(BigDecimal.valueOf(100));
value = value.setScale(2, BigDecimal.ROUND_HALF_EVEN);
lbCriticalPathByDuration.setValue(value.toString() + " %");
progressCriticalPathByDuration.setValue(value.intValue());
}
public void setCriticalPathByNumHours(BigDecimal value) {
if (value == null) {
value = BigDecimal.ZERO;
}
value = value.multiply(BigDecimal.valueOf(100));
value = value.setScale(2, BigDecimal.ROUND_HALF_EVEN);
lbCriticalPathByNumHours.setValue(value.toString() + " %");
progressCriticalPathByNumHours.setValue(value.intValue());
}
}
}

View file

@ -1,70 +0,0 @@
<!--
This file is part of LibrePlan
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.
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
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<?taglib uri="/WEB-INF/tld/i18n.tld" prefix="i18n" ?>
<div sclass="plannergraph">
<vbox style="margin-left: 25px" >
<separator />
<!-- Spreading progress -->
<label id="textProgressSpread" style="font-weight: regular; font-size: 11px" />
<hbox style="margin-top: 5px">
<progressmeter id="progressSpread" style="margin-right: 5px" width="400px" />
<label id="lbProgressSpread" style="font-weight: regular; font-size: 11px" />
</hbox>
<separator />
<!-- Progress with all task tasks by hours -->
<label id="textProgressAllByNumHours" style="font-weight: regular; font-size: 11px" />
<hbox style="margin-top: 5px">
<progressmeter id="progressAllByNumHours" style="margin-right: 5px" width="400px" />
<label id="lbProgressAllByNumHours" style="font-weight: regular; font-size: 11px" />
</hbox>
<separator />
<!-- Progress with critical path tasks by hours -->
<label id="textCriticalPathByDuration" style="font-weight: regular; font-size: 11px" />
<hbox style="margin-top: 5px">
<progressmeter id="progressCriticalPathByDuration" style="margin-right: 5px" width="400px" />
<label id="lbCriticalPathByDuration" style="font-weight: regular; font-size: 11px" />
</hbox>
<separator />
<!-- Progress with critical path tasks by duration -->
<label id="textCriticalPathByNumHours" style="font-weight: regular; font-size: 11px" />
<hbox style="margin-top: 5px">
<progressmeter id="progressCriticalPathByNumHours" style="margin-right: 5px" width="400px" />
<label id="lbCriticalPathByNumHours" style="font-weight: regular; font-size: 11px" />
</hbox>
</vbox>
</div>

View file

@ -1,30 +0,0 @@
<!--
This file is part of LibrePlan
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.
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
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<?taglib uri="/WEB-INF/tld/i18n.tld" prefix="i18n" ?>
<?component name="overallProgressContent"
macroURI="_contentOverallProgress.zul"
inline="true" ?>
<hbox sclass="load-chart">
<overallProgressContent id="overallProgressContent" />
</hbox>