Community
Participate
Working Groups
In an Riena-application we often have e.g. TextRidgets with specific a configuration for let's say a postcalcode. So we would like to write our own NumericTextRidget that is limited to 5 digits, shows a warning when the text is shorter than the 5 digits. At the moment this can be accomplished by following these steps: 1. extend the NumericTextRidget and set all the properties we need in the constructor 2. register the PostcalCodeRidget by calling SwtControlRidgetMapper.getInstance().addMapping(Text.class, PostalcodeTextRidget.class, new TypedTextWidgetCondition(UIControlsFactory.TYPE_POSTALCODE)); 3. In our CustomUIControlsFactory we have to create a method like: public static Text createPostcalcodeText(Composite parent, String bindingId) { Text text = createTextNumeric(parent, bindingId); text.setData(KEY_TYPE, TYPE_POSTALCODE); return text; } and mark our text widget with a KEY_TYPE, so the RidgetMapper knows when to create a standard NumericTextRidget or a PostalcodeRidget. I think the possibility to create custom Ridgets by just writing a couple of lines of code is a huge benefit. At the moment this is only possible by using internal API (the ridgets itself, TypedTextWidgetCondition is final and internal). So I would like to see this as an official feature in Riena with a well defined API. Maybe we could haven extensionpoint to define custom ridgets.
Couldnt you write a factory that just does that like MyUIControlsFactory.createPostalCode() and then the factory does all the tricks and changes and settings without subclassing anything and with using internal API ?