Skip to content
Snippets Groups Projects
Commit e6ccb329 authored by felmer's avatar felmer
Browse files

SP-659, BIS-370: DataSetRegistrationNodeModelTest fixed. Improved waiting...

SP-659, BIS-370: DataSetRegistrationNodeModelTest fixed. Improved waiting cursor handling for ReportNodeDialog.

SVN: 29238
parent 3fdf0766
No related branches found
No related tags found
No related merge requests found
...@@ -20,6 +20,7 @@ import static ch.systemsx.cisd.openbis.knime.common.AbstractOpenBisNodeModel.PAS ...@@ -20,6 +20,7 @@ import static ch.systemsx.cisd.openbis.knime.common.AbstractOpenBisNodeModel.PAS
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Component; import java.awt.Component;
import java.awt.Cursor;
import java.awt.Dimension; import java.awt.Dimension;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
...@@ -214,7 +215,7 @@ public class Util ...@@ -214,7 +215,7 @@ public class Util
} }
} }
public static List<DataSet> getSelectedDataSets(Component parentComponent, public static List<DataSet> getSelectedDataSets(Component parentComponent, Cursor oldCursor,
List<DataSet> dataSets, boolean singleSelection) List<DataSet> dataSets, boolean singleSelection)
{ {
JTable table = new JTable(createTableModel(dataSets)); JTable table = new JTable(createTableModel(dataSets));
...@@ -257,6 +258,7 @@ public class Util ...@@ -257,6 +258,7 @@ public class Util
filterPanel.add(filterField, BorderLayout.CENTER); filterPanel.add(filterField, BorderLayout.CENTER);
panel.add(filterPanel, BorderLayout.SOUTH); panel.add(filterPanel, BorderLayout.SOUTH);
JOptionPane optionPane = new JOptionPane(panel, JOptionPane.PLAIN_MESSAGE, JOptionPane.OK_CANCEL_OPTION); JOptionPane optionPane = new JOptionPane(panel, JOptionPane.PLAIN_MESSAGE, JOptionPane.OK_CANCEL_OPTION);
parentComponent.setCursor(oldCursor);
JDialog dialog = optionPane.createDialog(parentComponent, "Data Sets"); JDialog dialog = optionPane.createDialog(parentComponent, "Data Sets");
dialog.setResizable(true); dialog.setResizable(true);
dialog.setVisible(true); dialog.setVisible(true);
......
...@@ -152,50 +152,50 @@ public class ReportNodeDialog extends AbstractDescriptionBasedNodeDialog<ReportD ...@@ -152,50 +152,50 @@ public class ReportNodeDialog extends AbstractDescriptionBasedNodeDialog<ReportD
{ {
return; return;
} }
List<DataSet> dataSets = loadDataSets(description, facade);
List<DataSet> selectedDataSets = Util.getSelectedDataSets(getPanel(), dataSets, false);
if (selectedDataSets.isEmpty())
{
return;
}
StringBuilder builder = new StringBuilder();
for (DataSet dataSet : selectedDataSets)
{
if (builder.length() > 0)
{
builder.append(DELIMITER);
}
builder.append(dataSet.getCode());
}
dataSetCodeFields.setText(builder.toString());
}
private List<DataSet> loadDataSets(ReportDescription description, IQueryApiFacade facade)
{
JPanel panel = getPanel(); JPanel panel = getPanel();
Cursor cursor = panel.getCursor(); Cursor cursor = panel.getCursor();
try try
{ {
panel.setCursor(new Cursor(Cursor.WAIT_CURSOR)); panel.setCursor(new Cursor(Cursor.WAIT_CURSOR));
List<String> dataSetTypes = description.getDataSetTypes(); List<DataSet> dataSets = loadDataSets(description, facade);
IGeneralInformationService service = facade.getGeneralInformationService(); List<DataSet> selectedDataSets = Util.getSelectedDataSets(getPanel(), cursor, dataSets, false);
List<DataSet> allDataSets = new ArrayList<DataSet>(); if (selectedDataSets.isEmpty())
for (String dataSetType : dataSetTypes)
{ {
SearchCriteria searchCriteria = new SearchCriteria(); return;
searchCriteria.setOperator(SearchOperator.MATCH_ANY_CLAUSES); }
MatchClause clause = StringBuilder builder = new StringBuilder();
MatchClause.createAttributeMatch(MatchClauseAttribute.TYPE, dataSetType); for (DataSet dataSet : selectedDataSets)
searchCriteria.addMatchClause(clause); {
List<DataSet> dataSets = service.searchForDataSets(facade.getSessionToken(), searchCriteria);
logger.info(dataSets.size() + " data sets of type " + dataSetType); if (builder.length() > 0)
allDataSets.addAll(dataSets); {
builder.append(DELIMITER);
}
builder.append(dataSet.getCode());
} }
return allDataSets; dataSetCodeFields.setText(builder.toString());
} finally } finally
{ {
panel.setCursor(cursor); panel.setCursor(cursor);
} }
} }
private List<DataSet> loadDataSets(ReportDescription description, IQueryApiFacade facade)
{
List<String> dataSetTypes = description.getDataSetTypes();
IGeneralInformationService service = facade.getGeneralInformationService();
List<DataSet> allDataSets = new ArrayList<DataSet>();
for (String dataSetType : dataSetTypes)
{
SearchCriteria searchCriteria = new SearchCriteria();
searchCriteria.setOperator(SearchOperator.MATCH_ANY_CLAUSES);
MatchClause clause =
MatchClause.createAttributeMatch(MatchClauseAttribute.TYPE, dataSetType);
searchCriteria.addMatchClause(clause);
List<DataSet> dataSets = service.searchForDataSets(facade.getSessionToken(), searchCriteria);
logger.info(dataSets.size() + " data sets of type " + dataSetType);
allDataSets.addAll(dataSets);
}
return allDataSets;
}
} }
...@@ -120,6 +120,9 @@ public class DataSetRegistrationNodeModelTest extends AbstractFileSystemTestCase ...@@ -120,6 +120,9 @@ public class DataSetRegistrationNodeModelTest extends AbstractFileSystemTestCase
allowing(facadeFactory).createFacade(null, null, null); allowing(facadeFactory).createFacade(null, null, null);
will(returnValue(serviceFacade)); will(returnValue(serviceFacade));
allowing(queryFacade).logout();
allowing(serviceFacade).logout();
} }
}); });
flowVariables = new HashMap<String, String>(); flowVariables = new HashMap<String, String>();
...@@ -505,5 +508,4 @@ public class DataSetRegistrationNodeModelTest extends AbstractFileSystemTestCase ...@@ -505,5 +508,4 @@ public class DataSetRegistrationNodeModelTest extends AbstractFileSystemTestCase
} }
}); });
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment