scijava-common icon indicating copy to clipboard operation
scijava-common copied to clipboard

Support widget groups to resolve #310

Open karlduderstadt opened this issue 3 years ago • 0 comments

This adds support for widget groups by adding ItemVisibility.GROUP and Parameter annotations group and expanded as well as all related implementations to interfaces and default classes.

Intended use is for the value of String Parameters with visibility GROUP to be used to create group labels. All Parameters with a matching group annotation to that value will be added to the widget group. The expanded annotation controls whether the parameters group are showing or not.

@Parameter(visibility = ItemVisibility.GROUP)
private String basic = "basic";

@Parameter(group = "basic", label = "Number of ducks")
private int duckCount = 1;

@Parameter(visibility = ItemVisibility.GROUP, expanded = false)
private String advanced = "advanced";

@Parameter(group = "advanced", label = "Advanced duck typing")
private boolean advancedDuckTyping = true;

@Parameter(group = "advanced", label = "Starvation threshold")
private int starvationThreshold = 6;

and in scripts

#@ String (visibility = GROUP,  value = "basic") basic
#@ Integer (label = "Number of ducks", group = "basic") duckCount
#@ String (visibility = GROUP, value = "advanced", expanded = false) advanced
#@ Boolean (label = "Advanced duck typing", value = true, group = "advanced") advancedDuckTyping
#@ Integer (label = "Starvation threshold", value = 6, group = "advanced") starvationThreshold

This PR supports a complete implementation of group labels that is realized in a corresponding PR in scijava-ui-swing - https://github.com/scijava/scijava-ui-swing/pull/60 and resolves issue https://github.com/scijava/scijava-common/issues/310

karlduderstadt avatar Aug 03 '21 22:08 karlduderstadt