diff --git a/ganttzk/src/main/java/org/zkoss/ganttz/ScriptsRequiredByPlanner.java b/ganttzk/src/main/java/org/zkoss/ganttz/ScriptsRequiredByPlanner.java
deleted file mode 100644
index 37ecf50db..000000000
--- a/ganttzk/src/main/java/org/zkoss/ganttz/ScriptsRequiredByPlanner.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * This file is part of NavalPlan
- *
- * Copyright (C) 2009-2010 Fundación para o Fomento da Calidade Industrial e
- * Desenvolvemento Tecnolóxico de Galicia
- * Copyright (C) 2010-2011 Igalia, S.L.
- *
- * 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 .
- */
-
-package org.zkoss.ganttz;
-
-import org.zkoss.ganttz.util.script.ScriptsRequiredDeclaration;
-
-@ScriptsRequiredDeclaration(dependsOn = { YUIMin.class, ScrollSyncScript.class })
-public class ScriptsRequiredByPlanner {
-
- private ScriptsRequiredByPlanner() {
- }
-
- public static final String SELECTOR = "/zkau/web/js/yui/2.7.0/selector/selector-min.js";
- public static final String YAHOO_DOM_EVENT = "/zkau/web/js/yui/2.7.0/yahoo-dom-event/yahoo-dom-event.js";
- public static final String DRAGDROPMIN = "/zkau/web/js/yui/2.7.0/dragdrop/dragdrop-min.js";
-
- public static final String ELEMENT_MIN = "/zkau/web/js/yui/2.7.0/element/element-min.js";
- public static final String RESIZE_MIN = "/zkau/web/js/yui/2.7.0/resize/resize-min.js";
- public static final String LOGGER_MIN = "/zkau/web/js/yui/2.7.0/logger/logger-min.js";
- // adding manually js associated to components since they can be used by
- // other files with no dependencies being present
- public static final String DEPENDENCY_LIST = "/zkau/web/js/ganttz/dependencylist.js";
- public static final String DEPENDENCY = "/zkau/web/js/ganttz/dependency.js";
-}
diff --git a/ganttzk/src/main/java/org/zkoss/ganttz/ScrollSyncScript.java b/ganttzk/src/main/java/org/zkoss/ganttz/ScrollSyncScript.java
deleted file mode 100644
index bda7012f8..000000000
--- a/ganttzk/src/main/java/org/zkoss/ganttz/ScrollSyncScript.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * This file is part of NavalPlan
- *
- * Copyright (C) 2009-2010 Fundación para o Fomento da Calidade Industrial e
- * Desenvolvemento Tecnolóxico de Galicia
- * Copyright (C) 2010-2011 Igalia, S.L.
- *
- * 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 .
- */
-
-package org.zkoss.ganttz;
-
-import org.zkoss.ganttz.util.script.ScriptsRequiredDeclaration;
-
-@ScriptsRequiredDeclaration(dependsOn = YUIMin.class)
-public class ScrollSyncScript {
-
- private ScrollSyncScript() {
- }
-
- public static final String SCROLL_SYNC = "/zkau/web/js/ganttz/scrollSync.js";
-
- public static final String YAHOO_DOM_EVENT = "/zkau/web/js/yui/2.7.0/yahoo-dom-event/yahoo-dom-event.js";
-
-}
diff --git a/ganttzk/src/main/java/org/zkoss/ganttz/YUIMin.java b/ganttzk/src/main/java/org/zkoss/ganttz/YUIMin.java
deleted file mode 100644
index d0afdec3c..000000000
--- a/ganttzk/src/main/java/org/zkoss/ganttz/YUIMin.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * This file is part of NavalPlan
- *
- * Copyright (C) 2009-2010 Fundación para o Fomento da Calidade Industrial e
- * Desenvolvemento Tecnolóxico de Galicia
- * Copyright (C) 2010-2011 Igalia, S.L.
- *
- * 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 .
- */
-
-package org.zkoss.ganttz;
-
-import org.zkoss.ganttz.util.script.ScriptsRequiredDeclaration;
-
-@ScriptsRequiredDeclaration
-public class YUIMin {
-
- private YUIMin() {
- }
-
- public static final String YUI_MIN = "/zkau/web/js/yui/2.7.0/yahoo/yahoo-min.js";
-
-}
diff --git a/ganttzk/src/main/java/org/zkoss/ganttz/resourceload/ResourcesLoadPanel.java b/ganttzk/src/main/java/org/zkoss/ganttz/resourceload/ResourcesLoadPanel.java
index caa27ddb6..e4d2c87a4 100644
--- a/ganttzk/src/main/java/org/zkoss/ganttz/resourceload/ResourcesLoadPanel.java
+++ b/ganttzk/src/main/java/org/zkoss/ganttz/resourceload/ResourcesLoadPanel.java
@@ -37,10 +37,8 @@ import org.zkoss.ganttz.util.Interval;
import org.zkoss.ganttz.util.LongOperationFeedback;
import org.zkoss.ganttz.util.LongOperationFeedback.ILongOperation;
import org.zkoss.ganttz.util.MutableTreeModel;
-import org.zkoss.ganttz.util.OnZKDesktopRegistry;
import org.zkoss.ganttz.util.WeakReferencedListeners;
import org.zkoss.ganttz.util.WeakReferencedListeners.IListenerNotification;
-import org.zkoss.ganttz.util.script.IScriptsRegister;
import org.zkoss.zk.au.out.AuInvoke;
import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.HtmlMacroComponent;
@@ -128,7 +126,6 @@ public class ResourcesLoadPanel extends HtmlMacroComponent {
timeTrackerComponent = timeTrackerForResourcesLoadPanel(timeTracker);
resourceLoadList = new ResourceLoadList(timeTracker, treeModel);
leftPane = new ResourceLoadLeftPane(treeModel, resourceLoadList);
- registerNeededScripts();
}
public ListModel getFilters() {
@@ -278,15 +275,6 @@ public class ResourcesLoadPanel extends HtmlMacroComponent {
return toolbar;
}
- private void registerNeededScripts() {
- getScriptsRegister().register(ScriptsRequiredByResourceLoadPanel.class);
- }
-
- private IScriptsRegister getScriptsRegister() {
- return OnZKDesktopRegistry.getLocatorFor(IScriptsRegister.class)
- .retrieve();
- }
-
private MutableTreeModel createModelForTree() {
MutableTreeModel result = MutableTreeModel
.create(LoadTimeLine.class);
@@ -513,7 +501,6 @@ public class ResourcesLoadPanel extends HtmlMacroComponent {
timeTrackerComponent = timeTrackerForResourcesLoadPanel(timeTracker);
resourceLoadList = new ResourceLoadList(timeTracker, treeModel);
leftPane = new ResourceLoadLeftPane(treeModel, resourceLoadList);
- registerNeededScripts();
}
nameFilterListener.fireEvent(new IListenerNotification() {
@Override
diff --git a/ganttzk/src/main/java/org/zkoss/ganttz/resourceload/ScriptsRequiredByResourceLoadPanel.java b/ganttzk/src/main/java/org/zkoss/ganttz/resourceload/ScriptsRequiredByResourceLoadPanel.java
deleted file mode 100644
index 9873c7de4..000000000
--- a/ganttzk/src/main/java/org/zkoss/ganttz/resourceload/ScriptsRequiredByResourceLoadPanel.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * This file is part of NavalPlan
- *
- * Copyright (C) 2009-2010 Fundación para o Fomento da Calidade Industrial e
- * Desenvolvemento Tecnolóxico de Galicia
- * Copyright (C) 2010-2011 Igalia, S.L.
- *
- * 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 .
- */
-
-package org.zkoss.ganttz.resourceload;
-
-import org.zkoss.ganttz.ScrollSyncScript;
-import org.zkoss.ganttz.YUIMin;
-import org.zkoss.ganttz.util.script.ScriptsRequiredDeclaration;
-
-@ScriptsRequiredDeclaration(dependsOn = { YUIMin.class, ScrollSyncScript.class })
-public class ScriptsRequiredByResourceLoadPanel {
-
- private ScriptsRequiredByResourceLoadPanel() {
- }
-
- public static final String SELECTOR = "/zkau/web/js/yui/2.7.0/selector/selector-min.js";
- public static final String YAHOO_DOM_EVENT = "/zkau/web/js/yui/2.7.0/yahoo-dom-event/yahoo-dom-event.js";
-
-}
diff --git a/ganttzk/src/main/java/org/zkoss/ganttz/util/script/IScriptsRegister.java b/ganttzk/src/main/java/org/zkoss/ganttz/util/script/IScriptsRegister.java
deleted file mode 100644
index e2fcb02aa..000000000
--- a/ganttzk/src/main/java/org/zkoss/ganttz/util/script/IScriptsRegister.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * This file is part of NavalPlan
- *
- * Copyright (C) 2009-2010 Fundación para o Fomento da Calidade Industrial e
- * Desenvolvemento Tecnolóxico de Galicia
- * Copyright (C) 2010-2011 Igalia, S.L.
- *
- * 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 .
- */
-
-package org.zkoss.ganttz.util.script;
-
-public interface IScriptsRegister {
-
- public void register(Class> klassContainingScripts)
- throws IllegalArgumentException;
-
-}
diff --git a/ganttzk/src/main/java/org/zkoss/ganttz/util/script/ScriptDependenciesSorter.java b/ganttzk/src/main/java/org/zkoss/ganttz/util/script/ScriptDependenciesSorter.java
deleted file mode 100644
index 10b36964b..000000000
--- a/ganttzk/src/main/java/org/zkoss/ganttz/util/script/ScriptDependenciesSorter.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * This file is part of NavalPlan
- *
- * Copyright (C) 2009-2010 Fundación para o Fomento da Calidade Industrial e
- * Desenvolvemento Tecnolóxico de Galicia
- * Copyright (C) 2010-2011 Igalia, S.L.
- *
- * 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 .
- */
-
-package org.zkoss.ganttz.util.script;
-
-import java.lang.reflect.Field;
-import java.lang.reflect.Modifier;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.apache.commons.lang.Validate;
-
-public class ScriptDependenciesSorter implements IScriptsRegister {
-
- public static List extractFrom(Class> classWithScripts) {
- ScriptsRequiredDeclaration annotation = classWithScripts
- .getAnnotation(ScriptsRequiredDeclaration.class);
- if (annotation == null) {
- throw new IllegalArgumentException(classWithScripts
- + " must be annotated with "
- + ScriptsRequiredDeclaration.class.getName());
- }
- List dependsOn = getDependencies(annotation);
- List result = new ArrayList();
- for (Field field : getStringFields(getStaticFields(classWithScripts
- .getFields()))) {
- result.add(new ScriptDependency(getValueFromStringField(field),
- dependsOn));
- }
- return result;
- }
-
- static ArrayList getDependencies(
- ScriptsRequiredDeclaration declaration) {
- Class>[] dependsOn = declaration.dependsOn();
- ArrayList result = new ArrayList();
- for (Class> klass : dependsOn) {
- result.addAll(extractFrom(klass));
- }
- return result;
- }
-
- static String getValueFromStringField(Field stringField) {
- try {
- return (String) stringField.get(null);
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
-
- private static List getStaticFields(Field[] fields) {
- List result = new ArrayList();
- for (Field field : fields) {
- if (Modifier.isStatic(field.getModifiers())) {
- result.add(field);
- }
- }
- return result;
- }
-
- static List getStringFields(Collection fields) {
- List stringFields = new ArrayList();
- for (Field field : fields) {
- if (field.getType().equals(String.class)) {
- stringFields.add(field);
- }
- }
- return stringFields;
- }
-
- private List allScripts = new ArrayList();
-
- public ScriptDependenciesSorter() {
- }
-
- public void add(ScriptDependency scriptDependency) {
- addAll(Arrays.asList(scriptDependency));
- }
-
- public void addAll(List dependencies) {
- Validate.noNullElements(dependencies);
- allScripts.addAll(dependencies);
- }
-
- public List getScriptDependenciesOrderered() {
- List result = new ArrayList();
- Set alreadyAdded = new HashSet();
- for (ScriptDependency scriptDependency : allScripts) {
- result.addAll(extract(alreadyAdded, scriptDependency));
- }
- return Collections.unmodifiableList(result);
- }
-
- private List extract(Set alreadyAdded,
- ScriptDependency scriptDependency) {
- List result = new ArrayList();
- if (alreadyAdded.contains(scriptDependency)) {
- return result;
- }
- for (ScriptDependency d : scriptDependency.getDependsOn()) {
- result.addAll(extract(alreadyAdded, d));
- }
- result.add(scriptDependency);
- alreadyAdded.add(scriptDependency);
- return result;
- }
-
- @Override
- public void register(Class> klassContainingScripts)
- throws IllegalArgumentException {
- addAll(extractFrom(klassContainingScripts));
- }
-
-}
diff --git a/ganttzk/src/main/java/org/zkoss/ganttz/util/script/ScriptDependency.java b/ganttzk/src/main/java/org/zkoss/ganttz/util/script/ScriptDependency.java
deleted file mode 100644
index aa90f78d7..000000000
--- a/ganttzk/src/main/java/org/zkoss/ganttz/util/script/ScriptDependency.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * This file is part of NavalPlan
- *
- * Copyright (C) 2009-2010 Fundación para o Fomento da Calidade Industrial e
- * Desenvolvemento Tecnolóxico de Galicia
- * Copyright (C) 2010-2011 Igalia, S.L.
- *
- * 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 .
- */
-
-package org.zkoss.ganttz.util.script;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-
-import org.apache.commons.lang.Validate;
-import org.apache.commons.lang.builder.HashCodeBuilder;
-
-/**
- * Represents a dependency to a script
- * @author Óscar González Fernández
- */
-public class ScriptDependency {
-
- public static List getOnlyURLs(
- Collection extends ScriptDependency> dependencies) {
- List result = new ArrayList();
- for (ScriptDependency scriptDependency : dependencies) {
- result.add(scriptDependency.getURL());
- }
- return result;
- }
-
- private final String url;
- private final List dependsOn;
-
- public ScriptDependency(String url) {
- this(url, Collections. emptyList());
- }
-
- public ScriptDependency(String url, Collection extends ScriptDependency> dependencies) {
- Validate.notEmpty(url);
- Validate.noNullElements(dependencies);
- this.url = url;
- this.dependsOn = Collections.unmodifiableList(new ArrayList(
- dependencies));
- }
-
- public String getURL() {
- return this.url;
- }
-
- public List getDependsOn() {
- return dependsOn;
- }
-
- @Override
- public boolean equals(Object other) {
- if (this == other) {
- return true;
- }
- if (other instanceof ScriptDependency) {
- return url.equals(((ScriptDependency) other).url);
- }
- return false;
- }
-
- @Override
- public int hashCode() {
- return new HashCodeBuilder().append(url).toHashCode();
- }
-
- @Override
- public String toString() {
- return url;
- }
-
-}
diff --git a/ganttzk/src/main/java/org/zkoss/ganttz/util/script/ScriptsComponent.java b/ganttzk/src/main/java/org/zkoss/ganttz/util/script/ScriptsComponent.java
deleted file mode 100644
index 5083e2e7a..000000000
--- a/ganttzk/src/main/java/org/zkoss/ganttz/util/script/ScriptsComponent.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * This file is part of NavalPlan
- *
- * Copyright (C) 2009-2010 Fundación para o Fomento da Calidade Industrial e
- * Desenvolvemento Tecnolóxico de Galicia
- * Copyright (C) 2010-2011 Igalia, S.L.
- *
- * 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 .
- */
-
-package org.zkoss.ganttz.util.script;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import org.zkoss.ganttz.util.OnZKDesktopRegistry;
-import org.zkoss.zk.ui.Execution;
-import org.zkoss.zk.ui.Executions;
-import org.zkoss.zk.ui.HtmlMacroComponent;
-
-public class ScriptsComponent extends HtmlMacroComponent {
-
- private List current = Collections.emptyList();
-
- public ScriptsComponent() {
- OnZKDesktopRegistry singleton = getScriptsRegister();
- ScriptRegister register;
- if (singleton.isRegistered()) {
- register = (ScriptRegister) singleton.retrieve();
- } else {
- register = new ScriptRegister();
- singleton.store(register);
- }
- register.addDependant(this);
- }
-
- private OnZKDesktopRegistry getScriptsRegister() {
- return OnZKDesktopRegistry.getLocatorFor(IScriptsRegister.class);
- }
-
- public List getScriptDependencies() {
- return current;
- }
-
- void setDependencies(List current) {
- this.current = current;
- if (!executionIsUpdatingPage()) {
- recreate();
- }
- }
-
- private boolean executionIsUpdatingPage() {
- return Executions.getCurrent().isAsyncUpdate(null);
- }
-
-}
-
-class ScriptRegister implements IScriptsRegister {
- private ScriptDependenciesSorter dependenciesSorter = new ScriptDependenciesSorter();
-
- private List dependant = new ArrayList();
-
- void addDependant(ScriptsComponent component) {
- dependant.add(component);
- }
-
- @Override
- public void register(Class> klassContainingScripts)
- throws IllegalArgumentException {
- dependenciesSorter.register(klassContainingScripts);
- notifyDependant(encodeURLs(dependenciesSorter
- .getScriptDependenciesOrderered()));
- }
-
- private List encodeURLs(
- List scriptDependenciesOrderered) {
- List result = new ArrayList();
- Execution execution = Executions.getCurrent();
- for (ScriptDependency s : scriptDependenciesOrderered) {
- result.add(new ScriptDependency(execution.encodeURL(s.getURL())));
- }
- return result;
- }
-
- private void notifyDependant(List current) {
- for (ScriptsComponent d : dependant) {
- d.setDependencies(current);
- }
- }
-}
diff --git a/ganttzk/src/main/java/org/zkoss/ganttz/util/script/ScriptsRequiredDeclaration.java b/ganttzk/src/main/java/org/zkoss/ganttz/util/script/ScriptsRequiredDeclaration.java
deleted file mode 100644
index 1bb2eeac9..000000000
--- a/ganttzk/src/main/java/org/zkoss/ganttz/util/script/ScriptsRequiredDeclaration.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * This file is part of NavalPlan
- *
- * Copyright (C) 2009-2010 Fundación para o Fomento da Calidade Industrial e
- * Desenvolvemento Tecnolóxico de Galicia
- * Copyright (C) 2010-2011 Igalia, S.L.
- *
- * 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 .
- */
-
-package org.zkoss.ganttz.util.script;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-@Retention(RetentionPolicy.RUNTIME)
-@Target(ElementType.TYPE)
-public @interface ScriptsRequiredDeclaration {
-
- public Class>[] dependsOn() default {};
-}
diff --git a/ganttzk/src/main/resources/metainfo/zk/lang-addon.xml b/ganttzk/src/main/resources/metainfo/zk/lang-addon.xml
index 9a4ff3fd4..65c70da24 100755
--- a/ganttzk/src/main/resources/metainfo/zk/lang-addon.xml
+++ b/ganttzk/src/main/resources/metainfo/zk/lang-addon.xml
@@ -182,10 +182,4 @@
~./ganttz/zul/timetracker/timetrackedtable.zul
-
- scripts
- org.zkoss.ganttz.util.script.ScriptsComponent
- ~./ganttz/zul/scripts.zul
-
-
diff --git a/ganttzk/src/test/java/org/zkoss/ganttz/util/script/ScriptDependenciesSorterTest.java b/ganttzk/src/test/java/org/zkoss/ganttz/util/script/ScriptDependenciesSorterTest.java
deleted file mode 100644
index 4b53a238d..000000000
--- a/ganttzk/src/test/java/org/zkoss/ganttz/util/script/ScriptDependenciesSorterTest.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * This file is part of NavalPlan
- *
- * Copyright (C) 2009-2010 Fundación para o Fomento da Calidade Industrial e
- * Desenvolvemento Tecnolóxico de Galicia
- * Copyright (C) 2010-2011 Igalia, S.L.
- *
- * 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 .
- */
-
-package org.zkoss.ganttz.util.script;
-
-import static org.junit.Assert.assertThat;
-
-import java.util.Arrays;
-import java.util.List;
-
-import org.hamcrest.BaseMatcher;
-import org.hamcrest.Description;
-import org.hamcrest.Matcher;
-import org.junit.Test;
-
-public class ScriptDependenciesSorterTest {
-
- private ScriptDependenciesSorter scriptDependenciesSorter;
-
- @Test(expected = IllegalArgumentException.class)
- public void cannotAddNullDependency() {
- givenAllScriptsRequired();
- scriptDependenciesSorter.add(null);
- }
-
- @Test
- public void testWithoutDependencies() {
- givenAllScriptsRequired();
- scriptDependenciesSorter.add(new ScriptDependency("A"));
- scriptDependenciesSorter.add(new ScriptDependency("B"));
- assertThat(scriptDependenciesSorter.getScriptDependenciesOrderered(),
- scriptsReturnedAre("A", "B"));
- }
-
- @Test(expected = UnsupportedOperationException.class)
- public void theDependenciesOrderedCannotBeModified() {
- givenAllScriptsRequired();
- scriptDependenciesSorter.getScriptDependenciesOrderered().add(
- new ScriptDependency("bla"));
- }
-
- @Test
- public void dependenciesGoesFirst() {
- givenAllScriptsRequired();
- scriptDependenciesSorter.add(new ScriptDependency("A", Arrays
- .asList(new ScriptDependency("B"))));
- assertThat(scriptDependenciesSorter.getScriptDependenciesOrderered(),
- scriptsReturnedAre("B", "A"));
- }
-
- @Test
- public void dependenciesAreNotRepeated() {
- givenAllScriptsRequired();
- scriptDependenciesSorter.add(new ScriptDependency("A", Arrays
- .asList(new ScriptDependency("B"))));
- scriptDependenciesSorter.add(new ScriptDependency("C", Arrays
- .asList(new ScriptDependency("B"))));
- scriptDependenciesSorter.add(new ScriptDependency("D"));
- assertThat(scriptDependenciesSorter.getScriptDependenciesOrderered(),
- scriptsReturnedAre("B", "A", "C", "D"));
- }
-
- private Matcher> scriptsReturnedAre(String... urls) {
- final List urlsList = Arrays.asList(urls);
- return new BaseMatcher>() {
-
- @Override
- public boolean matches(Object object) {
- if (object instanceof List) {
- List scriptsRequired = (List) object;
- List onlyURLs = ScriptDependency
- .getOnlyURLs(scriptsRequired);
- return onlyURLs.equals(urlsList);
- }
- return false;
- }
-
- @Override
- public void describeTo(Description description) {
- description.appendText("must return " + urlsList);
- }
- };
- }
-
- private void givenAllScriptsRequired() {
- scriptDependenciesSorter = new ScriptDependenciesSorter();
- }
-
-}
diff --git a/ganttzk/src/test/java/org/zkoss/ganttz/util/script/ScriptDependencyTest.java b/ganttzk/src/test/java/org/zkoss/ganttz/util/script/ScriptDependencyTest.java
deleted file mode 100644
index b7bced701..000000000
--- a/ganttzk/src/test/java/org/zkoss/ganttz/util/script/ScriptDependencyTest.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * This file is part of NavalPlan
- *
- * Copyright (C) 2009-2010 Fundación para o Fomento da Calidade Industrial e
- * Desenvolvemento Tecnolóxico de Galicia
- * Copyright (C) 2010-2011 Igalia, S.L.
- *
- * 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 .
- */
-
-package org.zkoss.ganttz.util.script;
-
-import static org.hamcrest.CoreMatchers.equalTo;
-import static org.hamcrest.CoreMatchers.not;
-import static org.junit.Assert.assertThat;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.junit.Test;
-
-public class ScriptDependencyTest {
-
- private ScriptDependency script;
- private String url;
- private List dependencies;
-
- private void givenScript() {
- url = "blabla/zkau/web/js/yui/2.7.0/selector/selector-min.js";
- dependencies = new ArrayList();
- dependencies.add(new ScriptDependency("blabla/blabla/bla.js"));
- script = new ScriptDependency(url, dependencies);
- }
-
- @Test
- public void aScriptHasAURL() {
- givenScript();
- assertThat(script.getURL(), equalTo(url));
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void theURLMustBeNotNull() {
- new ScriptDependency(null);
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void theURLMustBeNotEmpty() {
- new ScriptDependency("");
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void noDependenciesCanBeNull() {
- List list = new ArrayList();
- list.add(null);
- new ScriptDependency("bla", list);
- }
-
- @Test
- public void aScriptCanHaveDependencies() {
- givenScript();
- assertThat(script.getDependsOn(), equalTo(dependencies));
- }
-
- @Test(expected = UnsupportedOperationException.class)
- public void theDependenciesCannotBeModified() {
- givenScript();
- script.getDependsOn().clear();
- }
-
- @Test
- public void twoScriptsAreEqualsIfHaveTheSameURL() {
- givenScript();
- ScriptDependency scriptDependencyWithSameURL = new ScriptDependency(url);
- assertThat(scriptDependencyWithSameURL, equalTo(script));
- assertThat(scriptDependencyWithSameURL.hashCode(), equalTo(script
- .hashCode()));
- assertThat(new ScriptDependency(url + "b"), not(equalTo(script)));
- }
-
-}
diff --git a/ganttzk/src/test/java/org/zkoss/ganttz/util/script/ScriptExtractionTest.java b/ganttzk/src/test/java/org/zkoss/ganttz/util/script/ScriptExtractionTest.java
deleted file mode 100644
index a9c46b389..000000000
--- a/ganttzk/src/test/java/org/zkoss/ganttz/util/script/ScriptExtractionTest.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * This file is part of NavalPlan
- *
- * Copyright (C) 2009-2010 Fundación para o Fomento da Calidade Industrial e
- * Desenvolvemento Tecnolóxico de Galicia
- * Copyright (C) 2010-2011 Igalia, S.L.
- *
- * 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 .
- */
-
-package org.zkoss.ganttz.util.script;
-
-import static org.hamcrest.CoreMatchers.equalTo;
-import static org.junit.Assert.assertThat;
-import static org.junit.matchers.JUnitMatchers.each;
-import static org.junit.matchers.JUnitMatchers.hasItem;
-
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.hamcrest.BaseMatcher;
-import org.hamcrest.Description;
-import org.hamcrest.Matcher;
-import org.junit.Test;
-
-public class ScriptExtractionTest {
-
- @Test(expected = IllegalArgumentException.class)
- public void aClassWithoutScriptRequiredAnnotationIsNotIncluded() {
- ScriptDependenciesSorter.extractFrom(String.class);
- }
-
- @Test
- public void onlyPublicStringFieldsAreIncluded() {
- List scripts = ScriptDependenciesSorter
- .extractFrom(ScriptsDeclarationsExample.class);
- assertThat(scripts.size(), equalTo(2));
- assertThat(scripts,
- hasItem(withURL(ScriptsDeclarationsExample.EXAMPLE_A)));
- }
-
- @Test
- public void testIncludesDependencies() {
- List scripts = ScriptDependenciesSorter
- .extractFrom(ScriptsDeclarationsExample.class);
- assertThat(scripts, each(withDependencies(ScriptIncludedExample.base,
- ScriptIncludedExample.other)));
-
- }
-
- private Matcher withDependencies(final String... urls) {
- final Set urlsSet = new HashSet(Arrays.asList(urls));
- return new BaseMatcher() {
-
- @Override
- public boolean matches(Object object) {
- if (object instanceof ScriptDependency) {
- ScriptDependency dependency = (ScriptDependency) object;
- Set urls = new HashSet();
- for (ScriptDependency s : dependency.getDependsOn()) {
- urls.add(s.getURL());
- }
- return urlsSet.equals(urls);
- }
- return false;
- }
-
- @Override
- public void describeTo(Description description) {
- description.appendText("depends on "
- + Arrays.toString(urls));
- }
- };
- }
-
- private Matcher withURL(final String url) {
- return new BaseMatcher() {
-
- @Override
- public boolean matches(Object dependency) {
- if (dependency instanceof ScriptDependency) {
- ScriptDependency d = (ScriptDependency) dependency;
- return d.getURL().equals(url);
- }
- return false;
- }
-
- @Override
- public void describeTo(Description description) {
- description.appendText("it has url:" + url);
- }
- };
- }
-
-}
diff --git a/ganttzk/src/test/java/org/zkoss/ganttz/util/script/ScriptIncludedExample.java b/ganttzk/src/test/java/org/zkoss/ganttz/util/script/ScriptIncludedExample.java
deleted file mode 100644
index ed77398aa..000000000
--- a/ganttzk/src/test/java/org/zkoss/ganttz/util/script/ScriptIncludedExample.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * This file is part of NavalPlan
- *
- * Copyright (C) 2009-2010 Fundación para o Fomento da Calidade Industrial e
- * Desenvolvemento Tecnolóxico de Galicia
- * Copyright (C) 2010-2011 Igalia, S.L.
- *
- * 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 .
- */
-
-package org.zkoss.ganttz.util.script;
-
-@ScriptsRequiredDeclaration
-public class ScriptIncludedExample {
-
- public static final String base = "blabla/bla/base.js";
- public static final String other = "othare/other.js";
-
-}
diff --git a/ganttzk/src/test/java/org/zkoss/ganttz/util/script/ScriptsDeclarationsExample.java b/ganttzk/src/test/java/org/zkoss/ganttz/util/script/ScriptsDeclarationsExample.java
deleted file mode 100644
index 8e2cf1bc8..000000000
--- a/ganttzk/src/test/java/org/zkoss/ganttz/util/script/ScriptsDeclarationsExample.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * This file is part of NavalPlan
- *
- * Copyright (C) 2009-2010 Fundación para o Fomento da Calidade Industrial e
- * Desenvolvemento Tecnolóxico de Galicia
- * Copyright (C) 2010-2011 Igalia, S.L.
- *
- * 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 .
- */
-
-package org.zkoss.ganttz.util.script;
-
-@ScriptsRequiredDeclaration(dependsOn = ScriptIncludedExample.class)
-public class ScriptsDeclarationsExample {
-
- public static final String EXAMPLE_A = "/project-a/blabla/a.js";
-
- public static final String EXAMPLE_B = "/project-a/blabla/b.js";
-
- private static String EXAMPLE_NOT_INCLUDED = "/project-a/blablaadsf/a.js";
-
- public static int NOT_INCLUDED_BECAUSE_IS_NOT_STRING = 4;
-
- public String NOT_INCLUDED_BECAUSE_IS_NOT_STATIC = "balbla/bladsfafa/ba.js";
-
-}
diff --git a/navalplanner-webapp/src/main/java/org/navalplanner/web/planner/allocation/ResourceAllocationController.java b/navalplanner-webapp/src/main/java/org/navalplanner/web/planner/allocation/ResourceAllocationController.java
index a9ddd1191..96bc31594 100644
--- a/navalplanner-webapp/src/main/java/org/navalplanner/web/planner/allocation/ResourceAllocationController.java
+++ b/navalplanner-webapp/src/main/java/org/navalplanner/web/planner/allocation/ResourceAllocationController.java
@@ -56,8 +56,6 @@ import org.zkoss.ganttz.extensions.IContextWithPlannerTask;
import org.zkoss.ganttz.timetracker.ICellForDetailItemRenderer;
import org.zkoss.ganttz.timetracker.IConvertibleToColumn;
import org.zkoss.ganttz.timetracker.OnColumnsRowRenderer;
-import org.zkoss.ganttz.util.OnZKDesktopRegistry;
-import org.zkoss.ganttz.util.script.IScriptsRegister;
import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.WrongValueException;
import org.zkoss.zk.ui.event.Event;
@@ -136,16 +134,6 @@ public class ResourceAllocationController extends GenericForwardComposer {
private Window editTaskWindow;
- public static void registerNeededScripts() {
- getScriptsRegister()
- .register(ScriptsRequiredByAdvancedAllocation.class);
- }
-
- private static IScriptsRegister getScriptsRegister() {
- return OnZKDesktopRegistry.getLocatorFor(IScriptsRegister.class)
- .retrieve();
- }
-
private EditTaskController editTaskController;
public void setEditTaskController(EditTaskController editTaskController) {
diff --git a/navalplanner-webapp/src/main/java/org/navalplanner/web/planner/allocation/ScriptsRequiredByAdvancedAllocation.java b/navalplanner-webapp/src/main/java/org/navalplanner/web/planner/allocation/ScriptsRequiredByAdvancedAllocation.java
deleted file mode 100644
index 912822965..000000000
--- a/navalplanner-webapp/src/main/java/org/navalplanner/web/planner/allocation/ScriptsRequiredByAdvancedAllocation.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * This file is part of NavalPlan
- *
- * Copyright (C) 2009-2010 Fundación para o Fomento da Calidade Industrial e
- * Desenvolvemento Tecnolóxico de Galicia
- * Copyright (C) 2010-2011 Igalia, S.L.
- *
- * 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 .
- */
-package org.navalplanner.web.planner.allocation;
-
-import org.zkoss.ganttz.util.script.ScriptsRequiredDeclaration;
-
-/**
- * Represents the scripts required by advance allocation
- * @author Óscar González Fernández
- */
-@ScriptsRequiredDeclaration
-public class ScriptsRequiredByAdvancedAllocation {
-
- private ScriptsRequiredByAdvancedAllocation() {
- }
-
- public static final String ADVANDED_ALLOCATION = "/js/advanceAllocations.js";
-
-}
diff --git a/navalplanner-webapp/src/main/java/org/navalplanner/web/planner/company/CompanyPlanningController.java b/navalplanner-webapp/src/main/java/org/navalplanner/web/planner/company/CompanyPlanningController.java
index bd5553cb4..31f4f832f 100644
--- a/navalplanner-webapp/src/main/java/org/navalplanner/web/planner/company/CompanyPlanningController.java
+++ b/navalplanner-webapp/src/main/java/org/navalplanner/web/planner/company/CompanyPlanningController.java
@@ -42,10 +42,7 @@ import org.springframework.context.annotation.Scope;
import org.zkoss.ganttz.IPredicate;
import org.zkoss.ganttz.Planner;
import org.zkoss.ganttz.extensions.ICommandOnTask;
-import org.zkoss.ganttz.resourceload.ScriptsRequiredByResourceLoadPanel;
import org.zkoss.ganttz.timetracker.zoom.ZoomLevel;
-import org.zkoss.ganttz.util.OnZKDesktopRegistry;
-import org.zkoss.ganttz.util.script.IScriptsRegister;
import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.Executions;
import org.zkoss.zk.ui.WrongValueException;
@@ -92,12 +89,6 @@ public class CompanyPlanningController implements Composer {
private MultipleTabsPlannerController tabsController;
public CompanyPlanningController() {
- getScriptsRegister().register(ScriptsRequiredByResourceLoadPanel.class);
- }
-
- private IScriptsRegister getScriptsRegister() {
- return OnZKDesktopRegistry.getLocatorFor(IScriptsRegister.class)
- .retrieve();
}
private Combobox cbProgressTypes;
diff --git a/navalplanner-webapp/src/main/java/org/navalplanner/web/planner/order/OrderPlanningController.java b/navalplanner-webapp/src/main/java/org/navalplanner/web/planner/order/OrderPlanningController.java
index eaaaea914..5b3c76623 100644
--- a/navalplanner-webapp/src/main/java/org/navalplanner/web/planner/order/OrderPlanningController.java
+++ b/navalplanner-webapp/src/main/java/org/navalplanner/web/planner/order/OrderPlanningController.java
@@ -25,7 +25,6 @@ import static org.navalplanner.web.I18nHelper._;
import java.util.ArrayList;
import java.util.Arrays;
-import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
@@ -41,7 +40,6 @@ import org.navalplanner.web.common.components.finders.FilterPair;
import org.navalplanner.web.orders.OrderCRUDController;
import org.navalplanner.web.orders.OrderElementPredicate;
import org.navalplanner.web.planner.advances.AdvanceAssignmentPlanningController;
-import org.navalplanner.web.planner.allocation.ResourceAllocationController;
import org.navalplanner.web.planner.calendar.CalendarAllocationController;
import org.navalplanner.web.planner.consolidations.AdvanceConsolidationController;
import org.navalplanner.web.planner.taskedition.EditTaskController;
@@ -56,12 +54,10 @@ import org.zkoss.ganttz.extensions.ContextWithPlannerTask;
import org.zkoss.ganttz.extensions.ICommand;
import org.zkoss.ganttz.extensions.IContext;
import org.zkoss.ganttz.extensions.IContextWithPlannerTask;
-import org.zkoss.ganttz.resourceload.ScriptsRequiredByResourceLoadPanel;
import org.zkoss.ganttz.timetracker.zoom.ZoomLevel;
import org.zkoss.ganttz.util.LongOperationFeedback;
-import org.zkoss.ganttz.util.OnZKDesktopRegistry;
import org.zkoss.ganttz.util.LongOperationFeedback.ILongOperation;
-import org.zkoss.ganttz.util.script.IScriptsRegister;
+import org.zkoss.ganttz.util.OnZKDesktopRegistry;
import org.zkoss.zk.ui.Executions;
import org.zkoss.zk.ui.WrongValueException;
import org.zkoss.zk.ui.util.Composer;
@@ -115,13 +111,6 @@ public class OrderPlanningController implements Composer {
private Textbox filterNameOrderElement;
public OrderPlanningController() {
- getScriptsRegister().register(ScriptsRequiredByResourceLoadPanel.class);
- ResourceAllocationController.registerNeededScripts();
- }
-
- private IScriptsRegister getScriptsRegister() {
- return OnZKDesktopRegistry.getLocatorFor(IScriptsRegister.class)
- .retrieve();
}
public List getCriticalPath() {
diff --git a/navalplanner-webapp/src/main/webapp/common/layout/template.zul b/navalplanner-webapp/src/main/webapp/common/layout/template.zul
index dc9744dd4..f8206d1cf 100644
--- a/navalplanner-webapp/src/main/webapp/common/layout/template.zul
+++ b/navalplanner-webapp/src/main/webapp/common/layout/template.zul
@@ -50,8 +50,6 @@ signature="java.lang.Boolean isDefaultPasswordsControl()"?>
-
-