Skip to content

Commit

Permalink
improve API ergonomics
Browse files Browse the repository at this point in the history
  • Loading branch information
Brandon committed Aug 29, 2024
1 parent 626ef06 commit b32e211
Show file tree
Hide file tree
Showing 39 changed files with 156 additions and 156 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package org.micromanager.lightsheetmanager;

import org.micromanager.lightsheetmanager.model.LightSheetManagerModel;
import org.micromanager.lightsheetmanager.gui.LightSheetManagerFrame;
import org.micromanager.lightsheetmanager.gui.utils.WindowUtils;
import org.micromanager.MenuPlugin;
import org.micromanager.Studio;
Expand All @@ -14,11 +12,11 @@ public class LightSheetManagerPlugin implements MenuPlugin, SciJavaPlugin {
public static final String copyright = "Applied Scientific Instrumentation (ASI), 2022-2024";
public static final String description = "A plugin to control various types of light sheet microscopes.";
public static final String menuName = "Light Sheet Manager";
public static final String version = "0.4.4";
public static final String version = "0.4.5";

private Studio studio_;
private LightSheetManager model_;
private LightSheetManagerFrame frame_;
private LightSheetManagerModel model_;

@Override
public void setContext(final Studio studio) {
Expand All @@ -39,11 +37,11 @@ public void onPluginSelected() {

// TODO: capture all errors like this?
try {
model_ = new LightSheetManagerModel(studio_);
model_ = new LightSheetManager(studio_);
final boolean isLoaded = model_.setup();
frame_ = new LightSheetManagerFrame(model_, isLoaded);
if (isLoaded) {
model_.acquisitions().setFrame(frame_); // TODO: remove later
model_.acquisitions().setFrame(frame_);
}
frame_.setVisible(true);
frame_.toFront();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,41 +1,41 @@
package org.micromanager.lightsheetmanager.api.internal;


import org.micromanager.lightsheetmanager.api.AutofocusSettings;
import org.micromanager.lightsheetmanager.api.LightSheetManager;
import org.micromanager.lightsheetmanager.api.TimingSettings;
import org.micromanager.lightsheetmanager.api.VolumeSettings;

public class DefaultLightSheetManager implements LightSheetManager {
/**
* Access to a AutofocusSettingsBuilder.
*
* @return AutofocusSettings.Builder with default settings.
*/
@Override
public AutofocusSettings.Builder autofocusSettingsBuilder() {
return new DefaultAutofocusSettings.Builder();
}

/**
* Access to a VolumeSettingsBuilder.
*
* @return VolumeSettings.Builder with default settings.
*/
@Override
public VolumeSettings.Builder volumeSettingsBuilder() {
return new DefaultVolumeSettings.Builder();
}

/**
* Access to a TimingSettingsBuilder.
*
* @return TimingSettings.Builder with default settings.
*/
@Override
public TimingSettings.Builder timingSettingsBuilder() {
return new DefaultTimingSettings.Builder();
}
}
//package org.micromanager.lightsheetmanager.api.internal;
//
//
//import org.micromanager.lightsheetmanager.api.AutofocusSettings;
//import org.micromanager.lightsheetmanager.api.LightSheetManagerAPI;
//import org.micromanager.lightsheetmanager.api.TimingSettings;
//import org.micromanager.lightsheetmanager.api.VolumeSettings;
//
//public class DefaultLightSheetManager implements LightSheetManagerAPI {
//
// /**
// * Access to a AutofocusSettingsBuilder.
// *
// * @return AutofocusSettings.Builder with default settings.
// */
// @Override
// public AutofocusSettings.Builder autofocusSettingsBuilder() {
// return new DefaultAutofocusSettings.Builder();
// }
//
// /**
// * Access to a VolumeSettingsBuilder.
// *
// * @return VolumeSettings.Builder with default settings.
// */
// @Override
// public VolumeSettings.Builder volumeSettingsBuilder() {
// return new DefaultVolumeSettings.Builder();
// }
//
// /**
// * Access to a TimingSettingsBuilder.
// *
// * @return TimingSettings.Builder with default settings.
// */
// @Override
// public TimingSettings.Builder timingSettingsBuilder() {
// return new DefaultTimingSettings.Builder();
// }
//
//}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import net.miginfocom.swing.MigLayout;
import org.micromanager.lightsheetmanager.gui.tabs.navigation.NavigationPanel;
import org.micromanager.lightsheetmanager.model.LightSheetManagerModel;
import org.micromanager.lightsheetmanager.LightSheetManager;
import org.micromanager.internal.utils.WindowPositioning;

import javax.swing.JFrame;
Expand All @@ -11,7 +11,7 @@ public class NavigationFrame extends JFrame {

private NavigationPanel navigationPanel_;

public NavigationFrame(final LightSheetManagerModel model) {
public NavigationFrame(final LightSheetManager model) {
WindowPositioning.setUpBoundsMemory(this, this.getClass(), this.getClass().getSimpleName());
setLayout(new MigLayout("", "", ""));
navigationPanel_ = new NavigationPanel(model);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import org.micromanager.lightsheetmanager.gui.components.Panel;
import org.micromanager.lightsheetmanager.gui.components.Spinner;
import org.micromanager.internal.utils.WindowPositioning;
import org.micromanager.lightsheetmanager.model.LightSheetManagerModel;
import org.micromanager.lightsheetmanager.LightSheetManager;
import org.micromanager.lightsheetmanager.model.XYZGrid;

import javax.swing.JFrame;
Expand Down Expand Up @@ -43,9 +43,9 @@ public class XYZGridFrame extends JFrame {
private JLabel lblYCountValue_;
private JLabel lblZCountValue_;

private LightSheetManagerModel model_;
private LightSheetManager model_;

public XYZGridFrame(final LightSheetManagerModel model) {
public XYZGridFrame(final LightSheetManager model) {
model_ = Objects.requireNonNull(model);
WindowPositioning.setUpBoundsMemory(this, this.getClass(), this.getClass().getSimpleName());
createUserInterface();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import org.micromanager.lightsheetmanager.gui.tabs.acquisition.VolumeDurationPanel;
import org.micromanager.lightsheetmanager.gui.tabs.acquisition.MultiPositionPanel;
import org.micromanager.lightsheetmanager.gui.tabs.acquisition.TimePointsPanel;
import org.micromanager.lightsheetmanager.model.LightSheetManagerModel;
import org.micromanager.lightsheetmanager.LightSheetManager;
import org.micromanager.lightsheetmanager.gui.tabs.channels.ChannelTablePanel;
import org.micromanager.lightsheetmanager.gui.tabs.acquisition.SliceSettingsPanel;
import org.micromanager.lightsheetmanager.gui.tabs.acquisition.VolumeSettingsPanel;
Expand Down Expand Up @@ -69,9 +69,9 @@ public class AcquisitionTab extends Panel implements ListeningPanel {
// acquisition playlist
private final AcquisitionTableFrame acqTableFrame_;

private final LightSheetManagerModel model_;
private final LightSheetManager model_;

public AcquisitionTab(final LightSheetManagerModel model) {
public AcquisitionTab(final LightSheetManager model) {
model_ = Objects.requireNonNull(model);
studio_ = model_.studio();
acqTableFrame_ = new AcquisitionTableFrame(studio_);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import org.micromanager.lightsheetmanager.gui.components.ListeningPanel;
import org.micromanager.lightsheetmanager.gui.components.Panel;
import org.micromanager.lightsheetmanager.gui.components.Spinner;
import org.micromanager.lightsheetmanager.model.LightSheetManagerModel;
import org.micromanager.lightsheetmanager.LightSheetManager;

import java.awt.Font;
import java.util.Objects;
Expand Down Expand Up @@ -43,9 +43,9 @@ public class AutofocusTab extends Panel implements ListeningPanel {
private Spinner spnMaxOffsetSetup_;
private CheckBox cbxAutoUpdateFocusFound_;

private LightSheetManagerModel model_;
private LightSheetManager model_;

public AutofocusTab(final LightSheetManagerModel model) {
public AutofocusTab(final LightSheetManager model) {
model_ = Objects.requireNonNull(model);
createUserInterface();
createEventHandlers();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import org.micromanager.lightsheetmanager.gui.components.Label;
import org.micromanager.lightsheetmanager.gui.components.ListeningPanel;
import org.micromanager.lightsheetmanager.gui.components.Panel;
import org.micromanager.lightsheetmanager.model.LightSheetManagerModel;
import org.micromanager.lightsheetmanager.LightSheetManager;
import org.micromanager.lightsheetmanager.model.devices.cameras.CameraBase;

import java.awt.Font;
Expand All @@ -25,9 +25,9 @@ public class CameraTab extends Panel implements ListeningPanel {
private ComboBox cmbCameraTriggerMode_;

private TabPanel tabPanel_;
private LightSheetManagerModel model_;
private LightSheetManager model_;

public CameraTab(final LightSheetManagerModel model, final TabPanel tabPanel) {
public CameraTab(final LightSheetManager model, final TabPanel tabPanel) {
tabPanel_ = Objects.requireNonNull(tabPanel);
model_ = Objects.requireNonNull(model);
createUserInterface();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import org.micromanager.internal.utils.FileDialogs;
import org.micromanager.lightsheetmanager.api.internal.DefaultAcquisitionSettingsSCAPE;
import org.micromanager.lightsheetmanager.gui.LightSheetManagerFrame;
import org.micromanager.lightsheetmanager.LightSheetManagerFrame;
import org.micromanager.lightsheetmanager.gui.components.Button;
import org.micromanager.lightsheetmanager.gui.components.CheckBox;
import org.micromanager.lightsheetmanager.gui.components.Label;
Expand All @@ -16,7 +16,7 @@
import org.micromanager.lightsheetmanager.gui.components.RadioButton;
import org.micromanager.lightsheetmanager.gui.components.TextField;
import org.micromanager.lightsheetmanager.model.DataStorage;
import org.micromanager.lightsheetmanager.model.LightSheetManagerModel;
import org.micromanager.lightsheetmanager.LightSheetManager;

import javax.swing.JLabel;
import java.util.Objects;
Expand All @@ -32,10 +32,10 @@ public class DataTab extends Panel implements ListeningPanel {

private final FileDialogs.FileType directorySelect_;

private LightSheetManagerModel model_;
private LightSheetManager model_;
private LightSheetManagerFrame frame_;

public DataTab(final LightSheetManagerModel model,
public DataTab(final LightSheetManager model,
final LightSheetManagerFrame frame) {
model_ = Objects.requireNonNull(model);
frame_ = Objects.requireNonNull(frame);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import org.micromanager.lightsheetmanager.gui.components.ListeningPanel;
import org.micromanager.lightsheetmanager.gui.components.Panel;
import org.micromanager.lightsheetmanager.model.DeviceManager;
import org.micromanager.lightsheetmanager.model.LightSheetManagerModel;
import org.micromanager.lightsheetmanager.LightSheetManager;

import javax.swing.JLabel;
import java.util.Objects;
Expand All @@ -17,9 +17,9 @@ public class DeviceTab extends Panel implements ListeningPanel {
private Button btnCreateConfigGroup_;

private DeviceManager devices_;
private LightSheetManagerModel model_;
private LightSheetManager model_;

public DeviceTab(final LightSheetManagerModel model) {
public DeviceTab(final LightSheetManager model) {
model_ = Objects.requireNonNull(model);
devices_ = model_.devices();
createUserInterface();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@
import org.micromanager.lightsheetmanager.gui.components.ListeningPanel;
import org.micromanager.lightsheetmanager.gui.components.Panel;
import org.micromanager.lightsheetmanager.gui.tabs.navigation.NavigationPanel;
import org.micromanager.lightsheetmanager.model.LightSheetManagerModel;
import org.micromanager.lightsheetmanager.LightSheetManager;

import java.util.Objects;

public class NavigationTab extends Panel implements ListeningPanel {

private final NavigationPanel navigationPanel_;

private final LightSheetManagerModel model_;
private final LightSheetManager model_;

public NavigationTab(final LightSheetManagerModel model) {
public NavigationTab(final LightSheetManager model) {
model_ = Objects.requireNonNull(model);
navigationPanel_ = new NavigationPanel(model_);
add(navigationPanel_, "");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@
import org.micromanager.lightsheetmanager.gui.components.ListeningPanel;
import org.micromanager.lightsheetmanager.gui.components.Panel;
import org.micromanager.lightsheetmanager.gui.components.Spinner;
import org.micromanager.lightsheetmanager.model.LightSheetManagerModel;
import org.micromanager.lightsheetmanager.model.devices.XYStage;
import org.micromanager.lightsheetmanager.LightSheetManager;
import org.micromanager.lightsheetmanager.model.devices.vendor.ASIScanner;
import org.micromanager.lightsheetmanager.model.devices.vendor.ASIXYStage;

import javax.swing.JLabel;
import java.util.Objects;
Expand All @@ -33,9 +31,9 @@ public class SettingsTab extends Panel implements ListeningPanel {
private boolean isUsingPLogic_;
private boolean isUsingScanSettings_;

private final LightSheetManagerModel model_;
private final LightSheetManager model_;

public SettingsTab(final LightSheetManagerModel model) {
public SettingsTab(final LightSheetManager model) {
model_ = Objects.requireNonNull(model);
createUserInterface();
createEventHandlers();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import org.micromanager.lightsheetmanager.gui.components.ListeningPanel;
import org.micromanager.lightsheetmanager.gui.components.Panel;
import org.micromanager.lightsheetmanager.gui.tabs.setup.SetupPanel;
import org.micromanager.lightsheetmanager.model.LightSheetManagerModel;
import org.micromanager.lightsheetmanager.LightSheetManager;

import java.awt.Font;
import java.util.Objects;
Expand All @@ -15,9 +15,9 @@ public class SetupPathTab extends Panel implements ListeningPanel {
private int pathNum_;
private SetupPanel setupPanel_;

private LightSheetManagerModel model_;
private LightSheetManager model_;

public SetupPathTab(final LightSheetManagerModel model, final int pathNum) {
public SetupPathTab(final LightSheetManager model, final int pathNum) {
model_ = Objects.requireNonNull(model);
pathNum_ = pathNum;
createUserInterface();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package org.micromanager.lightsheetmanager.gui.tabs;

import org.micromanager.lightsheetmanager.api.data.CameraMode;
import org.micromanager.lightsheetmanager.gui.LightSheetManagerFrame;
import org.micromanager.lightsheetmanager.model.LightSheetManagerModel;
import org.micromanager.lightsheetmanager.LightSheetManagerFrame;
import org.micromanager.lightsheetmanager.LightSheetManager;
import org.micromanager.lightsheetmanager.model.DeviceManager;
import org.micromanager.lightsheetmanager.gui.components.Panel;
import org.micromanager.lightsheetmanager.gui.components.TabbedPane;
Expand Down Expand Up @@ -30,10 +30,10 @@ public class TabPanel extends Panel {

private DeviceManager devices_;

private final LightSheetManagerModel model_;
private final LightSheetManager model_;
private final LightSheetManagerFrame frame_;

public TabPanel(final LightSheetManagerModel model,
public TabPanel(final LightSheetManager model,
final LightSheetManagerFrame frame,
final int width, final int height) {
model_ = Objects.requireNonNull(model);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import org.micromanager.lightsheetmanager.gui.components.Label;
import org.micromanager.lightsheetmanager.gui.components.Panel;
import org.micromanager.lightsheetmanager.gui.components.Spinner;
import org.micromanager.lightsheetmanager.model.LightSheetManagerModel;
import org.micromanager.lightsheetmanager.LightSheetManager;

import java.util.Objects;

Expand All @@ -22,9 +22,9 @@ public class AdvancedTimingPanel extends Panel {

private CheckBox cbxAlternateScanDirection_;

private final LightSheetManagerModel model_;
private final LightSheetManager model_;

public AdvancedTimingPanel(final LightSheetManagerModel model) {
public AdvancedTimingPanel(final LightSheetManager model) {
super("Advanced Timing Settings");
model_ = Objects.requireNonNull(model);
createUserInterface();
Expand Down
Loading

0 comments on commit b32e211

Please sign in to comment.