Skip to content

Commit

Permalink
Merge pull request #166 from bls337/main
Browse files Browse the repository at this point in the history
update numChannels when using the channel table
  • Loading branch information
bls337 authored Oct 3, 2023
2 parents 72ac25c + 61e8408 commit a18a4ae
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import org.micromanager.lightsheetmanager.gui.components.Panel;
import org.micromanager.lightsheetmanager.model.LightSheetManagerModel;
import org.micromanager.lightsheetmanager.api.data.MultiChannelMode;
import org.micromanager.lightsheetmanager.model.channels.ChannelSpec;

import javax.swing.JLabel;
import java.util.ArrayList;
Expand Down Expand Up @@ -79,14 +80,18 @@ private void createEventHandlers() {
// repaint();
System.out.println("add channel");
table_.getData().printChannelData();
asb.channels(table_.getData().getChannelArray());
final ChannelSpec[] channels = table_.getData().getChannelArray();
asb.channels(channels);
asb.numChannels(channels.length);
});

btnRemoveChannel_.registerListener(e -> {
final int row = table_.getTable().getSelectedRow();
if (row != -1) {
table_.getData().removeChannel(row);
asb.channels(table_.getData().getChannelArray());
final ChannelSpec[] channels = table_.getData().getChannelArray();
asb.channels(channels);
asb.numChannels(channels.length);
table_.refreshData();
System.out.println("remove row index: " + row);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public ChannelTableData() {

public ChannelTableData(final ChannelSpec[] channels, final String channelGroup) {
channels_ = new ArrayList<>();
// TODO: Objects.requireNonNull
if (channels != null) {
Collections.addAll(channels_, channels);
}
Expand Down

0 comments on commit a18a4ae

Please sign in to comment.