ItEr27S07CUVistaRecursosTempoPorProxectoItEr26S08: Using the model for retrieving the data
This commit is contained in:
parent
a3f524935c
commit
fc8e484ca6
3 changed files with 42 additions and 19 deletions
|
|
@ -1,5 +1,16 @@
|
|||
package org.navalplanner.web.resourceload;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.zkoss.ganttz.data.resourceload.LoadTimelinesGroup;
|
||||
import org.zkoss.ganttz.util.Interval;
|
||||
|
||||
public interface IResourceLoadModel {
|
||||
|
||||
void initGlobalView();
|
||||
|
||||
List<LoadTimelinesGroup> getLoadTimeLines();
|
||||
|
||||
Interval getViewInterval();
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,17 +1,11 @@
|
|||
package org.navalplanner.web.resourceload;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
|
||||
import org.joda.time.LocalDate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.zkoss.ganttz.data.resourceload.LoadTimelinesGroup;
|
||||
import org.zkoss.ganttz.resourceload.ResourcesLoadPanel;
|
||||
import org.zkoss.ganttz.timetracker.TimeTracker;
|
||||
import org.zkoss.ganttz.util.Interval;
|
||||
import org.zkoss.zk.ui.util.GenericForwardComposer;
|
||||
|
||||
/**
|
||||
|
|
@ -30,24 +24,14 @@ public class ResourceLoadController extends GenericForwardComposer {
|
|||
|
||||
@Override
|
||||
public void doAfterCompose(org.zkoss.zk.ui.Component comp) throws Exception {
|
||||
resourceLoadModel.initGlobalView();
|
||||
ResourcesLoadPanel resourcesLoadPanel = buildResourcesLoadPanel();
|
||||
comp.appendChild(resourcesLoadPanel);
|
||||
resourcesLoadPanel.afterCompose();
|
||||
}
|
||||
|
||||
private ResourcesLoadPanel buildResourcesLoadPanel() {
|
||||
return new ResourcesLoadPanel(new ArrayList<LoadTimelinesGroup>(),
|
||||
getDummyTimeTracker());
|
||||
return new ResourcesLoadPanel(resourceLoadModel.getLoadTimeLines(),
|
||||
new TimeTracker(resourceLoadModel.getViewInterval()));
|
||||
}
|
||||
|
||||
private TimeTracker getDummyTimeTracker() {
|
||||
Interval interval = new Interval(toDate(new LocalDate(2008, 6, 10)),
|
||||
toDate(new LocalDate(2011, 6, 10)));
|
||||
return new TimeTracker(interval);
|
||||
}
|
||||
|
||||
private Date toDate(LocalDate localDate) {
|
||||
return localDate.toDateTimeAtStartOfDay().toDate();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,11 +1,39 @@
|
|||
package org.navalplanner.web.resourceload;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.joda.time.LocalDate;
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.zkoss.ganttz.data.resourceload.LoadTimelinesGroup;
|
||||
import org.zkoss.ganttz.util.Interval;
|
||||
|
||||
@Component
|
||||
@Scope(BeanDefinition.SCOPE_PROTOTYPE)
|
||||
public class ResourceLoadModel implements IResourceLoadModel {
|
||||
|
||||
@Override
|
||||
public void initGlobalView() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<LoadTimelinesGroup> getLoadTimeLines() {
|
||||
return new ArrayList<LoadTimelinesGroup>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Interval getViewInterval() {
|
||||
return new Interval(toDate(new LocalDate(2008, 6, 10)),
|
||||
toDate(new LocalDate(
|
||||
2011, 6, 10)));
|
||||
}
|
||||
|
||||
private Date toDate(LocalDate localDate) {
|
||||
return localDate.toDateTimeAtStartOfDay().toDate();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue