Ticket #2007 (closed enhancement: moved)

Opened 5 years ago

Last modified 5 years ago

Make TypeChanger non-dynamic, and use DataTypeService

Reported by: curtis Owned by: bdezonia
Priority: major Milestone: imagej2-b8-analysis
Component: Data Model Version:
Severity: serious Keywords:
Cc: Blocked By:
Blocking:

Description (last modified by curtis) (diff)

The TypeChanger class is currently a DynamicCommand but does not need to be. It has a private String typeName parameter with an initializer that asks the DataTypeService for its list of instances. But the module framework takes care of this automatically now: just change the parameter to private DataType type and the available singletons will be automatically used in a multiple choice (via the ObjectWidget). See ImageCalculator and Threshold for working examples.

There is also a large amount of code embedded in the command, which should be factored out to one or more methods of DataTypeService instead. Then the TypeChanger command itself becomes very simple, merely delegating to DataTypeService to perform the actual type change. This is the preferred ImageJ2 design pattern so that the type change operation is available to other code directly from a @Parameter DataTypeService dataTypeService field, instead of needing to explicitly construct and invoke a TypeChanger command instance.

Change History

comment:1 Changed 5 years ago by curtis

  • Description modified (diff)

comment:2 Changed 5 years ago by curtis

  • Status changed from new to closed
  • Resolution set to moved
Note: See TracTickets for help on using tickets.