Questions tagged [memento]

The Memento pattern allows a caretaker object to roll back the originator object to a previous state, offering undo capability. It is one of the Gang of Four's behavioral design patterns.

This is one of the Gang of Four's behavioral , first published in Gamma et al.'s book "Design Patterns: Elements of Reusable Object-Oriented Software".

More information is available on Wikipedia.

75 questions
0
votes
3 answers

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

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…
bretddog
  • 5,411
  • 11
  • 63
  • 111
0
votes
1 answer

Getters in abstract State pattern not accessible in Memento pattern

I have a problem with saving some variables from State abstract method into the File in Memento Pattern. The error is 'Non accessible in scope'. Here are the pieces of code: State class. public abstract class State { protected int W; …
user4132350
0
votes
1 answer

How can I get the UNDO-stack with PropertyChangeUndo objects from the MementoService in Catel?

I'm developing an application with undo/redo mechanism. I use the Catel MVVM framework. I use the Catel.Memento for the undo/redo. I got worked it, but I want to show the list of redo-objects in a list. My question is: How can I get the…
0
votes
2 answers

Memento patterns doesn't work correctly

I tried to implement some implementation of Memento pattern in Java. Example is easy - copy video game as example, when user press F5 save gamer state => after pressing F9 recover last saved gamer state. Here is output from easy run: Health: …
catch23
  • 17,519
  • 42
  • 144
  • 217
0
votes
0 answers

Memento pattern lack

in my project about image processing I need to have Undo/Redo button. Briefly saying I do multiple operations on Bitmaps which then I assign to picturebox. I found this article…
Filus1025
  • 43
  • 1
  • 7
0
votes
1 answer

How should one implement a change state dialog with undo/redo support in Catel?

I cannot get Undo and Redo to behave correctly when using a dialog. I have a simple model with a property indicating the state of the object(running, paused, stopped) which can be altered via a dialog. What happens is that I get actions that seems…
0
votes
1 answer

Remove Redo actions in Memento?

In my application a user can add rows to a DataGrid and change properties of each row. The user can also delete rows. It works fine to undo and redo these actions but if the user adds rows, say three, modify some values and then undo back to where…
0
votes
1 answer

'Catel.IoC.IServiceLocator' does not contain a definition for 'Instance'

I'm quite new to .NET development and Catel but is working on a project to learn it. At the moment the original developer is not present so I'll try my luck here instead. To implement Undo/Redo the Memento Pattern support of Catel seems great so…
0
votes
2 answers

Saving assignments in object passed by reference

I would like to confirm the expanation to some things I've been trying to understand. I have two scenarios: Scenario 1: I have one list stored in a private field of my class, I make a deep copy of it and store it in other private field. After doing…
Tao Gómez Gil
  • 2,228
  • 20
  • 36
0
votes
1 answer

Memento Implementation in VBA

I'm looking for a VBA implementation of the Memento pattern (GoF). I'm looking at converting the Java version from Wikipedia. It will be used for Undo/Redo functionality for an Excel add-in. Specifically, I am having difficulty with the line: return…
bvukas
  • 359
  • 2
  • 7
0
votes
2 answers

.htaccess - Configuring an Apache server for Memento

I try to configure an Apache server to add an HTTP Link header pointing at a Memento TimeGates url My htaccess: RewriteEngine on RewriteCond %{IS_SUBREQ} false RewriteRule ^/(.*) - [E=ORIGURI:%{HTTP_HOST}/$1] RewriteRule ^/(.*) -…
RafaSashi
  • 16,483
  • 8
  • 84
  • 94
0
votes
1 answer

Apply button in Catel's DataWindow

I am reimplementing options dialog in order to support cancellation of changes. I am trying to use Catel's DataWindow with IMementoService for that. Noticed that DataWindow already has OK and Cancel buttons but not Apply. Just wonder whether I…
IUnknown
  • 335
  • 1
  • 11
0
votes
1 answer

Some explanation on memento

I have checked every where, and read countless article. I even went on some Chinese forum looking for answers. The thing is i can't fully understand c# memento pattern. Different articles show different ways on doing it, i cant understand it…
-1
votes
1 answer

Keep getting the ID from items in a list which is in a class

class EditorState: def __init__(self, content): self.content = content class Editor: def __init__(self): self.content = "" def __str__(self): return f'{self.content}' def setContent(self, value): …
-2
votes
1 answer

Memento design pattern

Here is my code: class Number; class Memento { public: Memento(int val) { _state = val; } private: friend class Number; // not essential, but p287 suggests this int _state; }; class Number { public: Number(int…
ssg
  • 247
  • 2
  • 15
1 2 3 4
5