Skip to content

Commit

Permalink
Removing Old Plugin Dead Code
Browse files Browse the repository at this point in the history
  • Loading branch information
AvocadoMoon committed Apr 25, 2024
1 parent 1b69322 commit 4cb7f4f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 265 deletions.
Original file line number Diff line number Diff line change
@@ -1,22 +1,13 @@
package org.vcell.N5;


import org.scijava.log.slf4j.SLF4JLogService;
import org.vcell.N5.UI.N5ExportTable;
import org.vcell.N5.UI.N5ViewerGUI;
import ij.ImagePlus;
import ij.plugin.Duplicator;
import org.scijava.command.Command;
import org.scijava.log.LogService;
import org.scijava.log.Logger;
import org.scijava.log.slf4j.SLF4JLogService;
import org.scijava.plugin.Parameter;
import org.scijava.plugin.Plugin;

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.IOException;
import java.net.URI;
import org.vcell.N5.UI.N5ExportTable;


/*
Expand All @@ -27,90 +18,17 @@
*/

@Plugin(type = Command.class, menuPath = "Plugins>VCell>VCell Simulation Results Viewer")
public class N5ImageHandler implements Command, ActionListener {
private N5ViewerGUI vGui;
public class N5ImageHandler implements Command {
public static final String formatName = "N5";
private SimResultsLoader simResultsLoader;
@Parameter
public static LogService logService;

@Override
public void actionPerformed(ActionEvent e) {
enableCriticalButtons(false);

// generate dataset list
if (e.getSource() == vGui.remoteFileSelection.submitS3Info || e.getSource() == vGui.mostRecentExport){
simResultsLoader = new SimResultsLoader();
SwingWorker n5DatasetListUpdater = new SwingWorker() {
@Override
protected Object doInBackground() throws Exception {
vGui.setCursor(new Cursor(Cursor.WAIT_CURSOR));
String uri = "";
if (e.getSource() == vGui.remoteFileSelection.submitS3Info) {
vGui.remoteFileSelection.setCursor(new Cursor(Cursor.WAIT_CURSOR));
uri = vGui.remoteFileSelection.getS3URL();
} else if (e.getSource() == vGui.mostRecentExport) {
ExportDataRepresentation.SimulationExportDataRepresentation lastElement = N5ExportTable.getLastJSONElement();
if (lastElement != null) {
uri = lastElement.uri;
simResultsLoader.setDataSetChosen(lastElement.savedFileName);
}
}
simResultsLoader.setURI(URI.create(uri));
simResultsLoader.createS3Client();
displayN5Dataset(simResultsLoader.getImgPlusFromN5File());

return null;
}

@Override
protected void done() {
vGui.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
enableCriticalButtons(true);
try {
if (e.getSource() == vGui.remoteFileSelection.submitS3Info) {
vGui.remoteFileSelection.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
vGui.remoteFileSelection.dispose();
}
} catch (Exception exception) {
logService.error(exception);
}
}
};
N5ImageHandler.logService.debug("Generating Dataset List");
n5DatasetListUpdater.execute();
}
// https://stackoverflow.com/questions/16937997/java-swingworker-thread-to-update-main-gui
// Why swing updating does not work


}

public void enableCriticalButtons(boolean enable) {
logService.debug("Disabling Critical Buttons");
vGui.remoteFileSelection.submitS3Info.setEnabled(enable);
vGui.okayButton.setEnabled(enable);
vGui.localFiles.setEnabled(enable);
vGui.remoteFiles.setEnabled(enable);
vGui.mostRecentExport.setEnabled(enable);
vGui.exportTableButton.setEnabled(enable);
logService.debug("Enabling Critical Buttons");
logService.error("Test Error");
}

static {

}
public static N5ExportTable exportTable;

@Override
public void run() {
// this.vGui = new N5ViewerGUI(this);
// this.vGui.localFileDialog.addActionListener(this);
// this.vGui.okayButton.addActionListener(this);
//// this.vGui.exportTableButton.addActionListener(this);
//
// this.vGui.remoteFileSelection.submitS3Info.addActionListener(this);
// this.vGui.mostRecentExport.addActionListener(this);
exportTable = new N5ExportTable();
initializeLogService();
// N5ImageHandler.logService.setLevel(LogService.DEBUG);
N5ExportTable exportTable = new N5ExportTable(this);
if(N5ImageHandler.logService == null){
N5ImageHandler.logService = new SLF4JLogService();
Expand Down
162 changes: 0 additions & 162 deletions view-simulation-results/src/main/java/org/vcell/N5/UI/N5ViewerGUI.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -64,19 +64,7 @@ public RemoteFileSelection(JFrame parentFrame){
this.credentialsPanel.setVisible(false);
this.endpointPanel.setVisible(false);

this.credentialsCheckBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
credentialsPanel.setVisible(!credentialsPanel.isVisible());
}
});

this.endpointCheckBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
endpointPanel.setVisible(!endpointPanel.isVisible());
}
});
submitS3Info.addActionListener(this);
}

public HashMap<String, String> returnCredentials(){
Expand Down

0 comments on commit 4cb7f4f

Please sign in to comment.