ItEr28S14RFVistaGraficaInformacionAvance: Showing basic advance info at planner.

This commit is contained in:
Manuel Rego Casasnovas 2009-10-01 13:09:06 +02:00 committed by Javier Moran Rua
parent 9bf65754c6
commit 591c898121
12 changed files with 56 additions and 12 deletions

View file

@ -1,5 +1,6 @@
package org.navalplanner.web.planner;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
@ -182,7 +183,7 @@ public class DataForPlanner {
private DefaultFundamentalProperties createTask(String name, Date now,
Date end) {
return new DefaultFundamentalProperties(name, end, end.getTime()
- now.getTime(), "bla");
- now.getTime(), "bla", new BigDecimal(0.5));
}
private void addNewTask(IContext<ITaskFundamentalProperties> context) {

View file

@ -41,4 +41,5 @@ public class DatesMapperOnInterval implements IDatesMapper {
public long toMilliseconds(int pixels) {
return millisecondsPerPixel * pixels;
}
}

View file

@ -2,6 +2,7 @@ package org.zkoss.ganttz;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.math.BigDecimal;
import java.util.Map;
import java.util.UUID;
import java.util.regex.Matcher;
@ -152,7 +153,7 @@ public class TaskComponent extends Div implements AfterCompose {
new Object[] { calculateClass() }));
}
public void afterCompose() {
public final void afterCompose() {
updateProperties();
if (propertiesListener == null) {
propertiesListener = new PropertyChangeListener() {
@ -274,7 +275,7 @@ public class TaskComponent extends Div implements AfterCompose {
super.setParent(parent);
}
public void zoomChanged() {
public final void zoomChanged() {
updateProperties();
}
@ -291,6 +292,15 @@ public class TaskComponent extends Div implements AfterCompose {
if (dependencyList != null) {
dependencyList.redrawDependenciesConnectedTo(this);
}
updateCompletion();
}
private void updateCompletion() {
BigDecimal advancePercentage = task.getAdvancePercentage().multiply(
new BigDecimal(100));
response(null, new AuInvoke(this, "resizeCompletionAdvance",
advancePercentage.intValue() + "%"));
}
private DependencyList getDependencyList() {

View file

@ -1,5 +1,6 @@
package org.zkoss.ganttz.data;
import java.math.BigDecimal;
import java.util.Date;
/**
@ -15,15 +16,18 @@ public class DefaultFundamentalProperties implements ITaskFundamentalProperties
private String notes;
private BigDecimal advancePercentage;
public DefaultFundamentalProperties() {
}
public DefaultFundamentalProperties(String name, Date beginDate,
long lengthMilliseconds, String notes) {
long lengthMilliseconds, String notes, BigDecimal advancePercentage) {
this.name = name;
this.beginDate = beginDate;
this.lengthMilliseconds = lengthMilliseconds;
this.notes = notes;
this.advancePercentage = advancePercentage;
}
public String getName() {
@ -61,4 +65,10 @@ public class DefaultFundamentalProperties implements ITaskFundamentalProperties
public void setNotes(String notes) {
this.notes = notes;
}
@Override
public BigDecimal getAdvancePercentage() {
return advancePercentage;
}
}

View file

@ -1,5 +1,6 @@
package org.zkoss.ganttz.data;
import java.math.BigDecimal;
import java.util.Date;
/**
@ -23,4 +24,6 @@ public interface ITaskFundamentalProperties {
public void setNotes(String notes);
public BigDecimal getAdvancePercentage();
}

View file

@ -2,6 +2,7 @@ package org.zkoss.ganttz.data;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
@ -138,4 +139,9 @@ public abstract class Task implements ITaskFundamentalProperties {
setVisible(false);
}
@Override
public BigDecimal getAdvancePercentage() {
return fundamentalProperties.getAdvancePercentage();
}
}

View file

@ -8,7 +8,7 @@
<div id="row${self.uuid}" class="row" z.valor="boxid="${self.uuid}">
<div id="${self.uuid}" z.type="ganttz.task.Task" idTask="${self.id}"
z.autoz="true"${self.outerAttrs}">
<div id="completion${self.uuid}" class="completion"></div>
<div id="completion2${self.uuid}" class="completion2"></div>
<div class="completion"></div>
<div class="completion2"></div>
</div>
</div>

View file

@ -9,8 +9,8 @@
<div id="${self.uuid}" z.type="ganttz.taskcontainer.TaskContainer" idTask="${self.id}"
z.autoz="true"${self.outerAttrs}" class="taskgroup">
<div class="taskcontainer_completion">
<div id="completion${self.uuid}" class="completion"></div>
<div id="completion2${self.uuid}" class="completion2"></div>
<div class="completion"></div>
<div class="completion2"></div>
</div>
<div class="taskgroup_start"></div>
<div class="taskgroup_end"></div>

View file

@ -405,6 +405,11 @@ zkTask.getElementsByAttribute = function(oElm, strTagName, strAttributeName,
return arrReturnElements;
}
zkTask.resizeCompletionAdvance = function(cmp, width) {
var completionDiv = YAHOO.util.Selector.query('.completion2', cmp, true);
completionDiv["style"].width = width;
}
YAHOO.example.DDRegion = function(id, sGroup, config) {
this.cont = config.cont;
YAHOO.example.DDRegion.superclass.constructor.apply(this, arguments);
@ -532,6 +537,8 @@ zkTaskContainer.setClass = function(cmp, newclass) {
cmp.className = newclass;
};
zkTaskContainer.resizeCompletionAdvance = zkTask.resizeCompletionAdvance;
/* We will not allow taskcontainer move or resize untill its behaviour its
* clearly specified

View file

@ -2,6 +2,7 @@ package org.navalplanner.web.planner;
import static org.navalplanner.web.I18nHelper._;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
@ -350,7 +351,7 @@ public class DataForPlanner {
private DefaultFundamentalProperties createTask(String name, Date now,
Date end) {
return new DefaultFundamentalProperties(name, end, end.getTime()
- now.getTime(), _("bla"));
- now.getTime(), _("bla"), new BigDecimal(0.5));
}
private void addNewTask(IContext<ITaskFundamentalProperties> context) {

View file

@ -1,5 +1,8 @@
package org.navalplanner.web.planner;
import static org.navalplanner.web.I18nHelper._;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
@ -16,8 +19,6 @@ import org.zkoss.ganttz.adapters.DomainDependency;
import org.zkoss.ganttz.data.DependencyType;
import org.zkoss.ganttz.data.ITaskFundamentalProperties;
import static org.navalplanner.web.I18nHelper._;
/**
* Responsible of adaptating a {@link TaskElement} into a
* {@link ITaskFundamentalProperties} <br />
@ -97,6 +98,11 @@ public class TaskElementAdapter implements ITaskElementAdapter {
+ this.lengthMilliseconds));
}
@Override
public BigDecimal getAdvancePercentage() {
return taskElement.getOrderElement().getAdvancePercentage();
}
}
@Override

View file

@ -152,7 +152,6 @@ zkTasklist.GANTT_PANEL_LEFT = 300
}
.completion2 {
width: 50%;
height: 5px; /* zkTasklist.HEIGHT_PER_TASK / 2 */
background-color: #75d9b0;
z-index: 5;