I was wondering if it possible to display a text label using the @script parameters for example to add a link to a wiki page of associated documentation.
I could use a @String but the idea would be to have something immutable. I dont think it is possible currently, possible future improvements ? Eventhough it is not a parameter per see…
You can use the
visibility option for a
#@ String(visibility="MESSAGE", value="Something") somethingString #@ String(value="Something else") somethingElseString
String will be an immutable label, while the second can be changed.
Thanks ! That could be worth adding to the wiki.
Is there some formatting to display hyperlink as well ?
It supports HTML as far as I know. You can try wrapping your text in
<html></html> and add a link this way.
# @String(visibility="MESSAGE", value="<html><a href='http://forum.image.sc/'>This is my link</a></html>") Footer
indeed produce a html-formatted string but the link is not clickable
Sorry, should have thought about that!
@imagejan: Any idea where an issue for this should live?
scijava-ui-swing is the correct repository for this.
The class responsible for displaying messages is
SwingMessageWidget, which currently simply generates a
JLabel with the text:
There’s some extra logic needed to make links work in
JLabels, as discussed e.g. in these stackoverflow posts:
I opened an issue to track this:
Hi all, was there any update to this? It would be awesome to link to some documentation URL directly from the script the user is running…
As you can see from the github issue, no…
I started a quick trial implementing
JEditorPane as suggested in this old discussion on coderanch:
But it doesn’t work due to a
NullPointerException thrown during dialog creation.
Feel free to test it and investigate if you find how to fix this. I’m not planning to invest any more time in it in the next weeks, so unless you or someone else picks it up, the issue might well sit there for another few months.
I would strongly suggest to rely on the built-in behavior of the search bar that offers a help button for every command for free. Just create a wiki page for your command, and you’re all set.
Not messing with UI dialogs has the added benefit that your module/command/plugin/script will run in a number of headless environments (from within KNIME, from the command line, etc.) withtout any additional work.
I just realized that when recorded using the macro recorder, the tag
visibility="MESSAGE" result in having the string actually displayed in a pop-up OK/Cancel window.
Is there a way to prevent that ?
As long as the window is not closed the execution of the macro is interrupted…
Otherwise it works fine to have an uneditable documentation string in the GUI.
The other tags (“NORMAL”, “TRANSIENT”…) are unfortunately all for editable strings…
Does this work with any kind of macro ? How do you do that ?