Is it possible to use the memento pattern for undo operation in JFreeChart?
If it's possible please give me some examples of it.
Is it possible to use the memento pattern for undo operation in JFreeChart?
If it's possible please give me some examples of it.
Copyright © 2021 Jogjafile Inc.
Yes, the memento pattern can be used with
JFreeChart. This typical example manages aString, but yourMementoclass would contain a suitable concrete implementation of your chosenDataset. An instance of that dataset would be held by yourOriginator. YourCaretakerwould then contain aList<Originator.Memento>. Your implementation ofOriginator::setandOriginator::restoreFromMementocan usesetDataset(), as shown here, to set the chart's current dataset or restore the chart to any previously saved state. For convenience, many implementations ofDatasetimplementCloneable.