diff --git a/view-simulation-results/src/main/java/org/vcell/N5/UI/AdvancedFeatures.java b/view-simulation-results/src/main/java/org/vcell/N5/UI/AdvancedFeatures.java index f2d6884..62c6152 100644 --- a/view-simulation-results/src/main/java/org/vcell/N5/UI/AdvancedFeatures.java +++ b/view-simulation-results/src/main/java/org/vcell/N5/UI/AdvancedFeatures.java @@ -6,8 +6,7 @@ import java.awt.*; public class AdvancedFeatures extends JPanel { - public final JCheckBox inMemory; - public final JCheckBox dataReduction; + public final JButton openInMemory; public final JButton copyLink; public final JButton useN5Link; @@ -16,21 +15,21 @@ public AdvancedFeatures(){ Border lowerEtchedBorder = BorderFactory.createEtchedBorder(EtchedBorder.LOWERED); - inMemory = new JCheckBox("Open In Memory"); - dataReduction = new JCheckBox("Run Measurement Script"); + openInMemory = new JButton("Open In Memory"); JPanel checkBoxPanel = new JPanel(); - checkBoxPanel.add(dataReduction); +// checkBoxPanel.add(openInMemory); JPanel buttonPanel = new JPanel(); copyLink = new JButton("Copy Link"); useN5Link = new JButton("Use N5 Link"); buttonPanel.add(copyLink); buttonPanel.add(useN5Link); + buttonPanel.add(openInMemory); - setLayout(new BorderLayout()); - add(buttonPanel, BorderLayout.NORTH); - add(checkBoxPanel, BorderLayout.SOUTH); +// setLayout(new BorderLayout()); +// add(buttonPanel, BorderLayout.NORTH); +// add(checkBoxPanel, BorderLayout.SOUTH); + add(buttonPanel); this.setBorder(BorderFactory.createTitledBorder(lowerEtchedBorder, " Advanced Features ")); } - } diff --git a/view-simulation-results/src/main/java/org/vcell/N5/UI/ControlButtonsPanel.java b/view-simulation-results/src/main/java/org/vcell/N5/UI/ControlButtonsPanel.java index de063b9..4c72ab0 100644 --- a/view-simulation-results/src/main/java/org/vcell/N5/UI/ControlButtonsPanel.java +++ b/view-simulation-results/src/main/java/org/vcell/N5/UI/ControlButtonsPanel.java @@ -12,7 +12,7 @@ public class ControlButtonsPanel extends JPanel implements ActionListener { private static JButton openOrCancel; - private JButton openInMemory; + private final JButton dataReduction; // private final JButton openLocal = new JButton("Open N5 Local"); private final JButton questionMark; @@ -31,7 +31,7 @@ public ControlButtonsPanel(){ displayAdvancedFeatures = new JCheckBox("Advanced Features"); openOrCancel = new JButton("Open Virtually"); - openInMemory = new JButton("Open In Memory"); + dataReduction = new JButton("Run Measurement Script"); questionMark = new JButton("?"); questionMark.setPreferredSize(new Dimension(20, 20)); @@ -43,16 +43,16 @@ public ControlButtonsPanel(){ topRow.add(openOrCancel, gridBagConstraints); gridBagConstraints.gridx = 1; - topRow.add(openInMemory, gridBagConstraints); + topRow.add(dataReduction, gridBagConstraints); + - gridBagConstraints.gridx = 2; - topRow.add(questionMark); JPanel bottomRow = new JPanel(new GridBagLayout()); bottomRow.add(includeExampleExports); gridBagConstraints.gridx = 1; bottomRow.add(displayAdvancedFeatures, gridBagConstraints); - + gridBagConstraints.gridx = 2; + bottomRow.add(questionMark); JPanel userButtonsPanel = new JPanel(new GridBagLayout()); gridBagConstraints.gridx = 0; @@ -86,11 +86,12 @@ public ControlButtonsPanel(){ // openLocal.addActionListener(this); includeExampleExports.addActionListener(this); displayAdvancedFeatures.addActionListener(this); - openInMemory.addActionListener(this); + dataReduction.addActionListener(this); + advancedFeatures.openInMemory.addActionListener(this); openOrCancel.setEnabled(false); - openInMemory.setEnabled(false); + dataReduction.setEnabled(false); advancedFeatures.copyLink.setEnabled(false); } @@ -101,11 +102,13 @@ public void initialize(N5ExportTable n5ExportTable, RemoteFileSelection remoteFi @Override public void actionPerformed(ActionEvent e) { - if(e.getSource().equals(openOrCancel) || e.getSource().equals(openInMemory)){ + boolean inMemory = e.getSource().equals(advancedFeatures.openInMemory); + boolean performDataReduction = e.getSource().equals(dataReduction); + if(e.getSource().equals(openOrCancel) || inMemory || performDataReduction){ if (openOrCancel.getText().equals("Cancel")){ n5ExportTable.removeFromLoadingRows(); } else { - n5ExportTable.openSelectedRows(e.getSource().equals(openInMemory)); + n5ExportTable.openSelectedRows(inMemory, performDataReduction); } } else if (e.getSource().equals(advancedFeatures.copyLink)) { n5ExportTable.copySelectedRowLink(); @@ -126,7 +129,8 @@ public void allowCancel(boolean allow){ advancedFeatures.copyLink.setEnabled(true); advancedFeatures.useN5Link.setEnabled(true); remoteFileSelection.submitS3Info.setEnabled(true); - openInMemory.setEnabled(!allow); + dataReduction.setEnabled(!allow); + advancedFeatures.openInMemory.setEnabled(!allow); if (allow){ openOrCancel.setText("Cancel"); } else { @@ -139,7 +143,8 @@ public void enableRowContextDependentButtons(boolean enable){ if (allowButtons){ openOrCancel.setEnabled(enable); advancedFeatures.copyLink.setEnabled(enable); - openInMemory.setEnabled(enable); + dataReduction.setEnabled(enable); + advancedFeatures.openInMemory.setEnabled(enable); } } @@ -148,7 +153,8 @@ public void enableCriticalButtons(boolean enable){ openOrCancel.setEnabled(enable); advancedFeatures.copyLink.setEnabled(enable); remoteFileSelection.submitS3Info.setEnabled(enable); - openInMemory.setEnabled(enable); + dataReduction.setEnabled(enable); + advancedFeatures.openInMemory.setEnabled(enable); allowButtons = enable; } } diff --git a/view-simulation-results/src/main/java/org/vcell/N5/UI/MainPanel.java b/view-simulation-results/src/main/java/org/vcell/N5/UI/MainPanel.java index 8f82d9f..4a5690b 100644 --- a/view-simulation-results/src/main/java/org/vcell/N5/UI/MainPanel.java +++ b/view-simulation-results/src/main/java/org/vcell/N5/UI/MainPanel.java @@ -5,6 +5,7 @@ import javax.swing.*; import javax.swing.border.Border; +import javax.swing.border.EmptyBorder; import javax.swing.border.EtchedBorder; import javax.swing.table.DefaultTableCellRenderer; import javax.swing.table.TableColumn; @@ -12,8 +13,7 @@ import java.util.Enumeration; public class MainPanel { - private static JDialog exportTableDialog; - private final int paneWidth = 800; + private static JFrame exportTableDialog; public final static ControlButtonsPanel controlButtonsPanel = new ControlButtonsPanel(); public final static N5ExportTable n5ExportTable = new N5ExportTable(); @@ -23,32 +23,30 @@ public class MainPanel { public final static SearchBar searchBar = new SearchBar(); public MainPanel(){ - JPanel parentPanel = new JPanel(); - - n5ExportTable.initialize(controlButtonsPanel, exportDetailsPanel, timeFilter); controlButtonsPanel.initialize(n5ExportTable, remoteFileSelection); + JPanel contentPanel = new JPanel(new BorderLayout()); JPanel northPanel = new JPanel(new BorderLayout()); northPanel.add(controlButtonsPanel, BorderLayout.SOUTH); - parentPanel.setLayout(new BorderLayout()); - parentPanel.add(northPanel, BorderLayout.NORTH); JSplitPane jSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, n5ExportTable, exportDetailsPanel); jSplitPane.setContinuousLayout(true); - parentPanel.add(jSplitPane, BorderLayout.CENTER); JPanel filters = new JPanel(new BorderLayout()); Border lowerEtchedBorder = BorderFactory.createEtchedBorder(EtchedBorder.LOWERED); filters.setBorder(BorderFactory.createTitledBorder(lowerEtchedBorder, " Filters ")); filters.add(timeFilter, BorderLayout.NORTH); filters.add(searchBar, BorderLayout.SOUTH); - parentPanel.add(filters, BorderLayout.SOUTH); - parentPanel.setPreferredSize(new Dimension(paneWidth, 750)); - JOptionPane pane = new JOptionPane(parentPanel, JOptionPane.PLAIN_MESSAGE, 0, null, new Object[]{"Close"}); - exportTableDialog = pane.createDialog("VCell Exports"); - exportTableDialog.setModal(false); + contentPanel.add(northPanel, BorderLayout.NORTH); + contentPanel.add(jSplitPane, BorderLayout.CENTER); + contentPanel.add(filters, BorderLayout.SOUTH); + contentPanel.setBorder(new EmptyBorder(15, 12, 15, 12)); + + exportTableDialog = new JFrame("VCell Exports"); + exportTableDialog.add(contentPanel); + exportTableDialog.pack(); exportTableDialog.setResizable(true); exportTableDialog.setVisible(true); } diff --git a/view-simulation-results/src/main/java/org/vcell/N5/UI/N5ExportTable.java b/view-simulation-results/src/main/java/org/vcell/N5/UI/N5ExportTable.java index b4643dd..c8bfc39 100644 --- a/view-simulation-results/src/main/java/org/vcell/N5/UI/N5ExportTable.java +++ b/view-simulation-results/src/main/java/org/vcell/N5/UI/N5ExportTable.java @@ -155,7 +155,7 @@ private void automaticRefresh(){ refreshTableThread.start(); } - public void openSelectedRows(boolean openInMemory){ + public void openSelectedRows(boolean openInMemory, boolean performDataReduction){ ArrayList filesToOpen = new ArrayList<>(); for(int row: exportListTable.getSelectedRows()){ String uri = n5ExportTableModel.getRowData(row).uri; @@ -163,9 +163,8 @@ public void openSelectedRows(boolean openInMemory){ SimResultsLoader simResultsLoader = new SimResultsLoader(uri, rowData.savedFileName, row, rowData.jobID); filesToOpen.add(simResultsLoader); } - AdvancedFeatures advancedFeatures = MainPanel.controlButtonsPanel.advancedFeatures; N5ImageHandler.loadingManager.openN5FileDataset(filesToOpen, openInMemory, - advancedFeatures.dataReduction.isSelected()); + performDataReduction); } public void copySelectedRowLink(){ diff --git a/view-simulation-results/src/main/java/org/vcell/N5/UI/RemoteFileSelection.java b/view-simulation-results/src/main/java/org/vcell/N5/UI/RemoteFileSelection.java index fbe16b9..7ed8a78 100644 --- a/view-simulation-results/src/main/java/org/vcell/N5/UI/RemoteFileSelection.java +++ b/view-simulation-results/src/main/java/org/vcell/N5/UI/RemoteFileSelection.java @@ -96,10 +96,9 @@ public String getS3URL(){ @Override public void actionPerformed(ActionEvent e) { SimResultsLoader simResultsLoader = new SimResultsLoader(getS3URL(), "", -1, ""); - AdvancedFeatures advancedFeatures = MainPanel.controlButtonsPanel.advancedFeatures; N5ImageHandler.loadingManager.openN5FileDataset(new ArrayList(){{add(simResultsLoader);}}, - advancedFeatures.inMemory.isSelected(), - advancedFeatures.dataReduction.isSelected()); + false, + false); this.setVisible(false); } }