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