Any control over parameterized input field position/layout

ij2command
dialog
gui
Tags: #<Tag:0x00007fd540b028f0> #<Tag:0x00007fd540b02738> #<Tag:0x00007fd540b004d8>

#1

Since I want to try to rewrite the “Extended Particle Analyzer” for the BioVoxxel toolbox to make it work more consistently and functional for stacks as well as for IJ2 (and potentially KNIME).

Problem is, that the user interface of this tool has quite a lot of parameter fields which makes it necessary to organize them a little bit.

Is there a way to somehow control the position or layout of the automatically created fields and checkboxes when using the @Parameter declaration or is it then necessary to use the GenericDialog class or probably any Swing GUI.

Might be that I’m just blind but I haven’t really found any hints on that.

I would appreciate any input (also recommendations regarding the better/safer/more appropriate way to do that for IJ)

Thanks in advance


#2

I am not sure if it’s flexible enough for your needs but have a look at this code https://github.com/imagej/imagej-tutorials/blob/master/widget-demo/src/main/java/WidgetDemo.java


#3

Hi @hadim

Thanks. I had already a look at the link you posted but that’s unfortunately only the different types of parameterized fields (sorry if that’s not the perfectly correct programming vocabulary). But as far as I saw it there is no chance to influence the layout. It will always be sequential in the GUI.


#4

It has been a planned feature for a long time. We want the parameter annotations to support grouping, so that you can assign multiple parameters to the same group key and then they get somehow put together nicely. I want to avoid the feature being too “UI-centric” but also make it possible to do common things like two-column layouts, and labeled sections.

Unfortunately, it does not exist yet. It will in the future, but I cannot promise when. You can file an issue at https://github.com/scijava/scijava-common/issues if you like, which might spur development efforts, although I am unlikely to forget about this feature completely.


#5

Hi @biovoxxel

I was thinking about this myself. One thing I am considering doing is trying to extend SwingInputWidget to get more complicated behaviour, and more control over the layout.

An example is the SwingColorWidget which can be used in a script as follows…

// @org.scijava.util.ColorRGB color

My initial thought is I can make groups of parameters as small classes, and make a widget for them, that organizes the fields horizontally, or has a button for a more complicated pop-up (like the color one does).

I haven’t actually tried this yet, just at the planning stage… so I am very open to other strategies.


#6

It would be great if someone could take a crack at doing this properly, by adding the group feature I mentioned before, rather than hacking a Swing-specific solution. Obviously, doing it “properly” also entails work in Swing, but it would be awesome if the framework itself supported a well-thought-out way to configure the layout.

@bnorthan By “someone” I don’t necessarily mean you (though if you have time and energy, then great!). It’s just that: A) I cannot do it myself in the near future; and B) I would rather not see a proliferation of hacky workarounds in the meantime. Wishful thinking, I know.


#7

Struggling with this same issue (i.e., how to layout a usable UI with many, many input parameters). Did anything change since the last post was made in this thread?


#8

Everything I wrote above is still accurate.