imagej / imagej-common

ImageJ core data model
https://imagej.net/libs/imagej-common
BSD 2-Clause "Simplified" License
9 stars 18 forks source link

DefaultImageDisplay: add readable toString #69

Closed stelfrich closed 7 years ago

stelfrich commented 7 years ago

Fixes an issue when showing a selection dialog for ImagePlus parameters in a Swing UI. In that case, the dropdown for selecting an image gets populated with toString representations of the usable objects (ImageDisplay among others).

ctrueden commented 7 years ago

This is definitely a step forward, so merging!

I do have this intuition that using toString() for the objects in these combo boxes is not going to cut the mustard somehow... @dietzc and I are doing the same thing with the revamped widget framework, but I can't shake the feeling that there will be edge cases. In some cases perhaps toString() is being used for too many conflicting things (e.g. it is used for debugging SciJava events). Or perhaps we cannot override toString() for certain types of objects whose code we don't control.

A more flexible solution might be to preferentially support another method such as Named#getName() method in cases where the thing implements Named.

For now though, I am OK with this being a problem for future @ctrueden. 😝

stelfrich commented 7 years ago

A more flexible solution might be to preferentially support another method such as Named#getName() method in cases where the thing implements Named.

I'll file an issue to remind future @ctrueden 👍 . But where would that actually live? scijava-ui-swing because the drop downs for image selections are ObjectWidgets (I haven't completely grasped that part yet..)?

ctrueden commented 7 years ago

Filing it in scijava-common for now is fine. It is a decision that needs to be made independent of specific UI implementations. Just documented somewhere, like in the ObjectWidget interface perhaps.