Skip to content

Commit

Permalink
add new channels to currently selected group; more channel table ui i…
Browse files Browse the repository at this point in the history
…mprovements
  • Loading branch information
Brandon committed Oct 3, 2023
1 parent 159dbad commit d3d4d47
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,17 @@ 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_);

// init presets combo box
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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<ChannelSpec> getChannels() {
Expand All @@ -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) {
Expand Down

0 comments on commit d3d4d47

Please sign in to comment.