RE: [Sweet-swt-develop] Properties as Resources
Status: Beta
Brought to you by:
dvorme
|
From: Joe W. <WIN...@uk...> - 2003-06-17 12:17:35
|
Hi Dave, >Sounds like there's a need for a FontManager class that the GUI builder is aware of and can use optionally in lieu of manually creating fonts. In Sweet's parlance, this would be a custom font PropertyEditor that can interact >with a FontManager to generate the appropriate initialization strings for the individual GUI builder's code generator. To me the problem sounds more like you just need to be able to point to a property value by name or by reference. Usually a property editor comes up with a new color, font, etc... That's what the BeanInfo spec basically enforces( it actually says explicitly that the property editor instance must be newed up each time ). However some properties don't, for example an AWT Checkbox/checkboxGroup ( the whole point is to share one ), or Swing's JComponent/nextFocusableComponent ( that points to the next GUI element to tab onto ). Others do come from other places such as strings from resource bundles, borders from factories, even in SWT color rather than new org.eclipse.swt.graphics.Color(display,255,255,255) you might want display.getSystemColor(SWT.COLOR_WHITE); Whatever the solution, I think that rather than just solving Font with FontManager, it should be generic and basically address the fact that property values can come from other objects. The FontManager is that objects, and the method used to access the font is the accessor. In the case of FontManager being a class then you don't need to reference the instance by anything other than name ( two property values will get the same instance because the VM will ensure that ), however if it's something else that's part of the set of other objects ( i.e.an instance of a resource bundle ) then you need to be able to identify that specific instance not necessarily via a static. The problem here is that you may be then getting into the issue of persistence, so right now I'm in two minds. Do you just reference things by value and allow static class references, or do you allow anything more complex. Best regards, Joe |