From b013b2a7bcd087a0e1969f295beef477572866e7 Mon Sep 17 00:00:00 2001 From: Jean Palate Date: Mon, 16 Oct 2017 16:58:13 +0200 Subject: [PATCH 1/5] To 2.2.1 --- nbdemetra-benchmarking/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nbdemetra-benchmarking/pom.xml b/nbdemetra-benchmarking/pom.xml index d393b7b..41cb6e2 100644 --- a/nbdemetra-benchmarking/pom.xml +++ b/nbdemetra-benchmarking/pom.xml @@ -5,7 +5,7 @@ eu.europa.ec.joinup.sat nbdemetra-benchmarking nbm - 2.2.0 + 2.2.1-SNAPSHOT NbDemetra - Benchmarking This module provides some experimental methods for temporal disaggregation and multi-variate benchmarking: From b7777a9fcd42f4f6c7c3a0adc077f485b7312564 Mon Sep 17 00:00:00 2001 From: Philippe Charles Date: Wed, 21 Feb 2018 15:43:56 +0100 Subject: [PATCH 2/5] Fixed workspace saving. --- nbdemetra-benchmarking/pom.xml | 6 +++ .../CalendarizationDocFileRepository.java | 30 ++++++++++---- .../CalendarizationDocumentManager.java | 3 +- .../CholetteDocFileRepository.java | 31 ++++++++++---- .../benchmarking/CholetteDocumentManager.java | 3 +- .../benchmarking/DentonDocFileRepository.java | 31 ++++++++++---- .../benchmarking/DentonDocumentManager.java | 3 +- .../MultiCholetteDocFileRepository.java | 37 ++++++++++++++--- .../MultiCholetteDocumentManager.java | 6 +-- ...sDisaggregationModelDocFileRepository.java | 31 ++++++++++---- .../TsDisaggregationModelManager.java | 3 +- .../file/CalendarizationDocHandler.java | 41 +++++++++++++++++++ .../workspace/file/CholetteDocHandler.java | 41 +++++++++++++++++++ .../workspace/file/DentonDocHandler.java | 41 +++++++++++++++++++ .../file/MultiCholetteDocHandler.java | 41 +++++++++++++++++++ .../file/TsDisaggregationDocHandler.java | 41 +++++++++++++++++++ 16 files changed, 344 insertions(+), 45 deletions(-) create mode 100644 nbdemetra-benchmarking/src/main/java/internal/workspace/file/CalendarizationDocHandler.java create mode 100644 nbdemetra-benchmarking/src/main/java/internal/workspace/file/CholetteDocHandler.java create mode 100644 nbdemetra-benchmarking/src/main/java/internal/workspace/file/DentonDocHandler.java create mode 100644 nbdemetra-benchmarking/src/main/java/internal/workspace/file/MultiCholetteDocHandler.java create mode 100644 nbdemetra-benchmarking/src/main/java/internal/workspace/file/TsDisaggregationDocHandler.java diff --git a/nbdemetra-benchmarking/pom.xml b/nbdemetra-benchmarking/pom.xml index 41cb6e2..8dc0de9 100644 --- a/nbdemetra-benchmarking/pom.xml +++ b/nbdemetra-benchmarking/pom.xml @@ -114,6 +114,12 @@ nbdemetra-spreadsheet runtime + + + org.projectlombok + lombok + provided + diff --git a/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/CalendarizationDocFileRepository.java b/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/CalendarizationDocFileRepository.java index 42e5a92..f38c620 100644 --- a/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/CalendarizationDocFileRepository.java +++ b/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/CalendarizationDocFileRepository.java @@ -21,6 +21,7 @@ import ec.nbdemetra.ws.WorkspaceItem; import ec.tss.disaggregation.documents.CalendarizationDocument; import ec.tstoolkit.MetaData; +import internal.workspace.file.CalendarizationDocHandler; import java.util.Date; import org.openide.util.lookup.ServiceProvider; @@ -31,23 +32,36 @@ @ServiceProvider(service = IWorkspaceItemRepository.class) public final class CalendarizationDocFileRepository extends DefaultFileItemRepository { - public static final String REPOSITORY = "CalendarizationDoc"; - + @Deprecated + public static final String REPOSITORY = CalendarizationDocHandler.REPOSITORY; + @Override public String getRepository() { return REPOSITORY; } @Override - public Class getSupportedType() { - return CalendarizationDocument.class; + public boolean load(WorkspaceItem item) { + return loadFile(item, (CalendarizationDocument o) -> { + item.setElement(o); + item.resetDirty(); + }); } - + @Override - public boolean save(WorkspaceItem doc) { - CalendarizationDocument element = doc.getElement(); + public boolean save(WorkspaceItem item) { + CalendarizationDocument element = item.getElement(); element.getMetaData().put(MetaData.DATE, new Date().toString()); - return super.save(doc); + return storeFile(item, element, item::resetDirty); } + @Override + public boolean delete(WorkspaceItem doc) { + return deleteFile(doc); + } + + @Override + public Class getSupportedType() { + return CalendarizationDocument.class; + } } diff --git a/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/CalendarizationDocumentManager.java b/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/CalendarizationDocumentManager.java index 9e78f05..44741f8 100644 --- a/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/CalendarizationDocumentManager.java +++ b/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/CalendarizationDocumentManager.java @@ -25,6 +25,7 @@ import ec.tss.disaggregation.documents.CalendarizationDocument; import ec.tstoolkit.utilities.Id; import ec.tstoolkit.utilities.LinearId; +import internal.workspace.file.CalendarizationDocHandler; import java.awt.event.ActionEvent; import javax.swing.AbstractAction; import javax.swing.Action; @@ -40,7 +41,7 @@ position = 4000) public class CalendarizationDocumentManager extends AbstractWorkspaceItemManager { - public static final LinearId ID = new LinearId("Benchmarking", "Calendarization"); + public static final LinearId ID = CalendarizationDocHandler.FAMILY; public static final String PATH = "calendarization"; public static final String ITEMPATH = "calendarization.item"; public static final String CONTEXTPATH = "calendarization.context"; 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 4d0dca9..78c16e8 100644 --- a/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/CholetteDocFileRepository.java +++ b/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/CholetteDocFileRepository.java @@ -21,6 +21,7 @@ import ec.nbdemetra.ws.IWorkspaceItemRepository; import ec.nbdemetra.ws.WorkspaceItem; import ec.tstoolkit.MetaData; +import internal.workspace.file.CholetteDocHandler; import java.util.Date; import org.openide.util.lookup.ServiceProvider; @@ -31,22 +32,36 @@ @ServiceProvider(service = IWorkspaceItemRepository.class) public final class CholetteDocFileRepository extends DefaultFileItemRepository { - public static final String REPOSITORY = "CholetteDoc"; + @Deprecated + public static final String REPOSITORY = CholetteDocHandler.REPOSITORY; @Override - public Class getSupportedType() { - return CholetteDocument2.class; + public String getRepository() { + return REPOSITORY; } @Override - public String getRepository() { - return REPOSITORY; + public boolean load(WorkspaceItem item) { + return loadFile(item, (CholetteDocument2 o) -> { + item.setElement(o); + item.resetDirty(); + }); } @Override - public boolean save(WorkspaceItem doc) { - CholetteDocument2 element = doc.getElement(); + public boolean save(WorkspaceItem item) { + CholetteDocument2 element = item.getElement(); element.getMetaData().put(MetaData.DATE, new Date().toString()); - return super.save(doc); + return storeFile(item, element, item::resetDirty); + } + + @Override + public boolean delete(WorkspaceItem doc) { + return deleteFile(doc); + } + + @Override + public Class getSupportedType() { + return CholetteDocument2.class; } } 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 ec02e98..82d0351 100644 --- a/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/CholetteDocumentManager.java +++ b/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/CholetteDocumentManager.java @@ -29,6 +29,7 @@ import ec.tstoolkit.utilities.Id; import ec.tstoolkit.utilities.LinearId; import ec.ui.view.tsprocessing.IProcDocumentView; +import internal.workspace.file.CholetteDocHandler; import java.awt.event.ActionEvent; import javax.swing.AbstractAction; import javax.swing.Action; @@ -60,7 +61,7 @@ public IProcDocumentView getDocumentView(CholetteDocument2 do }); } - public static final LinearId ID = new LinearId("Benchmarking", "Univariate", "Cholette"); + public static final LinearId ID = CholetteDocHandler.FAMILY; public static final String PATH = "cholette"; public static final String ITEMPATH = "cholette.item"; public static final String CONTEXTPATH = "cholette.context"; 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 739032f..950586b 100644 --- a/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/DentonDocFileRepository.java +++ b/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/DentonDocFileRepository.java @@ -21,6 +21,7 @@ import ec.nbdemetra.ws.WorkspaceItem; import ec.benchmarking.DentonDocument2; import ec.tstoolkit.MetaData; +import internal.workspace.file.DentonDocHandler; import java.util.Date; import org.openide.util.lookup.ServiceProvider; @@ -31,22 +32,36 @@ @ServiceProvider(service = IWorkspaceItemRepository.class) public final class DentonDocFileRepository extends DefaultFileItemRepository { - public static final String REPOSITORY = "DentonDoc"; + @Deprecated + public static final String REPOSITORY = DentonDocHandler.REPOSITORY; @Override - public Class getSupportedType() { - return DentonDocument2.class; + public String getRepository() { + return REPOSITORY; } @Override - public String getRepository() { - return REPOSITORY; + public boolean load(WorkspaceItem item) { + return loadFile(item, (DentonDocument2 o) -> { + item.setElement(o); + item.resetDirty(); + }); } @Override - public boolean save(WorkspaceItem doc) { - DentonDocument2 element = doc.getElement(); + public boolean save(WorkspaceItem item) { + DentonDocument2 element = item.getElement(); element.getMetaData().put(MetaData.DATE, new Date().toString()); - return super.save(doc); + return storeFile(item, element, item::resetDirty); + } + + @Override + public boolean delete(WorkspaceItem doc) { + return deleteFile(doc); + } + + @Override + public Class getSupportedType() { + return DentonDocument2.class; } } 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 a9bad40..4f9b749 100644 --- a/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/DentonDocumentManager.java +++ b/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/DentonDocumentManager.java @@ -31,6 +31,7 @@ import ec.tstoolkit.utilities.Id; import ec.tstoolkit.utilities.LinearId; import ec.ui.view.tsprocessing.IProcDocumentView; +import internal.workspace.file.DentonDocHandler; import java.awt.event.ActionEvent; import javax.swing.AbstractAction; import javax.swing.Action; @@ -59,7 +60,7 @@ public IProcDocumentView getDocumentView(DentonDocument2 docume }); } - public static final LinearId ID = new LinearId("Benchmarking", "Univariate", "Denton"); + public static final LinearId ID = DentonDocHandler.FAMILY; public static final String PATH = "denton"; public static final String ITEMPATH = "denton.item"; public static final String CONTEXTPATH = "denton.context"; diff --git a/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/MultiCholetteDocFileRepository.java b/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/MultiCholetteDocFileRepository.java index f59e9fb..781197a 100644 --- a/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/MultiCholetteDocFileRepository.java +++ b/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/MultiCholetteDocFileRepository.java @@ -18,25 +18,50 @@ import ec.nbdemetra.ws.DefaultFileItemRepository; import ec.nbdemetra.ws.IWorkspaceItemRepository; +import ec.nbdemetra.ws.WorkspaceItem; import ec.tss.disaggregation.documents.MultiCholetteDocument; +import ec.tstoolkit.MetaData; +import internal.workspace.file.MultiCholetteDocHandler; +import java.util.Date; import org.openide.util.lookup.ServiceProvider; /** * * @author Jean Palate - */@ServiceProvider(service = IWorkspaceItemRepository.class) -public class MultiCholetteDocFileRepository extends DefaultFileItemRepository{ + */ +@ServiceProvider(service = IWorkspaceItemRepository.class) +public class MultiCholetteDocFileRepository extends DefaultFileItemRepository { + + @Deprecated + public static final String REPOSITORY = MultiCholetteDocHandler.REPOSITORY; - public static final String REPOSITORY = "MultiCholetteDoc"; - - @Override + @Override public String getRepository() { return REPOSITORY; } + @Override + public boolean load(WorkspaceItem item) { + return loadFile(item, (MultiCholetteDocument o) -> { + item.setElement(o); + item.resetDirty(); + }); + } + + @Override + public boolean save(WorkspaceItem item) { + MultiCholetteDocument element = item.getElement(); +// element.getMetaData().put(MetaData.DATE, new Date().toString()); + return storeFile(item, element, item::resetDirty); + } + + @Override + public boolean delete(WorkspaceItem doc) { + return deleteFile(doc); + } + @Override public Class getSupportedType() { return MultiCholetteDocument.class; } } - diff --git a/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/MultiCholetteDocumentManager.java b/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/MultiCholetteDocumentManager.java index 1a0deb8..223153c 100644 --- a/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/MultiCholetteDocumentManager.java +++ b/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/MultiCholetteDocumentManager.java @@ -23,6 +23,7 @@ import ec.tss.disaggregation.documents.MultiCholetteDocument; import ec.tstoolkit.utilities.Id; import ec.tstoolkit.utilities.LinearId; +import internal.workspace.file.MultiCholetteDocHandler; import java.awt.event.ActionEvent; import javax.swing.AbstractAction; import javax.swing.Action; @@ -36,7 +37,7 @@ */ @ServiceProvider( service = IWorkspaceItemManager.class, -position = 3000) + position = 3000) public class MultiCholetteDocumentManager extends AbstractWorkspaceItemManager { // static { @@ -57,8 +58,7 @@ public class MultiCholetteDocumentManager extends AbstractWorkspaceItemManager { - public static final String REPOSITORY = "TsDisaggregationDoc"; + @Deprecated + public static final String REPOSITORY = TsDisaggregationDocHandler.REPOSITORY; @Override - public Class getSupportedType() { - return TsDisaggregationModelDocument.class; + public String getRepository() { + return REPOSITORY; } @Override - public String getRepository() { - return REPOSITORY; + public boolean load(WorkspaceItem item) { + return loadFile(item, (TsDisaggregationModelDocument o) -> { + item.setElement(o); + item.resetDirty(); + }); } @Override - public boolean save(WorkspaceItem doc) { - TsDisaggregationModelDocument element = doc.getElement(); + public boolean save(WorkspaceItem item) { + TsDisaggregationModelDocument element = item.getElement(); element.getMetaData().put(MetaData.DATE, new Date().toString()); - return super.save(doc); + return storeFile(item, element, item::resetDirty); + } + + @Override + public boolean delete(WorkspaceItem doc) { + return deleteFile(doc); + } + + @Override + public Class getSupportedType() { + return TsDisaggregationModelDocument.class; } } diff --git a/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/disaggregation/TsDisaggregationModelManager.java b/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/disaggregation/TsDisaggregationModelManager.java index 5e2beb7..536a511 100644 --- a/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/disaggregation/TsDisaggregationModelManager.java +++ b/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/disaggregation/TsDisaggregationModelManager.java @@ -32,6 +32,7 @@ import ec.tstoolkit.utilities.Id; import ec.tstoolkit.utilities.LinearId; import ec.ui.view.tsprocessing.IProcDocumentView; +import internal.workspace.file.TsDisaggregationDocHandler; import java.awt.event.ActionEvent; import javax.swing.AbstractAction; import javax.swing.Action; @@ -69,7 +70,7 @@ public IProcDocumentView getDocumentView(TsDisagg } }); } - public static final LinearId ID = new LinearId("Temporal disaggregation", "Regression model"); + public static final LinearId ID = TsDisaggregationDocHandler.FAMILY; public static final String PATH = "tsdisaggregationmodel.doc"; public static final String ITEMPATH = "tsdisaggregationmodel.doc.item"; public static final String CONTEXTPATH = "tsdisaggregationmodel.doc.context"; diff --git a/nbdemetra-benchmarking/src/main/java/internal/workspace/file/CalendarizationDocHandler.java b/nbdemetra-benchmarking/src/main/java/internal/workspace/file/CalendarizationDocHandler.java new file mode 100644 index 0000000..1c86a6c --- /dev/null +++ b/nbdemetra-benchmarking/src/main/java/internal/workspace/file/CalendarizationDocHandler.java @@ -0,0 +1,41 @@ +/* + * Copyright 2018 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 internal.workspace.file; + +import ec.demetra.workspace.WorkspaceFamily; +import ec.demetra.workspace.file.FileFormat; +import ec.demetra.workspace.file.spi.FamilyHandler; +import ec.demetra.workspace.file.util.InformationSetSupport; +import ec.tss.disaggregation.documents.CalendarizationDocument; +import ec.tstoolkit.utilities.LinearId; +import org.openide.util.lookup.ServiceProvider; + +/** + * + * @author Philippe Charles + */ +@ServiceProvider(service = FamilyHandler.class) +public final class CalendarizationDocHandler implements FamilyHandler { + + public static final LinearId FAMILY = new LinearId("Benchmarking", "Calendarization"); + public static final String REPOSITORY = "CalendarizationDoc"; + + @lombok.experimental.Delegate + private final FamilyHandler delegate = InformationSetSupport + .of(CalendarizationDocument::new, REPOSITORY) + .asHandler(WorkspaceFamily.of(FAMILY), FileFormat.GENERIC); +} diff --git a/nbdemetra-benchmarking/src/main/java/internal/workspace/file/CholetteDocHandler.java b/nbdemetra-benchmarking/src/main/java/internal/workspace/file/CholetteDocHandler.java new file mode 100644 index 0000000..5d52f0f --- /dev/null +++ b/nbdemetra-benchmarking/src/main/java/internal/workspace/file/CholetteDocHandler.java @@ -0,0 +1,41 @@ +/* + * Copyright 2018 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 internal.workspace.file; + +import ec.benchmarking.CholetteDocument2; +import ec.demetra.workspace.WorkspaceFamily; +import ec.demetra.workspace.file.FileFormat; +import ec.demetra.workspace.file.spi.FamilyHandler; +import ec.demetra.workspace.file.util.InformationSetSupport; +import ec.tstoolkit.utilities.LinearId; +import org.openide.util.lookup.ServiceProvider; + +/** + * + * @author Philippe Charles + */ +@ServiceProvider(service = FamilyHandler.class) +public final class CholetteDocHandler implements FamilyHandler { + + public static final LinearId FAMILY = new LinearId("Benchmarking", "Univariate", "Cholette"); + public static final String REPOSITORY = "CholetteDoc"; + + @lombok.experimental.Delegate + private final FamilyHandler delegate = InformationSetSupport + .of(CholetteDocument2::new, REPOSITORY) + .asHandler(WorkspaceFamily.of(FAMILY), FileFormat.GENERIC); +} diff --git a/nbdemetra-benchmarking/src/main/java/internal/workspace/file/DentonDocHandler.java b/nbdemetra-benchmarking/src/main/java/internal/workspace/file/DentonDocHandler.java new file mode 100644 index 0000000..ac648e6 --- /dev/null +++ b/nbdemetra-benchmarking/src/main/java/internal/workspace/file/DentonDocHandler.java @@ -0,0 +1,41 @@ +/* + * Copyright 2018 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 internal.workspace.file; + +import ec.benchmarking.DentonDocument2; +import ec.demetra.workspace.WorkspaceFamily; +import ec.demetra.workspace.file.FileFormat; +import ec.demetra.workspace.file.spi.FamilyHandler; +import ec.demetra.workspace.file.util.InformationSetSupport; +import ec.tstoolkit.utilities.LinearId; +import org.openide.util.lookup.ServiceProvider; + +/** + * + * @author Philippe Charles + */ +@ServiceProvider(service = FamilyHandler.class) +public final class DentonDocHandler implements FamilyHandler { + + public static final LinearId FAMILY = new LinearId("Benchmarking", "Univariate", "Denton"); + public static final String REPOSITORY = "DentonDoc"; + + @lombok.experimental.Delegate + private final FamilyHandler delegate = InformationSetSupport + .of(DentonDocument2::new, REPOSITORY) + .asHandler(WorkspaceFamily.of(FAMILY), FileFormat.GENERIC); +} diff --git a/nbdemetra-benchmarking/src/main/java/internal/workspace/file/MultiCholetteDocHandler.java b/nbdemetra-benchmarking/src/main/java/internal/workspace/file/MultiCholetteDocHandler.java new file mode 100644 index 0000000..2003819 --- /dev/null +++ b/nbdemetra-benchmarking/src/main/java/internal/workspace/file/MultiCholetteDocHandler.java @@ -0,0 +1,41 @@ +/* + * Copyright 2018 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 internal.workspace.file; + +import ec.demetra.workspace.WorkspaceFamily; +import ec.demetra.workspace.file.FileFormat; +import ec.demetra.workspace.file.spi.FamilyHandler; +import ec.demetra.workspace.file.util.InformationSetSupport; +import ec.tss.disaggregation.documents.MultiCholetteDocument; +import ec.tstoolkit.utilities.LinearId; +import org.openide.util.lookup.ServiceProvider; + +/** + * + * @author Philippe Charles + */ +@ServiceProvider(service = FamilyHandler.class) +public final class MultiCholetteDocHandler implements FamilyHandler { + + public static final LinearId FAMILY = new LinearId("Benchmarking", "Multivariate", "Cholette"); + public static final String REPOSITORY = "MultiCholetteDoc"; + + @lombok.experimental.Delegate + private final FamilyHandler delegate = InformationSetSupport + .of(MultiCholetteDocument::new, REPOSITORY) + .asHandler(WorkspaceFamily.of(FAMILY), FileFormat.GENERIC); +} diff --git a/nbdemetra-benchmarking/src/main/java/internal/workspace/file/TsDisaggregationDocHandler.java b/nbdemetra-benchmarking/src/main/java/internal/workspace/file/TsDisaggregationDocHandler.java new file mode 100644 index 0000000..8c60672 --- /dev/null +++ b/nbdemetra-benchmarking/src/main/java/internal/workspace/file/TsDisaggregationDocHandler.java @@ -0,0 +1,41 @@ +/* + * Copyright 2018 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 internal.workspace.file; + +import ec.demetra.workspace.WorkspaceFamily; +import ec.demetra.workspace.file.FileFormat; +import ec.demetra.workspace.file.spi.FamilyHandler; +import ec.demetra.workspace.file.util.InformationSetSupport; +import ec.tss.disaggregation.documents.TsDisaggregationModelDocument; +import ec.tstoolkit.utilities.LinearId; +import org.openide.util.lookup.ServiceProvider; + +/** + * + * @author Philippe Charles + */ +@ServiceProvider(service = FamilyHandler.class) +public final class TsDisaggregationDocHandler implements FamilyHandler { + + public static final LinearId FAMILY = new LinearId("Temporal disaggregation", "Regression model"); + public static final String REPOSITORY = "TsDisaggregationDoc"; + + @lombok.experimental.Delegate + private final FamilyHandler delegate = InformationSetSupport + .of(TsDisaggregationModelDocument::new, REPOSITORY) + .asHandler(WorkspaceFamily.of(FAMILY), FileFormat.GENERIC); +} From a87feb41fc0abb5a20429c380ec2e304f72b2384 Mon Sep 17 00:00:00 2001 From: Philippe Charles Date: Wed, 21 Feb 2018 16:02:46 +0100 Subject: [PATCH 3/5] Pom cleanup. --- nbdemetra-benchmarking/pom.xml | 53 +++++++++++++++++----------------- 1 file changed, 27 insertions(+), 26 deletions(-) diff --git a/nbdemetra-benchmarking/pom.xml b/nbdemetra-benchmarking/pom.xml index 8dc0de9..4f58f6f 100644 --- a/nbdemetra-benchmarking/pom.xml +++ b/nbdemetra-benchmarking/pom.xml @@ -12,7 +12,18 @@ Chow-Lin, Fernandez, Litterman, Cholette, Calendarization... It has been originally designed for internal use at the NBB. - + + + National Bank of Belgium + + + + + European Union Public Licence (EUPL) + https://joinup.ec.europa.eu/page/eupl-text-11-12 + + + UTF-8 @@ -38,7 +49,14 @@ - + + + org.projectlombok + lombok + provided + + + org.netbeans.api org-netbeans-api-annotations-common @@ -100,7 +118,6 @@ org-openide-explorer - eu.europa.ec.joinup.sat nbdemetra-core @@ -109,42 +126,26 @@ eu.europa.ec.joinup.sat nbdemetra-ui + + eu.europa.ec.joinup.sat nbdemetra-spreadsheet runtime - - - org.projectlombok - lombok - provided - netbeans-releases - http://bits.netbeans.org/nexus/content/groups/netbeans/ - - false - - + http://bits.netbeans.org/maven2/ + - joinup-releases - https://joinup.ec.europa.eu/nexus/content/repositories/releases/ - - false - - - - joinup-snapshots - https://joinup.ec.europa.eu/nexus/content/repositories/snapshots/ - - true - + oss-jfrog-artifactory-releases + https://oss.jfrog.org/artifactory/oss-release-local + From 4245cf2835890d71d38df72dc49a2cee7f8aaf63 Mon Sep 17 00:00:00 2001 From: Jean Palate Date: Tue, 27 Feb 2018 09:55:15 +0100 Subject: [PATCH 4/5] Suppression of the workaround for the problem in multitsdocument --- nbdemetra-benchmarking/pom.xml | 55 ++-- .../ec/benchmarking/CholetteDocument2.java | 49 ---- .../java/ec/benchmarking/DentonDocument2.java | 57 ---- .../ec/benchmarking/MultiTsDocument2.java | 269 ------------------ .../CalendarizationDocumentManager.java | 3 +- .../CholetteDocFileRepository.java | 18 +- .../benchmarking/CholetteDocumentManager.java | 23 +- .../benchmarking/CholetteTopComponent.java | 20 +- .../benchmarking/DentonDocFileRepository.java | 18 +- .../benchmarking/DentonDocumentManager.java | 23 +- .../benchmarking/DentonTopComponent.java | 11 +- .../MultiCholetteDocFileRepository.java | 2 - .../actions/CholetteNewDocument.java | 4 +- .../actions/DentonNewDocument.java | 4 +- .../benchmarking/ui/CholetteViewFactory.java | 20 +- .../benchmarking/ui/DentonViewFactory.java | 20 +- .../benchmarking/ui/Ts2ProcessingViewer2.java | 141 --------- .../TsDisaggregationModelManager.java | 3 +- .../workspace/file/CholetteDocHandler.java | 4 +- .../workspace/file/DentonDocHandler.java | 4 +- 20 files changed, 112 insertions(+), 636 deletions(-) delete mode 100644 nbdemetra-benchmarking/src/main/java/ec/benchmarking/CholetteDocument2.java delete mode 100644 nbdemetra-benchmarking/src/main/java/ec/benchmarking/DentonDocument2.java delete mode 100644 nbdemetra-benchmarking/src/main/java/ec/benchmarking/MultiTsDocument2.java delete mode 100644 nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/ui/Ts2ProcessingViewer2.java diff --git a/nbdemetra-benchmarking/pom.xml b/nbdemetra-benchmarking/pom.xml index 4f58f6f..707b37a 100644 --- a/nbdemetra-benchmarking/pom.xml +++ b/nbdemetra-benchmarking/pom.xml @@ -12,18 +12,7 @@ Chow-Lin, Fernandez, Litterman, Cholette, Calendarization... It has been originally designed for internal use at the NBB. - - - National Bank of Belgium - - - - - European Union Public Licence (EUPL) - https://joinup.ec.europa.eu/page/eupl-text-11-12 - - - + UTF-8 @@ -33,7 +22,7 @@ 2.6 3.14 - 2.2.0 + 2.2.1-SNAPSHOT @@ -49,14 +38,7 @@ - - - org.projectlombok - lombok - provided - - - + org.netbeans.api org-netbeans-api-annotations-common @@ -118,6 +100,7 @@ org-openide-explorer + eu.europa.ec.joinup.sat nbdemetra-core @@ -126,26 +109,42 @@ eu.europa.ec.joinup.sat nbdemetra-ui - - eu.europa.ec.joinup.sat nbdemetra-spreadsheet runtime + + + org.projectlombok + lombok + provided + netbeans-releases - http://bits.netbeans.org/maven2/ - + http://bits.netbeans.org/nexus/content/groups/netbeans/ + + false + + - oss-jfrog-artifactory-releases - https://oss.jfrog.org/artifactory/oss-release-local + joinup-releases + https://joinup.ec.europa.eu/nexus/content/repositories/releases/ + + false + + + + joinup-snapshots + https://joinup.ec.europa.eu/nexus/content/repositories/snapshots/ + + true + - diff --git a/nbdemetra-benchmarking/src/main/java/ec/benchmarking/CholetteDocument2.java b/nbdemetra-benchmarking/src/main/java/ec/benchmarking/CholetteDocument2.java deleted file mode 100644 index 1bd7d09..0000000 --- a/nbdemetra-benchmarking/src/main/java/ec/benchmarking/CholetteDocument2.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * 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 deleted file mode 100644 index f35cf9c..0000000 --- a/nbdemetra-benchmarking/src/main/java/ec/benchmarking/DentonDocument2.java +++ /dev/null @@ -1,57 +0,0 @@ -/* -* 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/CalendarizationDocumentManager.java b/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/CalendarizationDocumentManager.java index 44741f8..9e78f05 100644 --- a/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/CalendarizationDocumentManager.java +++ b/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/CalendarizationDocumentManager.java @@ -25,7 +25,6 @@ import ec.tss.disaggregation.documents.CalendarizationDocument; import ec.tstoolkit.utilities.Id; import ec.tstoolkit.utilities.LinearId; -import internal.workspace.file.CalendarizationDocHandler; import java.awt.event.ActionEvent; import javax.swing.AbstractAction; import javax.swing.Action; @@ -41,7 +40,7 @@ position = 4000) public class CalendarizationDocumentManager extends AbstractWorkspaceItemManager { - public static final LinearId ID = CalendarizationDocHandler.FAMILY; + public static final LinearId ID = new LinearId("Benchmarking", "Calendarization"); public static final String PATH = "calendarization"; public static final String ITEMPATH = "calendarization.item"; public static final String CONTEXTPATH = "calendarization.context"; 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 78c16e8..973c4d1 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 internal.workspace.file.CholetteDocHandler; import java.util.Date; @@ -30,7 +30,7 @@ * @author palatej */ @ServiceProvider(service = IWorkspaceItemRepository.class) -public final class CholetteDocFileRepository extends DefaultFileItemRepository { +public final class CholetteDocFileRepository extends DefaultFileItemRepository { @Deprecated public static final String REPOSITORY = CholetteDocHandler.REPOSITORY; @@ -41,27 +41,27 @@ public String getRepository() { } @Override - public boolean load(WorkspaceItem item) { - return loadFile(item, (CholetteDocument2 o) -> { + public boolean load(WorkspaceItem item) { + return loadFile(item, (CholetteDocument o) -> { item.setElement(o); item.resetDirty(); }); } @Override - public boolean save(WorkspaceItem item) { - CholetteDocument2 element = item.getElement(); + public boolean save(WorkspaceItem item) { + CholetteDocument element = item.getElement(); element.getMetaData().put(MetaData.DATE, new Date().toString()); return storeFile(item, element, item::resetDirty); } @Override - public boolean delete(WorkspaceItem doc) { + public boolean delete(WorkspaceItem doc) { return deleteFile(doc); } @Override - public Class getSupportedType() { - return CholetteDocument2.class; + public Class getSupportedType() { + return CholetteDocument.class; } } 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 82d0351..1f5164c 100644 --- a/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/CholetteDocumentManager.java +++ b/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/CholetteDocumentManager.java @@ -23,13 +23,12 @@ import ec.nbdemetra.ws.IWorkspaceItemManager; import ec.nbdemetra.ws.WorkspaceFactory; import ec.nbdemetra.ws.WorkspaceItem; -import ec.benchmarking.CholetteDocument2; +import ec.tss.disaggregation.documents.CholetteDocument; import ec.tss.disaggregation.documents.UniCholetteSpecification; import ec.tstoolkit.descriptors.IObjectDescriptor; import ec.tstoolkit.utilities.Id; import ec.tstoolkit.utilities.LinearId; import ec.ui.view.tsprocessing.IProcDocumentView; -import internal.workspace.file.CholetteDocHandler; import java.awt.event.ActionEvent; import javax.swing.AbstractAction; import javax.swing.Action; @@ -44,24 +43,24 @@ @ServiceProvider( service = IWorkspaceItemManager.class, position = 1500) -public class CholetteDocumentManager extends AbstractWorkspaceItemManager { +public class CholetteDocumentManager extends AbstractWorkspaceItemManager { static { - DocumentUIServices.getDefault().register(CholetteDocument2.class, new DocumentUIServices.AbstractUIFactory() { + DocumentUIServices.getDefault().register(CholetteDocument.class, new DocumentUIServices.AbstractUIFactory() { @Override - public IObjectDescriptor getSpecificationDescriptor(CholetteDocument2 document) { + public IObjectDescriptor getSpecificationDescriptor(CholetteDocument document) { return new CholetteSpecUI(document.getSpecification().clone()); } @Override - public IProcDocumentView getDocumentView(CholetteDocument2 document) { + public IProcDocumentView getDocumentView(CholetteDocument document) { return CholetteViewFactory.getDefault().create(document); } }); } - public static final LinearId ID = CholetteDocHandler.FAMILY; + public static final LinearId ID = new LinearId("Benchmarking", "Univariate", "Cholette"); public static final String PATH = "cholette"; public static final String ITEMPATH = "cholette.item"; public static final String CONTEXTPATH = "cholette.context"; @@ -77,8 +76,8 @@ public Id getId() { } @Override - protected CholetteDocument2 createNewObject() { - return new CholetteDocument2(); + protected CholetteDocument createNewObject() { + return new CholetteDocument(); } @Override @@ -101,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); } @@ -111,7 +110,7 @@ public void actionPerformed(ActionEvent e) { @Override public Class getItemClass() { - return CholetteDocument2.class; + return CholetteDocument.class; } @Override @@ -119,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 806712b..ab679a7 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.tss.disaggregation.documents.CholetteDocument; import ec.nbdemetra.ws.WorkspaceFactory; import ec.nbdemetra.ws.WorkspaceItem; import ec.nbdemetra.ws.ui.WorkspaceTopComponent; +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 Ts2ProcessingViewer2 panel; + protected Ts2ProcessingViewer 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 = Ts2ProcessingViewer2.create(this.getDocument().getElement(), "Series", "Constraint"); + panel = Ts2ProcessingViewer.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 { -// CholetteDocument2 document = getDocument().getElement(); +// CholetteDocument 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 { -// CholetteDocument2 document = getDocument().getElement(); +// CholetteDocument 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 { -//// CholetteDocument2 document = getDocument().getElement(); +//// CholetteDocument 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 { -// CholetteDocument2 document = getDocument().getElement(); +// CholetteDocument 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 950586b..616f54e 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.benchmarking.DentonDocument2; +import ec.tss.disaggregation.documents.DentonDocument; import ec.tstoolkit.MetaData; import internal.workspace.file.DentonDocHandler; import java.util.Date; @@ -30,7 +30,7 @@ * @author palatej */ @ServiceProvider(service = IWorkspaceItemRepository.class) -public final class DentonDocFileRepository extends DefaultFileItemRepository { +public final class DentonDocFileRepository extends DefaultFileItemRepository { @Deprecated public static final String REPOSITORY = DentonDocHandler.REPOSITORY; @@ -41,27 +41,27 @@ public String getRepository() { } @Override - public boolean load(WorkspaceItem item) { - return loadFile(item, (DentonDocument2 o) -> { + public boolean load(WorkspaceItem item) { + return loadFile(item, (DentonDocument o) -> { item.setElement(o); item.resetDirty(); }); } @Override - public boolean save(WorkspaceItem item) { - DentonDocument2 element = item.getElement(); + public boolean save(WorkspaceItem item) { + DentonDocument element = item.getElement(); element.getMetaData().put(MetaData.DATE, new Date().toString()); return storeFile(item, element, item::resetDirty); } @Override - public boolean delete(WorkspaceItem doc) { + public boolean delete(WorkspaceItem doc) { return deleteFile(doc); } @Override - public Class getSupportedType() { - return DentonDocument2.class; + public Class getSupportedType() { + return DentonDocument.class; } } 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 4f9b749..0dd8a64 100644 --- a/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/DentonDocumentManager.java +++ b/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/DentonDocumentManager.java @@ -16,7 +16,7 @@ */ package ec.nbdemetra.benchmarking; -import ec.benchmarking.DentonDocument2; +import ec.tss.disaggregation.documents.DentonDocument; import ec.nbdemetra.benchmarking.descriptors.DentonSpecUI; import ec.nbdemetra.benchmarking.ui.DentonViewFactory; import ec.nbdemetra.disaggregation.descriptors.BasicSpecUI; @@ -31,7 +31,6 @@ import ec.tstoolkit.utilities.Id; import ec.tstoolkit.utilities.LinearId; import ec.ui.view.tsprocessing.IProcDocumentView; -import internal.workspace.file.DentonDocHandler; import java.awt.event.ActionEvent; import javax.swing.AbstractAction; import javax.swing.Action; @@ -42,25 +41,25 @@ @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(DentonDocument2.class, new DocumentUIServices.AbstractUIFactory() { + DocumentUIServices.getDefault().register(DentonDocument.class, new DocumentUIServices.AbstractUIFactory() { @Override - public IObjectDescriptor getSpecificationDescriptor(DentonDocument2 document) { + public IObjectDescriptor getSpecificationDescriptor(DentonDocument document) { return new DentonSpecUI(document.getSpecification().clone()); } @Override - public IProcDocumentView getDocumentView(DentonDocument2 document) { + public IProcDocumentView getDocumentView(DentonDocument document) { return DentonViewFactory.getDefault().create(document); } }); } - public static final LinearId ID = DentonDocHandler.FAMILY; + public static final LinearId ID = new LinearId("Benchmarking", "Univariate", "Denton"); public static final String PATH = "denton"; public static final String ITEMPATH = "denton.item"; public static final String CONTEXTPATH = "denton.context"; @@ -76,8 +75,8 @@ public Id getId() { } @Override - protected DentonDocument2 createNewObject() { - return new DentonDocument2(); + protected DentonDocument createNewObject() { + return new DentonDocument(); } @Override @@ -100,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); } @@ -108,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 { @@ -120,7 +119,7 @@ public void openDocument(WorkspaceItem item) { @Override public Class getItemClass() { - return DentonDocument2.class; + return DentonDocument.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 754fa31..f2472e6 100644 --- a/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/DentonTopComponent.java +++ b/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/DentonTopComponent.java @@ -16,8 +16,7 @@ */ package ec.nbdemetra.benchmarking; -import ec.benchmarking.DentonDocument2; -import ec.nbdemetra.benchmarking.ui.Ts2ProcessingViewer2; +import ec.tss.disaggregation.documents.DentonDocument; import ec.nbdemetra.ws.WorkspaceFactory; import ec.nbdemetra.ws.WorkspaceItem; import ec.nbdemetra.ws.ui.WorkspaceTopComponent; @@ -49,16 +48,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 Ts2ProcessingViewer2 panel; + protected Ts2ProcessingViewer panel; public DentonTopComponent() { super(null); //initDocument(); } - public DentonTopComponent(WorkspaceItem doc) { + public DentonTopComponent(WorkspaceItem doc) { super(doc); initDocument(); } @@ -67,7 +66,7 @@ public void initDocument() { setName(getDocument().getDisplayName()); setToolTipText(Bundle.CTL_CholetteTopComponent()); initComponents(); - panel = Ts2ProcessingViewer2.create(this.getDocument().getElement(), "Series", "Constraint"); + panel = Ts2ProcessingViewer.create(this.getDocument().getElement(), "Series", "Constraint"); add(panel); } diff --git a/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/MultiCholetteDocFileRepository.java b/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/MultiCholetteDocFileRepository.java index 781197a..1c25073 100644 --- a/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/MultiCholetteDocFileRepository.java +++ b/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/MultiCholetteDocFileRepository.java @@ -20,9 +20,7 @@ import ec.nbdemetra.ws.IWorkspaceItemRepository; import ec.nbdemetra.ws.WorkspaceItem; import ec.tss.disaggregation.documents.MultiCholetteDocument; -import ec.tstoolkit.MetaData; import internal.workspace.file.MultiCholetteDocHandler; -import java.util.Date; import org.openide.util.lookup.ServiceProvider; /** 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 805da29..a93d88c 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.benchmarking.CholetteDocument2; +import ec.tss.disaggregation.documents.CholetteDocument; 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 5c999c1..aace589 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,7 +16,7 @@ */ package ec.nbdemetra.benchmarking.actions; -import ec.benchmarking.DentonDocument2; +import ec.tss.disaggregation.documents.DentonDocument; import ec.nbdemetra.benchmarking.DentonDocumentManager; import ec.nbdemetra.ws.Workspace; import ec.nbdemetra.ws.WorkspaceFactory; @@ -47,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 0c83652..40ec565 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.benchmarking.CholetteDocument2; +import ec.tss.disaggregation.documents.CholetteDocument; 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(CholetteDocument2.class); + registerFromLookup(CholetteDocument.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(CholetteDocument2 source) { + public BenchmarkingResults retrieve(CholetteDocument source) { return source.getResults(); } }; - private static class ItemFactory extends ComposedProcDocumentItemFactory { + private static class ItemFactory extends ComposedProcDocumentItemFactory { - public ItemFactory(Id itemId, InformationExtractor informationExtractor, ItemUI, I> itemUI) { - super(CholetteDocument2.class, itemId, informationExtractor, itemUI); + public ItemFactory(Id itemId, InformationExtractor informationExtractor, ItemUI, I> itemUI) { + super(CholetteDocument.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 03078c1..59942e5 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,7 +16,7 @@ */ package ec.nbdemetra.benchmarking.ui; -import ec.benchmarking.DentonDocument2; +import ec.tss.disaggregation.documents.DentonDocument; import ec.tss.disaggregation.documents.BenchmarkingResults; import ec.tstoolkit.utilities.DefaultInformationExtractor; import ec.tstoolkit.utilities.Id; @@ -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(DentonDocument2.class); + registerFromLookup(DentonDocument.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(DentonDocument2 source) { + public BenchmarkingResults retrieve(DentonDocument source) { return source.getResults(); } }; - private static class ItemFactory extends ComposedProcDocumentItemFactory { + private static class ItemFactory extends ComposedProcDocumentItemFactory { - public ItemFactory(Id itemId, InformationExtractor informationExtractor, ItemUI, I> itemUI) { - super(DentonDocument2.class, itemId, informationExtractor, itemUI); + public ItemFactory(Id itemId, InformationExtractor informationExtractor, ItemUI, I> itemUI) { + super(DentonDocument.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 deleted file mode 100644 index e3090d2..0000000 --- a/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/ui/Ts2ProcessingViewer2.java +++ /dev/null @@ -1,141 +0,0 @@ -/* - * 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; - } - } -} diff --git a/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/disaggregation/TsDisaggregationModelManager.java b/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/disaggregation/TsDisaggregationModelManager.java index 536a511..5e2beb7 100644 --- a/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/disaggregation/TsDisaggregationModelManager.java +++ b/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/disaggregation/TsDisaggregationModelManager.java @@ -32,7 +32,6 @@ import ec.tstoolkit.utilities.Id; import ec.tstoolkit.utilities.LinearId; import ec.ui.view.tsprocessing.IProcDocumentView; -import internal.workspace.file.TsDisaggregationDocHandler; import java.awt.event.ActionEvent; import javax.swing.AbstractAction; import javax.swing.Action; @@ -70,7 +69,7 @@ public IProcDocumentView getDocumentView(TsDisagg } }); } - public static final LinearId ID = TsDisaggregationDocHandler.FAMILY; + public static final LinearId ID = new LinearId("Temporal disaggregation", "Regression model"); public static final String PATH = "tsdisaggregationmodel.doc"; public static final String ITEMPATH = "tsdisaggregationmodel.doc.item"; public static final String CONTEXTPATH = "tsdisaggregationmodel.doc.context"; diff --git a/nbdemetra-benchmarking/src/main/java/internal/workspace/file/CholetteDocHandler.java b/nbdemetra-benchmarking/src/main/java/internal/workspace/file/CholetteDocHandler.java index 5d52f0f..b801f85 100644 --- a/nbdemetra-benchmarking/src/main/java/internal/workspace/file/CholetteDocHandler.java +++ b/nbdemetra-benchmarking/src/main/java/internal/workspace/file/CholetteDocHandler.java @@ -16,11 +16,11 @@ */ package internal.workspace.file; -import ec.benchmarking.CholetteDocument2; import ec.demetra.workspace.WorkspaceFamily; import ec.demetra.workspace.file.FileFormat; import ec.demetra.workspace.file.spi.FamilyHandler; import ec.demetra.workspace.file.util.InformationSetSupport; +import ec.tss.disaggregation.documents.CholetteDocument; import ec.tstoolkit.utilities.LinearId; import org.openide.util.lookup.ServiceProvider; @@ -36,6 +36,6 @@ public final class CholetteDocHandler implements FamilyHandler { @lombok.experimental.Delegate private final FamilyHandler delegate = InformationSetSupport - .of(CholetteDocument2::new, REPOSITORY) + .of(CholetteDocument::new, REPOSITORY) .asHandler(WorkspaceFamily.of(FAMILY), FileFormat.GENERIC); } diff --git a/nbdemetra-benchmarking/src/main/java/internal/workspace/file/DentonDocHandler.java b/nbdemetra-benchmarking/src/main/java/internal/workspace/file/DentonDocHandler.java index ac648e6..68c12c9 100644 --- a/nbdemetra-benchmarking/src/main/java/internal/workspace/file/DentonDocHandler.java +++ b/nbdemetra-benchmarking/src/main/java/internal/workspace/file/DentonDocHandler.java @@ -16,11 +16,11 @@ */ package internal.workspace.file; -import ec.benchmarking.DentonDocument2; import ec.demetra.workspace.WorkspaceFamily; import ec.demetra.workspace.file.FileFormat; import ec.demetra.workspace.file.spi.FamilyHandler; import ec.demetra.workspace.file.util.InformationSetSupport; +import ec.tss.disaggregation.documents.DentonDocument; import ec.tstoolkit.utilities.LinearId; import org.openide.util.lookup.ServiceProvider; @@ -36,6 +36,6 @@ public final class DentonDocHandler implements FamilyHandler { @lombok.experimental.Delegate private final FamilyHandler delegate = InformationSetSupport - .of(DentonDocument2::new, REPOSITORY) + .of(DentonDocument::new, REPOSITORY) .asHandler(WorkspaceFamily.of(FAMILY), FileFormat.GENERIC); } From 32296763cfd8cda1d8a98063b8eba406fedc2304 Mon Sep 17 00:00:00 2001 From: Jean Palate Date: Wed, 18 Apr 2018 11:13:03 +0200 Subject: [PATCH 5/5] Upgrade to JD+ 2.2.1 --- nbdemetra-benchmarking/pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nbdemetra-benchmarking/pom.xml b/nbdemetra-benchmarking/pom.xml index 707b37a..540e1b1 100644 --- a/nbdemetra-benchmarking/pom.xml +++ b/nbdemetra-benchmarking/pom.xml @@ -5,7 +5,7 @@ eu.europa.ec.joinup.sat nbdemetra-benchmarking nbm - 2.2.1-SNAPSHOT + 2.2.1 NbDemetra - Benchmarking This module provides some experimental methods for temporal disaggregation and multi-variate benchmarking: @@ -22,7 +22,7 @@ 2.6 3.14 - 2.2.1-SNAPSHOT + 2.2.1