ItEr55S11RFAspectosGraficosRecursoLimitantesItEr54S12: Created component structure for limiting resources lists and its dependencies based on resourcesload
This commit is contained in:
parent
db2600c111
commit
f904272b36
10 changed files with 640 additions and 14 deletions
|
|
@ -0,0 +1,159 @@
|
|||
/*
|
||||
* This file is part of NavalPlan
|
||||
*
|
||||
* Copyright (C) 2009 Fundación para o Fomento da Calidade Industrial e
|
||||
* Desenvolvemento Tecnolóxico de Galicia
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package org.zkoss.ganttz.limitingresources;
|
||||
|
||||
import java.beans.PropertyChangeEvent;
|
||||
import java.beans.PropertyChangeListener;
|
||||
import java.util.Date;
|
||||
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.zkoss.ganttz.TaskComponent;
|
||||
import org.zkoss.ganttz.data.Dependency;
|
||||
import org.zkoss.ganttz.data.DependencyType;
|
||||
import org.zkoss.ganttz.data.Task;
|
||||
import org.zkoss.ganttz.data.constraint.Constraint;
|
||||
import org.zkoss.ganttz.data.constraint.Constraint.IConstraintViolationListener;
|
||||
import org.zkoss.zk.au.out.AuInvoke;
|
||||
import org.zkoss.zk.ui.ext.AfterCompose;
|
||||
import org.zkoss.zul.Div;
|
||||
import org.zkoss.zul.impl.XulElement;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Francisco Javier Moran Rúa <jmoran@igalia.com>
|
||||
* @author Lorenzo Tilve Álvaro <ltilve@igalia.com>
|
||||
*/
|
||||
public class LimitingDependencyComponent extends XulElement implements
|
||||
AfterCompose {
|
||||
|
||||
private Div source;
|
||||
|
||||
private Div destination;
|
||||
|
||||
private DependencyType type;
|
||||
|
||||
private Dependency dependency;
|
||||
|
||||
private IConstraintViolationListener<Date> violationListener;
|
||||
|
||||
public LimitingDependencyComponent(Div source, Div destination,
|
||||
Dependency dependency) {
|
||||
Validate.notNull(dependency);
|
||||
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;
|
||||
violationListener = new IConstraintViolationListener<Date>() {
|
||||
|
||||
@Override
|
||||
public void constraintViolated(Constraint<Date> constraint,
|
||||
Date value) {
|
||||
// TODO mark graphically dependency as violated
|
||||
}
|
||||
};
|
||||
this.dependency.addConstraintViolationListener(violationListener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterCompose() {
|
||||
PropertyChangeListener listener = new PropertyChangeListener() {
|
||||
|
||||
@Override
|
||||
public void propertyChange(PropertyChangeEvent evt) {
|
||||
redrawDependency();
|
||||
}
|
||||
};
|
||||
// this.source.getTask().addFundamentalPropertiesChangeListener(listener);
|
||||
// this.destination.getTask().addFundamentalPropertiesChangeListener(listener);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the idTaskOrig
|
||||
*/
|
||||
public String getIdTaskOrig() {
|
||||
return source.getUuid();
|
||||
}
|
||||
|
||||
public void setIdTaskOrig(String idTaskOrig) {
|
||||
this.source = findTaskComponent(idTaskOrig);
|
||||
|
||||
}
|
||||
|
||||
private TaskComponent findTaskComponent(String idTaskOrig) {
|
||||
return (TaskComponent) getFellow(idTaskOrig);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the idTaskEnd
|
||||
*/
|
||||
public String getIdTaskEnd() {
|
||||
return destination.getUuid();
|
||||
}
|
||||
|
||||
public void setIdTaskEnd(String idTaskEnd) {
|
||||
this.destination = findTaskComponent(idTaskEnd);
|
||||
}
|
||||
|
||||
public void zoomChanged() {
|
||||
redrawDependency();
|
||||
}
|
||||
|
||||
public void redrawDependency() {
|
||||
response("zoomChanged", new AuInvoke(this, "draw"));
|
||||
}
|
||||
|
||||
public boolean contains(Task task) {
|
||||
return false;
|
||||
// Task sourceTask = getSource().getTask();
|
||||
// Task destinationTask = getDestination().getTask();
|
||||
// return task.equals(sourceTask) || task.equals(destinationTask);
|
||||
}
|
||||
|
||||
public Div getSource() {
|
||||
return source;
|
||||
}
|
||||
|
||||
public Div getDestination() {
|
||||
return destination;
|
||||
}
|
||||
|
||||
public Dependency getDependency() {
|
||||
return dependency;
|
||||
}
|
||||
|
||||
public DependencyType getDependencyType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public boolean hasSameSourceAndDestination(Dependency dependency) {
|
||||
return false;
|
||||
// Task sourceTask = source.getTask();
|
||||
// Task destinationTask = destination.getTask();
|
||||
// return sourceTask.equals(dependency.getSource())
|
||||
// && destinationTask.equals(dependency.getDestination());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,281 @@
|
|||
/*
|
||||
* This file is part of NavalPlan
|
||||
*
|
||||
* Copyright (C) 2009 Fundación para o Fomento da Calidade Industrial e
|
||||
* Desenvolvemento Tecnolóxico de Galicia
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package org.zkoss.ganttz.limitingresources;
|
||||
|
||||
import static org.zkoss.ganttz.i18n.I18nHelper._;
|
||||
|
||||
import java.beans.PropertyChangeEvent;
|
||||
import java.beans.PropertyChangeListener;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.zkoss.ganttz.DependencyList;
|
||||
import org.zkoss.ganttz.FunctionalityExposedForExtensions;
|
||||
import org.zkoss.ganttz.GanttPanel;
|
||||
import org.zkoss.ganttz.TaskComponent;
|
||||
import org.zkoss.ganttz.data.Dependency;
|
||||
import org.zkoss.ganttz.data.DependencyType;
|
||||
import org.zkoss.ganttz.data.Task;
|
||||
import org.zkoss.ganttz.timetracker.TimeTracker;
|
||||
import org.zkoss.ganttz.timetracker.TimeTrackerComponent;
|
||||
import org.zkoss.ganttz.timetracker.zoom.IZoomLevelChangedListener;
|
||||
import org.zkoss.ganttz.timetracker.zoom.ZoomLevel;
|
||||
import org.zkoss.ganttz.util.ComponentsFinder;
|
||||
import org.zkoss.ganttz.util.MenuBuilder;
|
||||
import org.zkoss.ganttz.util.MenuBuilder.ItemAction;
|
||||
import org.zkoss.zk.ui.event.Event;
|
||||
import org.zkoss.zk.ui.ext.AfterCompose;
|
||||
import org.zkoss.zul.Div;
|
||||
import org.zkoss.zul.Menupopup;
|
||||
import org.zkoss.zul.impl.XulElement;
|
||||
|
||||
/**
|
||||
* @author Lorenzo Tilve Álvaro <ltilve@igalia.com>
|
||||
*/
|
||||
public class LimitingDependencyList extends XulElement implements AfterCompose {
|
||||
|
||||
private final class ChangeTypeAction implements
|
||||
ItemAction<LimitingDependencyComponent> {
|
||||
private final DependencyType type;
|
||||
|
||||
private ChangeTypeAction(DependencyType type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEvent(final LimitingDependencyComponent choosen,
|
||||
Event event) {
|
||||
context.changeType(choosen.getDependency(), type);
|
||||
}
|
||||
}
|
||||
|
||||
private final class DependencyVisibilityToggler implements
|
||||
PropertyChangeListener {
|
||||
private final Task source;
|
||||
private final Task destination;
|
||||
private final LimitingDependencyComponent dependencyComponent;
|
||||
|
||||
private DependencyVisibilityToggler(Task source, Task destination,
|
||||
LimitingDependencyComponent dependencyComponent) {
|
||||
this.source = source;
|
||||
this.destination = destination;
|
||||
this.dependencyComponent = dependencyComponent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void propertyChange(PropertyChangeEvent evt) {
|
||||
if (!evt.getPropertyName().equals("visible")) {
|
||||
return;
|
||||
}
|
||||
if (dependencyMustBeVisible() != isDependencyNowVisible()) {
|
||||
toggleDependencyExistence(dependencyMustBeVisible());
|
||||
}
|
||||
}
|
||||
|
||||
void toggleDependencyExistence(boolean visible) {
|
||||
if (visible) {
|
||||
appendChild(dependencyComponent);
|
||||
addContextMenu(dependencyComponent);
|
||||
} else {
|
||||
removeChild(dependencyComponent);
|
||||
}
|
||||
}
|
||||
|
||||
boolean isDependencyNowVisible() {
|
||||
return dependencyComponent.getParent() != null;
|
||||
}
|
||||
|
||||
boolean dependencyMustBeVisible() {
|
||||
return source.isVisible() && destination.isVisible();
|
||||
}
|
||||
}
|
||||
|
||||
private static final Log LOG = LogFactory.getLog(DependencyList.class);
|
||||
|
||||
private transient IZoomLevelChangedListener listener;
|
||||
|
||||
private final FunctionalityExposedForExtensions<?> context;
|
||||
|
||||
public LimitingDependencyList(FunctionalityExposedForExtensions<?> context) {
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
private List<LimitingDependencyComponent> getLimitingDependencyComponents() {
|
||||
List<Object> children = getChildren();
|
||||
return ComponentsFinder.findComponentsOfType(
|
||||
LimitingDependencyComponent.class, children);
|
||||
}
|
||||
|
||||
void addDependencyComponent(
|
||||
final LimitingDependencyComponent dependencyComponent) {
|
||||
Div source = dependencyComponent.getSource();
|
||||
Div destination = dependencyComponent.getDestination();
|
||||
// DependencyVisibilityToggler visibilityToggler = new
|
||||
// DependencyVisibilityToggler(
|
||||
// source.getTask(), destination.getTask(), dependencyComponent);
|
||||
// source.getTask().addVisibilityPropertiesChangeListener(
|
||||
// visibilityToggler);
|
||||
// destination.getTask().addVisibilityPropertiesChangeListener(
|
||||
// visibilityToggler);
|
||||
// boolean dependencyMustBeVisible = visibilityToggler
|
||||
// .dependencyMustBeVisible();
|
||||
// visibilityToggler.toggleDependencyExistence(dependencyMustBeVisible);
|
||||
// if (dependencyMustBeVisible) {
|
||||
// dependencyComponent.redrawDependency();
|
||||
// }
|
||||
}
|
||||
|
||||
private void addContextMenu(LimitingDependencyComponent dependencyComponent) {
|
||||
dependencyComponent.setContext(getContextMenu());
|
||||
}
|
||||
|
||||
private GanttPanel getGanttPanel() {
|
||||
return (GanttPanel) getParent();
|
||||
}
|
||||
|
||||
public void setDependencyComponents(
|
||||
List<LimitingDependencyComponent> dependencyComponents) {
|
||||
for (LimitingDependencyComponent dependencyComponent : dependencyComponents) {
|
||||
addDependencyComponent(dependencyComponent);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterCompose() {
|
||||
if (listener == null) {
|
||||
listener = new IZoomLevelChangedListener() {
|
||||
@Override
|
||||
public void zoomLevelChanged(ZoomLevel detailLevel) {
|
||||
if (!isInPage()) {
|
||||
return;
|
||||
}
|
||||
for (LimitingDependencyComponent dependencyComponent : getLimitingDependencyComponents()) {
|
||||
dependencyComponent.zoomChanged();
|
||||
}
|
||||
}
|
||||
};
|
||||
// getTimeTracker().addZoomListener(listener);
|
||||
}
|
||||
// addContextMenu();
|
||||
}
|
||||
|
||||
private boolean isInPage() {
|
||||
return getParent() != null && getGanttPanel() != null
|
||||
&& getGanttPanel().getParent() != null;
|
||||
}
|
||||
|
||||
private TimeTracker getTimeTracker() {
|
||||
return getTimeTrackerComponent().getTimeTracker();
|
||||
}
|
||||
|
||||
private void addContextMenu() {
|
||||
for (LimitingDependencyComponent dependencyComponent : getLimitingDependencyComponents()) {
|
||||
addContextMenu(dependencyComponent);
|
||||
}
|
||||
}
|
||||
|
||||
private Menupopup contextMenu;
|
||||
|
||||
private Menupopup getContextMenu() {
|
||||
if (contextMenu == null) {
|
||||
MenuBuilder<LimitingDependencyComponent> contextMenuBuilder = MenuBuilder
|
||||
.on(getPage(), getLimitingDependencyComponents()).item(_("Erase"),
|
||||
"/common/img/ico_borrar.png",
|
||||
new ItemAction<LimitingDependencyComponent>() {
|
||||
@Override
|
||||
public void onEvent(
|
||||
final LimitingDependencyComponent choosen,
|
||||
Event event) {
|
||||
context
|
||||
.removeDependency(choosen.getDependency());
|
||||
}
|
||||
});
|
||||
contextMenuBuilder.item(_("Set End-Start"), null,
|
||||
new ChangeTypeAction(
|
||||
DependencyType.END_START));
|
||||
|
||||
contextMenuBuilder.item(_("Set Start-Start"), null,
|
||||
new ChangeTypeAction(
|
||||
DependencyType.START_START));
|
||||
|
||||
contextMenuBuilder.item(_("Set End-End"), null,
|
||||
new ChangeTypeAction(
|
||||
DependencyType.END_END));
|
||||
|
||||
contextMenu = contextMenuBuilder.create();
|
||||
|
||||
}
|
||||
return contextMenu;
|
||||
}
|
||||
|
||||
private TimeTrackerComponent getTimeTrackerComponent() {
|
||||
return getGanttPanel().getTimeTrackerComponent();
|
||||
}
|
||||
|
||||
public void redrawDependenciesConnectedTo(TaskComponent taskComponent) {
|
||||
redrawDependencyComponents(getDependencyComponentsConnectedTo(taskComponent));
|
||||
}
|
||||
|
||||
private List<LimitingDependencyComponent> getDependencyComponentsConnectedTo(
|
||||
TaskComponent taskComponent) {
|
||||
ArrayList<LimitingDependencyComponent> result = new ArrayList<LimitingDependencyComponent>();
|
||||
List<LimitingDependencyComponent> dependencies = getLimitingDependencyComponents();
|
||||
for (LimitingDependencyComponent dependencyComponent : dependencies) {
|
||||
if (dependencyComponent.getSource().equals(taskComponent)
|
||||
|| dependencyComponent.getDestination().equals(
|
||||
taskComponent)) {
|
||||
result.add(dependencyComponent);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public void redrawDependencies() {
|
||||
redrawDependencyComponents(getLimitingDependencyComponents());
|
||||
}
|
||||
|
||||
public void redrawDependencyComponents(
|
||||
List<LimitingDependencyComponent> dependencyComponents) {
|
||||
for (LimitingDependencyComponent dependencyComponent : dependencyComponents) {
|
||||
dependencyComponent.redrawDependency();
|
||||
}
|
||||
}
|
||||
|
||||
public void taskRemoved(Task task) {
|
||||
for (LimitingDependencyComponent dependencyComponent : LimitingDependencyList.this
|
||||
.getLimitingDependencyComponents()) {
|
||||
if (dependencyComponent.contains(task)) {
|
||||
this.removeChild(dependencyComponent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void remove(Dependency dependency) {
|
||||
for (LimitingDependencyComponent dependencyComponent : LimitingDependencyList.this
|
||||
.getLimitingDependencyComponents()) {
|
||||
if (dependencyComponent.hasSameSourceAndDestination(dependency)) {
|
||||
this.removeChild(dependencyComponent);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -68,6 +68,8 @@ public class LimitingResourcesPanel extends HtmlMacroComponent {
|
|||
|
||||
private TimeTracker timeTracker;
|
||||
|
||||
private LimitingDependencyList dependencyList;
|
||||
|
||||
// private WeakReferencedListeners<IFilterChangedListener> zoomListeners =
|
||||
// WeakReferencedListeners.create();
|
||||
|
||||
|
|
@ -181,7 +183,7 @@ public class LimitingResourcesPanel extends HtmlMacroComponent {
|
|||
}
|
||||
|
||||
private void registerNeededScripts() {
|
||||
getScriptsRegister().register(ScriptsRequiredByResourceLoadPanel.class);
|
||||
// getScriptsRegister().register(ScriptsRequiredByResourceLoadPanel.class);
|
||||
}
|
||||
|
||||
private IScriptsRegister getScriptsRegister() {
|
||||
|
|
@ -225,12 +227,34 @@ public class LimitingResourcesPanel extends HtmlMacroComponent {
|
|||
|
||||
@Override
|
||||
public void afterCompose() {
|
||||
|
||||
super.afterCompose();
|
||||
|
||||
leftPane.afterCompose();
|
||||
|
||||
getFellow("insertionPointRightPanel").appendChild(timeTrackerComponent);
|
||||
getFellow("insertionPointRightPanel").appendChild(limitingResourcesList);
|
||||
|
||||
/* ----------- All dependencies stuff ----------- */
|
||||
|
||||
/* Static limitingresources panel dependencies */
|
||||
// Div source = new Div();
|
||||
// Div destination = new Div();
|
||||
//
|
||||
// Dependency dependency = null;
|
||||
// LimitingDependencyComponent limitingDependencyComponent = new
|
||||
// LimitingDependencyComponent(
|
||||
// source, destination, dependency);
|
||||
//
|
||||
// dependencyList = new LimitingDependencyList(null);
|
||||
// dependencyList.addDependencyComponent(limitingDependencyComponent);
|
||||
//
|
||||
// dependencyList.afterCompose();
|
||||
//
|
||||
// getFellow("insertionPointRightPanel").appendChild(dependencyList);
|
||||
|
||||
/* ----------- All dependencies stuff ----------- */
|
||||
|
||||
TimeTrackerComponent timeTrackerHeader = createTimeTrackerHeader();
|
||||
getFellow("insertionPointTimetracker").appendChild(timeTrackerHeader);
|
||||
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@
|
|||
</component>
|
||||
|
||||
<component>
|
||||
<component-name>limitingresources</component-name>
|
||||
<component-name>limitingresources</component-name><!-- Limiting resources queue -->
|
||||
<component-class>org.zkoss.ganttz.limitingresources.LimitingResourcesComponent
|
||||
</component-class>
|
||||
<mold>
|
||||
|
|
@ -179,6 +179,17 @@
|
|||
</mold>
|
||||
</component>
|
||||
|
||||
<!-- Depencencies displayed in limiting resources window -->
|
||||
<component>
|
||||
<component-name>limitingdependencylist</component-name>
|
||||
<component-class>org.zkoss.ganttz.limitingresources.LimitingDependencyList</component-class>
|
||||
<mold>
|
||||
<mold-name>default</mold-name>
|
||||
<mold-uri>~./ganttz/limitingresources/limitingdependencylist.dsp</mold-uri>
|
||||
</mold>
|
||||
</component>
|
||||
|
||||
|
||||
<component>
|
||||
<component-name>timetracker</component-name>
|
||||
<component-class>org.zkoss.ganttz.timetracker.TimeTrackerComponent</component-class>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,16 @@
|
|||
<%@ 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="${self.uuid}" z.type="ganttz.dependencylist.Dependencylist" z.autoz="true"${self.outerAttrs}">
|
||||
|
||||
<div id="listdependencies">
|
||||
<c:forEach var="child" items="${self.children}">
|
||||
${z:redraw(child, null)}
|
||||
</c:forEach>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
|
@ -2,6 +2,7 @@
|
|||
<%@ taglib uri="http://www.zkoss.org/dsp/zk/core" prefix="z" %>
|
||||
|
||||
<c:set var="self" value="${requestScope.arg.self}"/>
|
||||
|
||||
<div id="${self.uuid}" class="row_resourceload resourceload-${self.resourceLoadType}"
|
||||
z.autoz="true" ${self.outerAttrs}">
|
||||
<span class="resourceload_name">${self.resourceLoadName}</span>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,24 @@
|
|||
/*
|
||||
* This file is part of NavalPlan
|
||||
*
|
||||
* Copyright (C) 2009 Fundación para o Fomento da Calidade Industrial e
|
||||
* Desenvolvemento Tecnolóxico de Galicia
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
zkDependencylist = {};
|
||||
|
||||
zkDependencylist.init = function (cmp) {
|
||||
}
|
||||
|
|
@ -0,0 +1,112 @@
|
|||
/*
|
||||
* This file is part of NavalPlan
|
||||
*
|
||||
* Copyright (C) 2009 Fundación para o Fomento da Calidade Industrial e
|
||||
* Desenvolvemento Tecnolóxico de Galicia
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
zkLimitingResourcesList = addLimitingResourcesListMethods( {});
|
||||
|
||||
function addLimitingResourcesListMethods(object) {
|
||||
var scrollSync;
|
||||
|
||||
function watermark() {
|
||||
return document.getElementById('watermark');
|
||||
}
|
||||
|
||||
function timetracker() {
|
||||
return document.getElementById('timetracker');
|
||||
}
|
||||
|
||||
function resourceloadlist() {
|
||||
return YAHOO.util.Selector.query('.resourceloadlist')[0];
|
||||
}
|
||||
|
||||
function taskspanelgap() {
|
||||
return YAHOO.util.Selector.query('.taskspanelgap')[0];
|
||||
}
|
||||
|
||||
function resourcesloadgraph() {
|
||||
return YAHOO.util.Selector.query('.resourcesloadgraph div')[0];
|
||||
}
|
||||
|
||||
function scrolledpannel() {
|
||||
return YAHOO.util.Selector.query('.rightpanellayout div')[0];
|
||||
}
|
||||
|
||||
|
||||
function timetrackergap() {
|
||||
return YAHOO.util.Selector.query('.timetrackergap')[0];
|
||||
}
|
||||
|
||||
function leftpanel() {
|
||||
return YAHOO.util.Selector.query('.leftpanelgap .z-tree-body')[0];
|
||||
}
|
||||
|
||||
|
||||
object.init = function(cmp) {
|
||||
this.adjustTimeTrackerSize(cmp);
|
||||
YAHOO.util.Event.addListener(window, 'resize',
|
||||
zkResourcesLoadList.adjustTimeTrackerSize, cmp);
|
||||
scrollSync = new ScrollSync(cmp);
|
||||
scrollSync.synchXChangeTo(timetracker);
|
||||
|
||||
listenToScroll();
|
||||
};
|
||||
|
||||
function listenToScroll() {
|
||||
|
||||
var timetrackergap_ = timetrackergap();
|
||||
var scrolledpannel_ = scrolledpannel();
|
||||
var resourcesloadgraph_ = resourcesloadgraph();
|
||||
var leftpanel_ = leftpanel();
|
||||
|
||||
var onScroll = function() {
|
||||
timetrackergap_.style["left"] = "-" + scrolledpannel_.scrollLeft + "px";
|
||||
leftpanel_.style["top"] = "-" + scrolledpannel_.scrollTop + "px";
|
||||
resourcesloadgraph_.scrollLeft = scrolledpannel_.scrollLeft;
|
||||
|
||||
};
|
||||
|
||||
YAHOO.util.Selector.query('.rightpanellayout div')[0].onscroll = onScroll;
|
||||
|
||||
}
|
||||
|
||||
object.adjustTimeTrackerSize = function(cmp) {
|
||||
watermark().style["height"] = cmp.clientHeight + "px";
|
||||
timetracker().style["width"] = cmp.clientWidth + "px";
|
||||
/* Set watermark width */
|
||||
YAHOO.util.Selector.query('.resourceloadlist')[0].style["width"] = YAHOO.util.Selector
|
||||
.query('.second_level_')[0].clientWidth
|
||||
+ "px";
|
||||
YAHOO.util.Selector.query('.rightpanellayout tr#watermark td')[0].style["height"] =
|
||||
/* Calculate min : taskspanelgap().clientHeight + 120 + 'px'; ) */
|
||||
YAHOO.util.Selector.query('.resourceloadlist')[0].clientHeight + 120
|
||||
+ "px";
|
||||
};
|
||||
|
||||
object.adjustResourceLoadRows = function(cmp) {
|
||||
YAHOO.util.Selector.query('.row_resourceload').each(function(node) {
|
||||
node.style["width"] = cmp.clientWidth + "px";
|
||||
});
|
||||
};
|
||||
|
||||
object.adjustScrollHorizontalPosition = function(cmp, offsetInPx) {
|
||||
cmp.scrollLeft = offsetInPx;
|
||||
}
|
||||
|
||||
return object;
|
||||
}
|
||||
|
|
@ -93,7 +93,7 @@ public class LimitingResourcesController implements Composer {
|
|||
resourceLoadModel.initGlobalView(filterBy, filterByResources);
|
||||
}
|
||||
timeTracker = buildTimeTracker();
|
||||
limitingResourcesPanel = buildResourcesLoadPanel();
|
||||
limitingResourcesPanel = buildLimitingResourcesPanel();
|
||||
addListeners();
|
||||
|
||||
this.parent.getChildren().clear();
|
||||
|
|
@ -104,7 +104,7 @@ public class LimitingResourcesController implements Composer {
|
|||
try {
|
||||
Messagebox
|
||||
.show(
|
||||
_("Some lines have not allocation periods.\nBelow it shows the load all company resources"),
|
||||
_("Limiting resources error") + e,
|
||||
_("Error"), Messagebox.OK, Messagebox.ERROR);
|
||||
} catch (InterruptedException o) {
|
||||
throw new RuntimeException(e);
|
||||
|
|
@ -139,7 +139,7 @@ public class LimitingResourcesController implements Composer {
|
|||
SeveralModificators.create(new BankHolidaysMarker()), parent);
|
||||
}
|
||||
|
||||
private LimitingResourcesPanel buildResourcesLoadPanel() {
|
||||
private LimitingResourcesPanel buildLimitingResourcesPanel() {
|
||||
return new LimitingResourcesPanel(resourceLoadModel.getLoadTimeLines(),
|
||||
timeTracker);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,8 +52,8 @@ public class LimitingResourcesTabCreator {
|
|||
LimitingResourcesController LimitingResourcesControllerGlobal,
|
||||
Component breadcrumbs) {
|
||||
return new LimitingResourcesTabCreator(mode,
|
||||
LimitingResourcesController, upCommand,
|
||||
LimitingResourcesControllerGlobal, breadcrumbs)
|
||||
LimitingResourcesController, LimitingResourcesControllerGlobal,
|
||||
breadcrumbs)
|
||||
.build();
|
||||
}
|
||||
|
||||
|
|
@ -62,29 +62,27 @@ public class LimitingResourcesTabCreator {
|
|||
|
||||
private final LimitingResourcesController LimitingResourcesControllerGlobal;
|
||||
|
||||
private final IToolbarCommand upCommand;
|
||||
private final Component breadcrumbs;
|
||||
|
||||
private LimitingResourcesTabCreator(Mode mode,
|
||||
LimitingResourcesController LimitingResourcesController,
|
||||
IToolbarCommand upCommand,
|
||||
LimitingResourcesController LimitingResourcesControllerGlobal,
|
||||
Component breadcrumbs) {
|
||||
this.mode = mode;
|
||||
this.LimitingResourcesController = LimitingResourcesController;
|
||||
this.upCommand = upCommand;
|
||||
this.LimitingResourcesControllerGlobal = LimitingResourcesControllerGlobal;
|
||||
this.breadcrumbs = breadcrumbs;
|
||||
}
|
||||
|
||||
private ITab build() {
|
||||
return TabOnModeType.forMode(mode)
|
||||
.forType(ModeType.GLOBAL, createGlobalResourcesLoadTab())
|
||||
.forType(ModeType.ORDER, createOrderResourcesLoadTab())
|
||||
.forType(ModeType.GLOBAL,
|
||||
createGlobalLimitingResourcesTab()).forType(ModeType.ORDER,
|
||||
createOrderLimitingResourcesTab())
|
||||
.create();
|
||||
}
|
||||
|
||||
private ITab createOrderResourcesLoadTab() {
|
||||
private ITab createOrderLimitingResourcesTab() {
|
||||
IComponentCreator componentCreator = new IComponentCreator() {
|
||||
|
||||
@Override
|
||||
|
|
@ -122,7 +120,7 @@ public class LimitingResourcesTabCreator {
|
|||
};
|
||||
}
|
||||
|
||||
private ITab createGlobalResourcesLoadTab() {
|
||||
private ITab createGlobalLimitingResourcesTab() {
|
||||
|
||||
final IComponentCreator componentCreator = new IComponentCreator() {
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue