ItEr40S21ImplantacionAplicacionItEr33S10: [Bug #184] Adding delete milestones commands
This commit is contained in:
parent
6a63178833
commit
c4529480b8
4 changed files with 111 additions and 0 deletions
|
|
@ -0,0 +1,66 @@
|
|||
/*
|
||||
* 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.milestone;
|
||||
|
||||
import static org.navalplanner.web.I18nHelper._;
|
||||
|
||||
import org.navalplanner.business.planner.entities.TaskElement;
|
||||
import org.navalplanner.business.planner.entities.TaskMilestone;
|
||||
import org.navalplanner.web.planner.order.PlanningState;
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.zkoss.ganttz.extensions.IContextWithPlannerTask;
|
||||
|
||||
/**
|
||||
* @author Óscar González Fernández <ogonzalez@igalia.com>
|
||||
*
|
||||
*/
|
||||
@Component
|
||||
@Scope(BeanDefinition.SCOPE_PROTOTYPE)
|
||||
public class DeleteMilestoneCommand implements IDeleteMilestoneCommand {
|
||||
|
||||
private PlanningState planningState;
|
||||
|
||||
@Override
|
||||
public void doAction(IContextWithPlannerTask<TaskElement> context,
|
||||
TaskElement task) {
|
||||
if (task instanceof TaskMilestone) {
|
||||
planningState.removed(task);
|
||||
context.remove(task);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIcon() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return (_("Delete Milestone"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setState(PlanningState planningState) {
|
||||
this.planningState = planningState;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
* 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.milestone;
|
||||
|
||||
import org.navalplanner.business.planner.entities.TaskElement;
|
||||
import org.navalplanner.web.planner.order.PlanningState;
|
||||
import org.zkoss.ganttz.extensions.ICommandOnTask;
|
||||
|
||||
/**
|
||||
* @author Óscar González Fernández <ogonzalez@igalia.com>
|
||||
*
|
||||
*/
|
||||
public interface IDeleteMilestoneCommand extends ICommandOnTask<TaskElement> {
|
||||
|
||||
void setState(PlanningState planningState);
|
||||
|
||||
}
|
||||
|
|
@ -69,6 +69,7 @@ import org.navalplanner.web.planner.chart.EarnedValueChartFiller;
|
|||
import org.navalplanner.web.planner.chart.IChartFiller;
|
||||
import org.navalplanner.web.planner.chart.EarnedValueChartFiller.EarnedValueType;
|
||||
import org.navalplanner.web.planner.milestone.IAddMilestoneCommand;
|
||||
import org.navalplanner.web.planner.milestone.IDeleteMilestoneCommand;
|
||||
import org.navalplanner.web.planner.order.ISaveCommand.IAfterSaveListener;
|
||||
import org.navalplanner.web.planner.taskedition.EditTaskController;
|
||||
import org.navalplanner.web.planner.taskedition.IEditTaskCommand;
|
||||
|
|
@ -191,6 +192,7 @@ public abstract class OrderPlanningModel implements IOrderPlanningModel {
|
|||
final IResourceAllocationCommand resourceAllocationCommand = buildResourceAllocationCommand(resourceAllocationController);
|
||||
configuration.addCommandOnTask(resourceAllocationCommand);
|
||||
configuration.addCommandOnTask(buildMilestoneCommand());
|
||||
configuration.addCommandOnTask(buildDeleteMilestoneCommand());
|
||||
configuration
|
||||
.addCommandOnTask(buildCalendarAllocationCommand(calendarAllocationController));
|
||||
configuration
|
||||
|
|
@ -225,6 +227,12 @@ public abstract class OrderPlanningModel implements IOrderPlanningModel {
|
|||
setEventListenerConfigurationCheckboxes(earnedValueChart);
|
||||
}
|
||||
|
||||
private IDeleteMilestoneCommand buildDeleteMilestoneCommand() {
|
||||
IDeleteMilestoneCommand result = getDeleteMilestoneCommand();
|
||||
result.setState(planningState);
|
||||
return result;
|
||||
}
|
||||
|
||||
private void showDeadlineIfExists(Order orderReloaded,
|
||||
PlannerConfiguration<TaskElement> configuration) {
|
||||
if (orderReloaded.getDeadline() != null) {
|
||||
|
|
@ -653,6 +661,8 @@ public abstract class OrderPlanningModel implements IOrderPlanningModel {
|
|||
|
||||
protected abstract IAddMilestoneCommand getAddMilestoneCommand();
|
||||
|
||||
protected abstract IDeleteMilestoneCommand getDeleteMilestoneCommand();
|
||||
|
||||
protected abstract IEditTaskCommand getEditTaskCommand();
|
||||
|
||||
protected abstract ICalendarAllocationCommand getCalendarAllocationCommand();
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@
|
|||
<lookup-method name="getEditTaskCommand" bean="editTaskCommand"/>
|
||||
<lookup-method name="getCalendarAllocationCommand" bean="calendarAllocationCommand"/>
|
||||
<lookup-method name="getAddMilestoneCommand" bean="addMilestoneCommand"/>
|
||||
<lookup-method name="getDeleteMilestoneCommand" bean="deleteMilestoneCommand"/>
|
||||
</bean>
|
||||
|
||||
<bean class="org.navalplanner.web.planner.company.CompanyPlanningModel" scope="prototype">
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue