From d3d4d47310d79e9cd2cf74c4a5c321ecff02eece Mon Sep 17 00:00:00 2001 From: Brandon Date: Tue, 3 Oct 2023 10:48:21 -0700 Subject: [PATCH] add new channels to currently selected group; more channel table ui improvements --- .../lightsheetmanager/gui/tabs/channels/ChannelTable.java | 4 ++-- .../gui/tabs/channels/ChannelTableModel.java | 2 +- .../lightsheetmanager/model/channels/ChannelSpec.java | 7 +++++++ .../lightsheetmanager/model/channels/ChannelTableData.java | 6 +++--- 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/micromanager/lightsheetmanager/gui/tabs/channels/ChannelTable.java b/src/main/java/org/micromanager/lightsheetmanager/gui/tabs/channels/ChannelTable.java index 738eb4d..93de30b 100644 --- a/src/main/java/org/micromanager/lightsheetmanager/gui/tabs/channels/ChannelTable.java +++ b/src/main/java/org/micromanager/lightsheetmanager/gui/tabs/channels/ChannelTable.java @@ -26,9 +26,10 @@ public class ChannelTable extends JScrollPane { public ChannelTable(final LightSheetManagerModel model) { model_ = Objects.requireNonNull(model); + final String channelGroup = model_.acquisitions().settings().channelGroup(); final ChannelSpec[] channels = model_.acquisitions().settings().channels(); - tableData_ = new ChannelTableData(channels); + tableData_ = new ChannelTableData(channels, channelGroup); tableModel_ = new ChannelTableModel(tableData_); table_ = new JTable(tableModel_); @@ -36,7 +37,6 @@ public ChannelTable(final LightSheetManagerModel model) { TableColumn column = table_.getColumnModel().getColumn(1); cmbPresets_ = new JComboBox<>(); - final String channelGroup = model_.acquisitions().settings().channelGroup(); final String[] presets = getAllPresets(channelGroup); for (String preset : presets) { cmbPresets_.addItem(preset); diff --git a/src/main/java/org/micromanager/lightsheetmanager/gui/tabs/channels/ChannelTableModel.java b/src/main/java/org/micromanager/lightsheetmanager/gui/tabs/channels/ChannelTableModel.java index 12b6936..67f584e 100644 --- a/src/main/java/org/micromanager/lightsheetmanager/gui/tabs/channels/ChannelTableModel.java +++ b/src/main/java/org/micromanager/lightsheetmanager/gui/tabs/channels/ChannelTableModel.java @@ -15,7 +15,7 @@ public class ChannelTableModel extends AbstractTableModel { "Offset" }; - private ChannelTableData tableData_; + private final ChannelTableData tableData_; public ChannelTableModel(final ChannelTableData tableData) { tableData_ = Objects.requireNonNull(tableData); diff --git a/src/main/java/org/micromanager/lightsheetmanager/model/channels/ChannelSpec.java b/src/main/java/org/micromanager/lightsheetmanager/model/channels/ChannelSpec.java index e41bc2a..fcc1845 100644 --- a/src/main/java/org/micromanager/lightsheetmanager/model/channels/ChannelSpec.java +++ b/src/main/java/org/micromanager/lightsheetmanager/model/channels/ChannelSpec.java @@ -17,6 +17,13 @@ public ChannelSpec() { offset_ = 0; } + public ChannelSpec(final String group) { + useChannel_ = false; + group_ = group; + name_ = ""; + offset_ = 0; + } + public ChannelSpec(final boolean useChannel, final String group, final String name, final double offset) { useChannel_ = useChannel; group_ = group; diff --git a/src/main/java/org/micromanager/lightsheetmanager/model/channels/ChannelTableData.java b/src/main/java/org/micromanager/lightsheetmanager/model/channels/ChannelTableData.java index 29aa925..85f0d2f 100644 --- a/src/main/java/org/micromanager/lightsheetmanager/model/channels/ChannelTableData.java +++ b/src/main/java/org/micromanager/lightsheetmanager/model/channels/ChannelTableData.java @@ -16,12 +16,12 @@ public ChannelTableData() { channelGroup_ = "None"; } - public ChannelTableData(final ChannelSpec[] channels) { + public ChannelTableData(final ChannelSpec[] channels, final String channelGroup) { channels_ = new ArrayList<>(); if (channels != null) { Collections.addAll(channels_, channels); } - channelGroup_ = "None"; + channelGroup_ = channelGroup; } public ArrayList getChannels() { @@ -37,7 +37,7 @@ public int getNumChannels() { } public void addEmptyChannel() { - channels_.add(new ChannelSpec()); + channels_.add(new ChannelSpec(channelGroup_)); } public void addChannel(final ChannelSpec channel) {