ItEr50S04ValidacionEProbasFuncionaisItEr49S04: Providing just what is needed to create a TaskComponent.
TaskComponents no longer needs the TaskList, they just need the IDisabilityConfiguration
This commit is contained in:
parent
540294af87
commit
388fc0c48e
3 changed files with 18 additions and 18 deletions
|
|
@ -151,29 +151,29 @@ public class TaskComponent extends Div implements AfterCompose {
|
|||
}
|
||||
};
|
||||
|
||||
private final IDisabilityConfiguration disabilityConfiguration;
|
||||
protected final IDisabilityConfiguration disabilityConfiguration;
|
||||
|
||||
private PropertyChangeListener criticalPathPropertyListener;
|
||||
|
||||
public static TaskComponent asTaskComponent(Task task, TaskList taskList,
|
||||
public static TaskComponent asTaskComponent(Task task,
|
||||
IDisabilityConfiguration disabilityConfiguration,
|
||||
boolean isTopLevel) {
|
||||
final TaskComponent result;
|
||||
if (task.isContainer()) {
|
||||
result = TaskContainerComponent.asTask((TaskContainer) task,
|
||||
taskList);
|
||||
disabilityConfiguration);
|
||||
} else if (task instanceof Milestone) {
|
||||
result = new MilestoneComponent(task, taskList
|
||||
.getDisabilityConfiguration());
|
||||
result = new MilestoneComponent(task, disabilityConfiguration);
|
||||
} else {
|
||||
result = new TaskComponent(task, taskList
|
||||
.getDisabilityConfiguration());
|
||||
result = new TaskComponent(task, disabilityConfiguration);
|
||||
}
|
||||
result.isTopLevel = isTopLevel;
|
||||
return TaskRow.wrapInRow(result);
|
||||
}
|
||||
|
||||
public static TaskComponent asTaskComponent(Task task, TaskList taskList) {
|
||||
return asTaskComponent(task, taskList, true);
|
||||
public static TaskComponent asTaskComponent(Task task,
|
||||
IDisabilityConfiguration disabilityConfiguration) {
|
||||
return asTaskComponent(task, disabilityConfiguration, true);
|
||||
}
|
||||
|
||||
private IReloadResourcesTextRequested reloadResourcesTextRequested;
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ import java.util.List;
|
|||
import java.util.ListIterator;
|
||||
import java.util.Map;
|
||||
|
||||
import org.zkoss.ganttz.adapters.IDisabilityConfiguration;
|
||||
import org.zkoss.ganttz.data.Task;
|
||||
import org.zkoss.ganttz.data.TaskContainer;
|
||||
import org.zkoss.ganttz.data.TaskContainer.IExpandListener;
|
||||
|
|
@ -39,23 +40,21 @@ public class TaskContainerComponent extends TaskComponent implements
|
|||
AfterCompose {
|
||||
|
||||
public static TaskContainerComponent asTask(Task taskContainerBean,
|
||||
TaskList taskList) {
|
||||
IDisabilityConfiguration disabilityConfiguration) {
|
||||
return new TaskContainerComponent((TaskContainer) taskContainerBean,
|
||||
taskList);
|
||||
disabilityConfiguration);
|
||||
}
|
||||
|
||||
private List<TaskComponent> subtaskComponents = new ArrayList<TaskComponent>();
|
||||
private final TaskList taskList;
|
||||
|
||||
private transient IExpandListener expandListener;
|
||||
|
||||
public TaskContainerComponent(final TaskContainer taskContainer,
|
||||
final TaskList taskList) {
|
||||
super(taskContainer, taskList.getDisabilityConfiguration());
|
||||
final IDisabilityConfiguration disabilityConfiguration) {
|
||||
super(taskContainer, disabilityConfiguration);
|
||||
if (!taskContainer.isContainer()) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
this.taskList = taskList;
|
||||
this.expandListener = new IExpandListener() {
|
||||
|
||||
@Override
|
||||
|
|
@ -70,7 +69,8 @@ public class TaskContainerComponent extends TaskComponent implements
|
|||
}
|
||||
|
||||
private TaskComponent createChild(Task task) {
|
||||
return TaskComponent.asTaskComponent(task, this.taskList, false);
|
||||
return TaskComponent.asTaskComponent(task, disabilityConfiguration,
|
||||
false);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -235,8 +235,8 @@ public class TaskList extends XulElement implements AfterCompose {
|
|||
for (Task task : newTasks) {
|
||||
TaskComponent taskComponent = taskComponentByTask.get(task);
|
||||
if (taskComponent == null) {
|
||||
taskComponent = TaskComponent.asTaskComponent(
|
||||
task, this);
|
||||
taskComponent = TaskComponent.asTaskComponent(task,
|
||||
disabilityConfiguration);
|
||||
taskComponent.publishTaskComponents(taskComponentByTask);
|
||||
}
|
||||
if (task.isContainer()) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue