memento

Storing the state of a complex object with Memento pattern (and Command)

Hello, I'm working on a small UML editor project, in Java, that I started a couple of months ago. After a few weeks, I got a working copy for a UML class diagram editor. But now, I'm redesigning it completely to support other types of diagrams, such a sequence, state, class, etc. This is done by implementing a graph construction framew...

Memento implementation on .NET

I've seen two different implementation of memento on .NET. One is pretty straightforward - The object creates another instance of itself. The other is serializing the object using BinaryFormatter and MemoryStream. Which is the preferred method? Can anyone point out advantages/disadvantages of each approach? ...

C#: How to implement good and efficient undo/redo functionaly for a TextBox

I have a TextBox which I would like to implement undo/redo functionality for. I have read that it might have some slight undo functionality already, but that it is buggy? Anyways, I would like to implement both undo and redo functionality also just to learn how you would go ahead and do that. I have read about the Memento Pattern and l...

Memento in Javascript

Hi, I'm looking for a JavaScript implementation of the memento pattern (GoF) to be used in CRUD forms. In its basic level it will be enough to undo changes on inputs, but it would be great to use it with standard JS frameworks like YUI or Ext, to undo & redo grid actions ( new row, delete row etc.). Thanks ...

Comparing two object state,before and after update

first things first. I have the following classes: class Employee { private int employeeID; private string firstName; private string lastName; private bool eligibleOT; private int positionID; private string positionName; private ArrayList arrPhone; public IList<Sector> ArrSector {get; private set;} //...

Correct way to trigger object clone/memento when property changes

Hi, I have a big doubt about the correct way to save an object state (clone object), if necessary to rollback the changes, when a property has changed. I know that the IEditableObject interface exists for those cases but during some tests the BeginEdit would just fire like crazy (I have a DataGrid whose values can be edited but I won't ...

How to create default instances of the memento in a Memento Pattern ?

Hi, I use the Memento Pattern to save properties of a multi-instance form, where n forms are created by user inside a parent form. The purpose of the memento is to regain the same number of forms, and their settings, when a user close and later reopen the parent form. The saving of the form mementos are done by a "save" button on the pa...