Remove enforceAllRestrictions call
It was done to force the showing of the constraint violations after the components have been created. Now this is not needed thanks to the support for receiving pending of notification events. FEA: ItEr74S04BugFixing
This commit is contained in:
parent
c60874af46
commit
47072040b5
6 changed files with 31 additions and 19 deletions
|
|
@ -32,6 +32,7 @@ import org.zkoss.ganttz.data.GanttDate;
|
|||
import org.zkoss.ganttz.data.Task;
|
||||
import org.zkoss.ganttz.data.constraint.Constraint;
|
||||
import org.zkoss.ganttz.data.constraint.Constraint.IConstraintViolationListener;
|
||||
import org.zkoss.ganttz.util.WeakReferencedListeners.Mode;
|
||||
import org.zkoss.zk.au.out.AuInvoke;
|
||||
import org.zkoss.zk.ui.ext.AfterCompose;
|
||||
import org.zkoss.zul.impl.XulElement;
|
||||
|
|
@ -53,6 +54,8 @@ public class DependencyComponent extends XulElement implements AfterCompose {
|
|||
|
||||
private IConstraintViolationListener<GanttDate> violationListener;
|
||||
|
||||
private boolean violated = false;
|
||||
|
||||
public DependencyComponent(TaskComponent source, TaskComponent destination,
|
||||
Dependency dependency) {
|
||||
Validate.notNull(dependency);
|
||||
|
|
@ -68,21 +71,28 @@ public class DependencyComponent extends XulElement implements AfterCompose {
|
|||
.onlyOnZKExecution(new IConstraintViolationListener<GanttDate>() {
|
||||
|
||||
@Override
|
||||
public void constraintViolated(Constraint<GanttDate> constraint,
|
||||
GanttDate value) {
|
||||
response("constraintViolated", new AuInvoke(
|
||||
DependencyComponent.this, "setCSSClass",
|
||||
"violated-dependency"));
|
||||
public void constraintViolated(Constraint<GanttDate> constraint, GanttDate value) {
|
||||
violated = true;
|
||||
sendCSSUpdate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void constraintSatisfied(Constraint<GanttDate> constraint,
|
||||
GanttDate value) {
|
||||
response("constraintViolated", new AuInvoke(
|
||||
DependencyComponent.this, "setCSSClass", "dependency"));
|
||||
public void constraintSatisfied(Constraint<GanttDate> constraint, GanttDate value) {
|
||||
violated = false;
|
||||
sendCSSUpdate();
|
||||
}
|
||||
});
|
||||
this.dependency.addConstraintViolationListener(violationListener);
|
||||
});
|
||||
this.dependency.addConstraintViolationListener(violationListener,
|
||||
Mode.RECEIVE_PENDING);
|
||||
}
|
||||
|
||||
private void sendCSSUpdate() {
|
||||
response("constraintViolated", new AuInvoke(DependencyComponent.this,
|
||||
"setCSSClass", getCSSClass()));
|
||||
}
|
||||
|
||||
public String getCSSClass() {
|
||||
return violated ? "violated-dependency" : "dependency";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -373,8 +373,6 @@ public class Planner extends HtmlMacroComponent {
|
|||
|
||||
this.visibleChart = configuration.isExpandPlanningViewCharts();
|
||||
((South) getFellow("graphics")).setOpen(this.visibleChart);
|
||||
|
||||
newContext.getDiagramGraph().enforceAllRestrictions();
|
||||
}
|
||||
|
||||
private void resettingPreviousComponentsToNull() {
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ import org.zkoss.ganttz.data.Task.IReloadResourcesTextRequested;
|
|||
import org.zkoss.ganttz.data.TaskContainer;
|
||||
import org.zkoss.ganttz.data.constraint.Constraint;
|
||||
import org.zkoss.ganttz.data.constraint.Constraint.IConstraintViolationListener;
|
||||
import org.zkoss.ganttz.util.WeakReferencedListeners.Mode;
|
||||
import org.zkoss.lang.Objects;
|
||||
import org.zkoss.xml.HTMLs;
|
||||
import org.zkoss.zk.au.AuRequest;
|
||||
|
|
@ -212,7 +213,8 @@ public class TaskComponent extends Div implements AfterCompose {
|
|||
// TODO mark graphically dependency as not violated
|
||||
}
|
||||
});
|
||||
this.task.addConstraintViolationListener(taskViolationListener);
|
||||
this.task.addConstraintViolationListener(taskViolationListener,
|
||||
Mode.RECEIVE_PENDING);
|
||||
reloadResourcesTextRequested = new IReloadResourcesTextRequested() {
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ import org.zkoss.ganttz.data.DependencyType.Point;
|
|||
import org.zkoss.ganttz.data.constraint.Constraint;
|
||||
import org.zkoss.ganttz.data.constraint.Constraint.IConstraintViolationListener;
|
||||
import org.zkoss.ganttz.util.ConstraintViolationNotificator;
|
||||
import org.zkoss.ganttz.util.WeakReferencedListeners.Mode;
|
||||
|
||||
/**
|
||||
* This class represents a dependency. Contains the source and the destination.
|
||||
|
|
@ -89,8 +90,8 @@ public class Dependency implements IDependency<Task> {
|
|||
}
|
||||
|
||||
public void addConstraintViolationListener(
|
||||
IConstraintViolationListener<GanttDate> listener) {
|
||||
violationsNotificator.addConstraintViolationListener(listener);
|
||||
IConstraintViolationListener<GanttDate> listener, Mode mode) {
|
||||
violationsNotificator.addConstraintViolationListener(listener, mode);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@ import org.zkoss.ganttz.data.GanttDiagramGraph.INotificationAfterDependenciesEnf
|
|||
import org.zkoss.ganttz.data.constraint.Constraint;
|
||||
import org.zkoss.ganttz.data.constraint.Constraint.IConstraintViolationListener;
|
||||
import org.zkoss.ganttz.util.ConstraintViolationNotificator;
|
||||
import org.zkoss.ganttz.util.WeakReferencedListeners.Mode;
|
||||
|
||||
/**
|
||||
* This class contains the information of a task. It can be modified and
|
||||
|
|
@ -389,8 +390,8 @@ public abstract class Task implements ITaskFundamentalProperties {
|
|||
}
|
||||
|
||||
public void addConstraintViolationListener(
|
||||
IConstraintViolationListener<GanttDate> listener) {
|
||||
violationNotificator.addConstraintViolationListener(listener);
|
||||
IConstraintViolationListener<GanttDate> listener, Mode mode) {
|
||||
violationNotificator.addConstraintViolationListener(listener, mode);
|
||||
}
|
||||
|
||||
public void addReloadListener(
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
<c:set var="self" value="${requestScope.arg.self}"/>
|
||||
|
||||
<div class="dependency" id="${self.uuid}" z.type="ganttz.dependency.Dependency"
|
||||
<div class="${self.CSSClass}" id="${self.uuid}" z.type="ganttz.dependency.Dependency"
|
||||
idTaskOrig="${self.idTaskOrig}" idTaskEnd="${self.idTaskEnd}" ${self.outerAttrs}
|
||||
type=${self.dependencyType}>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue