ItEr21S07CUVistaRecursosTempoPorProxectoItEr20S09: New components structure and zul page for Resources Load Panel

* It has been created a new page planner/resources_use.zul with an static view of ResourcesLoadComponent entities.
   * Added ResourceLoadInterval static elements to ResourceLoad component

Signed-off-by: Óscar González Fernández <ogonzalez@igalia.com>
Removed modifications to TimeTracker
This commit is contained in:
Lorenzo Tilve 2009-08-11 14:39:01 +02:00 committed by Óscar González Fernández
parent feb24373b9
commit 449ff9cea3
10 changed files with 306 additions and 1 deletions

View file

@ -0,0 +1,91 @@
package org.zkoss.ganttz;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import org.zkoss.ganttz.data.ResourceLoad;
import org.zkoss.zk.au.out.AuInvoke;
import org.zkoss.zk.ui.ext.AfterCompose;
import org.zkoss.zul.Div;
/**
* This class wraps ResourceLoad data inside an specific HTML Div component.
* Created at Aug 11, 2009
* @author Lorenzo Tilve Álvaro <ltilve@igalia.com>
*/
public class ResourceLoadComponent extends Div implements AfterCompose {
private static final int HEIGHT_PER_ROW = 10;
private final ResourceLoad resourceLoad;
private List<ResourceLoadInterval> children;
public class ResourceLoadInterval extends Div {
private int length;
private String plannificationType;
public ResourceLoadInterval(int length, String plannificationType) {
this.length = length;
this.plannificationType = plannificationType;
}
public int getLenght() {
return this.length;
}
public String getPlannificationType() {
return this.plannificationType;
}
}
public ResourceLoadComponent(ResourceLoad resourceLoad) {
setHeight(HEIGHT_PER_ROW + "px");
setContext("idContextMenuTaskAssigment");
this.resourceLoad = resourceLoad;
// Added some example ResourceLoadIntervals
this.children = new ArrayList<ResourceLoadInterval>();
setId(UUID.randomUUID().toString());
}
protected String calculateClass() {
return "box";
}
protected void updateClass() {
response(null, new AuInvoke(this, "setClass",
new Object[] { calculateClass() }));
}
public void afterCompose() {
}
private String _color;
public static ResourceLoadComponent asResourceLoadComponent(
ResourceLoad ResourceLoad, ResourceLoadList ResourceLoadList,
boolean isTopLevel) {
final ResourceLoadComponent result;
result = new ResourceLoadComponent(ResourceLoad);
return result;
}
public static ResourceLoadComponent asResourceLoadComponent(
ResourceLoad ResourceLoad, ResourceLoadList ResourceLoadList) {
return asResourceLoadComponent(ResourceLoad, ResourceLoadList, true);
}
public String getResourceLoadName() {
return this.resourceLoad.getName();
}
public List<ResourceLoadInterval> getChildren() {
return this.children;
}
public void addInterval(int length, String plannificationType) {
this.children.add(new ResourceLoadInterval(length, plannificationType));
}
}

View file

@ -0,0 +1,38 @@
package org.zkoss.ganttz;
import java.util.List;
import org.zkoss.ganttz.data.ResourceLoad;
import org.zkoss.zk.ui.ext.AfterCompose;
import org.zkoss.zul.impl.XulElement;
/**
* Component to include a list of ResourceLoads inside the ResourcesLoadPanel.
* Created at Aug 11, 2009
* @author Lorenzo Tilve Álvaro <ltilve@igalia.com>
*/
public class ResourceLoadList extends XulElement implements AfterCompose {
private List<ResourceLoad> resourceLoads;
public ResourceLoadList(List<ResourceLoad> resourceLoads) {
this.resourceLoads = resourceLoads;
}
@Override
public void afterCompose() {
}
public Planner getPlanner() {
return getGanttPanel().getPlanner();
}
private GanttPanel getGanttPanel() {
return (GanttPanel) getParent();
}
public synchronized void addResourceLoadComponent(ResourceLoad r) {
resourceLoads.add(r);
}
}

View file

@ -0,0 +1,46 @@
package org.zkoss.ganttz;
import org.zkoss.ganttz.data.ResourceLoad;
import org.zkoss.zk.ui.ext.AfterCompose;
import org.zkoss.zul.impl.XulElement;
public class ResourcesLoadPanel extends XulElement implements AfterCompose {
private TimeTracker timeTracker;
public ResourcesLoadPanel() {
ResourceLoadComponent rlc1 = new ResourceLoadComponent(
new ResourceLoad("ResourceLoad 1"));
ResourceLoadComponent rlc2 = new ResourceLoadComponent(
new ResourceLoad("ResourceLoad 1"));
rlc1.addInterval(40, "fullplanificated");
rlc1.addInterval(20, "planificated");
rlc1.addInterval(30, "overplanificated");
rlc1.addInterval(10, "not_planificated");
rlc2.addInterval(10, "overplanificated");
rlc2.addInterval(20, "planificated");
rlc2.addInterval(30, "fullplanificated");
rlc2.addInterval(20, "planificated");
rlc2.addInterval(20, "not_planificated");
appendChild(rlc1);
appendChild(rlc2);
}
@Override
public void afterCompose() {
//timeTracker.afterCompose();
}
public TimeTracker getTimeTracker() {
return timeTracker;
}
public Planner getPlanner() {
return (Planner) getParent();
}
}

View file

@ -0,0 +1,26 @@
package org.zkoss.ganttz.data;
/**
* This class contains the information of a ResourceLoad unit. It will fetch
* information from the DailyAssignments and build all its associated
* ResourceLoad intervals <br/>
* Created at Ago 11, 2009
* @author Lorenzo Tilve Álvaro <ltilve@igalia.com>
*/
public class ResourceLoad {
private String name;
public ResourceLoad(String name) {
this.name = name;
}
public String getName() {
return this.name;
}
public void setName(String name) {
this.name = name;
}
}

View file

@ -20,6 +20,15 @@
</mold>
</component>
<component>
<component-name>resourcesLoadPanel</component-name>
<component-class>org.zkoss.ganttz.ResourcesLoadPanel</component-class>
<mold>
<mold-name>default</mold-name>
<mold-uri>~./ganttz/resourcesLoadPanel.dsp</mold-uri>
</mold>
</component>
<component>
<component-name>leftPane</component-name>
<component-class>org.zkoss.ganttz.LeftPane</component-class>
@ -41,6 +50,15 @@
</mold>
</component>
<component>
<component-name>resourceload</component-name>
<component-class>org.zkoss.ganttz.ResourceLoadComponent</component-class>
<mold>
<mold-name>default</mold-name>
<mold-uri>~./ganttz/resourceload.dsp</mold-uri>
</mold>
</component>
<component>
<component-name>task</component-name>
<component-class>org.zkoss.ganttz.TaskComponent</component-class>

View file

@ -0,0 +1,15 @@
<%@ taglib uri="http://www.zkoss.org/dsp/web/core" prefix="c" %>
<%@ taglib uri="http://www.zkoss.org/dsp/zk/core" prefix="z" %>
<c:set var="self" value="${requestScope.arg.self}"/>
<div id="row_resourceload${self.uuid}" class="row_resourceload" z.valor="boxid="${self.uuid}">
<div id="${self.uuid}" z.type="ganttz.task.Task" idTask="${self.id}"
z.autoz="true"${self.outerAttrs}" >
<span class="resourceload_name" id="${self.uuid}!real">${self.resourceLoadName}</span>
<c:forEach var="child" items="${self.children}">
<div id="loadinterval${child.uuid}" style="width: ${child.lenght}%;"
class="taskassignmentinterval ${child.plannificationType}"></div>
</c:forEach>
</div>
</div>

View file

@ -0,0 +1,14 @@
<%@ taglib uri="http://www.zkoss.org/dsp/web/core" prefix="c" %>
<%@ taglib uri="http://www.zkoss.org/dsp/zk/core" prefix="z" %>
<c:set var="self" value="${requestScope.arg.self}"/>
<h3>Resources Load</h3>
<div id="${self.uuid}" z.type="ganttz.ganttpanel.GanttPanel" ${self.outerAttrs}>
<div id="ganttpanel">
<c:forEach var="child" items="${self.children}">
${z:redraw(child, null)}
</c:forEach>
</div>
</div>
<br/>

View file

@ -0,0 +1,8 @@
/**
* Javascript behaviuor for ResourcesLoadPanel element
* @author Lorenzo Tilve Álvaro <ltilve@igalia.com>
*/
zkResourcesLoadPanel = {};
zkResourcesLoadPanel.init = function(cmp){
}

View file

@ -326,10 +326,44 @@ tr.z-vbox-sep {
display:none;
}
/* Hide at the beginning */
/* Hidden at the beginning to avoid the first scalation effect */
#ganttpanel_scroller_x {
display:none;
}
#ganttpanel_scroller_y {
display:none;
}
/* -------------- ResourceLoad -------------- */
.taskassignmentinterval {
float:left;
height:10px;
position:relative;
}
.fullplanificated {
background-color:green;
}
.planificated {
background-color:orange;
}
.overplanificated {
background-color:red;
}
.not_planificated {
background-color:#007bbe;
}
.row_resourceload {
height: 10px;
border: solid 1px #000000;
margin-bottom: 10px;
margin-top: 10px;
width: auto;
}
.resourceload_name {
display:none;
}

View file

@ -0,0 +1,15 @@
<?page title="Navalpro: Scheduling"?>
<?init class="org.zkoss.zkplus.databind.AnnotateDataBinderInit" ?>
<?init class="org.zkoss.zk.ui.util.Composition" arg0="/common/layout/template_v02.zul"?>
<?taglib uri="http://www.zkoss.org/dsp/web/core" prefix="c"?>
<?link rel="stylesheet" type="text/css" href="/planner/css/ganttzk.css"?>
<?link rel="stylesheet" type="text/css" href="/common/css/navalpro_v01.css"?>
<?link rel="stylesheet" type="text/css" href="/common/css/navalpro_zk.css"?>
<?variable-resolver class="org.zkoss.zkplus.spring.DelegatingVariableResolver"?>
<zk>
<resourcesLoadPanel id="planner" self="@{define(content)}">
<div id="idContextMenuTaskAssigment"></div>
</resourcesLoadPanel>
</zk>