Skip to content

Commit

Permalink
Merge pull request #62 from qbicsoftware/hotfix/maxquant-download
Browse files Browse the repository at this point in the history
Hotfix/maxquant download
  • Loading branch information
wow-such-code authored Feb 1, 2022
2 parents 0612917 + c120917 commit 31da779
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 18 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@
Changelog
==========

1.12.9 (2022-02-01)
-------------------

**Added**

**Fixed**

* Fix dataset table pagelength which was missing from some views
* Selected entries are now no longer removed from the download list if a different subfolder in the same dataset is deselected

**Dependencies**

1.12.8 (2022-01-28)
-------------------

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<version>1.7.1</version>
</parent>
<artifactId>projectbrowser-portlet</artifactId>
<version>1.12.8</version>
<version>1.12.9</version>
<name>ProjectBrowser Portlet</name>
<url>http://github.com/qbicsoftware/projectbrowser-portlet</url>
<description>Browse and manage biomedical projects</description>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ private synchronized void prepareTSVExportFile(final BeanItemContainer<DatasetBe
public void setContainerDataSource(HierarchicalContainer newDataSource) {
datasets = (HierarchicalContainer) newDataSource;
table.setContainerDataSource(this.datasets);
table.setPageLength(Math.max(3, Math.min(numberOfDatasets, 10)));
table.setPageLength(Math.max(10, Math.min(numberOfDatasets, 15)));

table.setVisibleColumns((Object[]) FILTER_TABLE_COLUMNS);

Expand Down Expand Up @@ -698,7 +698,8 @@ public void deselectAllUnrelated(Set<Object> blackList) {
}
}

// if users don't click on a checkbox, but it needs to be selected or unselected due to parent items etc. we don't want to call the listeners
// if users don't click on a checkbox, but it needs to be selected or unselected due to parent
// items etc. we don't want to call the listeners
private void changeCheckBoxValueSilently(CheckBox checkbox, boolean value) {
Collection<ValueChangeListener> listeners =
(Collection<ValueChangeListener>) checkbox.getListeners(ValueChangeEvent.class);
Expand Down Expand Up @@ -738,23 +739,26 @@ public void valueChange(ValueChangeEvent event) {

boolean itemSelected = (Boolean) event.getProperty().getValue();

// find all rows of the dataset we performed changes on - important because sibling files can stay selected!
// find all rows of the dataset we performed changes on - important because sibling files can
// stay selected!
Set<Object> rowsForDataset = getAllDatasetRows(folderToDatasetCode(itemFolderName));

// propagates selection or deselection of subfolders and files and adds/removes their paths to/from download
// propagates selection or deselection of subfolders and files and adds/removes their paths
// to/from download
valueChange(itemId, itemSelected, entries, itemFolderName);

// now we deselect all unrelated data - that means rows belonging to other datasets
deselectAllUnrelated(rowsForDataset);

// now that selections have been fixed, we remove all files from the download list that
// do not start with this listener's folder name (ds code), since we only allow downloads of
// do not start with this listener's ds code, since we only allow downloads of
// single datasets

Set<String> toRemove = new HashSet<>();

for (String fileName : entries.keySet()) {
if (!fileName.startsWith(itemFolderName)) {
String datasetCode = folderToDatasetCode(itemFolderName);
if (!fileName.startsWith(datasetCode)) {
toRemove.add(fileName);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ public void windowClose(CloseEvent e) {
this.datasetTable.setCaption("Raw Data");

numberOfDatasets = retrievedDatasets.size();
this.datasetTable.setPageLength(10);
datasetTable.setPageLength(Math.max(10, Math.min(numberOfDatasets, 15)));
} else if (filterFor.equals("results")) {
BeanItemContainer<TestSampleBean> samplesContainer =
new BeanItemContainer<TestSampleBean>(TestSampleBean.class);
Expand Down Expand Up @@ -441,8 +441,7 @@ public void itemClick(ItemClickEvent event) {
});

numberOfDatasets = retrievedDatasets.size();
this.datasetTable.setPageLength(10);

datasetTable.setPageLength(Math.max(10, Math.min(numberOfDatasets, 15)));
}
break;

Expand Down Expand Up @@ -984,7 +983,8 @@ public void registerDatasetInTable(DatasetBean d, HierarchicalContainer dataset_
}
}

// if users don't click on a checkbox, but it needs to be selected or unselected due to parent items etc. we don't want to call the listeners
// if users don't click on a checkbox, but it needs to be selected or unselected due to parent
// items etc. we don't want to call the listeners
private void changeCheckBoxValueSilently(CheckBox checkbox, boolean value) {
Collection<ValueChangeListener> listeners =
(Collection<ValueChangeListener>) checkbox.getListeners(ValueChangeEvent.class);
Expand All @@ -999,7 +999,7 @@ private void changeCheckBoxValueSilently(CheckBox checkbox, boolean value) {
checkbox.addValueChangeListener(l);
}
}

// deselects all checkboxes but the ones provided
public void deselectAllUnrelated(Set<Object> blackList) {
for (Object rowId : datasetTable.getItemIds()) {
Expand Down Expand Up @@ -1035,23 +1035,26 @@ public void valueChange(ValueChangeEvent event) {

boolean itemSelected = (Boolean) event.getProperty().getValue();

// find all rows of the dataset we performed changes on - important because sibling files can stay selected!
// find all rows of the dataset we performed changes on - important because sibling files can
// stay selected!
Set<Object> rowsForDataset = getAllDatasetRows(folderToDatasetCode(itemFolderName));

// propagates selection or deselection of subfolders and files and adds/removes their paths to/from download
// propagates selection or deselection of subfolders and files and adds/removes their paths
// to/from download
valueChange(itemId, itemSelected, entries, itemFolderName);

// now we deselect all unrelated data - that means rows belonging to other datasets
deselectAllUnrelated(rowsForDataset);

// now that selections have been fixed, we remove all files from the download list that
// do not start with this listener's folder name (ds code), since we only allow downloads of
// do not start with this listener's ds code, since we only allow downloads of
// single datasets

Set<String> toRemove = new HashSet<>();

for (String fileName : entries.keySet()) {
if (!fileName.startsWith(itemFolderName)) {
String datasetCode = folderToDatasetCode(itemFolderName);
if (!fileName.startsWith(datasetCode)) {
toRemove.add(fileName);
}
}
Expand All @@ -1072,7 +1075,7 @@ public void valueChange(ValueChangeEvent event) {
}

}

private String folderToDatasetCode(String folderName) {
try {
return folderName.split("/")[0];
Expand All @@ -1090,7 +1093,7 @@ private Set<Object> getAllDatasetRows(String datasetCode) {
}
return res;
}

/**
* updates entries (puts and removes) for selected table item and all its children. Means
* Checkbox is updated. And in case download button is clicked all checked items will be
Expand Down

0 comments on commit 31da779

Please sign in to comment.