|
From: Sam N. <sam...@ma...> - 2004-03-08 13:51:16
|
Oh, I should point out that I would expect such an API to ship with a few template types, such as an Abstract base class for convenience, and classes displaying the validation information on a JLabel to the left, right, above and below a control, along with some measure of customization (text colour, font size etc). At present I am unsure to replace the notion of a TemplateClass with a TemplateFactory, as this seems to make a little more sense to me. Sam Newman wrote: > I've been thinking about the issue of feeding back validation > information to desktop applications (think: SWT or Swing) for > spring-rcp. If we take Struts as an example, we need: > > 1. General message areas > 2. Field specific feedback > > So, if you are filling in a form and don't fill in a required field, you > really want an message to that affect next to the field. The problem is > that you do not want to require that the user define each and every > location for errors - it would be nice if you could just define simple > JTextFields, JLabels etc. and identify them as fields. > My proposed solution is to add a Factory, which is capable of taking a > control (field, combobox, list etc) and a optional template, which then > produces a Component which includes the field and an for feedback which > will be propagated. The template will be a component which defines where > the field can be and where the message will be. I suggest the following > API: > > void addTemplate(Class componentClass, FeedbackTemplate template) > void setDefaultTemplate(FeedBackTemplate template); > <snip> -- sam http://www.magpiebrain.com/ |