18 package org.turro.zkoss.svg;
20 import java.util.HashSet;
21 import java.util.Iterator;
23 import org.turro.util.CompareUtil;
24 import org.zkoss.lang.Strings;
30 public class GanttItem implements Comparable<GanttItem> {
34 private final long reference;
35 private final String name, uniqueId;
36 private double hours, done, start = 0.0;
37 private int position = -1;
38 private boolean milestone, finished;
39 private final Set<GanttPredecessor> predecessors =
new HashSet<>();
41 public GanttItem(
long reference, String uniqueId, String name,
double hours,
double done) {
42 this.reference = reference;
43 this.uniqueId = uniqueId;
54 this.finished = finished;
62 this.milestone = milestone;
66 return finished ? (done == 0.0 ? Math.max(done, hours) : done) : Math.max(done, hours);
79 GanttItem predecessor =
set.getItem(gp.getIndex());
81 start = Math.max(predecessor.start + gp.getLag(), start);
83 start = Math.max(predecessor.start + predecessor.
getMaxHours() + gp.getLag(), start);
89 if(Strings.isBlank(uniqueId)) {
91 double endHours = 0.0d;
93 if(gi.reference == reference && !Strings.isBlank(gi.uniqueId)) {
94 start = (start == -1 ? gi.start : Math.min(start, gi.start));
95 endHours = Math.max(gi.start + gi.hours, endHours);
98 start = Math.max(start, 0.0d);
99 hours = endHours - start;
113 Iterator<GanttItem> it =
set.iterator();
115 while(it.hasNext()) {
128 this.position = position;
149 int result = CompareUtil.compare(reference, o.reference);
151 result = CompareUtil.compare(uniqueId, o.uniqueId);
Set< GanttPredecessor > getPredecessors()
void setMilestone(boolean milestone)
GanttItem(long reference, String uniqueId, String name, double hours, double done)
void setFinished(boolean finished)
void setSet(GanttData set)
int compareTo(GanttItem o)
void setPosition(int position)
static final int GANTT_START_TO_START