Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DatasetSelectorDialog starting API #95

Open
xulman opened this issue Nov 21, 2024 · 3 comments
Open

DatasetSelectorDialog starting API #95

xulman opened this issue Nov 21, 2024 · 3 comments

Comments

@xulman
Copy link
Contributor

xulman commented Nov 21, 2024

Minimal opening example

final String zarrRootStrPath = "/temp/Zurich.hackathon.testData/maybe_top_level.zarr";
DatasetSelectorDialog selectionDialog = new DatasetSelectorDialog(
				  new N5Importer.N5ViewerReaderFun(),
				  new N5Importer.N5BasePathFun(),
				  zarrRootStrPath,
				  new N5MetadataParser[]{new OmeNgffMetadataParser()},
				  PARSERS);

//just an empty function, otherwise NPE is thrown
selectionDialog.setContainerPathUpdateCallback(s -> {});

selectionDialog.run(ds -> {
     System.out.println("just some data is selected...");
});

//makes the dialog to update (and thus display) its content
selectionDialog.detectDatasets();

When working with the pointed at file/path, the dialog is calling its containerPathUpdateCallback, which is normally initiated as null.

So, one has to provide there simply anything... to avoid having it getting NPE.
And the issue is that it is not obvious and perhaps the empty callback could be a better initial setting than just null.
What do you think? @bogovicj

@xulman
Copy link
Contributor Author

xulman commented Nov 21, 2024

I have of course forgotten to suggest what to do with it:

replace current code
with

private Consumer<String> containerPathUpdateCallback = s -> {};

@bogovicj
Copy link
Contributor

@xulman
I agree, if you're interested in doing this, I would happily accept a PR, otherwise I'll get to it eventually.

@xulman
Copy link
Contributor Author

xulman commented Nov 22, 2024

actually, the PR #96 is solving this issue (by getting access to the original code base rather than trying to construct and use the dialog itself directly)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants