Win a copy of Microservices Testing (Live Project) this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

monitor changes - log only the actions.

 
Ranch Hand
Posts: 755
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

Consider a GUI with 10 (or more) elements: JTextField, JRadioBox, JCheckBox, JComboBox...

the end user is looking at the GUI and make some changes. Example: he check the checkbox that says Emply Sign or select a different item on a comobBox.

Say, I wish to create a log that monitors only the *changes*. So if in the example above the user has performed 2 actions - only those action will be logged (they will not be logged next time)

What is the best way to do that?
 
author & internet detective
Posts: 41184
848
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Peter,
You could set up event handlers to intercept the event when it occurs. This would log every time the user does something though.

If a user types selects a checkbox and immediately unselects it, do you want to log that once, twice or not at all?
 
Peter Primrose
Ranch Hand
Posts: 755
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hן Jeanne,
thanks for your reply.

"If a user types selects a checkbox and immediately unselects it, do you want to log that once, twice or not at all?"

well, if he pressed save - I count the changes otherwise not, so in your example the answer is 'not at all'.

I'm not sure I understand the solution you offer with 'event handlers' I mean if the user clicks SAVE - log the event (again, log only the changes)
thanks again
 
Jeanne Boyarsky
author & internet detective
Posts: 41184
848
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Peter,
The solution I offered above was for if you wanted to log everything that happened even if the user rolled it back before pressing save. So in my example, it would have logged the data twice.

What you are looking for is something like audit logging the changes when the user saves the record. The way to do this is store a master copy of the data. It can be in memory or wherever you got the original record from (file, database, etc.) Then when the user presses save, you compare the original values with the current values.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic