package org.hwo.ui.gantt; import java.util.LinkedList; import java.util.List; import org.hwo.datetime.DateTime; public class BaseGanttObject implements IGanttObject { private DateTime startTime, endTime; private String label, detailedLabel; List dependencies; List resources; public BaseGanttObject() { dependencies = new LinkedList(); resources = new LinkedList(); } @Override public DateTime getStartTime() { return new DateTime(this.startTime); } @Override public void setStartTime(DateTime startTime) { this.startTime = new DateTime(startTime); } @Override public DateTime getEndTime() { return new DateTime(this.endTime); } @Override public void setEndTime(DateTime endTime) { this.endTime = new DateTime(endTime); } @Override public boolean canMove() { return true; } @Override public boolean canStretch() { return true; } @Override public IGanttObject[] getDependencies() { return this.dependencies.toArray(new IGanttObject[0]); } @Override public void addDependency(IGanttObject depend) { if (!this.dependencies.contains(depend)) this.dependencies.add(depend); } @Override public void removeDependency(IGanttObject depend) { this.dependencies.remove(depend); } @Override public IGanttResource[] getResources() { return this.resources.toArray(new IGanttResource[0]); } @Override public void addResource(IGanttResource resource) { if (!this.resources.contains(resource)) this.resources.add(resource); } @Override public void removeResource(IGanttResource resource) { this.resources.remove(resource); } @Override public void replaceResource(IGanttResource oldResource, IGanttResource newResource) { addResource(newResource); removeResource(oldResource); } @Override public String getDetailedLabel() { return this.detailedLabel; } public void setDetailedLabel(String detailedLabel) { this.detailedLabel = detailedLabel; } public String getShortLabel() { return label; } public void setShortLabel(String label) { this.label = label; } @Override public void addNotify(JGantt gantt) { } @Override public void removeNotify(JGantt gantt) { } }