Hi all,
Hope there's someone out there knowlegable about documents (specifically PlainDocument) that can help me. I'm working on a rather small part of a very large project, but it concerns the use of an extended PlainDocument that keeps track of and changes my data objects (built from an Oracle DBfield).
In the section I'm working on I need to check some rules against the content of that document. (ie username must be between 5 and 22 characters in length) I've thought of insertString or DocumentListeners on my document but they would check the rules anytime that the document was changed. This won't work for several reasons the most obvious is creating a new username... (enter a single letter into a blank document and it fails because its not at least 5 characters)
I also thought of adding a focus listener to the textfield that the document is connected to, so the rule would be checked when focus is lost. That WOULD work exept for the problem of what to do if the test fails (the document already updated the data object with the new text and an undo wouldn't be very user friendly since this is the first notification the user has that the name isn't acceptable)
Is there any way the document can handle some sort of post update or lost focus??? or am I looking at this all wrong? Please let me know any ideas you have... anything could be helpful and would be appreciated. Kris McCuller
Programmer Portiva Corp.
kmcculler@portiva.com
Hope there's someone out there knowlegable about documents (specifically PlainDocument) that can help me. I'm working on a rather small part of a very large project, but it concerns the use of an extended PlainDocument that keeps track of and changes my data objects (built from an Oracle DBfield).
In the section I'm working on I need to check some rules against the content of that document. (ie username must be between 5 and 22 characters in length) I've thought of insertString or DocumentListeners on my document but they would check the rules anytime that the document was changed. This won't work for several reasons the most obvious is creating a new username... (enter a single letter into a blank document and it fails because its not at least 5 characters)
I also thought of adding a focus listener to the textfield that the document is connected to, so the rule would be checked when focus is lost. That WOULD work exept for the problem of what to do if the test fails (the document already updated the data object with the new text and an undo wouldn't be very user friendly since this is the first notification the user has that the name isn't acceptable)
Is there any way the document can handle some sort of post update or lost focus??? or am I looking at this all wrong? Please let me know any ideas you have... anything could be helpful and would be appreciated. Kris McCuller
Programmer Portiva Corp.
kmcculler@portiva.com