• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Memento pattern in swing

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

Any ideas on how to implement Memento Design Pattern in swing?

Sorry, if I posted in the wrong forum, but I did not find any appropriate forum
 
Rancher
Posts: 2759
32
Eclipse IDE Spring Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can implement any design pattern using core Java. SInce, you can use core Java in Swing, you can use any design pattern in Swing.

So, you know what's the Memento Design pattern?
 
Vishal Shaw
Ranch Hand
Posts: 179
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Jayesh A Lalwani wrote:You can implement any design pattern using core Java. SInce, you can use core Java in Swing, you can use any design pattern in Swing.

So, you know what's the Memento Design pattern?



Yes, Jayesh I know about the Memento Design Pattern. It can be used to rollback a state . For e.g. redo/undo an operation.

But I am unsure about it's implementation, like shall I save all the object's state whenever any minute change occurs? How do I save the state, shall I save the object for the same or maintain a log for the changes?
 
Jayesh A Lalwani
Rancher
Posts: 2759
32
Eclipse IDE Spring Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Wikipedia has a good description
 
Vishal Shaw
Ranch Hand
Posts: 179
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Jayesh A Lalwani wrote:Wikipedia has a good description



I have already studied this page. But there's one problem, in real life scenario, we may do upto 'n' no. of undos and redos. But here , it supports only one. Also, with every object I will have to implement this stuff. So, I was thinking about serializing the states in a log for the same and rollback the states from there.

What do you say? Is it a good idea to save the states in a log and work accordingly?
 
reply
    Bookmark Topic Watch Topic
  • New Topic