Icon Fun..
Posted by Eitan Suez Thu, 16 Nov 2006 21:28:00 GMT
Yesterday I redid the Icon resolution for types. I thought this might be a good topic for re-starting the jmatter blog entries. Activity here has been somewhat dormant for a while..
The way icons are associated with types is by following a naming convention. The idea was well-illustrated in NakedObjects v1.0. For example, if you have a class User.java, you can place icons User32.png and User16.png in the resources/images directory and that icon would be used in a number of the views representing instances of this type.
In JMatter, there are a number of twists. For one, you can specify different icons to be used for lists of users. So Users32.png and Users16.png are also automatically picked up for use by views of lists of users.
Here's the second twist: User.java in JMatter is Stateful. A User can be in Locked or Unlocked State. So, UserLocked32.png and UserUnlocked32.png are also automatically picked up and preferred for instances in a given state. I use this to show an icon of a user with a Lock icon overlayed on top of it.
Of course, JMatter will pick up either a png or a gif.
Here's the new twist I put in yesterday (in subversion): inheritance fallback. So take the ContactManager demo application as an example. In it, I create the class PersonContact which extends the Person class. I no longer need to provide a PersonContact32.png icon. The app will automatically fall back to using Person32.png.
I feel good about this small enhancement. In the next weblog entry, I will talk about some of the progress I've been making recently on the meta-front. Lots to talk about and it's pretty exciting.
/ eitan

