ItEr58S08RFAspectosGraficosRecursoLimitantesItEr57S08: Improvements on queuedependencies draw algorithm

This commit is contained in:
Lorenzo Tilve 2010-05-10 12:18:43 +02:00 committed by Javier Moran Rua
parent 6804d9e310
commit 37da0a3ca9
3 changed files with 35 additions and 16 deletions

View file

@ -51,13 +51,15 @@ public class LimitingDependencyComponent extends XulElement implements
private IConstraintViolationListener<Date> violationListener;
public LimitingDependencyComponent(QueueTask source, QueueTask destination,
DependencyType type) {
this(source, destination);
this.type = type;
}
public LimitingDependencyComponent(QueueTask source, QueueTask destination) {
Validate.notNull(source);
Validate.notNull(destination);
// Validate.isTrue(source.getTask() == dependency.getSource());
// Validate.isTrue(destination.getTask() ==
// dependency.getDestination());
// this.type = dependency.getType();
this.source = source;
this.destination = destination;
// this.dependency = dependency;

View file

@ -29,6 +29,7 @@ import org.apache.commons.lang.StringUtils;
import org.navalplanner.business.resources.daos.IResourceDAO;
import org.navalplanner.business.resources.entities.LimitingResourceQueue;
import org.springframework.beans.factory.annotation.Autowired;
import org.zkoss.ganttz.data.DependencyType;
import org.zkoss.ganttz.timetracker.TimeTracker;
import org.zkoss.ganttz.timetracker.TimeTrackerComponent;
import org.zkoss.ganttz.timetracker.zoom.ZoomLevel;
@ -245,11 +246,12 @@ public class LimitingResourcesPanel extends HtmlMacroComponent {
private LimitingDependencyList generateSimulatedDependencyList() {
dependencyList = new LimitingDependencyList(this);
List<QueueTask> queueTasks = queueListComponent.getQueueTasks();
if (queueTasks.size() > 3) {
if (queueTasks.size() > 4) {
QueueTask source = queueTasks.get(1);
QueueTask destination = queueTasks.get(2);
QueueTask destination2 = queueTasks.get(3);
QueueTask destination3 = queueTasks.get(3);
QueueTask destination4 = queueTasks.get(4);
LimitingDependencyComponent limitingDependencyComponent = new LimitingDependencyComponent(
source, destination);
@ -257,9 +259,16 @@ public class LimitingResourcesPanel extends HtmlMacroComponent {
source, destination2);
LimitingDependencyComponent limitingDependencyComponent3 = new LimitingDependencyComponent(
source, destination3);
LimitingDependencyComponent limitingDependencyComponent4 = new LimitingDependencyComponent(
source, destination3, DependencyType.START_START);
LimitingDependencyComponent limitingDependencyComponent5 = new LimitingDependencyComponent(
destination3, destination4);
dependencyList.addDependencyComponent(limitingDependencyComponent);
dependencyList.addDependencyComponent(limitingDependencyComponent2);
dependencyList.addDependencyComponent(limitingDependencyComponent3);
dependencyList.addDependencyComponent(limitingDependencyComponent4);
dependencyList.addDependencyComponent(limitingDependencyComponent5);
}
return dependencyList;
}

View file

@ -32,11 +32,10 @@ zkLimitingDependencies.constants = {
END_END: "END_END"
};
zkLimitingDependencies.CORNER_WIDTH = 20;
zkLimitingDependencies.HEIGHT = 10;
zkLimitingDependencies.HALF_HEIGHT = 5;
zkLimitingDependencies.DEPENDENCY_PADDING = 4;
zkLimitingDependencies.HALF_DEPENDENCY_PADDING = 2;
zkLimitingDependencies.CORNER = 4;
zkLimitingDependencies.HEIGHT = 12;
zkLimitingDependencies.ARROW_PADDING = 10;
zkLimitingDependencies.HALF_ARROW_PADDING = 5;
zkLimitingDependencies.addRelatedDependency = function(cmp, dependency) {
if (!cmp['relatedDependencies']) {
@ -116,9 +115,16 @@ zkLimitingDependency.destination = function(dependency) {
/* ----------- Generic Limiting dependency draw function ---------- */
zkLimitingDependencies.newdraw = function(arrow, orig, dest, param) {
var xorig = orig[0];
var yorig = orig[1];
var yorig = orig[1] - zkLimitingDependencies.CORNER;
var xend = dest[0];
var yend = dest[1];
var yend = dest[1] - zkLimitingDependencies.CORNER;
if (yend < yorig) {
yend = yend + zkLimitingDependencies.HEIGHT;
} else {
yorig = yorig + zkLimitingDependencies.HEIGHT;
}
var width = Math.abs(xend - xorig);
var height = Math.abs(yorig - yend);
@ -168,10 +174,10 @@ zkLimitingDependencies.newdraw = function(arrow, orig, dest, param) {
// --------- Arrow -----------
var deparrow = this.findImageElement(arrow, 'arrow');
deparrow.style.left = xend - 5 + "px";
deparrow.style.left = ( xend - zkLimitingDependencies.HALF_ARROW_PADDING ) + "px";
if (yend > yorig) {
deparrow.src = this.getImagesDir()+"arrow2.png";
deparrow.style.top = ( yend - param ) + "px";
deparrow.style.top = ( yend - zkLimitingDependencies.ARROW_PADDING ) + "px";
} else if (yend == yorig) {
deparrow.src = this.getImagesDir()+"arrow4.png";
deparrow.style.top = yorig + "px";
@ -193,10 +199,12 @@ zkLimitingDependency.draw = function(dependency) {
switch(dependency.getAttribute('type'))
{
case zkLimitingDependencies.constants.START_START:
verticalSeparation = 5;
verticalSeparation = 20;
orig[0] = orig[0] - zkLimitingDependencies.CORNER;
dest[0] = dest[0] - zkLimitingDependencies.CORNER;
break;
case zkLimitingDependencies.constants.END_END:
verticalSeparation = 10;
verticalSeparation = 25;
break;
case zkLimitingDependencies.constants.END_START:
default: