[Figleaf-developer] Need for a ViewRegistry
Status: Alpha
Brought to you by:
steckman
|
From: <sam...@ma...> - 2004-07-05 08:18:00
|
Playing around with your SwingViewer last night, I had some problems getting my registered views to be picked up. I think this is down to the fact that I didn't register specific classes with views - that is I registered Informative not my applications ImageAlbum class. I think we could do with defining a ViewRegistry class which could be used with any viewing mechanism. It would define the following methods: void addViewMapping(Class clazz, View view); View getView(Class clazz); And would define the following behaviour: 1. If a direct mapping exists, it returns that view 2. If no direct mapping exists, it looks for mappings for its immediate superclass, then interfaces 3. If no mapping exists for its immediate superclass or interfaces, it recursively traverses the superclass structure looking for a match 4. Finally if no match can be found null is returned. This allows us to assume a mapping for Informative but let the user override this. It also lets us map to classes or interfaces - your code seems to only support mapping to interfaces. This should be a very simple thing to write and can drop right into your code (it should even make your code a little simpler) - I'm happy to work on this while you concentrate on the UI if you want. sam http://www.magpiebrain.com/ |