• Post Reply Bookmark Topic Watch Topic
  • New Topic

Design Considerations for Save/Update  RSS feed

 
Saket Barve
Ranch Hand
Posts: 231
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I am using Swing for the UI in my module pertaining to product lifecycle management. For Saving/Updating the screen data, I need some guidance as to how I may approach the same. The screen contains everything - from table, to textfields to combo boxes.

I believe the first task would be to assign listeners to all the editable fields in order to keep track of all that can be changed. I notice that my main panel class is becoming rather bloated - what with all the listeners and actions events - so would it be appropriate to create independent listener classes to each of my editable screen fields?

The next question is not directly related to swing but I am posting it here nevertheless.

For Saving a new Page, the approach is straight - I'd be passing the entire value object and its children to the server. Thus, the method call to my bean would simply read:



In the case of updates, the approach would be not to send the entire VO; instead only the ID of product being changed, the actual modifided data and the field name as its key (HashMap). For tables, I have created a ProductTableUpdate class, which will retain the basic required stuff - the rowID and the value being modified. The update call will look something like:


Please let me know if my thoughts are in the right direction. I'd appreciate any feedback.

Thanks,
Saket
[ October 01, 2006: Message edited by: Saket Barve ]
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For the UI, take a look at https://binding.dev.java.net/

And for your second question, I think you should start a new thread in the Distributed Java forum...
 
Saket Barve
Ranch Hand
Posts: 231
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Ilja, will do.

Regards,
Saket
 
Saket Barve
Ranch Hand
Posts: 231
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As an afterthought, I wondered if I can have multiple text fields attached to the same document listener class, and then in the listener determine which widget (text field) data has undergone modification. The listener class methods take DocumentEvent as the parameter.

After going through the DocumentListener and DocumentEvent API's and walking through this How To Write DocumentListeners tutorial, I was not able to determine a direct way to know which text field has changed from inside the implemented listener class.

The alternative would be to create different listeners for each of the editable fields, which would end up resulting in a lot of repetitive code.

I'd really appreciate any feedback at the earliest.

Thanks,
Saket

And here's what I just found out:

1. Add a property to the documents:



2. In the Listener class insertUpdate( DocumentEvent e ) method, determine if the property exists. If it does, take appropriate action.



Please let me know if this is the correct approach.
[ October 02, 2006: Message edited by: Saket Barve ]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!