commit
a03ce069d2
12 changed files with 855 additions and 773 deletions
29
NEWS.rst
29
NEWS.rst
|
|
@ -24,28 +24,33 @@ Thanks to all the contributors to this new version:
|
||||||
Changes
|
Changes
|
||||||
~~~~~~~
|
~~~~~~~
|
||||||
|
|
||||||
* Update MPXJ
|
|
||||||
* Update Maven Gettext Plugin
|
* Update Maven Gettext Plugin
|
||||||
* Update Maven Compiler Plugin
|
* Update Maven Compiler Plugin
|
||||||
* Update Maven War Plugin
|
* Update Maven War Plugin
|
||||||
* Update Maven Surfire Plugin
|
* Update Maven Surfire Plugin
|
||||||
* Update Bonecp
|
|
||||||
* Update Slf4j API
|
|
||||||
* Update Slf4j Simple
|
|
||||||
* Update Guava
|
|
||||||
* Update Maven Cobertura Plugin
|
* Update Maven Cobertura Plugin
|
||||||
* Update Maven Liquibase Plugin
|
* Update Maven Liquibase Plugin
|
||||||
* Update Liquibase Core
|
|
||||||
* Update Jackson
|
* Update Slf4j API
|
||||||
* Update LibrePlan version to 1.6.0
|
* Update Slf4j Simple
|
||||||
* Update Javax Servlet
|
* Update Log4j
|
||||||
* Update Jfree
|
* Update Slf4j
|
||||||
|
|
||||||
* Update Commons Lang
|
* Update Commons Lang
|
||||||
* Update Commons Math
|
* Update Commons Math
|
||||||
|
* Update Commons Collections
|
||||||
|
|
||||||
|
* Update MPXJ
|
||||||
|
* Update Bonecp
|
||||||
|
* Update Guava
|
||||||
|
* Update Liquibase Core
|
||||||
|
* Update Jackson
|
||||||
|
* Update Javax Servlet
|
||||||
|
* Update Jfree
|
||||||
* Update JGraphT
|
* Update JGraphT
|
||||||
* Update DBUnit
|
* Update DBUnit
|
||||||
* Update Log4j
|
|
||||||
* Update JodaTime
|
* Update LibrePlan version to 1.6.0
|
||||||
|
|
||||||
* Remove Ezmorph
|
* Remove Ezmorph
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -120,8 +120,8 @@
|
||||||
<artifactId>commons-lang3</artifactId>
|
<artifactId>commons-lang3</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>commons-collections</groupId>
|
<groupId>org.apache.commons</groupId>
|
||||||
<artifactId>commons-collections</artifactId>
|
<artifactId>commons-collections4</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- ZK -->
|
<!-- ZK -->
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.apache.commons.collections.CollectionUtils;
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
import org.joda.time.LocalDate;
|
import org.joda.time.LocalDate;
|
||||||
import org.zkoss.ganttz.adapters.DomainDependency;
|
import org.zkoss.ganttz.adapters.DomainDependency;
|
||||||
import org.zkoss.ganttz.adapters.IAdapterToTaskFundamentalProperties;
|
import org.zkoss.ganttz.adapters.IAdapterToTaskFundamentalProperties;
|
||||||
|
|
@ -65,23 +65,25 @@ import org.zkoss.zul.Window;
|
||||||
public class FunctionalityExposedForExtensions<T> implements IContext<T> {
|
public class FunctionalityExposedForExtensions<T> implements IContext<T> {
|
||||||
|
|
||||||
private static class OneToOneMapper<T> implements IDomainAndBeansMapper<T> {
|
private static class OneToOneMapper<T> implements IDomainAndBeansMapper<T> {
|
||||||
private Map<T, Task> fromDomainToTask = new HashMap<T, Task>();
|
|
||||||
|
|
||||||
private Map<Task, T> fromTaskToDomain = new HashMap<Task, T>();
|
private Map<T, Task> fromDomainToTask = new HashMap<>();
|
||||||
|
|
||||||
private Map<Task, TaskContainer> fromTaskToParent = new HashMap<Task, TaskContainer>();
|
private Map<Task, T> fromTaskToDomain = new HashMap<>();
|
||||||
|
|
||||||
private List<Task> topLevel = new ArrayList<Task>();
|
private Map<Task, TaskContainer> fromTaskToParent = new HashMap<>();
|
||||||
|
|
||||||
|
private List<Task> topLevel = new ArrayList<>();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Task findAssociatedBean(T domainObject)
|
public Task findAssociatedBean(T domainObject) throws IllegalArgumentException {
|
||||||
throws IllegalArgumentException {
|
if ( domainObject == null ) {
|
||||||
if (domainObject == null) {
|
|
||||||
throw new IllegalArgumentException("domainObject is null");
|
throw new IllegalArgumentException("domainObject is null");
|
||||||
}
|
}
|
||||||
if (!fromDomainToTask.containsKey(domainObject)) {
|
|
||||||
|
if ( !fromDomainToTask.containsKey(domainObject) ) {
|
||||||
throw new IllegalArgumentException("not found " + domainObject);
|
throw new IllegalArgumentException("not found " + domainObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
return fromDomainToTask.get(domainObject);
|
return fromDomainToTask.get(domainObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -96,9 +98,9 @@ public class FunctionalityExposedForExtensions<T> implements IContext<T> {
|
||||||
fromDomainToTask.put(domainObject, task);
|
fromDomainToTask.put(domainObject, task);
|
||||||
fromTaskToDomain.put(task, domainObject);
|
fromTaskToDomain.put(task, domainObject);
|
||||||
|
|
||||||
if (position.isAppendToTop()) {
|
if ( position.isAppendToTop() ) {
|
||||||
topLevel.add(task);
|
topLevel.add(task);
|
||||||
} else if (position.isAtTop()) {
|
} else if ( position.isAtTop() ) {
|
||||||
topLevel.add(position.getInsertionPosition(), task);
|
topLevel.add(position.getInsertionPosition(), task);
|
||||||
} else {
|
} else {
|
||||||
fromTaskToParent.put(task, position.getParent());
|
fromTaskToParent.put(task, position.getParent());
|
||||||
|
|
@ -110,34 +112,39 @@ public class FunctionalityExposedForExtensions<T> implements IContext<T> {
|
||||||
fromDomainToTask.remove(domainObject);
|
fromDomainToTask.remove(domainObject);
|
||||||
fromTaskToDomain.remove(toBeRemoved);
|
fromTaskToDomain.remove(toBeRemoved);
|
||||||
TaskContainer parent = fromTaskToParent.get(toBeRemoved);
|
TaskContainer parent = fromTaskToParent.get(toBeRemoved);
|
||||||
if (parent != null) {
|
|
||||||
|
if ( parent != null ) {
|
||||||
parent.remove(toBeRemoved);
|
parent.remove(toBeRemoved);
|
||||||
}
|
}
|
||||||
|
|
||||||
fromTaskToParent.remove(toBeRemoved);
|
fromTaskToParent.remove(toBeRemoved);
|
||||||
topLevel.remove(toBeRemoved);
|
topLevel.remove(toBeRemoved);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public T findAssociatedDomainObject(Task task)
|
public T findAssociatedDomainObject(Task task) throws IllegalArgumentException {
|
||||||
throws IllegalArgumentException {
|
if ( task == null ) {
|
||||||
if (task == null) {
|
|
||||||
throw new IllegalArgumentException("taskBean is null");
|
throw new IllegalArgumentException("taskBean is null");
|
||||||
}
|
}
|
||||||
if (!fromTaskToDomain.containsKey(task)) {
|
|
||||||
|
if ( !fromTaskToDomain.containsKey(task) ) {
|
||||||
throw new IllegalArgumentException();
|
throw new IllegalArgumentException();
|
||||||
}
|
}
|
||||||
|
|
||||||
return fromTaskToDomain.get(task);
|
return fromTaskToDomain.get(task);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Position findPositionFor(Task task) {
|
public Position findPositionFor(Task task) {
|
||||||
List<TaskContainer> ancestors = ancestorsOf(task);
|
List<TaskContainer> ancestors = ancestorsOf(task);
|
||||||
if (ancestors.isEmpty()) {
|
|
||||||
|
if ( ancestors.isEmpty() ) {
|
||||||
return Position.createAtTopPosition(topLevel.indexOf(task));
|
return Position.createAtTopPosition(topLevel.indexOf(task));
|
||||||
}
|
}
|
||||||
|
|
||||||
TaskContainer parent = ancestors.get(0);
|
TaskContainer parent = ancestors.get(0);
|
||||||
return Position.createPosition(ancestors, parent.getTasks()
|
|
||||||
.indexOf(task));
|
return Position.createPosition(ancestors, parent.getTasks().indexOf(task));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -146,18 +153,21 @@ public class FunctionalityExposedForExtensions<T> implements IContext<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<TaskContainer> ancestorsOf(Task task) {
|
private List<TaskContainer> ancestorsOf(Task task) {
|
||||||
ArrayList<TaskContainer> result = new ArrayList<TaskContainer>();
|
ArrayList<TaskContainer> result = new ArrayList<>();
|
||||||
TaskContainer taskContainer = fromTaskToParent.get(task);
|
TaskContainer taskContainer = fromTaskToParent.get(task);
|
||||||
|
|
||||||
while (taskContainer != null) {
|
while (taskContainer != null) {
|
||||||
result.add(taskContainer);
|
result.add(taskContainer);
|
||||||
taskContainer = fromTaskToParent.get(taskContainer);
|
taskContainer = fromTaskToParent.get(taskContainer);
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<? extends TaskContainer> getParents(Task task) {
|
public List<? extends TaskContainer> getParents(Task task) {
|
||||||
Position position = findPositionFor(task);
|
Position position = findPositionFor(task);
|
||||||
|
|
||||||
return position.getAncestors();
|
return position.getAncestors();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -171,39 +181,38 @@ public class FunctionalityExposedForExtensions<T> implements IContext<T> {
|
||||||
private TimeTracker timeTracker;
|
private TimeTracker timeTracker;
|
||||||
private final PlannerConfiguration<T> configuration;
|
private final PlannerConfiguration<T> configuration;
|
||||||
|
|
||||||
public FunctionalityExposedForExtensions(Planner planner,
|
public FunctionalityExposedForExtensions(
|
||||||
PlannerConfiguration<T> configuration,
|
Planner planner, PlannerConfiguration<T> configuration, GanttZKDiagramGraph diagramGraph) {
|
||||||
GanttZKDiagramGraph diagramGraph) {
|
|
||||||
this.planner = planner;
|
this.planner = planner;
|
||||||
this.configuration = configuration;
|
this.configuration = configuration;
|
||||||
this.adapter = configuration.getAdapter();
|
this.adapter = configuration.getAdapter();
|
||||||
this.navigator = configuration.getNavigator();
|
this.navigator = configuration.getNavigator();
|
||||||
this.diagramGraph = diagramGraph;
|
this.diagramGraph = diagramGraph;
|
||||||
|
|
||||||
final IDetailItemModificator firstLevelModificators = configuration
|
final IDetailItemModificator firstLevelModificators = configuration.getFirstLevelModificators();
|
||||||
.getFirstLevelModificators();
|
final IDetailItemModificator secondLevelModificators = configuration.getSecondLevelModificators();
|
||||||
final IDetailItemModificator secondLevelModificators = configuration
|
|
||||||
.getSecondLevelModificators();
|
|
||||||
|
|
||||||
Calendar calendarRightNow = Calendar.getInstance();
|
Calendar calendarRightNow = Calendar.getInstance();
|
||||||
LocalDate localDateRightNow = LocalDate.fromCalendarFields(calendarRightNow);
|
LocalDate localDateRightNow = LocalDate.fromCalendarFields(calendarRightNow);
|
||||||
LocalDate initDate = localDateRightNow.minusYears(1);
|
LocalDate initDate = localDateRightNow.minusYears(1);
|
||||||
LocalDate endDate = localDateRightNow.plusYears(5);
|
LocalDate endDate = localDateRightNow.plusYears(5);
|
||||||
|
|
||||||
this.timeTracker = new TimeTracker(new Interval(
|
this.timeTracker = new TimeTracker(
|
||||||
TimeTrackerState.year(initDate.getYear()),
|
new Interval(TimeTrackerState.year(initDate.getYear()), TimeTrackerState.year(endDate.getYear())),
|
||||||
TimeTrackerState.year(endDate.getYear())),
|
planner.getZoomLevel(),
|
||||||
planner.getZoomLevel(), firstLevelModificators,
|
firstLevelModificators,
|
||||||
secondLevelModificators, planner);
|
secondLevelModificators,
|
||||||
|
planner);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param insertionPosition
|
* @param insertionPosition the position in which to register the task at top level.
|
||||||
* the position in which to register the task at top level. It
|
* It can be <code>null</code>
|
||||||
* can be <code>null</code>
|
|
||||||
* @param accumulatedDependencies
|
* @param accumulatedDependencies
|
||||||
* @param data
|
* @param data
|
||||||
* @param parent
|
* @param parent
|
||||||
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private Task buildAndRegister(Position position, List<DomainDependency<T>> accumulatedDependencies, T data) {
|
private Task buildAndRegister(Position position, List<DomainDependency<T>> accumulatedDependencies, T data) {
|
||||||
|
|
@ -212,15 +221,17 @@ public class FunctionalityExposedForExtensions<T> implements IContext<T> {
|
||||||
|
|
||||||
final Task result = build(data);
|
final Task result = build(data);
|
||||||
|
|
||||||
if (!navigator.isLeaf(data)) {
|
if ( !navigator.isLeaf(data) ) {
|
||||||
TaskContainer container = (TaskContainer) result;
|
TaskContainer container = (TaskContainer) result;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
for (T child : navigator.getChildren(data)) {
|
for (T child : navigator.getChildren(data)) {
|
||||||
container.add(buildAndRegister(position.down(container, i),
|
container.add(buildAndRegister(position.down(container, i),
|
||||||
accumulatedDependencies, child));
|
accumulatedDependencies, child));
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
} else if (navigator.isMilestone(data)) {
|
|
||||||
|
} else if ( navigator.isMilestone(data) ) {
|
||||||
Milestone milestone = (Milestone) result;
|
Milestone milestone = (Milestone) result;
|
||||||
milestone.setOwner(position.getParent());
|
milestone.setOwner(position.getParent());
|
||||||
}
|
}
|
||||||
|
|
@ -230,6 +241,7 @@ public class FunctionalityExposedForExtensions<T> implements IContext<T> {
|
||||||
result.setShowingAdvances(planner.showAdvancesRightNow());
|
result.setShowingAdvances(planner.showAdvancesRightNow());
|
||||||
|
|
||||||
mapper.register(position, result, data);
|
mapper.register(position, result, data);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -245,14 +257,17 @@ public class FunctionalityExposedForExtensions<T> implements IContext<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void add(Position position, Collection<? extends T> domainObjects) {
|
public void add(Position position, Collection<? extends T> domainObjects) {
|
||||||
List<DomainDependency<T>> totalDependencies = new ArrayList<DomainDependency<T>>();
|
List<DomainDependency<T>> totalDependencies = new ArrayList<>();
|
||||||
List<Task> tasksCreated = new ArrayList<Task>();
|
List<Task> tasksCreated = new ArrayList<>();
|
||||||
|
|
||||||
for (T object : domainObjects) {
|
for (T object : domainObjects) {
|
||||||
Task task = buildAndRegister(position, totalDependencies, object);
|
Task task = buildAndRegister(position, totalDependencies, object);
|
||||||
tasksCreated.add(task);
|
tasksCreated.add(task);
|
||||||
}
|
}
|
||||||
|
|
||||||
updateTimeTracker(tasksCreated);
|
updateTimeTracker(tasksCreated);
|
||||||
if (position.isAppendToTop() || position.isAtTop()) {
|
|
||||||
|
if ( position.isAppendToTop() || position.isAtTop() ) {
|
||||||
this.diagramGraph.addTopLevel(tasksCreated);
|
this.diagramGraph.addTopLevel(tasksCreated);
|
||||||
} else {
|
} else {
|
||||||
this.diagramGraph.addTasks(tasksCreated);
|
this.diagramGraph.addTasks(tasksCreated);
|
||||||
|
|
@ -260,10 +275,11 @@ public class FunctionalityExposedForExtensions<T> implements IContext<T> {
|
||||||
parent.addAll(position.getInsertionPosition(), tasksCreated);
|
parent.addAll(position.getInsertionPosition(), tasksCreated);
|
||||||
this.diagramGraph.childrenAddedTo(parent);
|
this.diagramGraph.childrenAddedTo(parent);
|
||||||
}
|
}
|
||||||
for (Dependency dependency : DomainDependency.toDependencies(mapper,
|
|
||||||
totalDependencies)) {
|
for (Dependency dependency : DomainDependency.toDependencies(mapper, totalDependencies)) {
|
||||||
this.diagramGraph.addWithoutEnforcingConstraints(dependency);
|
this.diagramGraph.addWithoutEnforcingConstraints(dependency);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.diagramGraph.enforceAllRestrictions();
|
this.diagramGraph.enforceAllRestrictions();
|
||||||
this.planner.addTasks(position, tasksCreated);
|
this.planner.addTasks(position, tasksCreated);
|
||||||
}
|
}
|
||||||
|
|
@ -271,7 +287,8 @@ public class FunctionalityExposedForExtensions<T> implements IContext<T> {
|
||||||
private void updateTimeTracker(List<Task> tasksCreated) {
|
private void updateTimeTracker(List<Task> tasksCreated) {
|
||||||
for (Task task : tasksCreated) {
|
for (Task task : tasksCreated) {
|
||||||
timeTracker.trackPosition(task);
|
timeTracker.trackPosition(task);
|
||||||
if (task.isContainer()) {
|
|
||||||
|
if ( task.isContainer() ) {
|
||||||
TaskContainer container = (TaskContainer) task;
|
TaskContainer container = (TaskContainer) task;
|
||||||
updateTimeTracker(container.getTasks());
|
updateTimeTracker(container.getTasks());
|
||||||
}
|
}
|
||||||
|
|
@ -310,6 +327,7 @@ public class FunctionalityExposedForExtensions<T> implements IContext<T> {
|
||||||
diagramGraph.remove(task);
|
diagramGraph.remove(task);
|
||||||
task.removed();
|
task.removed();
|
||||||
planner.removeTask(task);
|
planner.removeTask(task);
|
||||||
|
|
||||||
return position;
|
return position;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -330,20 +348,19 @@ public class FunctionalityExposedForExtensions<T> implements IContext<T> {
|
||||||
|
|
||||||
private DomainDependency<T> toDomainDependency(Dependency bean) {
|
private DomainDependency<T> toDomainDependency(Dependency bean) {
|
||||||
T source = mapper.findAssociatedDomainObject(bean.getSource());
|
T source = mapper.findAssociatedDomainObject(bean.getSource());
|
||||||
T destination = mapper
|
T destination = mapper.findAssociatedDomainObject(bean.getDestination());
|
||||||
.findAssociatedDomainObject(bean.getDestination());
|
DomainDependency<T> dep = DomainDependency.createDependency(source, destination, bean.getType());
|
||||||
DomainDependency<T> dep = DomainDependency.createDependency(source,
|
|
||||||
destination, bean.getType());
|
|
||||||
return dep;
|
return dep;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addDependency(Dependency dependency) {
|
public void addDependency(Dependency dependency) {
|
||||||
if (!canAddDependency(dependency)) {
|
if ( !canAddDependency(dependency) ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
diagramGraph.add(dependency);
|
diagramGraph.add(dependency);
|
||||||
getDependencyList().addDependencyComponent(
|
getDependencyList().addDependencyComponent(getTaskList().asDependencyComponent(dependency));
|
||||||
getTaskList().asDependencyComponent(dependency));
|
|
||||||
adapter.addDependency(toDomainDependency(dependency));
|
adapter.addDependency(toDomainDependency(dependency));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -352,8 +369,7 @@ public class FunctionalityExposedForExtensions<T> implements IContext<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean canAddDependency(Dependency dependency) {
|
private boolean canAddDependency(Dependency dependency) {
|
||||||
return diagramGraph.canAddDependency(dependency)
|
return diagramGraph.canAddDependency(dependency) && adapter.canAddDependency(toDomainDependency(dependency));
|
||||||
&& adapter.canAddDependency(toDomainDependency(dependency));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private DependencyList getDependencyList() {
|
private DependencyList getDependencyList() {
|
||||||
|
|
@ -370,18 +386,22 @@ public class FunctionalityExposedForExtensions<T> implements IContext<T> {
|
||||||
* Substitutes the dependency for a new one with the same source and
|
* Substitutes the dependency for a new one with the same source and
|
||||||
* destination but with the specified type. If the new dependency cannot be
|
* destination but with the specified type. If the new dependency cannot be
|
||||||
* added, the old one remains.
|
* added, the old one remains.
|
||||||
|
*
|
||||||
* @param dependency
|
* @param dependency
|
||||||
* @param type
|
* @param type
|
||||||
* the new type
|
* the new type
|
||||||
|
*
|
||||||
* @return true only if the new dependency can be added.
|
* @return true only if the new dependency can be added.
|
||||||
*/
|
*/
|
||||||
public boolean changeType(Dependency dependency, DependencyType type) {
|
public boolean changeType(Dependency dependency, DependencyType type) {
|
||||||
Dependency newDependency = dependency.createWithType(type);
|
Dependency newDependency = dependency.createWithType(type);
|
||||||
boolean canAddDependency = diagramGraph.canAddDependency(newDependency);
|
boolean canAddDependency = diagramGraph.canAddDependency(newDependency);
|
||||||
if (canAddDependency) {
|
|
||||||
|
if ( canAddDependency ) {
|
||||||
removeDependency(dependency);
|
removeDependency(dependency);
|
||||||
addDependency(newDependency);
|
addDependency(newDependency);
|
||||||
}
|
}
|
||||||
|
|
||||||
return canAddDependency;
|
return canAddDependency;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -398,19 +418,20 @@ public class FunctionalityExposedForExtensions<T> implements IContext<T> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void showCriticalPath() {
|
public void showCriticalPath() {
|
||||||
CriticalPathCalculator<Task, Dependency> criticalPathCalculator = CriticalPathCalculator
|
CriticalPathCalculator<Task, Dependency> criticalPathCalculator =
|
||||||
.create(configuration.isDependenciesConstraintsHavePriority());
|
CriticalPathCalculator.create(configuration.isDependenciesConstraintsHavePriority());
|
||||||
|
|
||||||
|
List<Task> criticalPath = criticalPathCalculator.calculateCriticalPath(diagramGraph);
|
||||||
|
|
||||||
List<Task> criticalPath = criticalPathCalculator
|
|
||||||
.calculateCriticalPath(diagramGraph);
|
|
||||||
for (Task task : diagramGraph.getTasks()) {
|
for (Task task : diagramGraph.getTasks()) {
|
||||||
task.setInCriticalPath(isInCriticalPath(criticalPath, task));
|
task.setInCriticalPath(isInCriticalPath(criticalPath, task));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isInCriticalPath(List<Task> criticalPath, Task task) {
|
private boolean isInCriticalPath(List<Task> criticalPath, Task task) {
|
||||||
if (task.isContainer()) {
|
if ( task.isContainer() ) {
|
||||||
List<Task> allTaskLeafs = ((TaskContainer) task).getAllTaskLeafs();
|
List<Task> allTaskLeafs = task.getAllTaskLeafs();
|
||||||
|
|
||||||
return CollectionUtils.containsAny(criticalPath, allTaskLeafs);
|
return CollectionUtils.containsAny(criticalPath, allTaskLeafs);
|
||||||
} else {
|
} else {
|
||||||
return criticalPath.contains(task);
|
return criticalPath.contains(task);
|
||||||
|
|
@ -419,13 +440,15 @@ public class FunctionalityExposedForExtensions<T> implements IContext<T> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<T> getCriticalPath() {
|
public List<T> getCriticalPath() {
|
||||||
List<T> result = new ArrayList<T>();
|
List<T> result = new ArrayList<>();
|
||||||
CriticalPathCalculator<Task, Dependency> criticalPathCalculator = CriticalPathCalculator
|
|
||||||
.create(configuration.isDependenciesConstraintsHavePriority());
|
CriticalPathCalculator<Task, Dependency> criticalPathCalculator =
|
||||||
for (Task each : criticalPathCalculator
|
CriticalPathCalculator.create(configuration.isDependenciesConstraintsHavePriority());
|
||||||
.calculateCriticalPath(diagramGraph)) {
|
|
||||||
|
for (Task each : criticalPathCalculator.calculateCriticalPath(diagramGraph)) {
|
||||||
result.add(mapper.findAssociatedDomainObject(each));
|
result.add(mapper.findAssociatedDomainObject(each));
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -488,49 +511,56 @@ public class FunctionalityExposedForExtensions<T> implements IContext<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
private HashMap<String, String> buildParameters(Component parent) {
|
private HashMap<String, String> buildParameters(Component parent) {
|
||||||
HashMap<String, String> parameters = new HashMap<String, String>();
|
HashMap<String, String> parameters = new HashMap<>();
|
||||||
|
|
||||||
Checkbox expanded = (Checkbox) parent.getFellow("print_expanded");
|
Checkbox expanded = (Checkbox) parent.getFellow("print_expanded");
|
||||||
Checkbox resources = (Checkbox) parent.getFellow("print_resources");
|
Checkbox resources = (Checkbox) parent.getFellow("print_resources");
|
||||||
Checkbox labels = (Checkbox) parent.getFellow("print_labels");
|
Checkbox labels = (Checkbox) parent.getFellow("print_labels");
|
||||||
Checkbox advances = (Checkbox) parent.getFellow("print_advances");
|
Checkbox advances = (Checkbox) parent.getFellow("print_advances");
|
||||||
Checkbox reportedHours = (Checkbox) parent
|
Checkbox reportedHours = (Checkbox) parent.getFellow("print_reported_hours");
|
||||||
.getFellow("print_reported_hours");
|
Checkbox moneyCostBar = (Checkbox) parent.getFellow("print_money_cost_bar");
|
||||||
Checkbox moneyCostBar = (Checkbox) parent
|
|
||||||
.getFellow("print_money_cost_bar");
|
|
||||||
|
|
||||||
parameters.put("extension", ".png");
|
parameters.put("extension", ".png");
|
||||||
if (expanded.isChecked() == true) {
|
|
||||||
|
if ( expanded.isChecked() ) {
|
||||||
parameters.put("expanded", "all");
|
parameters.put("expanded", "all");
|
||||||
}
|
}
|
||||||
if (labels.isChecked() == true) {
|
|
||||||
|
if ( labels.isChecked() ) {
|
||||||
parameters.put("labels", "all");
|
parameters.put("labels", "all");
|
||||||
}
|
}
|
||||||
if (advances.isChecked() == true) {
|
|
||||||
|
if ( advances.isChecked() ) {
|
||||||
parameters.put("advances", "all");
|
parameters.put("advances", "all");
|
||||||
}
|
}
|
||||||
if (reportedHours.isChecked() == true) {
|
|
||||||
|
if ( reportedHours.isChecked() ) {
|
||||||
parameters.put("reportedHours", "all");
|
parameters.put("reportedHours", "all");
|
||||||
}
|
}
|
||||||
if (moneyCostBar.isChecked() == true) {
|
|
||||||
|
if ( moneyCostBar.isChecked() ) {
|
||||||
parameters.put("moneyCostBar", "all");
|
parameters.put("moneyCostBar", "all");
|
||||||
}
|
}
|
||||||
if (resources.isChecked() == true) {
|
|
||||||
|
if ( resources.isChecked() ) {
|
||||||
parameters.put("resources", "all");
|
parameters.put("resources", "all");
|
||||||
}
|
}
|
||||||
|
|
||||||
parameters.put("zoom", planner.getZoomLevel().getInternalName());
|
parameters.put("zoom", planner.getZoomLevel().getInternalName());
|
||||||
|
|
||||||
return parameters;
|
return parameters;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void print() {
|
public void print() {
|
||||||
if (!isPrintEnabled()) {
|
if ( !isPrintEnabled() ) {
|
||||||
throw new UnsupportedOperationException("print is not supported");
|
throw new UnsupportedOperationException("print is not supported");
|
||||||
}
|
}
|
||||||
|
|
||||||
final Window printProperties = (Window) Executions.createComponents(
|
final Window printProperties =
|
||||||
"/planner/print_configuration.zul", planner, null);
|
(Window) Executions.createComponents("/planner/print_configuration.zul", planner, null);
|
||||||
|
|
||||||
Button printButton = (Button) printProperties.getFellow("printButton");
|
Button printButton = (Button) printProperties.getFellow("printButton");
|
||||||
|
|
||||||
printButton.addEventListener(Events.ON_CLICK, new EventListener() {
|
printButton.addEventListener(Events.ON_CLICK, new EventListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onEvent(Event event) {
|
public void onEvent(Event event) {
|
||||||
|
|
@ -538,6 +568,7 @@ public class FunctionalityExposedForExtensions<T> implements IContext<T> {
|
||||||
configuration.print(buildParameters(printProperties),planner);
|
configuration.print(buildParameters(printProperties),planner);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
printButton.setParent(printProperties);
|
printButton.setParent(printProperties);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
@ -551,13 +582,14 @@ public class FunctionalityExposedForExtensions<T> implements IContext<T> {
|
||||||
@Override
|
@Override
|
||||||
public List<Task> getTasksOrderedByStartDate() {
|
public List<Task> getTasksOrderedByStartDate() {
|
||||||
List<Task> tasks = diagramGraph.getTasks();
|
List<Task> tasks = diagramGraph.getTasks();
|
||||||
Collections.sort(tasks, new Comparator<Task>() {
|
|
||||||
|
|
||||||
|
Collections.sort(tasks, new Comparator<Task>() {
|
||||||
@Override
|
@Override
|
||||||
public int compare(Task o1, Task o2) {
|
public int compare(Task o1, Task o2) {
|
||||||
return o1.getBeginDate().compareTo(o2.getBeginDate());
|
return o1.getBeginDate().compareTo(o2.getBeginDate());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return tasks;
|
return tasks;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -571,7 +603,7 @@ public class FunctionalityExposedForExtensions<T> implements IContext<T> {
|
||||||
|
|
||||||
private void setExpandAll(boolean expand, List<Task> tasks) {
|
private void setExpandAll(boolean expand, List<Task> tasks) {
|
||||||
for (Task task : tasks) {
|
for (Task task : tasks) {
|
||||||
if (task instanceof TaskContainer) {
|
if ( task instanceof TaskContainer ) {
|
||||||
((TaskContainer) task).setExpanded(expand);
|
((TaskContainer) task).setExpanded(expand);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ import java.util.Collections;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.apache.commons.collections.ComparatorUtils;
|
import org.apache.commons.collections4.comparators.NullComparator;
|
||||||
import org.apache.commons.lang3.Validate;
|
import org.apache.commons.lang3.Validate;
|
||||||
import org.joda.time.LocalDate;
|
import org.joda.time.LocalDate;
|
||||||
import org.zkoss.ganttz.data.GanttDate;
|
import org.zkoss.ganttz.data.GanttDate;
|
||||||
|
|
@ -35,15 +35,14 @@ import org.zkoss.ganttz.util.Interval;
|
||||||
public class LoadTimeLine {
|
public class LoadTimeLine {
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
private static final Comparator<GanttDate> nullSafeComparator =
|
private static final Comparator<GanttDate> nullSafeComparator = new NullComparator<>(false);
|
||||||
ComparatorUtils.nullLowComparator(ComparatorUtils.naturalComparator());
|
|
||||||
|
|
||||||
public static Comparator<LoadTimeLine> byStartAndEndDate() {
|
public static Comparator<LoadTimeLine> byStartAndEndDate() {
|
||||||
return new Comparator<LoadTimeLine>() {
|
return new Comparator<LoadTimeLine>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int compare(LoadTimeLine o1, LoadTimeLine o2) {
|
public int compare(LoadTimeLine o1, LoadTimeLine o2) {
|
||||||
int result = nullSafeComparator.compare(o1.getStartPeriod(), o2.getStartPeriod());
|
int result = nullSafeComparator.compare(o1.getStartPeriod(), o2.getStartPeriod());
|
||||||
|
|
||||||
if ( result == 0 ) {
|
if ( result == 0 ) {
|
||||||
return nullSafeComparator.compare(o1.getEndPeriod(), o2.getEndPeriod());
|
return nullSafeComparator.compare(o1.getEndPeriod(), o2.getEndPeriod());
|
||||||
}
|
}
|
||||||
|
|
@ -151,7 +150,7 @@ public class LoadTimeLine {
|
||||||
GanttDate end = null;
|
GanttDate end = null;
|
||||||
|
|
||||||
for (LoadTimeLine loadTimeLine : timeLines) {
|
for (LoadTimeLine loadTimeLine : timeLines) {
|
||||||
if( !loadTimeLine.isEmpty() ) {
|
if ( !loadTimeLine.isEmpty() ) {
|
||||||
Validate.notNull(loadTimeLine.getStart());
|
Validate.notNull(loadTimeLine.getStart());
|
||||||
start = min(start, loadTimeLine.getStart());
|
start = min(start, loadTimeLine.getStart());
|
||||||
Validate.notNull(loadTimeLine.getEnd());
|
Validate.notNull(loadTimeLine.getEnd());
|
||||||
|
|
|
||||||
|
|
@ -285,9 +285,8 @@ public class ResourcesLoadPanel extends HtmlMacroComponent {
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
private Separator getSeparator() {
|
private Separator getSeparator() {
|
||||||
List<Component> children = getToolbar().getChildren();
|
List<Component> children = getToolbar().getChildren();
|
||||||
Separator separator = ComponentsFinder.findComponentsOfType(Separator.class, children).get(0);
|
|
||||||
|
|
||||||
return separator;
|
return ComponentsFinder.findComponentsOfType(Separator.class, children).get(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Component getToolbar() {
|
private Component getToolbar() {
|
||||||
|
|
@ -364,12 +363,12 @@ public class ResourcesLoadPanel extends HtmlMacroComponent {
|
||||||
|
|
||||||
// Insert additional filters if any
|
// Insert additional filters if any
|
||||||
Component additionalFilter = getFirstOptionalFilter();
|
Component additionalFilter = getFirstOptionalFilter();
|
||||||
if( additionalFilter != null ) {
|
if ( additionalFilter != null ) {
|
||||||
getFellow("additionalFilterInsertionPoint1").appendChild(additionalFilter);
|
getFellow("additionalFilterInsertionPoint1").appendChild(additionalFilter);
|
||||||
}
|
}
|
||||||
|
|
||||||
additionalFilter = getSecondOptionalFilter();
|
additionalFilter = getSecondOptionalFilter();
|
||||||
if( additionalFilter != null ) {
|
if ( additionalFilter != null ) {
|
||||||
getFellow("additionalFilterInsertionPoint2").appendChild(additionalFilter);
|
getFellow("additionalFilterInsertionPoint2").appendChild(additionalFilter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -378,10 +377,10 @@ public class ResourcesLoadPanel extends HtmlMacroComponent {
|
||||||
listZoomLevels = (Listbox) getFellow("listZoomLevels");
|
listZoomLevels = (Listbox) getFellow("listZoomLevels");
|
||||||
listZoomLevels.setSelectedIndex(timeTracker.getDetailLevel().ordinal());
|
listZoomLevels.setSelectedIndex(timeTracker.getDetailLevel().ordinal());
|
||||||
|
|
||||||
if( paginationType == PaginationType.INTERNAL_PAGINATION && refreshNameFilter ) {
|
if ( paginationType == PaginationType.INTERNAL_PAGINATION && refreshNameFilter ) {
|
||||||
setupNameFilter();
|
setupNameFilter();
|
||||||
}
|
}
|
||||||
else if( paginationType == PaginationType.NONE ) {
|
else if ( paginationType == PaginationType.NONE ) {
|
||||||
getFellow("filterByNameCombo").setVisible(false);
|
getFellow("filterByNameCombo").setVisible(false);
|
||||||
getFellow("filterByNameLabel").setVisible(false);
|
getFellow("filterByNameLabel").setVisible(false);
|
||||||
}
|
}
|
||||||
|
|
@ -443,15 +442,15 @@ public class ResourcesLoadPanel extends HtmlMacroComponent {
|
||||||
filterByNameCombo.getChildren().clear();
|
filterByNameCombo.getChildren().clear();
|
||||||
int size = groups.size();
|
int size = groups.size();
|
||||||
|
|
||||||
if( size > numberOfGroupsByName ) {
|
if ( size > numberOfGroupsByName ) {
|
||||||
int position = 0;
|
int position = 0;
|
||||||
|
|
||||||
while(position < size) {
|
while (position < size) {
|
||||||
String firstName = groups.get(position).getConceptName();
|
String firstName = groups.get(position).getConceptName();
|
||||||
String lastName;
|
String lastName;
|
||||||
int newPosition = position + numberOfGroupsByName;
|
int newPosition = position + numberOfGroupsByName;
|
||||||
|
|
||||||
if( newPosition - 1 < size ) {
|
if ( newPosition - 1 < size ) {
|
||||||
lastName = groups.get(newPosition - 1).getConceptName();
|
lastName = groups.get(newPosition - 1).getConceptName();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
@ -483,7 +482,7 @@ public class ResourcesLoadPanel extends HtmlMacroComponent {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private List<LoadTimeLine> getGroupsToShow() {
|
private List<LoadTimeLine> getGroupsToShow() {
|
||||||
if( paginationType != PaginationType.INTERNAL_PAGINATION || filterByNamePosition == -1 ) {
|
if ( paginationType != PaginationType.INTERNAL_PAGINATION || filterByNamePosition == -1 ) {
|
||||||
return groups;
|
return groups;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -522,7 +521,7 @@ public class ResourcesLoadPanel extends HtmlMacroComponent {
|
||||||
LongOperationFeedback.execute(componentOnWhichGiveFeedback, new ILongOperation() {
|
LongOperationFeedback.execute(componentOnWhichGiveFeedback, new ILongOperation() {
|
||||||
@Override
|
@Override
|
||||||
public void doAction() {
|
public void doAction() {
|
||||||
if( paginationType == PaginationType.INTERNAL_PAGINATION ) {
|
if ( paginationType == PaginationType.INTERNAL_PAGINATION ) {
|
||||||
|
|
||||||
//if the pagination is internal, we are in charge of repainting the graph
|
//if the pagination is internal, we are in charge of repainting the graph
|
||||||
treeModel = createModelForTree();
|
treeModel = createModelForTree();
|
||||||
|
|
@ -563,6 +562,7 @@ public class ResourcesLoadPanel extends HtmlMacroComponent {
|
||||||
|
|
||||||
public void changeChartVisibility(boolean visible) {
|
public void changeChartVisibility(boolean visible) {
|
||||||
visibleChart = visible;
|
visibleChart = visible;
|
||||||
|
|
||||||
chartVisibilityListeners.fireEvent(new IListenerNotification<IChartVisibilityChangedListener>() {
|
chartVisibilityListeners.fireEvent(new IListenerNotification<IChartVisibilityChangedListener>() {
|
||||||
@Override
|
@Override
|
||||||
public void doNotify(IChartVisibilityChangedListener listener) {
|
public void doNotify(IChartVisibilityChangedListener listener) {
|
||||||
|
|
@ -588,7 +588,7 @@ public class ResourcesLoadPanel extends HtmlMacroComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Combobox getPaginationFilterCombobox() {
|
public Combobox getPaginationFilterCombobox() {
|
||||||
if( paginationType == PaginationType.EXTERNAL_PAGINATION ) {
|
if ( paginationType == PaginationType.EXTERNAL_PAGINATION ) {
|
||||||
return (Combobox) getFellow("filterByNameCombo");
|
return (Combobox) getFellow("filterByNameCombo");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ package org.libreplan.web.common.components;
|
||||||
|
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
|
|
||||||
import org.apache.commons.collections.comparators.BooleanComparator;
|
import org.apache.commons.collections4.comparators.BooleanComparator;
|
||||||
import org.apache.commons.lang.Validate;
|
import org.apache.commons.lang.Validate;
|
||||||
import org.libreplan.business.INewObject;
|
import org.libreplan.business.INewObject;
|
||||||
import org.zkoss.zk.ui.ext.AfterCompose;
|
import org.zkoss.zk.ui.ext.AfterCompose;
|
||||||
|
|
@ -45,13 +45,13 @@ import org.zkoss.zul.api.Grid;
|
||||||
* in order to work properly. They notify the {@link NewDataSortableGrid} in which are
|
* in order to work properly. They notify the {@link NewDataSortableGrid} in which are
|
||||||
* included when they are requested to be sorted.
|
* included when they are requested to be sorted.
|
||||||
*<p>
|
*<p>
|
||||||
|
*
|
||||||
* @author Javier Moran Rua <jmoran@igalia.com>
|
* @author Javier Moran Rua <jmoran@igalia.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class NewDataSortableColumn extends Column implements AfterCompose {
|
public class NewDataSortableColumn extends Column implements AfterCompose {
|
||||||
|
|
||||||
private static class NewObjectDecoratorComparator implements
|
private static class NewObjectDecoratorComparator implements Comparator<Object> {
|
||||||
Comparator<Object> {
|
|
||||||
private Comparator<Object> decoratedComparator;
|
private Comparator<Object> decoratedComparator;
|
||||||
|
|
||||||
public NewObjectDecoratorComparator(Comparator<Object> c) {
|
public NewObjectDecoratorComparator(Comparator<Object> c) {
|
||||||
|
|
@ -61,7 +61,7 @@ public class NewDataSortableColumn extends Column implements AfterCompose {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int compare(Object o1, Object o2) {
|
public int compare(Object o1, Object o2) {
|
||||||
if (!doComparingObjectsSupportInterface(o1, o2)) {
|
if ( !doComparingObjectsSupportInterface(o1, o2) ) {
|
||||||
return decoratedComparator.compare(o1, o2);
|
return decoratedComparator.compare(o1, o2);
|
||||||
} else {
|
} else {
|
||||||
return decorateBehaviour((INewObject) o1, (INewObject) o2);
|
return decorateBehaviour((INewObject) o1, (INewObject) o2);
|
||||||
|
|
@ -73,11 +73,11 @@ public class NewDataSortableColumn extends Column implements AfterCompose {
|
||||||
}
|
}
|
||||||
|
|
||||||
private int decorateBehaviour(INewObject o1, INewObject o2) {
|
private int decorateBehaviour(INewObject o1, INewObject o2) {
|
||||||
if (o1.isNewObject() == o2.isNewObject()) {
|
if ( o1.isNewObject() == o2.isNewObject() ) {
|
||||||
return decoratedComparator.compare(o1, o2);
|
return decoratedComparator.compare(o1, o2);
|
||||||
}
|
}
|
||||||
return BooleanComparator.getTrueFirstComparator().compare(
|
|
||||||
o1.isNewObject(), o2.isNewObject());
|
return BooleanComparator.getTrueFirstComparator().compare(o1.isNewObject(), o2.isNewObject());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -94,10 +94,11 @@ public class NewDataSortableColumn extends Column implements AfterCompose {
|
||||||
@Override
|
@Override
|
||||||
public boolean sort(boolean ascending) {
|
public boolean sort(boolean ascending) {
|
||||||
Grid grid = getGrid();
|
Grid grid = getGrid();
|
||||||
if (grid instanceof NewDataSortableGrid) {
|
if ( grid instanceof NewDataSortableGrid ) {
|
||||||
((NewDataSortableGrid) grid).setSortedColumn(this);
|
((NewDataSortableGrid) grid).setSortedColumn(this);
|
||||||
((NewDataSortableGrid) grid).setLastSortedColumnAscending(ascending);
|
((NewDataSortableGrid) grid).setLastSortedColumnAscending(ascending);
|
||||||
}
|
}
|
||||||
|
|
||||||
return super.sort(ascending);
|
return super.sort(ascending);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -105,11 +106,11 @@ public class NewDataSortableColumn extends Column implements AfterCompose {
|
||||||
public void afterCompose() {
|
public void afterCompose() {
|
||||||
Grid g = getGrid();
|
Grid g = getGrid();
|
||||||
|
|
||||||
if (g instanceof NewDataSortableGrid) {
|
if ( g instanceof NewDataSortableGrid ) {
|
||||||
NewDataSortableGrid castedGrid = (NewDataSortableGrid) g;
|
NewDataSortableGrid castedGrid = (NewDataSortableGrid) g;
|
||||||
|
|
||||||
// The first registered column is responsible for ordering
|
// The first registered column is responsible for ordering
|
||||||
if (castedGrid.getSortedColumn() == null) {
|
if ( castedGrid.getSortedColumn() == null ) {
|
||||||
markInGridAsColumnToOrder(castedGrid);
|
markInGridAsColumnToOrder(castedGrid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -118,12 +119,10 @@ public class NewDataSortableColumn extends Column implements AfterCompose {
|
||||||
private void markInGridAsColumnToOrder(NewDataSortableGrid parentGrid) {
|
private void markInGridAsColumnToOrder(NewDataSortableGrid parentGrid) {
|
||||||
parentGrid.setSortedColumn(this);
|
parentGrid.setSortedColumn(this);
|
||||||
|
|
||||||
if ("ascending".equals(getSortDirection())) {
|
if ( "ascending".equals(getSortDirection()) ) {
|
||||||
parentGrid.setLastSortedColumnAscending(
|
parentGrid.setLastSortedColumnAscending(true);
|
||||||
Boolean.TRUE.booleanValue());
|
} else if ( "descending".equals(getSortDirection()) ) {
|
||||||
} else if ("descending".equals(getSortDirection())) {
|
parentGrid.setLastSortedColumnAscending(false);
|
||||||
parentGrid.setLastSortedColumnAscending(
|
|
||||||
Boolean.FALSE.booleanValue());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -81,7 +81,7 @@ public class BandboxMultipleSearch extends HtmlMacroComponent {
|
||||||
|
|
||||||
private List selectedFilters = new ArrayList();
|
private List selectedFilters = new ArrayList();
|
||||||
|
|
||||||
private String selectedFiltersText = new String("");
|
private String selectedFiltersText = "";
|
||||||
|
|
||||||
public void afterCompose() {
|
public void afterCompose() {
|
||||||
super.afterCompose();
|
super.afterCompose();
|
||||||
|
|
@ -104,15 +104,17 @@ public class BandboxMultipleSearch extends HtmlMacroComponent {
|
||||||
@Override
|
@Override
|
||||||
public boolean service(AuRequest request, boolean everError) {
|
public boolean service(AuRequest request, boolean everError) {
|
||||||
String command = request.getCommand();
|
String command = request.getCommand();
|
||||||
if (command.equals("closeBandbox")) {
|
if ( command.equals("closeBandbox") ) {
|
||||||
pickElementFromListAndCloseBandbox();
|
pickElementFromListAndCloseBandbox();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
listbox.addEventListener(Events.ON_OK, new EventListener() {
|
|
||||||
|
|
||||||
|
listbox.addEventListener(Events.ON_OK, new EventListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onEvent(Event event) {
|
public void onEvent(Event event) {
|
||||||
pickElementFromListAndCloseBandbox();
|
pickElementFromListAndCloseBandbox();
|
||||||
|
|
@ -125,11 +127,10 @@ public class BandboxMultipleSearch extends HtmlMacroComponent {
|
||||||
* Search for matching elements while typing on bandbox
|
* Search for matching elements while typing on bandbox
|
||||||
*/
|
*/
|
||||||
bandbox.addEventListener("onChanging", new EventListener() {
|
bandbox.addEventListener("onChanging", new EventListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEvent(Event event) {
|
public void onEvent(Event event) {
|
||||||
final String inputText = ((InputEvent) event).getValue();
|
final String inputText = ((InputEvent) event).getValue();
|
||||||
if ((inputText == null) || (inputText.isEmpty())) {
|
if ( (inputText == null) || (inputText.isEmpty()) ) {
|
||||||
clear();
|
clear();
|
||||||
listbox.setSelectedIndex(0);
|
listbox.setSelectedIndex(0);
|
||||||
Events.postEvent(Events.ON_CHANGE, listbox, null);
|
Events.postEvent(Events.ON_CHANGE, listbox, null);
|
||||||
|
|
@ -145,7 +146,7 @@ public class BandboxMultipleSearch extends HtmlMacroComponent {
|
||||||
@Override
|
@Override
|
||||||
public void onEvent(Event event) {
|
public void onEvent(Event event) {
|
||||||
List<Listitem> items = listbox.getItems();
|
List<Listitem> items = listbox.getItems();
|
||||||
if (!items.isEmpty()) {
|
if ( !items.isEmpty() ) {
|
||||||
listbox.setSelectedIndex(0);
|
listbox.setSelectedIndex(0);
|
||||||
items.get(0).setFocus(true);
|
items.get(0).setFocus(true);
|
||||||
}
|
}
|
||||||
|
|
@ -154,20 +155,22 @@ public class BandboxMultipleSearch extends HtmlMacroComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initFinder() {
|
private void initFinder() {
|
||||||
if (multipleFiltersFinder != null) {
|
if ( multipleFiltersFinder != null ) {
|
||||||
if (listbox != null) {
|
|
||||||
|
if ( listbox != null ) {
|
||||||
initListbox();
|
initListbox();
|
||||||
}
|
}
|
||||||
if (bandbox != null) {
|
|
||||||
|
if ( bandbox != null ) {
|
||||||
initBandbox();
|
initBandbox();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void pickElementFromListAndCloseBandbox() {
|
private void pickElementFromListAndCloseBandbox() {
|
||||||
if(getSelectedItem() != null) {
|
if ( getSelectedItem() != null ) {
|
||||||
final Object object = getSelectedItem().getValue();
|
final Object object = getSelectedItem().getValue();
|
||||||
if (multipleFiltersFinder.isValidNewFilter(selectedFilters, object)) {
|
if ( multipleFiltersFinder.isValidNewFilter(selectedFilters, object) ) {
|
||||||
addSelectedElement(object);
|
addSelectedElement(object);
|
||||||
clearListbox();
|
clearListbox();
|
||||||
listbox.setModel(getSubModel());
|
listbox.setModel(getSubModel());
|
||||||
|
|
@ -186,16 +189,16 @@ public class BandboxMultipleSearch extends HtmlMacroComponent {
|
||||||
|
|
||||||
private void searchMultipleFilters(String inputText) {
|
private void searchMultipleFilters(String inputText) {
|
||||||
// update the filters list if some filter was deleted
|
// update the filters list if some filter was deleted
|
||||||
boolean someRemoved = multipleFiltersFinder.updateDeletedFilters(
|
boolean someRemoved = multipleFiltersFinder.updateDeletedFilters(selectedFilters, inputText);
|
||||||
selectedFilters, inputText);
|
|
||||||
if (someRemoved) {
|
if ( someRemoved ) {
|
||||||
updateselectedFiltersText();
|
updateselectedFiltersText();
|
||||||
updateBandboxValue();
|
updateBandboxValue();
|
||||||
} else {
|
} else {
|
||||||
// find the filter set to show it in the listbox
|
// find the filter set to show it in the listbox
|
||||||
String newFilterText = multipleFiltersFinder
|
String newFilterText = multipleFiltersFinder.getNewFilterText(inputText);
|
||||||
.getNewFilterText(inputText);
|
|
||||||
if ((newFilterText != null) && (!newFilterText.isEmpty())) {
|
if ( (newFilterText != null) && (!newFilterText.isEmpty()) ) {
|
||||||
listbox.setModel(getSubModel(newFilterText));
|
listbox.setModel(getSubModel(newFilterText));
|
||||||
listbox.invalidate();
|
listbox.invalidate();
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -213,7 +216,7 @@ public class BandboxMultipleSearch extends HtmlMacroComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addSelectedElement(Object obj) {
|
public void addSelectedElement(Object obj) {
|
||||||
if (obj != null) {
|
if ( obj != null ) {
|
||||||
addFilter(obj);
|
addFilter(obj);
|
||||||
updateselectedFiltersText();
|
updateselectedFiltersText();
|
||||||
updateBandboxValue();
|
updateBandboxValue();
|
||||||
|
|
@ -223,10 +226,11 @@ public class BandboxMultipleSearch extends HtmlMacroComponent {
|
||||||
private void addFilter(Object obj) {
|
private void addFilter(Object obj) {
|
||||||
FilterPair newFilter = (FilterPair) obj;
|
FilterPair newFilter = (FilterPair) obj;
|
||||||
for (FilterPair filter : (List<FilterPair>) selectedFilters) {
|
for (FilterPair filter : (List<FilterPair>) selectedFilters) {
|
||||||
if ((filter.getType().equals(newFilter.getType()))
|
|
||||||
&& (filter.getPattern().equals(newFilter.getPattern()))) {
|
if ( (filter.getType().equals(newFilter.getType())) &&
|
||||||
throw new WrongValueException(bandbox,
|
(filter.getPattern().equals(newFilter.getPattern())) ) {
|
||||||
_("filter already exists"));
|
|
||||||
|
throw new WrongValueException(bandbox, _("filter already exists"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
selectedFilters.add(obj);
|
selectedFilters.add(obj);
|
||||||
|
|
@ -234,13 +238,12 @@ public class BandboxMultipleSearch extends HtmlMacroComponent {
|
||||||
|
|
||||||
public List getSelectedElements() {
|
public List getSelectedElements() {
|
||||||
updateBandboxValue();
|
updateBandboxValue();
|
||||||
if (this.multipleFiltersFinder != null) {
|
if ( this.multipleFiltersFinder != null ) {
|
||||||
if (!multipleFiltersFinder.isValidFormatText(selectedFilters,
|
if ( !multipleFiltersFinder.isValidFormatText(selectedFilters, bandbox.getValue()) ) {
|
||||||
bandbox.getValue())) {
|
throw new WrongValueException(bandbox, _("format filters are not valid"));
|
||||||
throw new WrongValueException(bandbox,
|
|
||||||
_("format filters are not valid"));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return selectedFilters;
|
return selectedFilters;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -250,6 +253,7 @@ public class BandboxMultipleSearch extends HtmlMacroComponent {
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
private ListModel getSubModel() {
|
private ListModel getSubModel() {
|
||||||
List result = multipleFiltersFinder.getFirstTenFilters();
|
List result = multipleFiltersFinder.getFirstTenFilters();
|
||||||
|
|
||||||
return new SimpleListModel(result);
|
return new SimpleListModel(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -260,6 +264,7 @@ public class BandboxMultipleSearch extends HtmlMacroComponent {
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
private ListModel getSubModel(String inputText) {
|
private ListModel getSubModel(String inputText) {
|
||||||
List result = multipleFiltersFinder.getMatching(inputText);
|
List result = multipleFiltersFinder.getMatching(inputText);
|
||||||
|
|
||||||
return new SimpleListModel(result);
|
return new SimpleListModel(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -270,13 +275,13 @@ public class BandboxMultipleSearch extends HtmlMacroComponent {
|
||||||
public void addHeaders() {
|
public void addHeaders() {
|
||||||
clearHeaderIfNecessary();
|
clearHeaderIfNecessary();
|
||||||
final String[] headers = multipleFiltersFinder.getHeaders();
|
final String[] headers = multipleFiltersFinder.getHeaders();
|
||||||
for (int i = 0; i < headers.length; i++) {
|
for (String header : headers) {
|
||||||
listhead.getChildren().add(new Listheader(_(headers[i])));
|
listhead.getChildren().add(new Listheader(_(header)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void clearHeaderIfNecessary() {
|
private void clearHeaderIfNecessary() {
|
||||||
if (listhead.getChildren() != null) {
|
if ( listhead.getChildren() != null ) {
|
||||||
listhead.getChildren().clear();
|
listhead.getChildren().clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -295,12 +300,12 @@ public class BandboxMultipleSearch extends HtmlMacroComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
private Object getBean(String beanName) {
|
private Object getBean(String beanName) {
|
||||||
HttpServletRequest servletRequest = (HttpServletRequest) Executions
|
HttpServletRequest servletRequest = (HttpServletRequest) Executions.getCurrent().getNativeRequest();
|
||||||
.getCurrent().getNativeRequest();
|
ServletContext servletContext = servletRequest.getSession().getServletContext();
|
||||||
ServletContext servletContext = servletRequest.getSession()
|
|
||||||
.getServletContext();
|
WebApplicationContext webApplicationContext =
|
||||||
WebApplicationContext webApplicationContext = WebApplicationContextUtils
|
WebApplicationContextUtils.getWebApplicationContext(servletContext);
|
||||||
.getWebApplicationContext(servletContext);
|
|
||||||
return webApplicationContext.getBean(beanName);
|
return webApplicationContext.getBean(beanName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -309,8 +314,7 @@ public class BandboxMultipleSearch extends HtmlMacroComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFinder(String classname) {
|
public void setFinder(String classname) {
|
||||||
multipleFiltersFinder = (IMultipleFiltersFinder) getBean(StringUtils
|
multipleFiltersFinder = (IMultipleFiltersFinder) getBean(StringUtils.uncapitalize(classname));
|
||||||
.uncapitalize(classname));
|
|
||||||
initFinder();
|
initFinder();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -324,16 +328,17 @@ public class BandboxMultipleSearch extends HtmlMacroComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void clearListbox() {
|
private void clearListbox() {
|
||||||
List<Object> list = new ArrayList<Object>();
|
List<Object> list = new ArrayList<>();
|
||||||
listbox.setModel(new SimpleListModel(list));
|
listbox.setModel(new SimpleListModel(list));
|
||||||
listbox.invalidate();
|
listbox.invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Object> asList(ListModel model) {
|
public List<Object> asList(ListModel model) {
|
||||||
List<Object> result = new ArrayList<Object>();
|
List<Object> result = new ArrayList<>();
|
||||||
for (int i = 0; i < model.getSize(); i++) {
|
for (int i = 0; i < model.getSize(); i++) {
|
||||||
result.add(model.getElementAt(i));
|
result.add(model.getElementAt(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -358,14 +363,14 @@ public class BandboxMultipleSearch extends HtmlMacroComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateWidth() {
|
private void updateWidth() {
|
||||||
if ((widthBandbox != null) && (!widthBandbox.isEmpty())) {
|
if ( (widthBandbox != null) && (!widthBandbox.isEmpty()) ) {
|
||||||
this.bandbox.setWidth(widthBandbox);
|
this.bandbox.setWidth(widthBandbox);
|
||||||
this.listbox.setWidth(widthListbox);
|
this.listbox.setWidth(widthListbox);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateHeight() {
|
private void updateHeight() {
|
||||||
if ((heightBbox != null) && (!heightBbox.isEmpty())) {
|
if ( (heightBbox != null) && (!heightBbox.isEmpty()) ) {
|
||||||
this.bandbox.setHeight(heightBbox);
|
this.bandbox.setHeight(heightBbox);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -377,8 +382,7 @@ public class BandboxMultipleSearch extends HtmlMacroComponent {
|
||||||
private void updateselectedFiltersText() {
|
private void updateselectedFiltersText() {
|
||||||
selectedFiltersText = "";
|
selectedFiltersText = "";
|
||||||
for (Object obj : selectedFilters) {
|
for (Object obj : selectedFilters) {
|
||||||
selectedFiltersText = selectedFiltersText
|
selectedFiltersText = selectedFiltersText.concat(multipleFiltersFinder.objectToString(obj));
|
||||||
.concat(multipleFiltersFinder.objectToString(obj));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -392,9 +396,11 @@ public class BandboxMultipleSearch extends HtmlMacroComponent {
|
||||||
|
|
||||||
public void addSelectedElements(List<FilterPair> sessionFilterPairs) {
|
public void addSelectedElements(List<FilterPair> sessionFilterPairs) {
|
||||||
selectedFilters.clear();
|
selectedFilters.clear();
|
||||||
|
|
||||||
for (FilterPair filterPair : sessionFilterPairs) {
|
for (FilterPair filterPair : sessionFilterPairs) {
|
||||||
addFilter(filterPair);
|
addFilter(filterPair);
|
||||||
}
|
}
|
||||||
|
|
||||||
updateselectedFiltersText();
|
updateselectedFiltersText();
|
||||||
updateBandboxValue();
|
updateBandboxValue();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ import java.util.Collections;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.apache.commons.collections.comparators.BooleanComparator;
|
import org.apache.commons.collections4.comparators.BooleanComparator;
|
||||||
import org.libreplan.business.planner.limiting.entities.Gap.GapOnQueue;
|
import org.libreplan.business.planner.limiting.entities.Gap.GapOnQueue;
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -45,12 +45,12 @@ public class GapsMergeSort {
|
||||||
*/
|
*/
|
||||||
private static class CurrentGap implements Comparable<CurrentGap> {
|
private static class CurrentGap implements Comparable<CurrentGap> {
|
||||||
|
|
||||||
static List<CurrentGap> convert(
|
static List<CurrentGap> convert(Collection<? extends Iterator<GapOnQueue>> iterators) {
|
||||||
Collection<? extends Iterator<GapOnQueue>> iterators) {
|
List<CurrentGap> result = new ArrayList<>();
|
||||||
List<CurrentGap> result = new ArrayList<CurrentGap>();
|
|
||||||
for (Iterator<GapOnQueue> iterator : iterators) {
|
for (Iterator<GapOnQueue> iterator : iterators) {
|
||||||
result.add(new CurrentGap(iterator));
|
result.add(new CurrentGap(iterator));
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -65,6 +65,7 @@ public class GapsMergeSort {
|
||||||
public GapOnQueue consume() {
|
public GapOnQueue consume() {
|
||||||
GapOnQueue result = getCurrent();
|
GapOnQueue result = getCurrent();
|
||||||
current = null;
|
current = null;
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -73,12 +74,14 @@ public class GapsMergeSort {
|
||||||
}
|
}
|
||||||
|
|
||||||
private GapOnQueue getCurrent() {
|
private GapOnQueue getCurrent() {
|
||||||
if (hasFinished()) {
|
if ( hasFinished() ) {
|
||||||
throw new IllegalStateException("already finished");
|
throw new IllegalStateException("already finished");
|
||||||
}
|
}
|
||||||
if (current != null) {
|
|
||||||
|
if ( current != null ) {
|
||||||
return current;
|
return current;
|
||||||
}
|
}
|
||||||
|
|
||||||
return current = iterator.next();
|
return current = iterator.next();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -88,53 +91,61 @@ public class GapsMergeSort {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int compareTo(CurrentGap other) {
|
public int compareTo(CurrentGap other) {
|
||||||
int finishComparison = BooleanComparator.getFalseFirstComparator()
|
int finishComparison =
|
||||||
.compare(hasFinished(), other.hasFinished());
|
BooleanComparator.getFalseFirstComparator().compare(hasFinished(), other.hasFinished());
|
||||||
if (finishComparison != 0) {
|
|
||||||
|
if ( finishComparison != 0 ) {
|
||||||
return finishComparison;
|
return finishComparison;
|
||||||
} else if (hasFinished()) {
|
} else if ( hasFinished() ) {
|
||||||
assert other.hasFinished();
|
assert other.hasFinished();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
assert !hasFinished() && !other.hasFinished();
|
assert !hasFinished() && !other.hasFinished();
|
||||||
return getCurrent().getGap().compareTo(
|
|
||||||
other.getCurrent().getGap());
|
return getCurrent().getGap().compareTo(other.getCurrent().getGap());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<GapOnQueue> sort(
|
public static List<GapOnQueue> sort(List<List<GapOnQueue>> orderedListsOfGaps) {
|
||||||
List<List<GapOnQueue>> orderedListsOfGaps) {
|
|
||||||
|
|
||||||
List<GapOnQueue> result = new ArrayList<GapOnQueue>();
|
List<GapOnQueue> result = new ArrayList<>();
|
||||||
|
|
||||||
if (orderedListsOfGaps.isEmpty()) {
|
if ( orderedListsOfGaps.isEmpty() ) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
if (orderedListsOfGaps.size() == 1) {
|
|
||||||
|
if ( orderedListsOfGaps.size() == 1 ) {
|
||||||
return orderedListsOfGaps.get(0);
|
return orderedListsOfGaps.get(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<CurrentGap> currentGaps = CurrentGap.convert(iteratorsFor(orderedListsOfGaps));
|
List<CurrentGap> currentGaps = CurrentGap.convert(iteratorsFor(orderedListsOfGaps));
|
||||||
CurrentGap min = Collections.min(currentGaps);
|
CurrentGap min = Collections.min(currentGaps);
|
||||||
|
|
||||||
while (!currentGaps.isEmpty() && !min.hasFinished()) {
|
while (!currentGaps.isEmpty() && !min.hasFinished()) {
|
||||||
|
|
||||||
result.add(min.consume());
|
result.add(min.consume());
|
||||||
if (min.hasFinished()) {
|
|
||||||
|
if ( min.hasFinished() ) {
|
||||||
|
|
||||||
currentGaps.remove(min);
|
currentGaps.remove(min);
|
||||||
if (!currentGaps.isEmpty()) {
|
|
||||||
|
if ( !currentGaps.isEmpty() ) {
|
||||||
min = Collections.min(currentGaps);
|
min = Collections.min(currentGaps);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static List<Iterator<GapOnQueue>> iteratorsFor(
|
private static List<Iterator<GapOnQueue>> iteratorsFor(List<List<GapOnQueue>> orderedListsOfGaps) {
|
||||||
List<List<GapOnQueue>> orderedListsOfGaps) {
|
List<Iterator<GapOnQueue>> result = new ArrayList<>();
|
||||||
List<Iterator<GapOnQueue>> result = new ArrayList<Iterator<GapOnQueue>>();
|
|
||||||
for (List<GapOnQueue> each : orderedListsOfGaps) {
|
for (List<GapOnQueue> each : orderedListsOfGaps) {
|
||||||
result.add(each.iterator());
|
result.add(each.iterator());
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -49,14 +49,13 @@ public class ResourcesLoadTabCreator {
|
||||||
private final IOrderPlanningGate orderPlanningGate;
|
private final IOrderPlanningGate orderPlanningGate;
|
||||||
|
|
||||||
public static ITab create(Mode mode,
|
public static ITab create(Mode mode,
|
||||||
ResourceLoadController resourceLoadController,
|
ResourceLoadController resourceLoadController,
|
||||||
ResourceLoadController resourceLoadControllerGlobal,
|
ResourceLoadController resourceLoadControllerGlobal,
|
||||||
IOrderPlanningGate orderPlanningGate,
|
IOrderPlanningGate orderPlanningGate,
|
||||||
Component breadcrumbs) {
|
Component breadcrumbs) {
|
||||||
return new ResourcesLoadTabCreator(mode, resourceLoadController,
|
|
||||||
resourceLoadControllerGlobal, orderPlanningGate,
|
return new ResourcesLoadTabCreator(
|
||||||
breadcrumbs)
|
mode, resourceLoadController, resourceLoadControllerGlobal, orderPlanningGate, breadcrumbs).build();
|
||||||
.build();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private final Mode mode;
|
private final Mode mode;
|
||||||
|
|
@ -67,10 +66,11 @@ public class ResourcesLoadTabCreator {
|
||||||
private final Component breadcrumbs;
|
private final Component breadcrumbs;
|
||||||
|
|
||||||
private ResourcesLoadTabCreator(Mode mode,
|
private ResourcesLoadTabCreator(Mode mode,
|
||||||
ResourceLoadController resourceLoadController,
|
ResourceLoadController resourceLoadController,
|
||||||
ResourceLoadController resourceLoadControllerGlobal,
|
ResourceLoadController resourceLoadControllerGlobal,
|
||||||
IOrderPlanningGate orderPlanningGate,
|
IOrderPlanningGate orderPlanningGate,
|
||||||
Component breadcrumbs) {
|
Component breadcrumbs) {
|
||||||
|
|
||||||
this.mode = mode;
|
this.mode = mode;
|
||||||
this.resourceLoadController = resourceLoadController;
|
this.resourceLoadController = resourceLoadController;
|
||||||
this.resourceLoadControllerGlobal = resourceLoadControllerGlobal;
|
this.resourceLoadControllerGlobal = resourceLoadControllerGlobal;
|
||||||
|
|
@ -87,20 +87,16 @@ public class ResourcesLoadTabCreator {
|
||||||
|
|
||||||
private ITab createOrderResourcesLoadTab() {
|
private ITab createOrderResourcesLoadTab() {
|
||||||
IComponentCreator componentCreator = new IComponentCreator() {
|
IComponentCreator componentCreator = new IComponentCreator() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public org.zkoss.zk.ui.Component create(
|
public org.zkoss.zk.ui.Component create(org.zkoss.zk.ui.Component parent) {
|
||||||
org.zkoss.zk.ui.Component parent) {
|
Map<String, Object> arguments = new HashMap<>();
|
||||||
Map<String, Object> arguments = new HashMap<String, Object>();
|
|
||||||
arguments.put("resourceLoadController", resourceLoadController);
|
arguments.put("resourceLoadController", resourceLoadController);
|
||||||
return Executions.createComponents(
|
|
||||||
"/resourceload/_resourceloadfororder.zul", parent,
|
return Executions.createComponents("/resourceload/_resourceloadfororder.zul", parent, arguments);
|
||||||
arguments);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
return new CreatedOnDemandTab(_("Resources Load"), "order-load",
|
return new CreatedOnDemandTab(_("Resources Load"), "order-load", componentCreator) {
|
||||||
componentCreator) {
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void afterShowAction() {
|
protected void afterShowAction() {
|
||||||
|
|
@ -111,8 +107,7 @@ public class ResourcesLoadTabCreator {
|
||||||
breadcrumbs.appendChild(new Label(_("Resources Load")));
|
breadcrumbs.appendChild(new Label(_("Resources Load")));
|
||||||
breadcrumbs.appendChild(new Image(BREADCRUMBS_SEPARATOR));
|
breadcrumbs.appendChild(new Image(BREADCRUMBS_SEPARATOR));
|
||||||
Order currentOrder = mode.getOrder();
|
Order currentOrder = mode.getOrder();
|
||||||
resourceLoadController
|
resourceLoadController.setPlanningControllerEntryPoints(orderPlanningGate);
|
||||||
.setPlanningControllerEntryPoints(orderPlanningGate);
|
|
||||||
resourceLoadController.filterBy(currentOrder);
|
resourceLoadController.filterBy(currentOrder);
|
||||||
resourceLoadController.reload();
|
resourceLoadController.reload();
|
||||||
breadcrumbs.appendChild(new Label(currentOrder.getName()));
|
breadcrumbs.appendChild(new Label(currentOrder.getName()));
|
||||||
|
|
@ -123,37 +118,33 @@ public class ResourcesLoadTabCreator {
|
||||||
private ITab createGlobalResourcesLoadTab() {
|
private ITab createGlobalResourcesLoadTab() {
|
||||||
|
|
||||||
final IComponentCreator componentCreator = new IComponentCreator() {
|
final IComponentCreator componentCreator = new IComponentCreator() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public org.zkoss.zk.ui.Component create(
|
public org.zkoss.zk.ui.Component create(org.zkoss.zk.ui.Component parent) {
|
||||||
org.zkoss.zk.ui.Component parent) {
|
Map<String, Object> arguments = new HashMap<>();
|
||||||
Map<String, Object> arguments = new HashMap<String, Object>();
|
arguments.put("resourceLoadController", resourceLoadControllerGlobal);
|
||||||
arguments.put("resourceLoadController",
|
|
||||||
resourceLoadControllerGlobal);
|
return Executions.createComponents("/resourceload/_resourceload.zul", parent, arguments);
|
||||||
return Executions.createComponents(
|
|
||||||
"/resourceload/_resourceload.zul", parent, arguments);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
return new CreatedOnDemandTab(_("Resources Load"), "company-load",
|
return new CreatedOnDemandTab(_("Resources Load"), "company-load", componentCreator) {
|
||||||
componentCreator) {
|
|
||||||
@Override
|
@Override
|
||||||
protected void beforeShowAction() {
|
protected void beforeShowAction() {
|
||||||
if (!SecurityUtils
|
if ( !SecurityUtils.isSuperuserOrUserInRoles(UserRole.ROLE_PLANNING) ) {
|
||||||
.isSuperuserOrUserInRoles(UserRole.ROLE_PLANNING)) {
|
|
||||||
Util.sendForbiddenStatusCodeInHttpServletResponse();
|
Util.sendForbiddenStatusCodeInHttpServletResponse();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void afterShowAction() {
|
protected void afterShowAction() {
|
||||||
resourceLoadControllerGlobal
|
resourceLoadControllerGlobal.setPlanningControllerEntryPoints(orderPlanningGate);
|
||||||
.setPlanningControllerEntryPoints(orderPlanningGate);
|
|
||||||
resourceLoadControllerGlobal.filterBy(null);
|
resourceLoadControllerGlobal.filterBy(null);
|
||||||
resourceLoadControllerGlobal.reload();
|
resourceLoadControllerGlobal.reload();
|
||||||
if (breadcrumbs.getChildren() != null) {
|
|
||||||
|
if ( breadcrumbs.getChildren() != null ) {
|
||||||
breadcrumbs.getChildren().clear();
|
breadcrumbs.getChildren().clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
breadcrumbs.appendChild(new Image(BREADCRUMBS_SEPARATOR));
|
breadcrumbs.appendChild(new Image(BREADCRUMBS_SEPARATOR));
|
||||||
breadcrumbs.appendChild(new Label(getSchedulingLabel()));
|
breadcrumbs.appendChild(new Label(getSchedulingLabel()));
|
||||||
breadcrumbs.appendChild(new Image(BREADCRUMBS_SEPARATOR));
|
breadcrumbs.appendChild(new Image(BREADCRUMBS_SEPARATOR));
|
||||||
|
|
|
||||||
|
|
@ -116,7 +116,7 @@ public class ResourceLoadController implements Composer {
|
||||||
@Autowired
|
@Autowired
|
||||||
private IAdHocTransactionService transactionService;
|
private IAdHocTransactionService transactionService;
|
||||||
|
|
||||||
private List<IToolbarCommand> commands = new ArrayList<IToolbarCommand>();
|
private List<IToolbarCommand> commands = new ArrayList<>();
|
||||||
|
|
||||||
private PlanningState filterBy;
|
private PlanningState filterBy;
|
||||||
|
|
||||||
|
|
@ -177,25 +177,28 @@ public class ResourceLoadController implements Composer {
|
||||||
private List<VisualizationModifier> visualizationModifiers = null;
|
private List<VisualizationModifier> visualizationModifiers = null;
|
||||||
|
|
||||||
private List<VisualizationModifier> getVisualizationModifiers() {
|
private List<VisualizationModifier> getVisualizationModifiers() {
|
||||||
if (visualizationModifiers != null) {
|
if ( visualizationModifiers != null ) {
|
||||||
return visualizationModifiers;
|
return visualizationModifiers;
|
||||||
}
|
}
|
||||||
|
|
||||||
return visualizationModifiers = buildVisualizationModifiers();
|
return visualizationModifiers = buildVisualizationModifiers();
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<IListenerAdder> listenersToAdd = null;
|
private List<IListenerAdder> listenersToAdd = null;
|
||||||
|
|
||||||
private List<IListenerAdder> getListenersToAdd() {
|
private List<IListenerAdder> getListenersToAdd() {
|
||||||
if (listenersToAdd != null) {
|
if ( listenersToAdd != null ) {
|
||||||
return listenersToAdd;
|
return listenersToAdd;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<IListenerAdder> result = new ArrayList<>();
|
List<IListenerAdder> result = new ArrayList<>();
|
||||||
for (VisualizationModifier each : getVisualizationModifiers()) {
|
for (VisualizationModifier each : getVisualizationModifiers()) {
|
||||||
if (each instanceof IListenerAdder) {
|
if ( each instanceof IListenerAdder ) {
|
||||||
result.add((IListenerAdder) each);
|
result.add((IListenerAdder) each);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
result.add(new GoToScheduleListener());
|
result.add(new GoToScheduleListener());
|
||||||
|
|
||||||
return listenersToAdd = result;
|
return listenersToAdd = result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -209,10 +212,10 @@ public class ResourceLoadController implements Composer {
|
||||||
|
|
||||||
public IOnTransaction<Void> reload() {
|
public IOnTransaction<Void> reload() {
|
||||||
return new IOnTransaction<Void>() {
|
return new IOnTransaction<Void>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Void execute() {
|
public Void execute() {
|
||||||
reloadInTransaction();
|
reloadInTransaction();
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
@ -222,7 +225,9 @@ public class ResourceLoadController implements Composer {
|
||||||
for (VisualizationModifier each : getVisualizationModifiers()) {
|
for (VisualizationModifier each : getVisualizationModifiers()) {
|
||||||
each.checkDependencies();
|
each.checkDependencies();
|
||||||
}
|
}
|
||||||
|
|
||||||
ResourceLoadParameters parameters = new ResourceLoadParameters(filterBy);
|
ResourceLoadParameters parameters = new ResourceLoadParameters(filterBy);
|
||||||
|
|
||||||
for (VisualizationModifier each : getVisualizationModifiers()) {
|
for (VisualizationModifier each : getVisualizationModifiers()) {
|
||||||
each.applyToParameters(parameters);
|
each.applyToParameters(parameters);
|
||||||
}
|
}
|
||||||
|
|
@ -230,7 +235,8 @@ public class ResourceLoadController implements Composer {
|
||||||
ResourceLoadDisplayData dataToShow = resourceLoadModel.calculateDataToDisplay(parameters);
|
ResourceLoadDisplayData dataToShow = resourceLoadModel.calculateDataToDisplay(parameters);
|
||||||
|
|
||||||
timeTracker = buildTimeTracker(dataToShow);
|
timeTracker = buildTimeTracker(dataToShow);
|
||||||
if (resourcesLoadPanel == null) {
|
|
||||||
|
if ( resourcesLoadPanel == null ) {
|
||||||
resourcesLoadPanel = buildPanel(dataToShow);
|
resourcesLoadPanel = buildPanel(dataToShow);
|
||||||
listeners.addListeners(resourcesLoadPanel, getListenersToAdd());
|
listeners.addListeners(resourcesLoadPanel, getListenersToAdd());
|
||||||
parent.getChildren().clear();
|
parent.getChildren().clear();
|
||||||
|
|
@ -241,8 +247,7 @@ public class ResourceLoadController implements Composer {
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
resourcesLoadPanel.init(dataToShow.getLoadTimeLines(),
|
resourcesLoadPanel.init(dataToShow.getLoadTimeLines(), timeTracker);
|
||||||
timeTracker);
|
|
||||||
listeners.addListeners(resourcesLoadPanel, getListenersToAdd());
|
listeners.addListeners(resourcesLoadPanel, getListenersToAdd());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -256,25 +261,30 @@ public class ResourceLoadController implements Composer {
|
||||||
|
|
||||||
private TimeTracker buildTimeTracker(ResourceLoadDisplayData dataToShow) {
|
private TimeTracker buildTimeTracker(ResourceLoadDisplayData dataToShow) {
|
||||||
ZoomLevel zoomLevel = getZoomLevel(dataToShow);
|
ZoomLevel zoomLevel = getZoomLevel(dataToShow);
|
||||||
TimeTracker result = new TimeTracker(dataToShow.getViewInterval(),
|
|
||||||
zoomLevel, SeveralModificators.create(),
|
TimeTracker result = new TimeTracker(
|
||||||
SeveralModificators.create(createBankHolidaysMarker()),
|
dataToShow.getViewInterval(),
|
||||||
parent);
|
zoomLevel,
|
||||||
|
SeveralModificators.create(),
|
||||||
|
SeveralModificators.create(createBankHolidaysMarker()),
|
||||||
|
parent);
|
||||||
|
|
||||||
setupZoomLevelListener(result);
|
setupZoomLevelListener(result);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ZoomLevel getZoomLevel(ResourceLoadDisplayData dataToShow) {
|
private ZoomLevel getZoomLevel(ResourceLoadDisplayData dataToShow) {
|
||||||
if (filterBy != null) {
|
if ( filterBy != null ) {
|
||||||
Order order = filterBy.getOrder();
|
Order order = filterBy.getOrder();
|
||||||
ZoomLevel sessionZoom = FilterUtils.readZoomLevel(order);
|
ZoomLevel sessionZoom = FilterUtils.readZoomLevel(order);
|
||||||
if (sessionZoom != null) {
|
if ( sessionZoom != null ) {
|
||||||
return sessionZoom;
|
return sessionZoom;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ZoomLevel sessionZoom = FilterUtils.readZoomLevelResourcesLoad();
|
ZoomLevel sessionZoom = FilterUtils.readZoomLevelResourcesLoad();
|
||||||
if (sessionZoom != null) {
|
if ( sessionZoom != null ) {
|
||||||
return sessionZoom;
|
return sessionZoom;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -287,11 +297,10 @@ public class ResourceLoadController implements Composer {
|
||||||
}
|
}
|
||||||
|
|
||||||
private IZoomLevelChangedListener getSessionZoomLevelListener() {
|
private IZoomLevelChangedListener getSessionZoomLevelListener() {
|
||||||
IZoomLevelChangedListener zoomListener = new IZoomLevelChangedListener() {
|
return new IZoomLevelChangedListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void zoomLevelChanged(ZoomLevel detailLevel) {
|
public void zoomLevelChanged(ZoomLevel detailLevel) {
|
||||||
if (filterBy != null) {
|
if ( filterBy != null ) {
|
||||||
Order order = filterBy.getOrder();
|
Order order = filterBy.getOrder();
|
||||||
FilterUtils.writeZoomLevel(order, detailLevel);
|
FilterUtils.writeZoomLevel(order, detailLevel);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -299,12 +308,11 @@ public class ResourceLoadController implements Composer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
return zoomListener;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private ResourcesLoadPanel buildPanel(ResourceLoadDisplayData dataToShow) {
|
private ResourcesLoadPanel buildPanel(ResourceLoadDisplayData dataToShow) {
|
||||||
return new ResourcesLoadPanel(dataToShow.getLoadTimeLines(),
|
return new ResourcesLoadPanel(
|
||||||
|
dataToShow.getLoadTimeLines(),
|
||||||
timeTracker, parent,
|
timeTracker, parent,
|
||||||
resourceLoadModel.isExpandResourceLoadViewCharts(),
|
resourceLoadModel.isExpandResourceLoadViewCharts(),
|
||||||
PaginationType.EXTERNAL_PAGINATION);
|
PaginationType.EXTERNAL_PAGINATION);
|
||||||
|
|
@ -318,47 +326,48 @@ public class ResourceLoadController implements Composer {
|
||||||
|
|
||||||
// Only by dates and bandbox filter on global resources load
|
// Only by dates and bandbox filter on global resources load
|
||||||
if ( filterBy == null ) {
|
if ( filterBy == null ) {
|
||||||
LocalDate startDate = FilterUtils.readResourceLoadsStartDate();
|
LocalDate startDate = FilterUtils.readResourceLoadsStartDate();
|
||||||
LocalDate endDate = FilterUtils.readResourceLoadsEndDate();
|
LocalDate endDate = FilterUtils.readResourceLoadsEndDate();
|
||||||
|
|
||||||
User user = resourceLoadModel.getUser();
|
User user = resourceLoadModel.getUser();
|
||||||
|
|
||||||
// Calculate filter based on user preferences
|
// Calculate filter based on user preferences
|
||||||
if ( user != null ) {
|
if ( user != null ) {
|
||||||
if ( startDate == null && !FilterUtils.hasResourceLoadsStartDateChanged()) {
|
if ( startDate == null && !FilterUtils.hasResourceLoadsStartDateChanged() ) {
|
||||||
if ( user.getResourcesLoadFilterPeriodSince() != null ) {
|
if ( user.getResourcesLoadFilterPeriodSince() != null ) {
|
||||||
startDate = new LocalDate().minusMonths(user.getResourcesLoadFilterPeriodSince());
|
startDate = new LocalDate().minusMonths(user.getResourcesLoadFilterPeriodSince());
|
||||||
} else {
|
} else {
|
||||||
// Default filter start
|
// Default filter start
|
||||||
startDate = new LocalDate().minusDays(1);
|
startDate = new LocalDate().minusDays(1);
|
||||||
}
|
|
||||||
}
|
|
||||||
if ( (endDate == null) && !FilterUtils.hasResourceLoadsEndDateChanged()
|
|
||||||
&& (user.getResourcesLoadFilterPeriodTo() != null) ) {
|
|
||||||
endDate = new LocalDate().plusMonths(user.getResourcesLoadFilterPeriodTo());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ( (endDate == null) &&
|
||||||
|
!FilterUtils.hasResourceLoadsEndDateChanged() &&
|
||||||
|
(user.getResourcesLoadFilterPeriodTo() != null) ) {
|
||||||
|
|
||||||
result.add(new ByDatesFilter(onChange, filterBy, startDate, endDate));
|
endDate = new LocalDate().plusMonths(user.getResourcesLoadFilterPeriodTo());
|
||||||
|
|
||||||
List<FilterPair> filterPairs = FilterUtils.readResourceLoadsBandbox();
|
|
||||||
if ( (filterPairs == null || filterPairs.isEmpty()) &&
|
|
||||||
user.getResourcesLoadFilterCriterion() != null ) {
|
|
||||||
filterPairs = new ArrayList<>();
|
|
||||||
filterPairs.add(new FilterPair(
|
|
||||||
ResourceAllocationFilterEnum.Criterion, user
|
|
||||||
.getResourcesLoadFilterCriterion()
|
|
||||||
.getFinderPattern(), user
|
|
||||||
.getResourcesLoadFilterCriterion()));
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
WorkersOrCriteriaBandbox bandbox = new WorkersOrCriteriaBandbox(onChange, filterBy, filterTypeChanger,
|
result.add(new ByDatesFilter(onChange, filterBy, startDate, endDate));
|
||||||
resourcesSearcher, filterPairs);
|
|
||||||
|
|
||||||
result.add(bandbox);
|
List<FilterPair> filterPairs = FilterUtils.readResourceLoadsBandbox();
|
||||||
result.add(new ByNamePaginator(onChange, filterBy, filterTypeChanger, bandbox));
|
if ( (filterPairs == null || filterPairs.isEmpty()) && user.getResourcesLoadFilterCriterion() != null ) {
|
||||||
|
filterPairs = new ArrayList<>();
|
||||||
|
filterPairs.add(new FilterPair(
|
||||||
|
ResourceAllocationFilterEnum.Criterion,
|
||||||
|
user.getResourcesLoadFilterCriterion().getFinderPattern(),
|
||||||
|
user.getResourcesLoadFilterCriterion()));
|
||||||
|
}
|
||||||
|
|
||||||
|
WorkersOrCriteriaBandbox bandbox =
|
||||||
|
new WorkersOrCriteriaBandbox(onChange, filterBy, filterTypeChanger, resourcesSearcher, filterPairs);
|
||||||
|
|
||||||
|
result.add(bandbox);
|
||||||
|
result.add(new ByNamePaginator(onChange, filterBy, filterTypeChanger, bandbox));
|
||||||
}
|
}
|
||||||
result.add(new LoadChart(onChange, filterBy));
|
result.add(new LoadChart(onChange, filterBy));
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -372,13 +381,14 @@ public class ResourceLoadController implements Composer {
|
||||||
@Override
|
@Override
|
||||||
public Object addAndReturnListener(ResourcesLoadPanel panel) {
|
public Object addAndReturnListener(ResourcesLoadPanel panel) {
|
||||||
ISeeScheduledOfListener listener = new ISeeScheduledOfListener() {
|
ISeeScheduledOfListener listener = new ISeeScheduledOfListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void seeScheduleOf(LoadTimeLine taskLine) {
|
public void seeScheduleOf(LoadTimeLine taskLine) {
|
||||||
onSeeScheduleOf(taskLine);
|
onSeeScheduleOf(taskLine);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
panel.addSeeScheduledOfListener(listener);
|
panel.addSeeScheduledOfListener(listener);
|
||||||
|
|
||||||
return listener;
|
return listener;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -389,26 +399,25 @@ public class ResourceLoadController implements Composer {
|
||||||
TaskElement task = (TaskElement) taskLine.getRole().getEntity();
|
TaskElement task = (TaskElement) taskLine.getRole().getEntity();
|
||||||
Order order = resourceLoadModel.getOrderByTask(task);
|
Order order = resourceLoadModel.getOrderByTask(task);
|
||||||
|
|
||||||
if (resourceLoadModel.userCanRead(order,
|
if ( resourceLoadModel.userCanRead(order, SecurityUtils.getSessionUserLoginName()) ) {
|
||||||
SecurityUtils.getSessionUserLoginName())) {
|
if ( order.isScheduled() ) {
|
||||||
if (order.isScheduled()) {
|
planningControllerEntryPoints.goToTaskResourceAllocation(order, task);
|
||||||
planningControllerEntryPoints.goToTaskResourceAllocation(order,
|
|
||||||
task);
|
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
Messagebox.show(_("The project has no scheduled elements"),
|
Messagebox.show(
|
||||||
_("Information"), Messagebox.OK,
|
_("The project has no scheduled elements"), _("Information"),
|
||||||
Messagebox.INFORMATION);
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
Messagebox
|
Messagebox.show(
|
||||||
.show(_("You don't have read access to this project"),
|
_("You don't have read access to this project"), _("Information"),
|
||||||
_("Information"), Messagebox.OK,
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
Messagebox.INFORMATION);
|
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
|
|
@ -451,8 +460,7 @@ public class ResourceLoadController implements Composer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class FilterTypeChanger extends VisualizationModifier
|
private static class FilterTypeChanger extends VisualizationModifier implements IListenerAdder {
|
||||||
implements IListenerAdder {
|
|
||||||
|
|
||||||
private boolean filterByResources = true;
|
private boolean filterByResources = true;
|
||||||
|
|
||||||
|
|
@ -472,7 +480,6 @@ public class ResourceLoadController implements Composer {
|
||||||
@Override
|
@Override
|
||||||
public Object addAndReturnListener(ResourcesLoadPanel panel) {
|
public Object addAndReturnListener(ResourcesLoadPanel panel) {
|
||||||
IFilterChangedListener listener = new IFilterChangedListener() {
|
IFilterChangedListener listener = new IFilterChangedListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void filterChanged(boolean newValue) {
|
public void filterChanged(boolean newValue) {
|
||||||
if ( filterByResources != newValue ) {
|
if ( filterByResources != newValue ) {
|
||||||
|
|
@ -481,7 +488,9 @@ public class ResourceLoadController implements Composer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
panel.addFilterListener(listener);
|
panel.addFilterListener(listener);
|
||||||
|
|
||||||
return listener;
|
return listener;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -509,12 +518,14 @@ public class ResourceLoadController implements Composer {
|
||||||
if ( isAppliedToOrder() ) {
|
if ( isAppliedToOrder() ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
panel.setFirstOptionalFilter(buildTimeFilter());
|
panel.setFirstOptionalFilter(buildTimeFilter());
|
||||||
}
|
}
|
||||||
|
|
||||||
private Hbox buildTimeFilter() {
|
private Hbox buildTimeFilter() {
|
||||||
startBox.setValue(asDate(startDateValue));
|
startBox.setValue(asDate(startDateValue));
|
||||||
startBox.setWidth("100px");
|
startBox.setWidth("100px");
|
||||||
|
|
||||||
startBox.addEventListener(Events.ON_CHANGE, new EventListener() {
|
startBox.addEventListener(Events.ON_CHANGE, new EventListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onEvent(Event event) {
|
public void onEvent(Event event) {
|
||||||
|
|
@ -529,6 +540,7 @@ public class ResourceLoadController implements Composer {
|
||||||
|
|
||||||
endBox.setValue(asDate(endDateValue));
|
endBox.setValue(asDate(endDateValue));
|
||||||
endBox.setWidth("100px");
|
endBox.setWidth("100px");
|
||||||
|
|
||||||
endBox.addEventListener(Events.ON_CHANGE, new EventListener() {
|
endBox.addEventListener(Events.ON_CHANGE, new EventListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onEvent(Event event) {
|
public void onEvent(Event event) {
|
||||||
|
|
@ -547,6 +559,7 @@ public class ResourceLoadController implements Composer {
|
||||||
hbox.appendChild(new Label(_("To") + ":"));
|
hbox.appendChild(new Label(_("To") + ":"));
|
||||||
hbox.appendChild(endBox);
|
hbox.appendChild(endBox);
|
||||||
hbox.setAlign("center");
|
hbox.setAlign("center");
|
||||||
|
|
||||||
return hbox;
|
return hbox;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -566,6 +579,7 @@ public class ResourceLoadController implements Composer {
|
||||||
|
|
||||||
DependingOnFiltering(Runnable onChange, PlanningState filterBy, FilterTypeChanger filterType) {
|
DependingOnFiltering(Runnable onChange, PlanningState filterBy, FilterTypeChanger filterType) {
|
||||||
super(onChange, filterBy);
|
super(onChange, filterBy);
|
||||||
|
|
||||||
this.filterType = filterType;
|
this.filterType = filterType;
|
||||||
this.filteringByResource = filterType.isFilterByResources();
|
this.filteringByResource = filterType.isFilterByResources();
|
||||||
}
|
}
|
||||||
|
|
@ -601,6 +615,7 @@ public class ResourceLoadController implements Composer {
|
||||||
FilterTypeChanger filterType,
|
FilterTypeChanger filterType,
|
||||||
IResourcesSearcher resourcesSearcher,
|
IResourcesSearcher resourcesSearcher,
|
||||||
List<FilterPair> selectedFilters) {
|
List<FilterPair> selectedFilters) {
|
||||||
|
|
||||||
super(onChange, filterBy, filterType);
|
super(onChange, filterBy, filterType);
|
||||||
this.resourcesSearcher = resourcesSearcher;
|
this.resourcesSearcher = resourcesSearcher;
|
||||||
|
|
||||||
|
|
@ -619,6 +634,7 @@ public class ResourceLoadController implements Composer {
|
||||||
if ( isAppliedToOrder() ) {
|
if ( isAppliedToOrder() ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
panel.setSecondOptionalFilter(buildBandboxFilterer());
|
panel.setSecondOptionalFilter(buildBandboxFilterer());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -633,8 +649,7 @@ public class ResourceLoadController implements Composer {
|
||||||
@Override
|
@Override
|
||||||
public void onEvent(Event event) throws Exception {
|
public void onEvent(Event event) throws Exception {
|
||||||
entitiesSelected = getSelected();
|
entitiesSelected = getSelected();
|
||||||
FilterUtils.writeResourceLoadsParameters(bandBox
|
FilterUtils.writeResourceLoadsParameters(bandBox.getSelectedElements());
|
||||||
.getSelectedElements());
|
|
||||||
notifyChange();
|
notifyChange();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -651,6 +666,7 @@ public class ResourceLoadController implements Composer {
|
||||||
|
|
||||||
private Label getLabel() {
|
private Label getLabel() {
|
||||||
updateLabelValue();
|
updateLabelValue();
|
||||||
|
|
||||||
return label;
|
return label;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -675,6 +691,7 @@ public class ResourceLoadController implements Composer {
|
||||||
if ( isAppliedToOrder() ) {
|
if ( isAppliedToOrder() ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
entitiesSelected = null;
|
entitiesSelected = null;
|
||||||
bandBox.setFinder(getFinderToUse());
|
bandBox.setFinder(getFinderToUse());
|
||||||
updateLabelValue();
|
updateLabelValue();
|
||||||
|
|
@ -704,7 +721,7 @@ public class ResourceLoadController implements Composer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !criteria.isEmpty() ) {
|
if ( !criteria.isEmpty()) {
|
||||||
resources.addAll(resourcesSearcher.searchBoth().byCriteria(criteria).execute());
|
resources.addAll(resourcesSearcher.searchBoth().byCriteria(criteria).execute());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -742,6 +759,7 @@ public class ResourceLoadController implements Composer {
|
||||||
PlanningState filterBy,
|
PlanningState filterBy,
|
||||||
FilterTypeChanger filterTypeChanger,
|
FilterTypeChanger filterTypeChanger,
|
||||||
WorkersOrCriteriaBandbox bandbox) {
|
WorkersOrCriteriaBandbox bandbox) {
|
||||||
|
|
||||||
super(onChange, filterBy, filterTypeChanger);
|
super(onChange, filterBy, filterTypeChanger);
|
||||||
this.bandbox = bandbox;
|
this.bandbox = bandbox;
|
||||||
this.currentPosition = initialPage();
|
this.currentPosition = initialPage();
|
||||||
|
|
@ -756,13 +774,15 @@ public class ResourceLoadController implements Composer {
|
||||||
IPaginationFilterChangedListener listener = new IPaginationFilterChangedListener() {
|
IPaginationFilterChangedListener listener = new IPaginationFilterChangedListener() {
|
||||||
@Override
|
@Override
|
||||||
public void filterChanged(int newPosition) {
|
public void filterChanged(int newPosition) {
|
||||||
if (currentPosition != newPosition) {
|
if ( currentPosition != newPosition ) {
|
||||||
currentPosition = newPosition;
|
currentPosition = newPosition;
|
||||||
notifyChange();
|
notifyChange();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
panel.addPaginationFilterListener(listener);
|
panel.addPaginationFilterListener(listener);
|
||||||
|
|
||||||
return listener;
|
return listener;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -787,6 +807,7 @@ public class ResourceLoadController implements Composer {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
void updateUI(ResourcesLoadPanel panel, ResourceLoadDisplayData generatedData) {
|
void updateUI(ResourcesLoadPanel panel, ResourceLoadDisplayData generatedData) {
|
||||||
|
|
||||||
panel.setInternalPaginationDisabled(bandbox.hasEntitiesSelected());
|
panel.setInternalPaginationDisabled(bandbox.hasEntitiesSelected());
|
||||||
Paginator<? extends BaseEntity> paginator = generatedData.getPaginator();
|
Paginator<? extends BaseEntity> paginator = generatedData.getPaginator();
|
||||||
List<? extends BaseEntity> newAllEntities = paginator.getAll();
|
List<? extends BaseEntity> newAllEntities = paginator.getAll();
|
||||||
|
|
@ -794,9 +815,10 @@ public class ResourceLoadController implements Composer {
|
||||||
if ( this.allEntitiesShown == null || !equivalent(this.allEntitiesShown, newAllEntities) ) {
|
if ( this.allEntitiesShown == null || !equivalent(this.allEntitiesShown, newAllEntities) ) {
|
||||||
this.currentPosition = initialPage();
|
this.currentPosition = initialPage();
|
||||||
this.allEntitiesShown = newAllEntities;
|
this.allEntitiesShown = newAllEntities;
|
||||||
updatePages(panel.getPaginationFilterCombobox(),
|
|
||||||
pagesByName(this.allEntitiesShown,
|
updatePages(
|
||||||
paginator.getPageSize()));
|
panel.getPaginationFilterCombobox(),
|
||||||
|
pagesByName(this.allEntitiesShown, paginator.getPageSize()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -804,12 +826,15 @@ public class ResourceLoadController implements Composer {
|
||||||
if ( a == null || b == null ) {
|
if ( a == null || b == null ) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( a.size() != b.size() ) {
|
if ( a.size() != b.size() ) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < a.size(); i++) {
|
for (int i = 0; i < a.size(); i++) {
|
||||||
BaseEntity aElement = a.get(i);
|
BaseEntity aElement = a.get(i);
|
||||||
BaseEntity bElement = b.get(i);
|
BaseEntity bElement = b.get(i);
|
||||||
|
|
||||||
if ( !ObjectUtils.equals(aElement.getId(), bElement.getId()) ) {
|
if ( !ObjectUtils.equals(aElement.getId(), bElement.getId()) ) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -822,6 +847,7 @@ public class ResourceLoadController implements Composer {
|
||||||
if ( filterByNameCombo == null ) {
|
if ( filterByNameCombo == null ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
filterByNameCombo.getChildren().clear();
|
filterByNameCombo.getChildren().clear();
|
||||||
|
|
||||||
Comboitem lastItem = new Comboitem();
|
Comboitem lastItem = new Comboitem();
|
||||||
|
|
@ -847,24 +873,21 @@ public class ResourceLoadController implements Composer {
|
||||||
if ( list.isEmpty() ) {
|
if ( list.isEmpty() ) {
|
||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
Object first = list.get(0);
|
Object first = list.get(0);
|
||||||
if ( first instanceof Resource ) {
|
if ( first instanceof Resource ) {
|
||||||
return pagesByName(as(Resource.class, list), pageSize,
|
return pagesByName(as(Resource.class, list), pageSize, new INameExtractor<Resource>() {
|
||||||
new INameExtractor<Resource>() {
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getNameOf(Resource resource) {
|
public String getNameOf(Resource resource) {
|
||||||
return resource.getName();
|
return resource.getName();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
|
||||||
return pagesByName(as(Criterion.class, list), pageSize,
|
|
||||||
new INameExtractor<Criterion>() {
|
|
||||||
|
|
||||||
|
} else {
|
||||||
|
return pagesByName(as(Criterion.class, list), pageSize, new INameExtractor<Criterion>() {
|
||||||
@Override
|
@Override
|
||||||
public String getNameOf(Criterion criterion) {
|
public String getNameOf(Criterion criterion) {
|
||||||
return criterion.getType().getName() + ": "
|
return criterion.getType().getName() + ": " + criterion.getName();
|
||||||
+ criterion.getName();
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -879,7 +902,6 @@ public class ResourceLoadController implements Composer {
|
||||||
|
|
||||||
for (int startPos = 0; startPos < elements.size(); startPos += pageSize) {
|
for (int startPos = 0; startPos < elements.size(); startPos += pageSize) {
|
||||||
int endPos = Math.min(startPos + pageSize - 1, elements.size() - 1);
|
int endPos = Math.min(startPos + pageSize - 1, elements.size() - 1);
|
||||||
|
|
||||||
String first = nameExtractor.getNameOf(elements.get(startPos));
|
String first = nameExtractor.getNameOf(elements.get(startPos));
|
||||||
String end = nameExtractor.getNameOf(elements.get(endPos));
|
String end = nameExtractor.getNameOf(elements.get(endPos));
|
||||||
Comboitem item = buildPageCombo(startPos, first, end);
|
Comboitem item = buildPageCombo(startPos, first, end);
|
||||||
|
|
@ -922,18 +944,18 @@ public class ResourceLoadController implements Composer {
|
||||||
}
|
}
|
||||||
|
|
||||||
void setup(ResourcesLoadPanel panel) {
|
void setup(ResourcesLoadPanel panel) {
|
||||||
panel.setLoadChart(buildChart(panel, emitter));
|
panel.setLoadChart(buildChart(emitter));
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object addAndReturnListener(ResourcesLoadPanel panel) {
|
public Object addAndReturnListener(ResourcesLoadPanel panel) {
|
||||||
IChartVisibilityChangedListener visibilityChangedListener = fillOnChartVisibilityChange();
|
IChartVisibilityChangedListener visibilityChangedListener = fillOnChartVisibilityChange();
|
||||||
panel.addChartVisibilityListener(visibilityChangedListener);
|
panel.addChartVisibilityListener(visibilityChangedListener);
|
||||||
|
|
||||||
return visibilityChangedListener;
|
return visibilityChangedListener;
|
||||||
}
|
}
|
||||||
|
|
||||||
private IChartVisibilityChangedListener fillOnChartVisibilityChange() {
|
private IChartVisibilityChangedListener fillOnChartVisibilityChange() {
|
||||||
IChartVisibilityChangedListener result = new IChartVisibilityChangedListener() {
|
return new IChartVisibilityChangedListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void chartVisibilityChanged(final boolean visible) {
|
public void chartVisibilityChanged(final boolean visible) {
|
||||||
if ( visible && loadChart != null ) {
|
if ( visible && loadChart != null ) {
|
||||||
|
|
@ -941,10 +963,9 @@ public class ResourceLoadController implements Composer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Tabbox buildChart(ResourcesLoadPanel resourcesLoadPanel, Emitter<Timeplot> timePlot) {
|
private Tabbox buildChart(Emitter<Timeplot> timePlot) {
|
||||||
Tabbox chartComponent = new Tabbox();
|
Tabbox chartComponent = new Tabbox();
|
||||||
chartComponent.setOrient("vertical");
|
chartComponent.setOrient("vertical");
|
||||||
chartComponent.setHeight("200px");
|
chartComponent.setHeight("200px");
|
||||||
|
|
@ -957,8 +978,7 @@ public class ResourceLoadController implements Composer {
|
||||||
Tabpanels chartTabpanels = new Tabpanels();
|
Tabpanels chartTabpanels = new Tabpanels();
|
||||||
Tabpanel loadChartPannel = new Tabpanel();
|
Tabpanel loadChartPannel = new Tabpanel();
|
||||||
// avoid adding Timeplot since it has some pending issues
|
// avoid adding Timeplot since it has some pending issues
|
||||||
CompanyPlanningModel.appendLoadChartAndLegend(loadChartPannel,
|
CompanyPlanningModel.appendLoadChartAndLegend(loadChartPannel, timePlot);
|
||||||
timePlot);
|
|
||||||
chartTabpanels.appendChild(loadChartPannel);
|
chartTabpanels.appendChild(loadChartPannel);
|
||||||
chartComponent.appendChild(chartTabpanels);
|
chartComponent.appendChild(chartTabpanels);
|
||||||
|
|
||||||
|
|
@ -975,9 +995,8 @@ public class ResourceLoadController implements Composer {
|
||||||
emitter.emit(newLoadChart);
|
emitter.emit(newLoadChart);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Timeplot buildLoadChart(ResourcesLoadPanel resourcesLoadPanel,
|
private Timeplot buildLoadChart(
|
||||||
ResourceLoadDisplayData generatedData,
|
ResourcesLoadPanel resourcesLoadPanel, ResourceLoadDisplayData generatedData, TimeTracker timeTracker) {
|
||||||
TimeTracker timeTracker) {
|
|
||||||
|
|
||||||
Timeplot chartLoadTimeplot = createEmptyTimeplot();
|
Timeplot chartLoadTimeplot = createEmptyTimeplot();
|
||||||
|
|
||||||
|
|
@ -993,14 +1012,13 @@ public class ResourceLoadController implements Composer {
|
||||||
}
|
}
|
||||||
|
|
||||||
private IZoomLevelChangedListener fillOnZoomChange(final ResourcesLoadPanel resourcesLoadPanel) {
|
private IZoomLevelChangedListener fillOnZoomChange(final ResourcesLoadPanel resourcesLoadPanel) {
|
||||||
|
return new IZoomLevelChangedListener() {
|
||||||
IZoomLevelChangedListener zoomListener = new IZoomLevelChangedListener() {
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void zoomLevelChanged(ZoomLevel detailLevel) {
|
public void zoomLevelChanged(ZoomLevel detailLevel) {
|
||||||
if ( loadChart == null ) {
|
if ( loadChart == null ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
loadChart.setZoomLevel(detailLevel);
|
loadChart.setZoomLevel(detailLevel);
|
||||||
|
|
||||||
if ( resourcesLoadPanel.isVisibleChart() ) {
|
if ( resourcesLoadPanel.isVisibleChart() ) {
|
||||||
|
|
@ -1009,8 +1027,6 @@ public class ResourceLoadController implements Composer {
|
||||||
adjustZoomPositionScroll(resourcesLoadPanel);
|
adjustZoomPositionScroll(resourcesLoadPanel);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
return zoomListener;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1021,6 +1037,7 @@ public class ResourceLoadController implements Composer {
|
||||||
private Timeplot createEmptyTimeplot() {
|
private Timeplot createEmptyTimeplot() {
|
||||||
Timeplot timeplot = new Timeplot();
|
Timeplot timeplot = new Timeplot();
|
||||||
timeplot.appendChild(new Plotinfo());
|
timeplot.appendChild(new Plotinfo());
|
||||||
|
|
||||||
return timeplot;
|
return timeplot;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1070,6 +1087,7 @@ public class ResourceLoadController implements Composer {
|
||||||
|
|
||||||
private BankHolidaysMarker createBankHolidaysMarker() {
|
private BankHolidaysMarker createBankHolidaysMarker() {
|
||||||
BaseCalendar defaultCalendar = configurationDAO.getConfiguration().getDefaultCalendar();
|
BaseCalendar defaultCalendar = configurationDAO.getConfiguration().getDefaultCalendar();
|
||||||
|
|
||||||
return BankHolidaysMarker.create(defaultCalendar);
|
return BankHolidaysMarker.create(defaultCalendar);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1078,15 +1096,12 @@ public class ResourceLoadController implements Composer {
|
||||||
}
|
}
|
||||||
|
|
||||||
PlanningState createPlanningState(final Order order) {
|
PlanningState createPlanningState(final Order order) {
|
||||||
return transactionService
|
return transactionService.runOnReadOnlyTransaction(new IOnTransaction<PlanningState>() {
|
||||||
.runOnReadOnlyTransaction(new IOnTransaction<PlanningState>() {
|
@Override
|
||||||
|
public PlanningState execute() {
|
||||||
@Override
|
return planningStateCreator.retrieveOrCreate(parent.getDesktop(), order);
|
||||||
public PlanningState execute() {
|
}
|
||||||
return planningStateCreator.retrieveOrCreate(
|
});
|
||||||
parent.getDesktop(), order);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPlanningControllerEntryPoints(IOrderPlanningGate planningControllerEntryPoints) {
|
public void setPlanningControllerEntryPoints(IOrderPlanningGate planningControllerEntryPoints) {
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
13
pom.xml
13
pom.xml
|
|
@ -388,15 +388,14 @@
|
||||||
<classifier>jdk15</classifier>
|
<classifier>jdk15</classifier>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- Commons collections -->
|
<!-- Commons Collections -->
|
||||||
<dependency>
|
<dependency>
|
||||||
|
<groupId>org.apache.commons</groupId>
|
||||||
|
<artifactId>commons-collections4</artifactId>
|
||||||
|
<version>4.1</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<groupId>commons-collections</groupId>
|
<!-- Commons Lang -->
|
||||||
<artifactId>commons-collections</artifactId>
|
|
||||||
<version>3.2.2</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- Commons lang -->
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.commons</groupId>
|
<groupId>org.apache.commons</groupId>
|
||||||
<artifactId>commons-lang3</artifactId>
|
<artifactId>commons-lang3</artifactId>
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue