Ticket #921 (closed enhancement: fixed)
Opened 2012-01-30T14:05:06-06:00
Last modified 2012-08-29T16:01:54-05:00
Application Framework Generalization
Reported by: | gharris | Owned by: | curtis |
---|---|---|---|
Priority: | minor | Milestone: |
|
Component: | Core | Version: | |
Severity: | minor | Keywords: | |
Cc: | Blocked By: | ||
Blocking: | #1323 |
Description
Generalize Application Framework
In relation to having created a generalized application framework (which is what we have apparentely done ;-), it would make sense to abstract the Title and Version of the application out.
- Rename imagej.ImageJ to Application. This is the static singleton that the everything gets its context from.
- Add static String getTitle() and getVersion() to Application
Then the application Title and Version can be pushed in from imagej.Main() thru
Application.createContext(Title, Version).
- Currently the application title is hard-coded in AbstractSwingUI in createUI() {appFrame = new SwingApplicationFrame("ImageJ");...} Change to new SwingApplicationFrame(Application.getTitle())
- In AboutImageJ SwingStatusBar, change "ImageJ " + ImageJ.VERSION to
Application.getTitle() + " " + Application.getVersion()
In AbstractUserInterface, change PREF_FIRST_RUN = "firstRun-" + ImageJ.VERSION;
Change History
comment:2 Changed 2012-08-29T16:01:54-05:00 by curtis
- Status changed from new to closed
- Resolution set to fixed
I worked on this ticket on the extract-version branch, which is now merged to master. The following items are complete:
- The ImageJ class has getTitle() and getVersion() methods now.
- You can override the title using ImageJ#setTitle().
- The getVersion() method works by pulling the version out of the Maven POM.
- The old ImageJ#VERSION constant still exists, but is deprecated. The only reason for this is so that the context-free ConfigFileParameters class continues to work without changes. In the future we will update it to use ImageJ#getVersion() instead.
- The SwingStatusBar info string generation has moved to ImageJ#getInfo(boolean) instead.
- The "first run" preference key is now derived from the context version.
- Lastly, the branch adds support for querying other metadata from the Maven POM as well as the JAR manifest.
I also replaced hardcoded usages of "ImageJ" for the title in 39371a8c.
What I did not do is rename ImageJ to Application. One reason is that it would confuse the existing ImageJ developer community. They expect an object of type "ImageJ" that represents the toplevel ImageJ instance. Even though it was a singleton in IJ1, but not in IJ2, we still keep the convention.
That said, I wanted to have ImageJ implement an interface called Application that declared certain methods (such as getTitle() and getVersion()). But upon actually trying to do it, I realized there are many roadblocks. In general, it adds a level of complexity that we probably do not need, so I am going to hold off for now.