GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Persistence of enum choices in Commands · Issue #471 · scijava/scijava-common

Persistence of enum choices in Commands #471

New issue
Copy link
New issue
Copy link
Open
scijava/scijava-ui-swing
#87
scijava/scijava-ui-swing#87
Open
Persistence of enum choices in Commands#471
scijava/scijava-ui-swing
#87
Copy link
Assignees
ctrueden

Description

@stefanhahmann
stefanhahmann
opened on Oct 12, 2023
Issue body actions

With 664b3ab and 61e98d7 it was made possible to use enums with custom labels in scijava commands

However, currently enums with custom labels are not persisted, i.e. if the user makes some settings using an enum with custom labels in a dialog, closes this dialog and comes back to this dialog, the selected value would fall back to the default parameter instead of the last selected parameter, which users may consider a bug, since this behavior would be different to other parameter types.

Reacted by Jan Eglinger and andmccall

Activity

  1. imagejan commented on Sep 27, 2024

    @imagejan
    imagejan
    on Sep 27, 2024
    Member
    More actions

    I think this issue is general for enums (i.e. not only enums with custom labels).

    Looking at MoBIE's OpenCollectionTableCommand.DataRoot:
    https://github.com/mobie/mobie-viewer-fiji/blob/18700b576efcc9574a9395598939bbf354f970e7/src/main/java/org/embl/mobie/command/open/OpenCollectionTableCommand.java#L49-L53

    ... non-default values seem to be correctly persisted to preference storage:

    #@ PrefService ps
    #@ ConvertService cs
    
    import org.embl.mobie.command.open.OpenCollectionTableCommand
    import org.embl.mobie.command.open.OpenCollectionTableCommand.DataRoot
    
    stringValue = ps.get(OpenCollectionTableCommand.class, "dataRoot")
    
    println(stringValue)  // e.g. UseTableFolder
    
    converted = cs.convert(stringValue, DataRoot.class)
    
    println(converted)  // e.g. UseTableFolder
    println(converted.class)  // class org.embl.mobie.command.open.OpenCollectionTableCommand$DataRoot

    However, the command dialog still falls back to default value every time.

    Hence I think the issue is somewhere in the command module processing, not in the preferences.

    @ctrueden would you have a best guess where to dig next?

  2. imagesc-bot commented on Mar 26, 2025

    @imagesc-bot
    imagesc-bot
    on Mar 26, 2025
    More actions

    This issue has been mentioned on Image.sc Forum. There might be relevant details there:

    https://forum.image.sc/t/scijava-persist-not-working-for-enums/99827/7

  3. imagejan commented on Mar 27, 2025

    @imagejan
    imagejan
    on Mar 27, 2025
    Member
    More actions

    I noticed that persisted enum values are actually harvested just fine: as long as you don't touch the dropdown widget, the persisted value is kept. It's just the UI that isn't updated to reflect the persisted value 🤦

    Consider this Groovy script:

    #@ org.scijava.ItemIO itemio
    
    println itemio
    

    When you run it, the dialog will always show the first enum value, INPUT:

    Image

    However, if you choose an alternative value (e.g. BOTH), press OK, and re-run the script, this time without changing in the dropdown (that again shows INPUT), the correct, persisted value (i.e. BOTH) will be printed.

    That means this issue actually belongs to scijava-ui-swing 🚀 .

    (NB: This didn't work in older Fiji installation of mine that had scijava-common-2.94.2, so the persisting behavior must have changed between that version and scijava-common-2.99.0)

  4. imagesc-bot commented on Mar 28, 2025

    @imagesc-bot
    imagesc-bot
    on Mar 28, 2025
    More actions

    This issue has been mentioned on Image.sc Forum. There might be relevant details there:

    https://forum.image.sc/t/scijava-persist-not-working-for-enums/99827/9

  5. tischi commented on Apr 16, 2025

    @tischi
    tischi
    on Apr 16, 2025
    Contributor
    More actions

    Hi @imagejan and @ctrueden, are those changes already shipped with Fiji? I think I observed some strange behaviour related to the persistence of enums. I would investigate more if you tell me that those changes are already in place.

  6. tischi commented on Apr 16, 2025

    @tischi
    tischi
    on Apr 16, 2025
    Contributor
    More actions

    I am sorry 😬 !

    I did not carefully read @imagejan's above post.
    In fact it seems that he exactly found what I found.
    I also saw now that the PR has not been merged yet.

    tl;dr please simply ignore all my comments.

  7. ctrueden
    self-assigned this
    on Jul 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @ctrueden
    ctrueden

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402503 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.