ItEr19S08CUCreacionProxectoPlanificacionItEr18S08: Added popup to edit a task from main planner to Scheduling view.
This commit is contained in:
parent
9452bc1d12
commit
997666f04b
7 changed files with 98 additions and 0 deletions
|
|
@ -0,0 +1,39 @@
|
|||
package org.navalplanner.web.planner;
|
||||
|
||||
import org.navalplanner.business.planner.entities.TaskElement;
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.zkoss.ganttz.TaskEditFormComposer;
|
||||
import org.zkoss.ganttz.extensions.IContextWithPlannerTask;
|
||||
|
||||
/**
|
||||
* Command to edit a {@link TaskElement}.
|
||||
*
|
||||
* @author Manuel Rego Casasnovas <mrego@igalia.com>
|
||||
*/
|
||||
@Component
|
||||
@Scope(BeanDefinition.SCOPE_PROTOTYPE)
|
||||
public class EditTaskCommand implements IEditTaskCommand {
|
||||
|
||||
private TaskEditFormComposer taskEditFormComposer;
|
||||
|
||||
@Override
|
||||
public void doAction(IContextWithPlannerTask<TaskElement> context,
|
||||
TaskElement task) {
|
||||
taskEditFormComposer.showEditFormFor(context.getRelativeTo(), context
|
||||
.getTask());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "Edit";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTaskEditFormComposer(
|
||||
TaskEditFormComposer taskEditFormComposer) {
|
||||
this.taskEditFormComposer = taskEditFormComposer;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
package org.navalplanner.web.planner;
|
||||
|
||||
import org.navalplanner.business.planner.entities.TaskElement;
|
||||
import org.zkoss.ganttz.TaskEditFormComposer;
|
||||
import org.zkoss.ganttz.extensions.ICommandOnTask;
|
||||
|
||||
/**
|
||||
* Contract for {@link EditTaskCommand} <br />
|
||||
*
|
||||
* @author Manuel Rego Casasnovas <mrego@igalia.com>
|
||||
*/
|
||||
public interface IEditTaskCommand extends ICommandOnTask<TaskElement> {
|
||||
|
||||
void setTaskEditFormComposer(TaskEditFormComposer taskEditFormComposer);
|
||||
|
||||
}
|
||||
|
|
@ -2,6 +2,7 @@ package org.navalplanner.web.planner;
|
|||
|
||||
import org.navalplanner.business.orders.entities.Order;
|
||||
import org.navalplanner.business.planner.entities.TaskElement;
|
||||
import org.zkoss.ganttz.TaskEditFormComposer;
|
||||
import org.zkoss.ganttz.adapters.PlannerConfiguration;
|
||||
|
||||
/**
|
||||
|
|
@ -15,6 +16,7 @@ public interface IOrderPlanningModel {
|
|||
|
||||
void createConfiguration(Order order,
|
||||
ResourceAllocationController resourceAllocationController,
|
||||
TaskEditFormComposer taskEditFormComposer,
|
||||
ConfigurationOnTransaction onTransaction);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import org.springframework.beans.factory.config.BeanDefinition;
|
|||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.zkoss.ganttz.Planner;
|
||||
import org.zkoss.ganttz.TaskEditFormComposer;
|
||||
import org.zkoss.ganttz.adapters.PlannerConfiguration;
|
||||
|
||||
/**
|
||||
|
|
@ -27,6 +28,12 @@ public class OrderPlanningController implements
|
|||
return resourceAllocationController;
|
||||
}
|
||||
|
||||
private TaskEditFormComposer taskEditFormComposer = new TaskEditFormComposer();
|
||||
|
||||
public TaskEditFormComposer getTaskEditFormComposer() {
|
||||
return taskEditFormComposer;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private IURLHandlerRegistry urlHandlerRegistry;
|
||||
|
||||
|
|
@ -41,6 +48,7 @@ public class OrderPlanningController implements
|
|||
@Override
|
||||
public void showSchedule(Order order) {
|
||||
model.createConfiguration(order, resourceAllocationController,
|
||||
taskEditFormComposer,
|
||||
new ConfigurationOnTransaction() {
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ 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.TaskEditFormComposer;
|
||||
import org.zkoss.ganttz.adapters.IStructureNavigator;
|
||||
import org.zkoss.ganttz.adapters.PlannerConfiguration;
|
||||
|
||||
|
|
@ -47,6 +48,7 @@ public abstract class OrderPlanningModel implements IOrderPlanningModel {
|
|||
@Transactional(readOnly = true)
|
||||
public void createConfiguration(Order order,
|
||||
ResourceAllocationController resourceAllocationController,
|
||||
TaskEditFormComposer taskEditFormComposer,
|
||||
ConfigurationOnTransaction onTransaction) {
|
||||
Order orderReloaded = reload(order);
|
||||
if (!orderReloaded.isSomeTaskElementScheduled())
|
||||
|
|
@ -67,6 +69,10 @@ public abstract class OrderPlanningModel implements IOrderPlanningModel {
|
|||
splitCommand.setState(planningState);
|
||||
configuration.addCommandOnTask(splitCommand);
|
||||
|
||||
IEditTaskCommand editTaskCommand = getEditTaskCommand();
|
||||
editTaskCommand.setTaskEditFormComposer(taskEditFormComposer);
|
||||
configuration.setEditTaskCommand(editTaskCommand);
|
||||
|
||||
onTransaction.use(configuration);
|
||||
}
|
||||
|
||||
|
|
@ -143,6 +149,8 @@ public abstract class OrderPlanningModel implements IOrderPlanningModel {
|
|||
|
||||
protected abstract ISplitTaskCommand getSplitCommand();
|
||||
|
||||
protected abstract IEditTaskCommand getEditTaskCommand();
|
||||
|
||||
private Order reload(Order order) {
|
||||
try {
|
||||
return orderService.find(order.getId());
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
<lookup-method name="getSaveCommand" bean="saveCommand"/>
|
||||
<lookup-method name="getResourceAllocationCommand" bean="resourceAllocationCommand"/>
|
||||
<lookup-method name="getSplitCommand" bean="splitTaskCommand"/>
|
||||
<lookup-method name="getEditTaskCommand" bean="editTaskCommand"/>
|
||||
</bean>
|
||||
|
||||
<context:component-scan base-package="org.navalplanner.web"/>
|
||||
|
|
|
|||
|
|
@ -18,6 +18,30 @@
|
|||
<div id="idContextMenuTaskAssigment"></div>
|
||||
</planner>
|
||||
|
||||
<popup width="300px" apply="${planningController.taskEditFormComposer}">
|
||||
<grid>
|
||||
<rows>
|
||||
<row>
|
||||
${c:l('task.name')}
|
||||
<textbox id="name" />
|
||||
</row>
|
||||
<row>
|
||||
${c:l('task.start')}
|
||||
<datebox id="startDateBox" compact="true" />
|
||||
</row>
|
||||
<row>
|
||||
${c:l('task.end')}
|
||||
<datebox id="endDateBox" compact="true" />
|
||||
</row>
|
||||
<row>
|
||||
${c:l('task.notes')}
|
||||
<textbox id="notes" />
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
<button id="ok" label=" ${c:l('task.ok')}" />
|
||||
</popup>
|
||||
|
||||
<window id="resourceAllocationWindow" visible="false" apply="${allocationController}">
|
||||
<vbox>
|
||||
<label value="Required criterions" />
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue