diff --git a/README.md b/README.md
index 49870ab..282bc03 100644
--- a/README.md
+++ b/README.md
@@ -1 +1,6 @@
-# jdemetra-benchmarking
+# Benchmarking extension for JDemetra+
+
+This module provides some experimental methods for temporal disaggregation and multi-variate benchmarking:
+Chow-Lin, Fernandez, Litterman, Cholette, Calendarization...
+
+It has been originally designed for internal use at the NBB.
diff --git a/nbdemetra-benchmarking/pom.xml b/nbdemetra-benchmarking/pom.xml
index 55f483b..d393b7b 100644
--- a/nbdemetra-benchmarking/pom.xml
+++ b/nbdemetra-benchmarking/pom.xml
@@ -1,103 +1,170 @@
-
-
- 4.0.0
-
- eu.europa.ec.joinup.sat
- nbdemetra-parent
- 2.0.0
-
-
- nbdemetra-benchmarking
- nbm
-
- NbDemetra - Benchmarking
- This module provides some experimental methods for temporal disaggregation and multi-variate benchmarking:
- Chow-Lin, Fernandez, Litterman, Cholette, Calendarization...
- It has been originally designed for internal use at the NBB.
-
-
-
-
-
- org.netbeans.api
- org-netbeans-api-annotations-common
-
-
- org.netbeans.api
- org-netbeans-core-multiview
-
-
- org.netbeans.api
- org-openide-windows
-
-
- org.netbeans.api
- org-openide-util
-
-
- org.netbeans.api
- org-openide-util-lookup
-
-
- org.netbeans.api
- org-openide-awt
-
-
- org.netbeans.api
- org-netbeans-modules-settings
-
-
- org.netbeans.api
- org-openide-io
-
-
- org.netbeans.api
- org-openide-dialogs
-
-
- org.netbeans.api
- org-netbeans-modules-options-api
-
-
- org.netbeans.api
- org-openide-nodes
-
-
- org.netbeans.api
- org-openide-filesystems
-
-
- org.netbeans.api
- org-openide-explorer
-
-
-
-
- ${project.groupId}
- nbdemetra-core
-
-
- ${project.groupId}
- nbdemetra-ui
-
-
- ${project.groupId}
- nbdemetra-spreadsheet
- runtime
-
-
-
-
-
-
- org.codehaus.mojo
- nbm-maven-plugin
- true
-
-
-
-
-
-
-
-
+
+
+ 4.0.0
+
+ eu.europa.ec.joinup.sat
+ nbdemetra-benchmarking
+ nbm
+ 2.2.0
+
+ NbDemetra - Benchmarking
+ This module provides some experimental methods for temporal disaggregation and multi-variate benchmarking:
+ Chow-Lin, Fernandez, Litterman, Cholette, Calendarization...
+ It has been originally designed for internal use at the NBB.
+
+
+
+
+ UTF-8
+ 1.8
+ RELEASE82
+ 3.1
+ 2.6
+ 3.14
+
+ 2.2.0
+
+
+
+
+
+ eu.europa.ec.joinup.sat
+ nbdemetra-parent
+ ${demetra.version}
+ pom
+ import
+
+
+
+
+
+
+
+ org.netbeans.api
+ org-netbeans-api-annotations-common
+
+
+ org.netbeans.api
+ org-netbeans-core-multiview
+
+
+ org.netbeans.api
+ org-openide-windows
+
+
+ org.netbeans.api
+ org-openide-util
+
+
+ org.netbeans.api
+ org-openide-util-lookup
+
+
+ org.netbeans.api
+ org-openide-util-ui
+
+
+ org.netbeans.api
+ org-openide-filesystems-nb
+
+
+ org.netbeans.api
+ org-openide-awt
+
+
+ org.netbeans.api
+ org-netbeans-modules-settings
+
+
+ org.netbeans.api
+ org-openide-io
+
+
+ org.netbeans.api
+ org-openide-dialogs
+
+
+ org.netbeans.api
+ org-netbeans-modules-options-api
+
+
+ org.netbeans.api
+ org-openide-nodes
+
+
+ org.netbeans.api
+ org-openide-filesystems
+
+
+ org.netbeans.api
+ org-openide-explorer
+
+
+
+
+ eu.europa.ec.joinup.sat
+ nbdemetra-core
+
+
+ eu.europa.ec.joinup.sat
+ nbdemetra-ui
+
+
+ eu.europa.ec.joinup.sat
+ nbdemetra-spreadsheet
+ runtime
+
+
+
+
+
+ netbeans-releases
+ http://bits.netbeans.org/nexus/content/groups/netbeans/
+
+ false
+
+
+
+ joinup-releases
+ https://joinup.ec.europa.eu/nexus/content/repositories/releases/
+
+ false
+
+
+
+ joinup-snapshots
+ https://joinup.ec.europa.eu/nexus/content/repositories/snapshots/
+
+ true
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ ${maven-compiler-plugin.version}
+
+
+ ${jdk.version}
+
+
+
+ org.apache.maven.plugins
+ maven-jar-plugin
+ ${maven-jar-plugin.version}
+
+
+ true
+
+
+
+ org.codehaus.mojo
+ nbm-maven-plugin
+ ${nbm-maven-plugin.version}
+ true
+
+
+
+
diff --git a/nbdemetra-benchmarking/src/main/java/ec/benchmarking/CholetteDocument2.java b/nbdemetra-benchmarking/src/main/java/ec/benchmarking/CholetteDocument2.java
new file mode 100644
index 0000000..1bd7d09
--- /dev/null
+++ b/nbdemetra-benchmarking/src/main/java/ec/benchmarking/CholetteDocument2.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2013 National Bank of Belgium
+ *
+ * Licensed under the EUPL, Version 1.1 or – as soon they will be approved
+ * by the European Commission - subsequent versions of the EUPL (the "Licence");
+ * You may not use this work except in compliance with the Licence.
+ * You may obtain a copy of the Licence at:
+ *
+ * http://ec.europa.eu/idabc/eupl
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the Licence is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the Licence for the specific language governing permissions and
+ * limitations under the Licence.
+ */
+package ec.benchmarking;
+
+import ec.tss.Ts;
+import ec.tss.disaggregation.documents.BenchmarkingResults;
+import ec.tss.disaggregation.documents.UniCholetteSpecification;
+import ec.tss.disaggregation.processors.CholetteProcessor;
+import ec.tss.documents.MultiTsDocument;
+import ec.tstoolkit.algorithm.ProcessingContext;
+
+/**
+ *
+ * @author Jean Palate
+ */
+public class CholetteDocument2 extends MultiTsDocument2 {
+
+ public CholetteDocument2() {
+ super(CholetteProcessor.instance);
+ setSpecification(new UniCholetteSpecification());
+ }
+
+ public CholetteDocument2(ProcessingContext context) {
+ super(CholetteProcessor.instance, context);
+ setSpecification(new UniCholetteSpecification());
+ }
+
+ @Override
+ public void setInput(Ts[] s) {
+ if (s != null && s.length != 2) {
+ throw new IllegalArgumentException("Cholette requires 2 time series");
+ }
+ super.setInput(s);
+ }
+}
\ No newline at end of file
diff --git a/nbdemetra-benchmarking/src/main/java/ec/benchmarking/DentonDocument2.java b/nbdemetra-benchmarking/src/main/java/ec/benchmarking/DentonDocument2.java
new file mode 100644
index 0000000..f35cf9c
--- /dev/null
+++ b/nbdemetra-benchmarking/src/main/java/ec/benchmarking/DentonDocument2.java
@@ -0,0 +1,57 @@
+/*
+* Copyright 2013 National Bank of Belgium
+*
+* Licensed under the EUPL, Version 1.1 or – as soon they will be approved
+* by the European Commission - subsequent versions of the EUPL (the "Licence");
+* You may not use this work except in compliance with the Licence.
+* You may obtain a copy of the Licence at:
+*
+* http://ec.europa.eu/idabc/eupl
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the Licence is distributed on an "AS IS" basis,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the Licence for the specific language governing permissions and
+* limitations under the Licence.
+*/
+
+package ec.benchmarking;
+
+import ec.tss.Ts;
+import ec.tss.disaggregation.documents.BenchmarkingResults;
+import ec.tss.disaggregation.documents.DentonSpecification;
+import ec.tss.disaggregation.processors.DentonProcessor;
+import ec.tss.documents.ActiveDocument;
+import ec.tss.documents.MultiTsDocument;
+import ec.tstoolkit.algorithm.ProcessingContext;
+import java.util.Arrays;
+
+/**
+ *
+ * @author Jean Palate
+ */
+public class DentonDocument2 extends MultiTsDocument2 {
+
+ public DentonDocument2() {
+ super(DentonProcessor.instance);
+ setSpecification(new DentonSpecification());
+ }
+
+ public DentonDocument2(ProcessingContext context) {
+ super(DentonProcessor.instance, context);
+ setSpecification(new DentonSpecification());
+ }
+
+ @Override
+ public void setInput(Ts[] s) {
+ if (s != null && s.length != 2) {
+ throw new IllegalArgumentException("Denton requires 2 time series");
+ }
+ Ts[] frozen=new Ts[2];
+ for (int i=0; i
+ * @param
+ */
+public abstract class MultiTsDocument2 extends ActiveDocument {
+
+ public static final String SERIES = "series";
+ protected IProcessingFactory factory_;
+
+ public MultiTsDocument2(IProcessingFactory factory) {
+ super(factory.getInformation().name);
+ this.factory_ = factory;
+ }
+
+ public MultiTsDocument2(IProcessingFactory factory, ProcessingContext context) {
+ super(factory.getInformation().name, context);
+ this.factory_ = factory;
+ }
+
+ @Deprecated
+ public Ts[] getTs() {
+ return getInput();
+ }
+
+ @Deprecated
+ void setTs(Ts[] ts) {
+ setInput(ts);
+ }
+
+ @Override
+ public void setInput(Ts[] s) {
+ if (isLocked() || Arrays.equals(getMonikers(getInput()), getMonikers(s))) {
+ return;
+ }
+ Ts[] frozen=new Ts[s.length];
+ for (int i=0; i processing = factory_.generateProcessing(spec, getContext());
+ return processing.process(dinput);
+ }
+
+ @Override
+ public MultiTsDocument2 clone() {
+ MultiTsDocument2 cl = (MultiTsDocument2) super.clone();
+ cl.setInput(clone(getInput()), true);
+ return cl;
+ }
+
+ public IProcessingFactory getProcessor() {
+ return factory_;
+ }
+
+ public TsMoniker[] getMonikers() {
+ return getMonikers(getInput());
+ }
+
+ private static TsMoniker[] getMonikers(Ts[] ts) {
+ if (ts == null) {
+ return null;
+ }
+ TsMoniker[] monikers = new TsMoniker[ts.length];
+ for (int i = 0; i < ts.length; ++i) {
+ monikers[i] = ts[i] != null ? ts[i].getMoniker() : null;
+ }
+ return monikers;
+ }
+
+ public boolean isTsFrozen() {
+ Ts[] ts = getInput();
+ if (ts == null) {
+ return false;
+ }
+ for (int i = 0; i < ts.length; ++i) {
+ if (ts[i].isFrozen()) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public void freezeTs() {
+ Ts[] ts = getInput();
+ if (ts == null) {
+ return;
+ }
+ boolean changed = false;
+ for (int i = 0; i < ts.length; ++i) {
+ if (!ts[i].isFrozen()) {
+ ts[i] = ts[i].freeze();
+ changed = true;
+ }
+ }
+ if (changed) {
+ super.setInput(ts, true);
+ }
+ }
+
+ public void unfreezeTs() {
+ Ts[] ts = getInput();
+ if (ts == null) {
+ return;
+ }
+ boolean changed = false;
+ for (int i = 0; i < ts.length; ++i) {
+ if (ts[i].isFrozen()) {
+ ts[i] = ts[i].unfreeze();
+ changed = true;
+ }
+ }
+ if (changed) {
+ super.setInput(ts, false);
+ getMetaData().put(MetaData.DATE, new Date().toString());
+ }
+ }
+
+ @Override
+ public void setSpecification(S spec) {
+ super.setSpecification(spec);
+ }
+
+ @Override
+ public InformationSet write(boolean verbose) {
+ Ts[] ts = getInput();
+ InformationSet info = super.write(verbose);
+ info.add(ALGORITHM, factory_.getInformation());
+ if (ts != null) {
+ TsInformation tsinfo;
+ for (int i = 0; i < ts.length; ++i) {
+ if (ts[i].getMoniker().isAnonymous()) {
+ tsinfo = new TsInformation(ts[i], TsInformationType.All);
+ } else {
+ tsinfo = new TsInformation(ts[i].freeze(), TsInformationType.All);
+ }
+ info.subSet(INPUT).add(SERIES + i, tsinfo);
+ }
+ }
+ S spec = getSpecification();
+ if (spec != null) {
+ info.set(SPEC, spec.write(verbose));
+ }
+ return info;
+ }
+
+ @Override
+ public boolean read(InformationSet info) {
+ if (!super.read(info)) {
+ return false;
+ }
+ AlgorithmDescriptor algorithm = info.get(ALGORITHM, AlgorithmDescriptor.class);
+ if (algorithm == null || !factory_.getInformation().isCompatible(algorithm)) {
+ return false;
+ }
+ InformationSet input = info.getSubSet(INPUT);
+ if (input != null) {
+ List> sel = input.select(SERIES + '*', TsInformation.class);
+ Collections.sort(sel, new Information.IndexedNameSorter(SERIES));
+ Ts[] s = new Ts[sel.size()];
+ for (int i = 0; i < s.length; ++i) {
+ TsInformation tsinfo = sel.get(i).value;
+ s[i] = TsFactory.instance.createTs(tsinfo.name, tsinfo.moniker, tsinfo.metaData, tsinfo.data);
+ }
+ setInput(s, true);
+ }
+ InformationSet ispec = info.getSubSet(SPEC);
+ if (ispec != null) {
+ S spec = getSpecification();
+ if (spec == null) {
+ return false;
+ } else {
+ return spec.read(ispec);
+ }
+ }
+ return true;
+ }
+
+ @Override
+ public String getDescription() {
+ return factory_.getInformation().name; //To change body of generated methods, choose Tools | Templates.
+ }
+
+ public static Ts[] clone(Ts[] s) {
+ if (s == null || s.length == 0) {
+ return s;
+ } else {
+ Ts[] ns = s.clone();
+ for (int i = 0; i < ns.length; ++i) {
+ ns[i] = TsDocument.clone(s[i]);
+ }
+ return ns;
+ }
+ }
+}
diff --git a/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/CholetteDocFileRepository.java b/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/CholetteDocFileRepository.java
index a713379..4d0dca9 100644
--- a/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/CholetteDocFileRepository.java
+++ b/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/CholetteDocFileRepository.java
@@ -16,10 +16,10 @@
*/
package ec.nbdemetra.benchmarking;
+import ec.benchmarking.CholetteDocument2;
import ec.nbdemetra.ws.DefaultFileItemRepository;
import ec.nbdemetra.ws.IWorkspaceItemRepository;
import ec.nbdemetra.ws.WorkspaceItem;
-import ec.tss.disaggregation.documents.CholetteDocument;
import ec.tstoolkit.MetaData;
import java.util.Date;
import org.openide.util.lookup.ServiceProvider;
@@ -29,13 +29,13 @@
* @author palatej
*/
@ServiceProvider(service = IWorkspaceItemRepository.class)
-public final class CholetteDocFileRepository extends DefaultFileItemRepository {
+public final class CholetteDocFileRepository extends DefaultFileItemRepository {
public static final String REPOSITORY = "CholetteDoc";
@Override
- public Class getSupportedType() {
- return CholetteDocument.class;
+ public Class getSupportedType() {
+ return CholetteDocument2.class;
}
@Override
@@ -44,8 +44,8 @@ public String getRepository() {
}
@Override
- public boolean save(WorkspaceItem doc) {
- CholetteDocument element = doc.getElement();
+ public boolean save(WorkspaceItem doc) {
+ CholetteDocument2 element = doc.getElement();
element.getMetaData().put(MetaData.DATE, new Date().toString());
return super.save(doc);
}
diff --git a/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/CholetteDocumentManager.java b/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/CholetteDocumentManager.java
index 1f5164c..ec02e98 100644
--- a/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/CholetteDocumentManager.java
+++ b/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/CholetteDocumentManager.java
@@ -23,7 +23,7 @@
import ec.nbdemetra.ws.IWorkspaceItemManager;
import ec.nbdemetra.ws.WorkspaceFactory;
import ec.nbdemetra.ws.WorkspaceItem;
-import ec.tss.disaggregation.documents.CholetteDocument;
+import ec.benchmarking.CholetteDocument2;
import ec.tss.disaggregation.documents.UniCholetteSpecification;
import ec.tstoolkit.descriptors.IObjectDescriptor;
import ec.tstoolkit.utilities.Id;
@@ -43,17 +43,17 @@
@ServiceProvider(
service = IWorkspaceItemManager.class,
position = 1500)
-public class CholetteDocumentManager extends AbstractWorkspaceItemManager {
+public class CholetteDocumentManager extends AbstractWorkspaceItemManager {
static {
- DocumentUIServices.getDefault().register(CholetteDocument.class, new DocumentUIServices.AbstractUIFactory() {
+ DocumentUIServices.getDefault().register(CholetteDocument2.class, new DocumentUIServices.AbstractUIFactory() {
@Override
- public IObjectDescriptor getSpecificationDescriptor(CholetteDocument document) {
+ public IObjectDescriptor getSpecificationDescriptor(CholetteDocument2 document) {
return new CholetteSpecUI(document.getSpecification().clone());
}
@Override
- public IProcDocumentView getDocumentView(CholetteDocument document) {
+ public IProcDocumentView getDocumentView(CholetteDocument2 document) {
return CholetteViewFactory.getDefault().create(document);
}
@@ -76,8 +76,8 @@ public Id getId() {
}
@Override
- protected CholetteDocument createNewObject() {
- return new CholetteDocument();
+ protected CholetteDocument2 createNewObject() {
+ return new CholetteDocument2();
}
@Override
@@ -100,7 +100,7 @@ public Action getPreferredItemAction(final Id child) {
return new AbstractAction() {
@Override
public void actionPerformed(ActionEvent e) {
- WorkspaceItem doc = (WorkspaceItem) WorkspaceFactory.getInstance().getActiveWorkspace().searchDocument(child);
+ WorkspaceItem doc = (WorkspaceItem) WorkspaceFactory.getInstance().getActiveWorkspace().searchDocument(child);
if (doc != null) {
openDocument(doc);
}
@@ -110,7 +110,7 @@ public void actionPerformed(ActionEvent e) {
@Override
public Class getItemClass() {
- return CholetteDocument.class;
+ return CholetteDocument2.class;
}
@Override
@@ -118,7 +118,7 @@ public Icon getManagerIcon() {
return ImageUtilities.loadImageIcon("ec/nbdemetra/benchmarking/resource-monitor_16x16.png", false);
}
- public void openDocument(WorkspaceItem item) {
+ public void openDocument(WorkspaceItem item) {
if (item.isOpen()) {
item.getView().requestActive();
} else {
diff --git a/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/CholetteTopComponent.java b/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/CholetteTopComponent.java
index 8b85cff..806712b 100644
--- a/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/CholetteTopComponent.java
+++ b/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/CholetteTopComponent.java
@@ -16,11 +16,11 @@
*/
package ec.nbdemetra.benchmarking;
+import ec.benchmarking.CholetteDocument2;
+import ec.nbdemetra.benchmarking.ui.Ts2ProcessingViewer2;
import ec.nbdemetra.ws.WorkspaceFactory;
import ec.nbdemetra.ws.WorkspaceItem;
import ec.nbdemetra.ws.ui.WorkspaceTopComponent;
-import ec.tss.disaggregation.documents.CholetteDocument;
-import ec.ui.view.tsprocessing.Ts2ProcessingViewer;
import org.netbeans.api.settings.ConvertAsProperties;
import org.openide.awt.ActionID;
import org.openide.awt.ActionReference;
@@ -47,16 +47,16 @@
"CTL_CholetteTopComponent=Cholette Window",
"HINT_CholetteTopComponent=This is a Cholette window"
})
-public final class CholetteTopComponent extends WorkspaceTopComponent {
+public final class CholetteTopComponent extends WorkspaceTopComponent {
- protected Ts2ProcessingViewer panel;
+ protected Ts2ProcessingViewer2 panel;
public CholetteTopComponent() {
super(null);
//initDocument();
}
- public CholetteTopComponent(WorkspaceItem doc) {
+ public CholetteTopComponent(WorkspaceItem doc) {
super(doc);
initDocument();
}
@@ -66,7 +66,7 @@ public void initDocument() {
setToolTipText(Bundle.CTL_CholetteTopComponent());
initComponents();
// node=new InternalNode();
- panel = Ts2ProcessingViewer.create(this.getDocument().getElement(), "Series", "Constraint");
+ panel = Ts2ProcessingViewer2.create(this.getDocument().getElement(), "Series", "Constraint");
add(panel);
}
@@ -160,7 +160,7 @@ protected String getContextPath() {
//
// @Override
// public void setValue(Object t) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException {
-// CholetteDocument document = getDocument().getElement();
+// CholetteDocument2 document = getDocument().getElement();
// UniCholetteSpecification nspec = document.getSpecification().clone();
// nspec.setRho((Double)t);
// document.setSpecification(nspec);
@@ -188,7 +188,7 @@ protected String getContextPath() {
//
// @Override
// public void setValue(Object t) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException {
-// CholetteDocument document = getDocument().getElement();
+// CholetteDocument2 document = getDocument().getElement();
// UniCholetteSpecification nspec = document.getSpecification().clone();
// nspec.setLambda((Double)t);
// setSpecification(nspec);
@@ -220,7 +220,7 @@ protected String getContextPath() {
////
//// @Override
//// public void setValue(Object t) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException {
-//// CholetteDocument document = getDocument().getElement();
+//// CholetteDocument2 document = getDocument().getElement();
//// UniCholetteSpecification nspec = document.getSpecification().clone();
//// // to do
//// document.setSpecification(nspec);
@@ -248,7 +248,7 @@ protected String getContextPath() {
//
// @Override
// public void setValue(Object t) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException {
-// CholetteDocument document = getDocument().getElement();
+// CholetteDocument2 document = getDocument().getElement();
// UniCholetteSpecification nspec = document.getSpecification().clone();
// nspec.setAggregationFrequency((TsFrequency)t);
// document.setSpecification(nspec);
diff --git a/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/DentonDocFileRepository.java b/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/DentonDocFileRepository.java
index 807d28d..739032f 100644
--- a/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/DentonDocFileRepository.java
+++ b/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/DentonDocFileRepository.java
@@ -19,7 +19,7 @@
import ec.nbdemetra.ws.DefaultFileItemRepository;
import ec.nbdemetra.ws.IWorkspaceItemRepository;
import ec.nbdemetra.ws.WorkspaceItem;
-import ec.tss.disaggregation.documents.DentonDocument;
+import ec.benchmarking.DentonDocument2;
import ec.tstoolkit.MetaData;
import java.util.Date;
import org.openide.util.lookup.ServiceProvider;
@@ -29,13 +29,13 @@
* @author palatej
*/
@ServiceProvider(service = IWorkspaceItemRepository.class)
-public final class DentonDocFileRepository extends DefaultFileItemRepository {
+public final class DentonDocFileRepository extends DefaultFileItemRepository {
public static final String REPOSITORY = "DentonDoc";
@Override
- public Class getSupportedType() {
- return DentonDocument.class;
+ public Class getSupportedType() {
+ return DentonDocument2.class;
}
@Override
@@ -44,8 +44,8 @@ public String getRepository() {
}
@Override
- public boolean save(WorkspaceItem doc) {
- DentonDocument element = doc.getElement();
+ public boolean save(WorkspaceItem doc) {
+ DentonDocument2 element = doc.getElement();
element.getMetaData().put(MetaData.DATE, new Date().toString());
return super.save(doc);
}
diff --git a/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/DentonDocumentManager.java b/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/DentonDocumentManager.java
index 8606ffc..a9bad40 100644
--- a/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/DentonDocumentManager.java
+++ b/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/DentonDocumentManager.java
@@ -16,6 +16,7 @@
*/
package ec.nbdemetra.benchmarking;
+import ec.benchmarking.DentonDocument2;
import ec.nbdemetra.benchmarking.descriptors.DentonSpecUI;
import ec.nbdemetra.benchmarking.ui.DentonViewFactory;
import ec.nbdemetra.disaggregation.descriptors.BasicSpecUI;
@@ -25,7 +26,6 @@
import ec.nbdemetra.ws.IWorkspaceItemManager;
import ec.nbdemetra.ws.WorkspaceFactory;
import ec.nbdemetra.ws.WorkspaceItem;
-import ec.tss.disaggregation.documents.DentonDocument;
import ec.tss.disaggregation.documents.DentonSpecification;
import ec.tstoolkit.descriptors.IObjectDescriptor;
import ec.tstoolkit.utilities.Id;
@@ -41,19 +41,19 @@
@ServiceProvider(
service = IWorkspaceItemManager.class,
position = 1000)
-public class DentonDocumentManager extends AbstractWorkspaceItemManager {
+public class DentonDocumentManager extends AbstractWorkspaceItemManager {
static {
CustomPropertyEditorRegistry.INSTANCE.registerEnumEditor(BasicSpecUI.AggregationType.class);
- DocumentUIServices.getDefault().register(DentonDocument.class, new DocumentUIServices.AbstractUIFactory() {
+ DocumentUIServices.getDefault().register(DentonDocument2.class, new DocumentUIServices.AbstractUIFactory() {
@Override
- public IObjectDescriptor getSpecificationDescriptor(DentonDocument document) {
+ public IObjectDescriptor getSpecificationDescriptor(DentonDocument2 document) {
return new DentonSpecUI(document.getSpecification().clone());
}
@Override
- public IProcDocumentView getDocumentView(DentonDocument document) {
+ public IProcDocumentView getDocumentView(DentonDocument2 document) {
return DentonViewFactory.getDefault().create(document);
}
@@ -75,8 +75,8 @@ public Id getId() {
}
@Override
- protected DentonDocument createNewObject() {
- return new DentonDocument();
+ protected DentonDocument2 createNewObject() {
+ return new DentonDocument2();
}
@Override
@@ -99,7 +99,7 @@ public Action getPreferredItemAction(final Id child) {
return new AbstractAction() {
@Override
public void actionPerformed(ActionEvent e) {
- WorkspaceItem doc = (WorkspaceItem) WorkspaceFactory.getInstance().getActiveWorkspace().searchDocument(child);
+ WorkspaceItem doc = (WorkspaceItem) WorkspaceFactory.getInstance().getActiveWorkspace().searchDocument(child);
if (doc != null) {
openDocument(doc);
}
@@ -107,7 +107,7 @@ public void actionPerformed(ActionEvent e) {
};
}
- public void openDocument(WorkspaceItem item) {
+ public void openDocument(WorkspaceItem item) {
if (item.isOpen()) {
item.getView().requestActive();
} else {
@@ -119,7 +119,7 @@ public void openDocument(WorkspaceItem item) {
@Override
public Class getItemClass() {
- return DentonDocument.class;
+ return DentonDocument2.class;
}
@Override
diff --git a/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/DentonTopComponent.java b/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/DentonTopComponent.java
index 1cb7f45..754fa31 100644
--- a/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/DentonTopComponent.java
+++ b/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/DentonTopComponent.java
@@ -16,10 +16,11 @@
*/
package ec.nbdemetra.benchmarking;
+import ec.benchmarking.DentonDocument2;
+import ec.nbdemetra.benchmarking.ui.Ts2ProcessingViewer2;
import ec.nbdemetra.ws.WorkspaceFactory;
import ec.nbdemetra.ws.WorkspaceItem;
import ec.nbdemetra.ws.ui.WorkspaceTopComponent;
-import ec.tss.disaggregation.documents.DentonDocument;
import ec.ui.view.tsprocessing.Ts2ProcessingViewer;
import org.netbeans.api.settings.ConvertAsProperties;
import org.openide.awt.ActionID;
@@ -48,16 +49,16 @@
"CTL_DentonTopComponent=Denton Window",
"HINT_DentonTopComponent=This is a Denton window"
})
-public final class DentonTopComponent extends WorkspaceTopComponent {
+public final class DentonTopComponent extends WorkspaceTopComponent {
- protected Ts2ProcessingViewer panel;
+ protected Ts2ProcessingViewer2 panel;
public DentonTopComponent() {
super(null);
//initDocument();
}
- public DentonTopComponent(WorkspaceItem doc) {
+ public DentonTopComponent(WorkspaceItem doc) {
super(doc);
initDocument();
}
@@ -66,7 +67,7 @@ public void initDocument() {
setName(getDocument().getDisplayName());
setToolTipText(Bundle.CTL_CholetteTopComponent());
initComponents();
- panel = Ts2ProcessingViewer.create(this.getDocument().getElement(), "Series", "Constraint");
+ panel = Ts2ProcessingViewer2.create(this.getDocument().getElement(), "Series", "Constraint");
add(panel);
}
diff --git a/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/actions/CholetteNewDocument.java b/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/actions/CholetteNewDocument.java
index a93d88c..805da29 100644
--- a/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/actions/CholetteNewDocument.java
+++ b/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/actions/CholetteNewDocument.java
@@ -20,7 +20,7 @@
import ec.nbdemetra.ws.Workspace;
import ec.nbdemetra.ws.WorkspaceFactory;
import ec.nbdemetra.ws.WorkspaceItem;
-import ec.tss.disaggregation.documents.CholetteDocument;
+import ec.benchmarking.CholetteDocument2;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import org.openide.awt.ActionID;
@@ -44,7 +44,7 @@ public void actionPerformed(ActionEvent e) {
CholetteDocumentManager mgr=WorkspaceFactory.getInstance().getManager(CholetteDocumentManager.class);
if (mgr != null){
Workspace ws=WorkspaceFactory.getInstance().getActiveWorkspace();
- WorkspaceItem ndoc = mgr.create(ws);
+ WorkspaceItem ndoc = mgr.create(ws);
mgr.openDocument(ndoc);
}
}
diff --git a/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/actions/DentonNewDocument.java b/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/actions/DentonNewDocument.java
index 30cd5f9..5c999c1 100644
--- a/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/actions/DentonNewDocument.java
+++ b/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/actions/DentonNewDocument.java
@@ -16,13 +16,11 @@
*/
package ec.nbdemetra.benchmarking.actions;
+import ec.benchmarking.DentonDocument2;
import ec.nbdemetra.benchmarking.DentonDocumentManager;
-import ec.nbdemetra.benchmarking.MultiCholetteDocumentManager;
import ec.nbdemetra.ws.Workspace;
import ec.nbdemetra.ws.WorkspaceFactory;
import ec.nbdemetra.ws.WorkspaceItem;
-import ec.tss.disaggregation.documents.DentonDocument;
-import ec.tss.disaggregation.documents.MultiCholetteDocument;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import org.openide.awt.ActionID;
@@ -49,7 +47,7 @@ public void actionPerformed(ActionEvent e) {
DentonDocumentManager mgr = WorkspaceFactory.getInstance().getManager(DentonDocumentManager.class);
if (mgr != null) {
Workspace ws = WorkspaceFactory.getInstance().getActiveWorkspace();
- WorkspaceItem ndoc = mgr.create(ws);
+ WorkspaceItem ndoc = mgr.create(ws);
mgr.openDocument(ndoc);
}
}
diff --git a/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/ui/CholetteViewFactory.java b/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/ui/CholetteViewFactory.java
index 40ec565..0c83652 100644
--- a/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/ui/CholetteViewFactory.java
+++ b/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/ui/CholetteViewFactory.java
@@ -17,7 +17,7 @@
package ec.nbdemetra.benchmarking.ui;
import ec.tss.disaggregation.documents.BenchmarkingResults;
-import ec.tss.disaggregation.documents.CholetteDocument;
+import ec.benchmarking.CholetteDocument2;
import ec.tstoolkit.utilities.DefaultInformationExtractor;
import ec.tstoolkit.utilities.Id;
import ec.tstoolkit.utilities.InformationExtractor;
@@ -35,19 +35,19 @@
*
* @author Jean Palate
*/
-public class CholetteViewFactory extends ProcDocumentViewFactory {
+public class CholetteViewFactory extends ProcDocumentViewFactory {
public static final String INPUT = "Input", RESULTS = "Results";
public static final Id RESULTS_MAIN = new LinearId(RESULTS);
- private static final IProcDocumentViewFactory INSTANCE = new CholetteViewFactory();
+ private static final IProcDocumentViewFactory INSTANCE = new CholetteViewFactory();
- public static IProcDocumentViewFactory getDefault() {
+ public static IProcDocumentViewFactory getDefault() {
return INSTANCE;
}
private CholetteViewFactory() {
- registerFromLookup(CholetteDocument.class);
+ registerFromLookup(CholetteDocument2.class);
}
@Override
@@ -55,20 +55,20 @@ public Id getPreferredView() {
return RESULTS_MAIN; //To change body of generated methods, choose Tools | Templates.
}
- private static class CholetteExtractor extends DefaultInformationExtractor {
+ private static class CholetteExtractor extends DefaultInformationExtractor {
static final CholetteExtractor INSTANCE = new CholetteExtractor();
@Override
- public BenchmarkingResults retrieve(CholetteDocument source) {
+ public BenchmarkingResults retrieve(CholetteDocument2 source) {
return source.getResults();
}
};
- private static class ItemFactory extends ComposedProcDocumentItemFactory {
+ private static class ItemFactory extends ComposedProcDocumentItemFactory {
- public ItemFactory(Id itemId, InformationExtractor super CholetteDocument, I> informationExtractor, ItemUI extends IProcDocumentView, I> itemUI) {
- super(CholetteDocument.class, itemId, informationExtractor, itemUI);
+ public ItemFactory(Id itemId, InformationExtractor super CholetteDocument2, I> informationExtractor, ItemUI extends IProcDocumentView, I> itemUI) {
+ super(CholetteDocument2.class, itemId, informationExtractor, itemUI);
}
}
diff --git a/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/ui/DentonViewFactory.java b/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/ui/DentonViewFactory.java
index 95b7e19..03078c1 100644
--- a/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/ui/DentonViewFactory.java
+++ b/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/ui/DentonViewFactory.java
@@ -16,8 +16,8 @@
*/
package ec.nbdemetra.benchmarking.ui;
+import ec.benchmarking.DentonDocument2;
import ec.tss.disaggregation.documents.BenchmarkingResults;
-import ec.tss.disaggregation.documents.DentonDocument;
import ec.tstoolkit.utilities.DefaultInformationExtractor;
import ec.tstoolkit.utilities.Id;
import ec.tstoolkit.utilities.InformationExtractor;
@@ -35,19 +35,19 @@
*
* @author Jean Palate
*/
-public class DentonViewFactory extends ProcDocumentViewFactory {
+public class DentonViewFactory extends ProcDocumentViewFactory {
public static final String INPUT = "Input", RESULTS = "Results";
public static final Id RESULTS_MAIN = new LinearId(RESULTS);
- private static final IProcDocumentViewFactory INSTANCE = new DentonViewFactory();
+ private static final IProcDocumentViewFactory INSTANCE = new DentonViewFactory();
- public static IProcDocumentViewFactory getDefault() {
+ public static IProcDocumentViewFactory getDefault() {
return INSTANCE;
}
private DentonViewFactory() {
- registerFromLookup(DentonDocument.class);
+ registerFromLookup(DentonDocument2.class);
}
@Override
@@ -55,20 +55,20 @@ public Id getPreferredView() {
return RESULTS_MAIN; //To change body of generated methods, choose Tools | Templates.
}
- private static class DentonExtractor extends DefaultInformationExtractor {
+ private static class DentonExtractor extends DefaultInformationExtractor {
static final DentonExtractor INSTANCE = new DentonExtractor();
@Override
- public BenchmarkingResults retrieve(DentonDocument source) {
+ public BenchmarkingResults retrieve(DentonDocument2 source) {
return source.getResults();
}
};
- private static class ItemFactory extends ComposedProcDocumentItemFactory {
+ private static class ItemFactory extends ComposedProcDocumentItemFactory {
- public ItemFactory(Id itemId, InformationExtractor super DentonDocument, I> informationExtractor, ItemUI extends IProcDocumentView, I> itemUI) {
- super(DentonDocument.class, itemId, informationExtractor, itemUI);
+ public ItemFactory(Id itemId, InformationExtractor super DentonDocument2, I> informationExtractor, ItemUI extends IProcDocumentView, I> itemUI) {
+ super(DentonDocument2.class, itemId, informationExtractor, itemUI);
}
}
diff --git a/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/ui/Ts2ProcessingViewer2.java b/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/ui/Ts2ProcessingViewer2.java
new file mode 100644
index 0000000..e3090d2
--- /dev/null
+++ b/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/ui/Ts2ProcessingViewer2.java
@@ -0,0 +1,141 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package ec.nbdemetra.benchmarking.ui;
+
+import ec.benchmarking.MultiTsDocument2;
+import ec.nbdemetra.ui.MonikerUI;
+import ec.tss.Ts;
+import ec.tss.TsMoniker;
+import ec.tss.datatransfer.TssTransferSupport;
+import ec.tss.documents.MultiTsDocument;
+import ec.tstoolkit.algorithm.IProcSpecification;
+import ec.ui.view.tsprocessing.DefaultProcessingViewer;
+import java.awt.Font;
+import javax.swing.Box;
+import javax.swing.JLabel;
+import javax.swing.JToolBar;
+import javax.swing.TransferHandler;
+
+/**
+ *
+ * @author Jean Palate
+ */
+public class Ts2ProcessingViewer2 extends DefaultProcessingViewer {
+
+ // FACTORY METHODS >
+ public static Ts2ProcessingViewer2 create(MultiTsDocument2 doc, String y, String z) {
+ Ts2ProcessingViewer2 viewer = new Ts2ProcessingViewer2(Type.APPLY, y, z);
+ if (doc != null) {
+ viewer.setDocument(doc);
+ }
+ return viewer;
+ }
+ // < FACTORY METHODS
+ // CONSTANTS
+ private static final Font DROP_DATA_FONT = new JLabel().getFont().deriveFont(Font.ITALIC);
+ // visual components
+ private final JLabel dropDataLabely, dropDataLabelz;
+ private final JLabel tsLabely, tsLabelz;
+ private final JLabel specLabel;
+
+ public Ts2ProcessingViewer2(Type type, String y, String z) {
+ super(type);
+ this.dropDataLabely = new JLabel("Drop " + y + " here");
+ this.dropDataLabelz = new JLabel("Drop " + z + " here");
+ dropDataLabely.setFont(DROP_DATA_FONT);
+ dropDataLabelz.setFont(DROP_DATA_FONT);
+ this.tsLabely = new JLabel(y);
+ tsLabely.setVisible(false);
+ this.tsLabelz = new JLabel(z);
+ tsLabelz.setVisible(false);
+ this.specLabel = new JLabel("Spec: ");
+ specLabel.setVisible(false);
+
+ toolBar.add(Box.createHorizontalStrut(3), 0);
+ toolBar.add(dropDataLabely, 1);
+ toolBar.add(tsLabely, 2);
+ toolBar.add(new JToolBar.Separator(), 3);
+ toolBar.add(dropDataLabelz, 4);
+ toolBar.add(tsLabelz, 5);
+ toolBar.add(new JToolBar.Separator(), 6);
+ toolBar.add(specLabel, 7);
+
+ TsHandler hy = new TsHandler(0);
+ TsHandler hz = new TsHandler(1);
+ tsLabely.setTransferHandler(hy);
+ dropDataLabely.setTransferHandler(hy);
+ tsLabelz.setTransferHandler(hz);
+ dropDataLabelz.setTransferHandler(hz);
+ }
+
+ @Override
+ public void refreshHeader() {
+ MultiTsDocument2 doc = getDocument();
+ if (doc == null) {
+ return;
+ }
+ Ts[] input = (Ts[]) doc.getInput();
+ if (input == null || input[0] == null) {
+ dropDataLabely.setVisible(true);
+ tsLabely.setVisible(false);
+ } else {
+ dropDataLabely.setVisible(false);
+ TsMoniker monikery = input[0].getMoniker();
+ tsLabely.setIcon(MonikerUI.getDefault().getIcon(monikery));
+ tsLabely.setToolTipText(tsLabely.getText() + (monikery.getSource() != null ? (" (" + monikery.getSource() + ")") : ""));
+ tsLabely.setVisible(true);
+ }
+ if (input == null || input[1] == null) {
+ dropDataLabelz.setVisible(true);
+ tsLabelz.setVisible(false);
+ } else {
+ dropDataLabelz.setVisible(false);
+ TsMoniker monikerz = input[1].getMoniker();
+ tsLabelz.setIcon(MonikerUI.getDefault().getIcon(monikerz));
+ tsLabelz.setToolTipText(tsLabelz.getText() + (monikerz.getSource() != null ? (" (" + monikerz.getSource() + ")") : ""));
+ tsLabelz.setVisible(true);
+ }
+ if (input != null) {
+ IProcSpecification spec = doc.getSpecification();
+ specLabel.setText("Spec: " + (spec != null ? spec.toString() : ""));
+ specLabel.setVisible(true);
+ } else {
+ specLabel.setVisible(false);
+ }
+ this.toolBar.doLayout();
+
+ }
+
+ class TsHandler extends TransferHandler {
+
+ private final int pos;
+
+ TsHandler(int pos) {
+ this.pos = pos;
+ }
+
+ @Override
+ public boolean canImport(TransferSupport support) {
+ return TssTransferSupport.getDefault().canImport(support.getDataFlavors());
+ }
+
+ @Override
+ public boolean importData(TransferHandler.TransferSupport support) {
+ Ts ts = TssTransferSupport.getDefault().toTs(support.getTransferable());
+ if (ts != null) {
+ Ts[] input = (Ts[]) getDocument().getInput();
+ if (input == null) {
+ input = new Ts[2];
+ }else
+ input=input.clone();
+ input[pos] = ts;
+ getDocument().setInput(input);
+ refreshAll();
+ return true;
+ }
+ return false;
+ }
+ }
+}