Re: [Essentialdata-discuss] Re: row-level validation
Brought to you by:
dankib01
From: Alex G. <lj...@gm...> - 2005-01-24 20:29:01
|
Dan, I think that's generally a good idea, but the one sticking point I have is that an individual cell may be valid without the row being valid. For example, assume there are two cells bound to properties Foo and Bar. The row is valid iff Foo and Bar are blank or Foo and Bar are numbers whose difference is prime. When the table loads, the row will be valid because it's blank. However, if the user enters '8' in Foo, the row is invalid because Bar is 0. At this point, the user can't just tab over to Bar to enter in '3', like they had planned. Essentially, there's a "Control -> POJOFieldAdapter -> property" relationship that's indicated by the "boundTo" property in the Control. I'm wondering if there's a similar "Row Composite -> POJOObjectAdapter -> Bean" relationship that I could take advantage of. Thanks, Alex On Mon, 24 Jan 2005 11:57:04 -0800, Kibler, Daniel (HQP) <Dan...@rh...> wrote: > Alex > > My non-expert recommendation - assumes you are binding your table to the properties of a POJO (bean) ala the tutorial expamle. > > In your POJO, add a custom validator to each of the properties that participate in the validation. Each custom validator validateComplete() method should call a common method that returns the current validation status of the overall row. If validateComplete() returns false, the associated field will automatically be colored yellow and the user will be unable to leave the row until the data is correct. > > I don't know if any of the behavior is configurable. It's not perfect but workiable. > > Here some snips from a validator that ensures bankBalance >= 1000 * age > > public IValidator getBankBalanceValidator() { > return new IValidator() { > ... > public boolean validateComplete(String value) { > try { > double doubleValue = Double.parseDouble(value); > return isAgeBalanceValid(getAge(),doubleValue); > ... > public boolean isAgeBalanceValid(int age, double bb) { > return bb >= (age * 1000.0); > } > > Livestrong > Dan > > Message: 4 > Date: Thu, 20 Jan 2005 15:36:01 -0600 > From: Alex Garrett <lj...@gm...> > To: ess...@li... > Subject: Re: [Essentialdata-discuss] row-level validation > Reply-To: ess...@li... > > Unfortunately, I was a little simplistic in my description and my > problem was incorrectly stated. Let me try again with more detail. I > have a reasonably complicated validation model. There are eight > columns. The status of the first column determines whether the other > seven count at all. If they do, the next four need to be numbers in > monotonically non-decreasing order. The last three columns have a > mathematical relationship between themselves and one or more of the > prior four. > > A use case is that a user may start by selecting a value from the > first column through a combo box and then enter values 10, 20, 30, 40 > (e.g.) in the next four fields. They'll want to use the tab key for > ease of entry, but after entering 10 in the first field, the row will > no longer be valid and they'll have to use the mouse to move to the > next three fields. At this point, the row still may not be valid > because the values don't satisfy the constraints for the last three > fields. > > This is why I wanted to be able to have some kind of process that > would allow them to enter in whatever data they want (subject to > syntactic constraints like ensuring the values were numbers) and > indicate whether the data were valid or not. > > One alternative that I considered was to have a column "Valid" that > would have an indicator, but the feedback I'm getting is that row > coloring is preferred. If there were a column indicator, it would have > to be an image, and I'm not sure how to pull that off, either. AFAIK, > the controls require String inputs. Any ideas? > > Thanks, > Alex > > On Thu, 20 Jan 2005 15:18:26 -0600, Dave Orme > <dj...@co...> wrote: > > Alex Garrett wrote: > > > I have some relational data in a row that I need to validate and I'm > > > having some trouble determining essentially how to do it. For example, > > > consider an MROTable that has columns for Name, Score and Max Score > > > and you want to validate that Score <= Max Score. What I want to be > > > able to do is color the row red if this criterion isn't met and color > > > it green if it is. > > > > Here's how: > > > > Put an IValidator on the Score property that range-checks that Score < > > Max Score. > > > > ED will let the user move around within the row (using the mouse), but > > will color the Score field yellow if it fails this validation test. And > > it won't allow the user to move off the row entirely until all fields > > within the row (including the Score field) pass all validity tests. > > > > Regards, > > > > Dave Orme > > > > -- > > Got Java? Use db4objects! <http://www.db4o.com> > > > > PGP Public Key (for confidential communications): > > http://www.coconut-palm-software.com/~djo/public_key.txt > > > > ------------------------------------------------------- > > This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting > > Tool for open source databases. Create drag-&-drop reports. Save time > > by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc. > > Download a FREE copy at http://www.intelliview.com/go/osdn_nl > > _______________________________________________ > > Essentialdata-discuss mailing list > > Ess...@li... > > https://lists.sourceforge.net/lists/listinfo/essentialdata-discuss > > > > > --__--__-- > > Message: 5 > Date: Thu, 20 Jan 2005 16:49:33 -0600 > From: Dave Orme <dj...@co...> > To: ess...@li... > Subject: Re: [Essentialdata-discuss] My status > Reply-To: ess...@li... > > Dave Orme wrote: > > All, > > > > Although I promised that I would support it [Essential Data] > > personally when I left my old company, my old company (ASC) has sent my > > new company (db4objects) a letter indicating that if I work on Essential > > Data, they will sue db4objects. > > I didn't spell this out in my earlier email, so I'd better. This means > I can't work on Essential Data beginning immediately. > > To be on the safe side, I won't answer questions any more on the mailing > list until this is resolved (even though this would be providing a free > service for ASC). I ask the community to please pitch in as best as you > can and help each other out during this time of difficulty. > > The grounds for sueing would be my non-competition agreement I signed in > order to be an employee. ASC apparently thinks they can just take > Essential Data closed-source commercial and stop it dead in its tracks > because I won't be able to work on it any more due to the non-compete > clause in my employee contract. > > Yes, they know that Essential Data is mostly GPL (parts are CPL) and on > SourceForge and that they can't stop the rest of the community from > developing or using it. I personally think they underestimated the > power of the open-source development community... > > **But please nobody contact ASC. Trust me, it'll just complicate our > negotiations.** > > Hopefully, it won't come to that and db4objects will be able to > negotiate something good for everybody. > > If not, then we'll have to talk about what's best for everyone in the > community... > > With warmest regards, > > Dave Orme > -- > Got Java? Use db4objects! <http://www.db4o.com> > > PGP Public Key (for confidential communications): > http://www.coconut-palm-software.com/~djo/public_key.txt > > > --__--__-- > > Message: 6 > Date: Thu, 20 Jan 2005 20:08:01 -0600 > From: Dave Orme <dj...@co...> > To: ess...@li... > Subject: Re: [Essentialdata-discuss] db4o is a Great Database > Reply-To: ess...@li... > > James Leotta wrote: > > Hello Dave, > > > > Always thought db4o was a perfect fit. Good luck. > > > > Jim Leotta > > Thanks Jim! > > > Regards, > > Dave Orme > > -- > Got Java? Use db4objects! <http://www.db4o.com> > > PGP Public Key (for confidential communications): > http://www.coconut-palm-software.com/~djo/public_key.txt > > > --__--__-- > > _______________________________________________ > Essentialdata-discuss mailing list > Ess...@li... > https://lists.sourceforge.net/lists/listinfo/essentialdata-discuss > > > End of Essentialdata-discuss Digest > > ------------------------------------------------------- > This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting > Tool for open source databases. Create drag-&-drop reports. Save time > by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc. > Download a FREE copy at http://www.intelliview.com/go/osdn_nl > _______________________________________________ > Essentialdata-discuss mailing list > Ess...@li... > https://lists.sourceforge.net/lists/listinfo/essentialdata-discuss > |