ItEr40S21ImplantacionAplicacionItEr33S10: ICommandOnTask has a method to know if it's applicable to a task.
This commit is contained in:
parent
25e3ff9f73
commit
758881b987
10 changed files with 56 additions and 4 deletions
|
|
@ -102,6 +102,11 @@ public class DataForPlanner {
|
|||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isApplicableTo(ITaskFundamentalProperties task) {
|
||||
return true;
|
||||
}
|
||||
|
||||
});
|
||||
configuration.setDoubleClickCommand(new ICommandOnTask<ITaskFundamentalProperties>() {
|
||||
|
||||
|
|
@ -123,6 +128,11 @@ public class DataForPlanner {
|
|||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isApplicableTo(ITaskFundamentalProperties task) {
|
||||
return true;
|
||||
}
|
||||
|
||||
});
|
||||
return configuration;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -93,7 +93,8 @@ public class CommandOnTaskContextualized<T> {
|
|||
}
|
||||
|
||||
public boolean accepts(TaskComponent taskComponent) {
|
||||
return true;
|
||||
T domainObject = domainObjectFor(taskComponent.getTask());
|
||||
return commandOnTask.isApplicableTo(domainObject);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -73,6 +73,11 @@ public class PlannerConfiguration<T> implements IDisabilityConfiguration {
|
|||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isApplicableTo(T task) {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private IAdapterToTaskFundamentalProperties<T> adapter;
|
||||
|
|
|
|||
|
|
@ -28,4 +28,11 @@ public interface ICommandOnTask<T> {
|
|||
|
||||
public void doAction(IContextWithPlannerTask<T> context, T task);
|
||||
|
||||
/**
|
||||
* @param task
|
||||
* @return <code>true</code> if and only if this command is applicable to
|
||||
* task
|
||||
*/
|
||||
public boolean isApplicableTo(T task);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ public class ResourceAllocationCommand implements IResourceAllocationCommand {
|
|||
@Override
|
||||
public void doAction(IContextWithPlannerTask<TaskElement> context,
|
||||
TaskElement task) {
|
||||
if (task instanceof Task) {
|
||||
if (isApplicableTo(task)) {
|
||||
this.resourceAllocationController.showWindow((Task) task, context
|
||||
.getTask(), planningState);
|
||||
}
|
||||
|
|
@ -72,5 +72,9 @@ public class ResourceAllocationCommand implements IResourceAllocationCommand {
|
|||
return "/common/img/ico_allocation.png";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isApplicableTo(TaskElement task) {
|
||||
return task instanceof Task;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ public class CalendarAllocationCommand implements ICalendarAllocationCommand {
|
|||
@Override
|
||||
public void doAction(IContextWithPlannerTask<TaskElement> context,
|
||||
TaskElement task) {
|
||||
if (task instanceof Task) {
|
||||
if (isApplicableTo(task)) {
|
||||
this.calendarAllocationController.showWindow((Task) task, context
|
||||
.getTask());
|
||||
}
|
||||
|
|
@ -68,4 +68,9 @@ public class CalendarAllocationCommand implements ICalendarAllocationCommand {
|
|||
return "/common/img/ico_calendar.png";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isApplicableTo(TaskElement task) {
|
||||
return task instanceof Task;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -104,4 +104,9 @@ public class AddMilestoneCommand implements IAddMilestoneCommand {
|
|||
return "/common/img/milestone.png";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isApplicableTo(TaskElement task) {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -42,7 +42,7 @@ public class DeleteMilestoneCommand implements IDeleteMilestoneCommand {
|
|||
@Override
|
||||
public void doAction(IContextWithPlannerTask<TaskElement> context,
|
||||
TaskElement task) {
|
||||
if (task instanceof TaskMilestone) {
|
||||
if (isApplicableTo(task)) {
|
||||
planningState.removed(task);
|
||||
context.remove(task);
|
||||
}
|
||||
|
|
@ -63,4 +63,9 @@ public class DeleteMilestoneCommand implements IDeleteMilestoneCommand {
|
|||
this.planningState = planningState;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isApplicableTo(TaskElement task) {
|
||||
return task instanceof TaskMilestone;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -119,6 +119,11 @@ public class PlanningTabCreator {
|
|||
public String getIcon() {
|
||||
return "/common/img/ico_planificador.png";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isApplicableTo(TaskElement task) {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
commands.add(scheduleCommand);
|
||||
companyPlanningController.setAdditional(commands);
|
||||
|
|
|
|||
|
|
@ -84,4 +84,9 @@ public class EditTaskCommand implements IEditTaskCommand {
|
|||
return "/common/img/ico_editar.png";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isApplicableTo(TaskElement task) {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue