undo-redo

using undo/redo in Swing for an MVC model?

主宰稳场 提交于 2019-12-11 07:57:09
问题 I have an MVC model,and Im trying to add an undo/redo feature to it. User can place a number in a JTextField, and when they click the UNDO button, it should be erased. I have provided the code for my classes that implement this. The error I get is at the bottom. The Control package: ButtonnGUIControl.java package control; /** * This class will control the button actions of the GUI.It implements the actionListener() method * and based on the button that was clicked, it initializes the *

How to discard only the last element of CKEditor undo stack?

荒凉一梦 提交于 2019-12-11 02:05:03
问题 Is there a way to remove only the last snapshot in the CKEditor undo stack or can i replace it with another.Should i implement it on my own? Example: Step 1 Step 2 --should be removed and replaced with step 3 (On given situation) Step 3 -- should become step 2 This feature should be available only if special event occurs. 回答1: If your undo snapshots are a result of user actions, following this way: Step 1. Step 2. CKEDITOR.instances.editor.fire( 'lockSnapshot' ) Step 3. CKEDITOR.instances

Undo in JTextField and setText

耗尽温柔 提交于 2019-12-10 19:49:08
问题 JTextField has an undo support out of box. It works fine for user interacion, but unfortunately if method setText(String str) is called, that results two UndoableEdits instead of one. So this code looks and feels fine but does not work: UndoManager undoManager = new UndoManager(); JTextField tf = new JTextField(); tf.setText("initial value"); tf.getDocument().addUndoableEditListener(undoManager); tf.setText("new value"); undoManager.undo(); System.out.println(tf.getText()); // Prints empty

How to utilize sqlite for undo/redo features?

不问归期 提交于 2019-12-09 13:36:36
问题 I'm writing a desktop application to do vector drawing in C++, and considering using sqlite to back my undo/redo feature. Has anybody used sqlite for undo/redo features? How does it work out for you? Clarification: I was aware of the stack approach, I have even implemented one application with that approach. The problem I encountered was that it becomes hard to maintain after a while. What I meant by utilizing sqlite is that I will map my entire in-memory data structure into a sqlite database

ActionScript - General Undo / Redo API?

回眸只為那壹抹淺笑 提交于 2019-12-08 05:09:37
问题 i've been unsuccessfully attempting to create my own undo/redo classes that work well with any type of possible undo and redo commands. for example, my simple class works perfectly with undoing/redoing x and y positions of display objects or undoing/redoing values of sliders, etc., but things get dicey when i try to tailor my classes to also work with things like adding and removing items to a list. is there any well known and well documented solution for general undoing and redoing for

Undo/Redo Implementation For Multiple Variables

不想你离开。 提交于 2019-12-08 04:43:02
问题 I'm trying to refactor an undo/redo implementation I have but am unsure how to go about it. public class MyObject { public int A; public int B; public int C; } public abstract class UndoRedoAction { protected MyObject myobj; protected int oldValue; protected int newValue; public abstract void Undo(); public abstract void Redo(); } public class UndoRedoActionA : UndoRedoAction { UndoRedoActionA(MyObject obj, int new) { myobj = obj; oldValue = myobj.A; newValue = new; myobj.A = newValue; }

How to undo Redux Async Action? (multiple steps back in the state)

自作多情 提交于 2019-12-07 20:56:03
问题 if I have an async action with api call, which could either be an action returns a function: export function asyncAction(itemId) { return (dispatch) => { dispatch(requestStarted()); return sendRequest(itemId).then( (result) => dispatch(requestSuccess()), (error) => dispatch(requestFail()) ); }; } or one returns an object and uses middleware to intercept it and do stuff: export function asyncAction(itemId) { return { type: [ITEM_REQUEST, ITEM_REQUEST_SUCCESS, ITEM_REQUEST_FAILURE], promise:

ActionScript - General Undo / Redo API?

馋奶兔 提交于 2019-12-07 03:37:31
i've been unsuccessfully attempting to create my own undo/redo classes that work well with any type of possible undo and redo commands. for example, my simple class works perfectly with undoing/redoing x and y positions of display objects or undoing/redoing values of sliders, etc., but things get dicey when i try to tailor my classes to also work with things like adding and removing items to a list. is there any well known and well documented solution for general undoing and redoing for actionscript (without Flex)? There are specific design patters for this kind of stuff in AS3 Please check

Why is there no undo/redo in Git?

只愿长相守 提交于 2019-12-05 19:28:06
问题 As far as I know, when you want to undo something in Git you have to explicitly find the command to undo whatever it is you've done and issue it. For instance, one way among many to undo a commit and redo it is to follow the example from here, $ git commit ... $ git reset --soft HEAD^ $ edit $ git add .... $ git commit -c ORIG_HEAD Or to undo a pull, you can follow the instructions from here, $ git reset --hard But these commands do not necessarily work interchangeably. Is there a reason why

Disabling undo/redo in an HTML input field

吃可爱长大的小学妹 提交于 2019-12-05 12:41:33
I am using asp.net input fields and they automatically provide undo/redo functionality. I am using JavaScript to format the value of the input field, however this ruins the undo/redo history. Is there a way to disable the undo/redo feature? or Is there a way to interact with the undo/redo history to add the correct values? Using JavaScript, try replacing the text field with a new one and then setting the value. New field, new undo buffer, right? jQuery: $('#theTextField').after('<textarea id="theTextField2"></textarea>').remove(); $('#theTextField2').attr('id','theTextField'); 来源: https:/