[Bug #829] Don't let user change the type of a dependency between a Limiting Task and any other type of Task
FEA: ItEr69S04BugFixing
This commit is contained in:
parent
a83efe11f4
commit
3a1b50c2c2
4 changed files with 34 additions and 12 deletions
|
|
@ -161,4 +161,8 @@ public class DependencyComponent extends XulElement implements AfterCompose {
|
|||
&& destinationTask.equals(dependency.getDestination());
|
||||
}
|
||||
|
||||
public boolean hasLimitingTasks() {
|
||||
return (source.isLimiting() || destination.isLimiting());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -126,6 +126,10 @@ public class DependencyList extends XulElement implements AfterCompose {
|
|||
|
||||
private final FunctionalityExposedForExtensions<?> context;
|
||||
|
||||
private Menupopup contextMenu;
|
||||
|
||||
private Menupopup limitingContextMenu;
|
||||
|
||||
public DependencyList(FunctionalityExposedForExtensions<?> context) {
|
||||
this.context = context;
|
||||
}
|
||||
|
|
@ -154,7 +158,10 @@ public class DependencyList extends XulElement implements AfterCompose {
|
|||
}
|
||||
|
||||
private void addContextMenu(DependencyComponent dependencyComponent) {
|
||||
dependencyComponent.setContext(getContextMenu());
|
||||
Menupopup contextMenu = dependencyComponent.hasLimitingTasks() ?
|
||||
getLimitingContextMenu()
|
||||
: getContextMenu();
|
||||
dependencyComponent.setContext(contextMenu);
|
||||
}
|
||||
|
||||
private GanttPanel getGanttPanel() {
|
||||
|
|
@ -202,7 +209,24 @@ public class DependencyList extends XulElement implements AfterCompose {
|
|||
}
|
||||
}
|
||||
|
||||
private Menupopup contextMenu;
|
||||
private Menupopup getLimitingContextMenu() {
|
||||
if (limitingContextMenu == null) {
|
||||
MenuBuilder<DependencyComponent> contextMenuBuilder = MenuBuilder
|
||||
.on(getPage(), getDependencyComponents()).item(_("Erase"),
|
||||
"/common/img/ico_borrar.png",
|
||||
new ItemAction<DependencyComponent>() {
|
||||
@Override
|
||||
public void onEvent(
|
||||
final DependencyComponent choosen,
|
||||
Event event) {
|
||||
context
|
||||
.removeDependency(choosen.getDependency());
|
||||
}
|
||||
});
|
||||
limitingContextMenu = contextMenuBuilder.create();
|
||||
}
|
||||
return limitingContextMenu;
|
||||
}
|
||||
|
||||
private Menupopup getContextMenu() {
|
||||
if (contextMenu == null) {
|
||||
|
|
@ -218,6 +242,7 @@ public class DependencyList extends XulElement implements AfterCompose {
|
|||
.removeDependency(choosen.getDependency());
|
||||
}
|
||||
});
|
||||
|
||||
contextMenuBuilder.item(_("Set End-Start"), null,
|
||||
new ChangeTypeAction(
|
||||
DependencyType.END_START));
|
||||
|
|
|
|||
|
|
@ -253,6 +253,9 @@ public class TaskComponent extends Div implements AfterCompose {
|
|||
return cssClass;
|
||||
}
|
||||
|
||||
public boolean isLimiting() {
|
||||
return task.isLimiting();
|
||||
}
|
||||
|
||||
protected void updateClass() {
|
||||
response(null, new AuInvoke(this, "setClass",
|
||||
|
|
|
|||
|
|
@ -240,19 +240,9 @@ public class LimitingResourceQueueModel implements ILimitingResourceQueueModel {
|
|||
}
|
||||
for (Dependency each: task.getDependenciesWithThisOrigin()) {
|
||||
Hibernate.initialize(each);
|
||||
TaskElement destination = each.getDestination();
|
||||
if (destination instanceof Task
|
||||
&& !Hibernate.isInitialized(destination)) {
|
||||
initializeTask((Task) destination);
|
||||
}
|
||||
}
|
||||
for (Dependency each: task.getDependenciesWithThisDestination()) {
|
||||
Hibernate.initialize(each);
|
||||
TaskElement origin = each.getOrigin();
|
||||
if (origin instanceof Task
|
||||
&& !Hibernate.isInitialized(origin)) {
|
||||
initializeTask((Task) origin);
|
||||
}
|
||||
}
|
||||
initializeTaskSource(task.getTaskSource());
|
||||
initializeRootOrder(task);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue