diff --git a/BUILD b/BUILD index d731468..5b2366b 100644 --- a/BUILD +++ b/BUILD @@ -1 +1 @@ -20240315-1525 \ No newline at end of file +20240319-1514 \ No newline at end of file diff --git a/JAVA/src/main/java/it/bancaditalia/oss/sdmx/helper/CheckboxListTableModel.java b/JAVA/src/main/java/it/bancaditalia/oss/sdmx/helper/CheckboxListTableModel.java index 0a0c084..6e0d90a 100644 --- a/JAVA/src/main/java/it/bancaditalia/oss/sdmx/helper/CheckboxListTableModel.java +++ b/JAVA/src/main/java/it/bancaditalia/oss/sdmx/helper/CheckboxListTableModel.java @@ -53,6 +53,15 @@ public Collection getCheckedCodes() return codes; } + public void updateCheckedCodes(Collection codes) + { + for (int i = 0; i < items.length; i++) + // 1 => key column + if (codes.contains(((String) items[i][1]))) + // 0 => checkbox column + items[i][0] = new Boolean(true); + } + public int getCheckedCodesCount() { int c = 0; diff --git a/JAVA/src/main/java/it/bancaditalia/oss/sdmx/helper/SDMXHelper.java b/JAVA/src/main/java/it/bancaditalia/oss/sdmx/helper/SDMXHelper.java index d7bf90f..102d790 100644 --- a/JAVA/src/main/java/it/bancaditalia/oss/sdmx/helper/SDMXHelper.java +++ b/JAVA/src/main/java/it/bancaditalia/oss/sdmx/helper/SDMXHelper.java @@ -34,6 +34,7 @@ import java.net.URI; import java.net.URISyntaxException; import java.util.AbstractMap.SimpleEntry; +import java.util.Collection; import java.util.Collections; import java.util.Date; import java.util.HashMap; @@ -964,9 +965,9 @@ private void dimSelListener(ListSelectionEvent e) codes -> { // Create new checkbox for codes given the selectedDimension // the new checkbox is stored in codelistSorterMap using the String selectedDimension as key. - // If the checkbox is not found in codelistSorterMap, it gets instantiated and put into it. + // If the checkbox is already present, the selected codes are updated and set to true CheckboxListTableModel model = null; - if (!codelistSortersMap.containsKey(selectedDimension)){ + //if (!codelistSortersMap.containsKey(selectedDimension)){ model = new CheckboxListTableModel(); model.addTableModelListener(event -> { tfSdmxQuery.setText(createQuery(dimsTableModel.getSource())); @@ -975,9 +976,14 @@ private void dimSelListener(ListSelectionEvent e) model.addTableModelListener(event -> formatQueryButton(selectedDataflow, dimsTableModel.getSource())); } model.setItems(codes); + if(codelistSortersMap.get(selectedDimension) != null){ + Collection checkedCodes = codelistSortersMap.get(selectedDimension).getModel().getCheckedCodes(); + model.updateCheckedCodes(checkedCodes); + } TableRowSorter> sorter = new TableRowSorter<>(model); codelistSortersMap.put(selectedDimension, sorter); - } + + //} }, ex -> { interrupted.set(true); diff --git a/RJSDMX/inst/java/SDMX.jar b/RJSDMX/inst/java/SDMX.jar index 6f70928..4afbd48 100644 Binary files a/RJSDMX/inst/java/SDMX.jar and b/RJSDMX/inst/java/SDMX.jar differ diff --git a/STATA/jar/SDMX.jar b/STATA/jar/SDMX.jar index 52df429..3b6a8d0 100644 Binary files a/STATA/jar/SDMX.jar and b/STATA/jar/SDMX.jar differ