ItEr29S08CUCreacionProxectoPlanificacionItEr28S09: Creating ResourceLoadForOrderCommand and wiring it

This commit is contained in:
Óscar González Fernández 2009-10-05 19:23:36 +02:00
parent b9053700df
commit 874430b6d9
5 changed files with 107 additions and 0 deletions

View file

@ -71,4 +71,8 @@ public class ViewSwitcher implements Composer {
isInPlanningOrder = true;
}
public void goToResourceLoad() {
// TODO implement
}
}

View file

@ -0,0 +1,36 @@
/*
* This file is part of ###PROJECT_NAME###
*
* Copyright (C) 2009 Fundación para o Fomento da Calidade Industrial e
* Desenvolvemento Tecnolóxico de Galicia
*
* 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/>.
*/
package org.navalplanner.web.planner;
import org.navalplanner.business.orders.entities.Order;
import org.navalplanner.business.planner.entities.TaskElement;
import org.navalplanner.web.common.ViewSwitcher;
import org.zkoss.ganttz.extensions.ICommand;
/**
* @author Óscar González Fernández <ogonzalez@igalia.com>
*
*/
public interface IResourceLoadForOrderCommand extends ICommand<TaskElement>{
public void initialize(Order order, ViewSwitcher switcher,
PlanningState planningState);
}

View file

@ -90,6 +90,10 @@ public abstract class OrderPlanningModel implements IOrderPlanningModel {
saveCommand.setState(planningState);
configuration.addGlobalCommand(saveCommand);
IResourceLoadForOrderCommand resourceLoadForOrderCommand = getResourceLoadForOrderCommand();
resourceLoadForOrderCommand.initialize(order, switcher, planningState);
configuration.addGlobalCommand(resourceLoadForOrderCommand);
IResourceAllocationCommand resourceAllocationCommand = getResourceAllocationCommand();
resourceAllocationCommand.initialize(resourceAllocationController,
planningState);
@ -199,6 +203,8 @@ public abstract class OrderPlanningModel implements IOrderPlanningModel {
protected abstract ICalendarAllocationCommand getCalendarAllocationCommand();
protected abstract IResourceLoadForOrderCommand getResourceLoadForOrderCommand();
private Order reload(Order order) {
try {
return orderDAO.find(order.getId());

View file

@ -0,0 +1,60 @@
/*
* This file is part of ###PROJECT_NAME###
*
* Copyright (C) 2009 Fundación para o Fomento da Calidade Industrial e
* Desenvolvemento Tecnolóxico de Galicia
*
* 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/>.
*/
package org.navalplanner.web.planner;
import static org.navalplanner.web.I18nHelper._;
import org.navalplanner.business.orders.entities.Order;
import org.navalplanner.business.planner.entities.TaskElement;
import org.navalplanner.web.common.ViewSwitcher;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
import org.zkoss.ganttz.extensions.IContext;
/**
* @author Óscar González Fernández <ogonzalez@igalia.com>
*
*/
@Component
@Scope(BeanDefinition.SCOPE_PROTOTYPE)
public class ResourceLoadForOrderCommand implements
IResourceLoadForOrderCommand {
private PlanningState planningState;
private ViewSwitcher switcher;
@Override
public void initialize(Order order, ViewSwitcher switcher,
PlanningState planningState) {
this.switcher = switcher;
this.planningState = planningState;
}
@Override
public void doAction(IContext<TaskElement> context) {
switcher.goToResourceLoad();
}
@Override
public String getName() {
return _("Resource Load");
}
}

View file

@ -24,6 +24,7 @@
<lookup-method name="getEditTaskCommand" bean="editTaskCommand"/>
<lookup-method name="getCalendarAllocationCommand" bean="calendarAllocationCommand"/>
<lookup-method name="getAddMilestoneCommand" bean="addMilestoneCommand"/>
<lookup-method name="getResourceLoadForOrderCommand" bean="resourceLoadForOrderCommand"/>
</bean>
<context:component-scan base-package="org.navalplanner.web"/>