Repaint Scijava Command UI

Hi,
cc @imagejan, @haesleinhuepf, @frauzufall

Is it possible to repaint the UI of a DynamicCommand?

I have such a callback:

private updateChoicesCallback() {
  final MutableModuleItem<String> gateChoiceItem = 
  getInfo().getMutableInput("gateChoice", String.class);
  final ArrayList< String > gates = new ArrayList<>( gateToRows.keySet() );
  gateChoiceItem.setChoices( gates );
}

But the gateChoiceItem does not get updated.

Any ideas? Maybe not possible?

2 Likes

Well, I guess the intended answer here should be: when writing your DynamicCommand you should not worry about drawing/repainting any UI element.

If it’s not working as you expect it to work, it is a bug. In this case, it all relates back to this old discussion, I guess:

Also, you might have seen this important note in the DynamicCallbacks tutorial:


I suppose this could possibly be fixed by adding additional logic to the doRefresh method of SwingChoiceWidget, as it currently only updates the value, but doesn’t support changing the actual choices dynamically:

2 Likes