Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 0 additions & 55 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,71 +21,16 @@ jobs:

build:
runs-on: ubuntu-latest
env:
AWS_ACCESS_KEY_ID: jj
AWS_SECRET_ACCESS_KEY: jj
AWS_DEFAULT_REGION: 'site2-low'
AWS_ENDPOINT_URL: "http://127.0.0.1:4000"



# https://docs.github.com/en/actions/using-containerized-services/about-service-containers
services:
s3proxy:
image: andrewgaul/s3proxy
ports:
- 4000:80
env:
JCLOUDS_FILESYSTEM_BASEDIR: /data
JCLOUDS_PROVIDER: filesystem
JCLOUDS_REGIONS: site2-low
S3PROXY_IDENTITY: jj
S3PROXY_CREDENTIAL: jj

LOG_LEVEL: info
S3PROXY_ENDPOINT: http://0.0.0.0:80
S3PROXY_AUTHORIZATION: "aws-v2-or-v4"
S3PROXY_VIRTUALHOST: ""
S3PROXY_KEYSTORE_PATH: keystore.jks
S3PROXY_KEYSTORE_PASSWORD: password
S3PROXY_CORS_ALLOW_ALL: false
S3PROXY_CORS_ALLOW_ORIGINS: ""
S3PROXY_CORS_ALLOW_METHODS: ""
S3PROXY_CORS_ALLOW_HEADERS: ""
S3PROXY_IGNORE_UNKNOWN_HEADERS: false
S3PROXY_ENCRYPTED_BLOBSTORE: ""
S3PROXY_ENCRYPTED_BLOBSTORE_PASSWORD: ""
S3PROXY_ENCRYPTED_BLOBSTORE_SALT: ""

JCLOUDS_ENDPOINT: ""
JCLOUDS_REGION: ""
JCLOUDS_IDENTITY: remote-identity
JCLOUDS_CREDENTIAL: remote-credential
JCLOUDS_KEYSTONE_VERSION: ""
JCLOUDS_KEYSTONE_SCOPE: ""
JCLOUDS_KEYSTONE_PROJECT_DOMAIN_NAME: ""
volumes:
- /dockerImage/data:/data

steps:
- uses: actions/checkout@v3

- name: Put test resources in S3Proxy Container
run: |
aws s3 mb s3://nfive
aws s3 cp ${{ github.workspace }}/view-simulation-results/src/test/resources/nfive s3://nfive --recursive

- name: Set up JDK 8
uses: actions/setup-java@v3
with:
java-version: '8'
distribution: 'temurin'
cache: maven

#Before building the Repo a docker container needs to intialized such that the test cases can work properly
# https://github.com/addnab/docker-run-action


- name: Build with Maven
run: mvn -B package --file pom.xml

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.vcell.N5;

import java.net.URL;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Stack;
Expand All @@ -24,26 +25,28 @@ public FormatExportDataRepresentation(HashMap<String, SimulationExportDataRepres
}

public static class SimulationExportDataRepresentation {
public String exportDate;
public String uri;
public String jobID;
public String dataID;
public String simulationName;
public String applicationName;
public String biomodelName;
public String variables;
public String startAndEndTime;

public ArrayList<String> differentParameterValues;
public String savedFileName;
public final String exportDate;
public final String uri;
public final String jobID;
public final String dataID;
public final String simulationName;
public final String applicationName;
public final String biomodelName;
public final String variables;
public final String startAndEndTime;

public final ArrayList<String> differentParameterValues;
public final String savedFileName;

public final ArrayList<URL> imageROIReferences;

public int zSlices;
public int tSlices;
public int numVariables;

public SimulationExportDataRepresentation(String exportDate, String uri, String jobID, String dataID, String simulationName,
String applicationName, String biomodelName, String variables, String startAndEndTime,
ArrayList<String> differentParameterValues, String savedFileName){
ArrayList<String> differentParameterValues, String savedFileName, ArrayList<URL> imageROIReferences){
this.exportDate = exportDate;
this.uri = uri;
this.jobID = jobID;
Expand All @@ -55,6 +58,7 @@ public SimulationExportDataRepresentation(String exportDate, String uri, String
this.startAndEndTime = startAndEndTime;
this.differentParameterValues = differentParameterValues;
this.savedFileName = savedFileName;
this.imageROIReferences = imageROIReferences;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ public class ControlButtonsPanel extends JPanel implements ActionListener {
// private final JButton openLocal = new JButton("Open N5 Local");
private final JButton questionMark;

public final JCheckBox includeExampleExports;
public final JCheckBox displayAdvancedFeatures;

private N5ExportTable n5ExportTable;
Expand All @@ -31,9 +30,6 @@ public class ControlButtonsPanel extends JPanel implements ActionListener {
private PanelState panelState = PanelState.NOTHING_OR_LOADING_IMAGE;

public ControlButtonsPanel(){
includeExampleExports = new JCheckBox("Show Example Exports");
includeExampleExports.setSelected(!N5ImageHandler.exportedDataExists());

displayAdvancedFeatures = new JCheckBox("Advanced Features");

openOrCancel = new JButton("Open Virtual Stack");
Expand All @@ -54,7 +50,6 @@ public ControlButtonsPanel(){


JPanel bottomRow = new JPanel(new GridBagLayout());
bottomRow.add(includeExampleExports);
gridBagConstraints.gridx = 1;
bottomRow.add(displayAdvancedFeatures, gridBagConstraints);
gridBagConstraints.gridx = 2;
Expand Down Expand Up @@ -86,7 +81,6 @@ public ControlButtonsPanel(){
questionMark.addActionListener(this);
advancedFeatures.useN5Link.addActionListener(this);
// openLocal.addActionListener(this);
includeExampleExports.addActionListener(this);
displayAdvancedFeatures.addActionListener(this);
dataReduction.addActionListener(this);
advancedFeatures.openInMemory.addActionListener(this);
Expand Down Expand Up @@ -130,8 +124,6 @@ public void actionPerformed(ActionEvent e) {
new HelpExplanation().displayHelpMenu();
} else if (e.getSource().equals(advancedFeatures.useN5Link)) {
remoteFileSelection.setVisible(true);
} else if (e.getSource().equals(includeExampleExports)){
n5ExportTable.updateTableData();
} else if (e.getSource().equals(displayAdvancedFeatures)) {
advancedFeatures.setVisible(displayAdvancedFeatures.isSelected());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,6 @@ public TimeFilter(){
public void actionPerformed(ActionEvent e) {
if (e.getSource().equals(anyInterval) || e.getSource().equals(todayInterval)
|| e.getSource().equals(monthInterval) || e.getSource().equals(yearlyInterval)) {
if(MainPanel.controlButtonsPanel.includeExampleExports.isSelected()){
n5ExportTable.updateTableData();
return;
}
n5ExportTable.updateTableData();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
import org.vcell.N5.retrieving.SimResultsLoader;

import javax.swing.*;
import javax.swing.border.Border;
import javax.swing.border.EtchedBorder;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import javax.swing.table.AbstractTableModel;
Expand All @@ -24,14 +22,16 @@
import java.util.*;
import java.util.concurrent.TimeUnit;

public class N5ExportTable extends JScrollPane implements ListSelectionListener, SimLoadingListener {
public N5ExportTableModel n5ExportTableModel;
public class N5ExportTable extends JTabbedPane implements ListSelectionListener, SimLoadingListener {
private N5ExportTableModel n5ExportTableModel;
private JTable exportListTable;

private final Border lowerEtchedBorder = BorderFactory.createEtchedBorder(EtchedBorder.LOWERED);
private final Border exampleBorder = BorderFactory.createTitledBorder(lowerEtchedBorder, "Example Exports");
private JTable exampleExportListTable;
private final Map<Integer, String> loadingRowsJobID = new HashMap<>();

private final JScrollPane personalExportsPanel = new JScrollPane();
private final JScrollPane exampleExportsPanel = new JScrollPane();


private ControlButtonsPanel controlPanel;
private ExportDetailsPanel exportDetailsPanel;
private TimeFilter timeFilter;
Expand All @@ -49,7 +49,12 @@ public void initialize(ControlButtonsPanel controlButtonsPanel, ExportDetailsPan
N5ImageHandler.loadingManager.addSimLoadingListener(this);
n5ExportTableModel = new N5ExportTableModel();
exportListTable = new JTable(n5ExportTableModel);
this.setViewportView(exportListTable);
exampleExportListTable = new JTable(n5ExportTableModel);
personalExportsPanel.setViewportView(exportListTable);
exampleExportsPanel.setViewportView(exampleExportListTable);

this.addTab("Personal Exports", personalExportsPanel);
this.addTab("Example Exports", exampleExportsPanel);


DefaultTableCellRenderer cellRenderer = new DefaultTableCellRenderer(){
Expand All @@ -70,12 +75,14 @@ public Component getTableCellRendererComponent(JTable table, Object value, boole
int columns = n5ExportTableModel.getColumnCount();
for (int i = 0; i < columns; i++){
exportListTable.getColumnModel().getColumn(i).setCellRenderer(cellRenderer);
exampleExportListTable.getColumnModel().getColumn(i).setCellRenderer(cellRenderer);
}

this.setPreferredSize(new Dimension(500, 400));
this.setBorder(BorderFactory.createTitledBorder(lowerEtchedBorder, "Export Table"));
exportListTable.getSelectionModel().addListSelectionListener(this);
exampleExportListTable.getSelectionModel().addListSelectionListener(this);

this.setSelectedIndex(N5ImageHandler.exportedDataExists() ? 0 : 1);
updateTableData("");
automaticRefresh();
}
Expand All @@ -95,13 +102,9 @@ public void updateTableData(String strFilter){

void updateTableData(LocalDateTime oldestTimeAllowed, String strFilter){
n5ExportTableModel.resetData();
if (!controlPanel.includeExampleExports.isSelected()){
this.setBorder(BorderFactory.createTitledBorder(lowerEtchedBorder, "Personal Exports"));
} else {
this.setBorder(exampleBorder);
}
try {
ExportDataRepresentation.FormatExportDataRepresentation formatExportData = N5ImageHandler.exportedDataExists() && !controlPanel.includeExampleExports.isSelected() ?
boolean hasPersonalExports = N5ImageHandler.exportedDataExists() && this.getSelectedIndex() == 0;
ExportDataRepresentation.FormatExportDataRepresentation formatExportData = hasPersonalExports ?
N5ImageHandler.getJsonData() : N5ImageHandler.getExampleJSONData();

Stack<String> jobStack = (Stack<String>) formatExportData.formatJobIDs.clone();
Expand All @@ -123,7 +126,7 @@ private void automaticRefresh(){
try {
while(true){
ExportDataRepresentation.FormatExportDataRepresentation formatExportData = N5ImageHandler.getJsonData();
if (formatExportData != null && !controlPanel.includeExampleExports.isSelected()){
if (formatExportData != null && this.getSelectedIndex() == 0){
ExportDataRepresentation.SimulationExportDataRepresentation mostRecentTableEntry = !n5ExportTableModel.tableData.isEmpty() ? n5ExportTableModel.tableData.getFirst() : null;
Stack<String> jobStack = formatExportData.formatJobIDs;
boolean isUpdated = false;
Expand Down Expand Up @@ -156,18 +159,20 @@ private void automaticRefresh(){

public void openSelectedRows(boolean openInMemory, boolean performDataReduction, SimResultsLoader.OpenTag openTag){
ArrayList<SimResultsLoader> filesToOpen = new ArrayList<>();
for(int row: exportListTable.getSelectedRows()){
JTable currentTable = getCurrentTable();
for(int row: currentTable.getSelectedRows()){
String uri = n5ExportTableModel.getRowData(row).uri;
ExportDataRepresentation.SimulationExportDataRepresentation rowData = n5ExportTableModel.getRowData(row);
SimResultsLoader simResultsLoader = new SimResultsLoader(uri, rowData.savedFileName, row, rowData.jobID, openTag);
SimResultsLoader simResultsLoader = new SimResultsLoader(uri, rowData.savedFileName, row, rowData.jobID, openTag, rowData.imageROIReferences);
filesToOpen.add(simResultsLoader);
}
N5ImageHandler.loadingManager.openN5FileDataset(filesToOpen, openInMemory,
performDataReduction);
}

public void copySelectedRowLink(){
ExportDataRepresentation.SimulationExportDataRepresentation selectedRow = n5ExportTableModel.getRowData(exportListTable.getSelectedRow());
JTable currentTable = getCurrentTable();
ExportDataRepresentation.SimulationExportDataRepresentation selectedRow = n5ExportTableModel.getRowData(currentTable.getSelectedRow());
Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
clipboard.setContents(new StringSelection(selectedRow.uri), null);
}
Expand All @@ -192,9 +197,10 @@ else if (n5ExportTableModel.getRowData(currentRow).jobID.equals(expectedJobID) &

@Override
public void valueChanged(ListSelectionEvent e) {
int row = exportListTable.getSelectedRow();
JTable currentTable = getCurrentTable();
int row = currentTable.getSelectedRow();
exportDetailsPanel.resetExportDetails();
if (row > exportListTable.getRowCount() || row < 0){
if (row > currentTable.getRowCount() || row < 0){
controlPanel.disableAllContextDependentButtons();
return;
}
Expand All @@ -206,24 +212,33 @@ public void valueChanged(ListSelectionEvent e) {
controlPanel.updateButtonsToMatchState(loadingRow != -1);
}

@Override
public void setSelectedIndex(int index) {
super.setSelectedIndex(index);
updateTableData();
}

public void stopSelectedImageFromLoading(){
int row = exportListTable.getSelectedRow();
JTable currentTable = getCurrentTable();
int row = currentTable.getSelectedRow();
N5ImageHandler.loadingManager.stopLoadingImage(n5ExportTableModel.tableData.get(row).jobID);
loadingRowsJobID.remove(row);
exportListTable.repaint();
currentTable.repaint();
}

public void removeSpecificRowFromLoadingRows(int rowNumber){
JTable currentTable = getCurrentTable();
int realRowNumber = findLoadingRow(rowNumber, rowNumber);
loadingRowsJobID.remove(realRowNumber);
controlPanel.updateButtonsToMatchState(false);
exportListTable.repaint();
currentTable.repaint();
}

@Override
public void simIsLoading(int itemRow, String exportID) {
JTable currentTable = getCurrentTable();
loadingRowsJobID.put(itemRow, exportID);
exportListTable.repaint();
currentTable.repaint();
}

@Override
Expand All @@ -234,6 +249,18 @@ public void simFinishedLoading(SimResultsLoader loadedResults) {
}
}

/**
* Required, for there is one table for examples and another for personal exports. The same table
* can not be used for both tabs, because a JComponent can have only one parent.
*/
private JTable getCurrentTable(){
return this.getSelectedIndex() == 0 ? exportListTable : exampleExportListTable;
}

public N5ExportTableModel getN5ExportTableModel(){
return n5ExportTableModel;
}

public static class N5ExportTableModel extends AbstractTableModel {
public final ArrayList<String> headers = new ArrayList<String>(){{
add("BioModel");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public String getS3URL(){

@Override
public void actionPerformed(ActionEvent e) {
SimResultsLoader simResultsLoader = new SimResultsLoader(getS3URL(), "", -1, "", SimResultsLoader.OpenTag.VIEW);
SimResultsLoader simResultsLoader = new SimResultsLoader(getS3URL(), "", -1, "", SimResultsLoader.OpenTag.VIEW, new ArrayList<>());
N5ImageHandler.loadingManager.openN5FileDataset(new ArrayList<SimResultsLoader>(){{add(simResultsLoader);}},
false,
false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ public void initializeDataSheets(){
public void addMetaData(SimResultsLoader loadedResults){
synchronized (metaDataLock){
N5ExportTable n5ExportTable = MainPanel.n5ExportTable;
ExportDataRepresentation.SimulationExportDataRepresentation data = n5ExportTable.n5ExportTableModel.getRowData(loadedResults.rowNumber);
ExportDataRepresentation.SimulationExportDataRepresentation data = n5ExportTable.getN5ExportTableModel().getRowData(loadedResults.rowNumber);
ArrayList<String> newMetaData = new ArrayList<>();
newMetaData.add(loadedResults.userSetFileName);
newMetaData.add(data.biomodelName);
Expand Down
Loading