ItEr18S08CUCreacionProxectoPlanificacionItEr17S10: Adding method reload. It reloads all the planner from a new set of data.
It makes easier the importation.
This commit is contained in:
parent
fbcd35beff
commit
a863ae31df
3 changed files with 22 additions and 24 deletions
|
|
@ -11,6 +11,7 @@ import org.zkoss.ganttz.adapters.DomainDependency;
|
|||
import org.zkoss.ganttz.adapters.IAdapterToTaskFundamentalProperties;
|
||||
import org.zkoss.ganttz.adapters.IDomainAndBeansMapper;
|
||||
import org.zkoss.ganttz.adapters.IStructureNavigator;
|
||||
import org.zkoss.ganttz.adapters.PlannerConfiguration;
|
||||
import org.zkoss.ganttz.data.Dependency;
|
||||
import org.zkoss.ganttz.data.GanttDiagramGraph;
|
||||
import org.zkoss.ganttz.data.ITaskFundamentalProperties;
|
||||
|
|
@ -112,4 +113,9 @@ public class FunctionalityExposedForExtensions<T> implements IContext<T> {
|
|||
return mapper;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reload(PlannerConfiguration<?> configuration) {
|
||||
planner.setConfiguration(configuration);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -75,14 +75,6 @@ public class Planner extends XulElement {
|
|||
return Executions.getCurrent().getContextPath();
|
||||
}
|
||||
|
||||
private void removePreviousGanntPanel() {
|
||||
List<Object> children = getChildren();
|
||||
for (GanttPanel ganttPanel : findComponentsOfType(GanttPanel.class,
|
||||
children)) {
|
||||
removeChild(ganttPanel);
|
||||
}
|
||||
}
|
||||
|
||||
public DependencyList getDependencyList() {
|
||||
List<Object> children = ganttPanel.getChildren();
|
||||
List<DependencyList> found = findComponentsOfType(DependencyList.class,
|
||||
|
|
@ -92,14 +84,6 @@ public class Planner extends XulElement {
|
|||
return found.get(0);
|
||||
}
|
||||
|
||||
private void removePreviousDetails() {
|
||||
List<Object> children = getChildren();
|
||||
for (LeftTasksTree l : Planner.findComponentsOfType(
|
||||
LeftTasksTree.class, children)) {
|
||||
removeChild(l);
|
||||
}
|
||||
}
|
||||
|
||||
public TaskEditFormComposer getModalFormComposer() {
|
||||
return taskEditFormComposer;
|
||||
}
|
||||
|
|
@ -109,7 +93,6 @@ public class Planner extends XulElement {
|
|||
}
|
||||
|
||||
public void registerListeners() {
|
||||
ganttPanel.afterCompose();
|
||||
TaskList taskList = getTaskList();
|
||||
dependencyAddedListener = new DependencyAddedListener() {
|
||||
|
||||
|
|
@ -196,7 +179,6 @@ public class Planner extends XulElement {
|
|||
FunctionalityExposedForExtensions<T> context = new FunctionalityExposedForExtensions<T>(
|
||||
this, configuration.getAdapter(), configuration.getNavigator(),
|
||||
diagramGraph);
|
||||
context.add(configuration.getData());
|
||||
dependencyAdder = new DependencyAdderAdapter<T>(configuration
|
||||
.getAdapter(), context.getMapper());
|
||||
this.contextualizedCommands = contextualize(context,
|
||||
|
|
@ -204,7 +186,16 @@ public class Planner extends XulElement {
|
|||
.getGlobalCommands());
|
||||
goingDownInLastArrowCommand = contextualize(context, configuration
|
||||
.getGoingDownInLastArrowCommand());
|
||||
clear();
|
||||
context.add(configuration.getData());
|
||||
recreate();
|
||||
registerListeners();
|
||||
}
|
||||
|
||||
private void clear() {
|
||||
this.leftPane = null;
|
||||
this.ganttPanel = null;
|
||||
getChildren().clear();
|
||||
}
|
||||
|
||||
private <T> CommandContextualized<T> contextualize(
|
||||
|
|
@ -227,18 +218,15 @@ public class Planner extends XulElement {
|
|||
}
|
||||
|
||||
private void recreate() {
|
||||
removePreviousDetails();
|
||||
this.leftPane = new LeftPane(contextualizedCommands, this.diagramGraph
|
||||
.getTopLevelTasks());
|
||||
insertBefore(this.leftPane, (Component) (getChildren().isEmpty() ? null
|
||||
: getChildren().get(0)));
|
||||
this.leftPane.setParent(this);
|
||||
this.leftPane.afterCompose();
|
||||
this.leftPane
|
||||
.setGoingDownInLastArrowCommand(goingDownInLastArrowCommand);
|
||||
removePreviousGanntPanel();
|
||||
this.ganttPanel = new GanttPanel(this.diagramGraph,
|
||||
taskEditFormComposer);
|
||||
appendChild(ganttPanel);
|
||||
registerListeners();
|
||||
ganttPanel.setParent(this);
|
||||
ganttPanel.afterCompose();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
package org.zkoss.ganttz.extensions;
|
||||
|
||||
import org.zkoss.ganttz.adapters.PlannerConfiguration;
|
||||
|
||||
|
||||
/**
|
||||
* A facade for operations allowed to extensions <br />
|
||||
|
|
@ -9,4 +11,6 @@ public interface IContext<T> {
|
|||
|
||||
void add(T domainObject);
|
||||
|
||||
void reload(PlannerConfiguration<?> configuration);
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue