My favorites | Sign in
Project Home Wiki Issues Source
Checkout   Browse   Changes    
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
package com.googlecode.pennybank.swing.controller.actions;

import java.util.List;

/**
* Action class which allows combining several actions into another one, so
* undoing, redoing and executing the composite one, will propagate the effects
* over the inner actions
*
* @author spenap
*/
public class CompositeAction extends GenericAction {

private List<GenericAction> actions = null;
private String actionName = null;

/**
* Creates the action with the specified arguments
*
* @param actions
* The list of inner actions to be executed
* @param actionName
* The name this generic action will have
*/
public CompositeAction(List<GenericAction> actions, String actionName) {
this.actions = actions;
this.actionName = actionName;
}

@Override
protected boolean doExecute() {
boolean success = true;
for (GenericAction action : actions) {
success &= action.doExecute();
}
return success;
}

@Override
protected String doGetName() {
return actionName;
}

@Override
protected void doRedo() {
for (GenericAction action : actions) {
action.doRedo();
}
}

@Override
protected void doUndo() {
for (GenericAction action : actions) {
action.doUndo();
}
}

}

Change log

r27 by bulfaiter on Apr 11, 2009   Diff
Adding, editing and removing account
operations works now. Deleting multiple
account operations at a time can be undone
in a single operation, too (without
reversing the deletion of every single
operation)

From the last commit log, the last
sentence still applies:

The actions must return an execution
result, which is still missing. Common
...
Go to: 
Project members, sign in to write a code review

Older revisions

All revisions of this file

File info

Size: 1240 bytes, 58 lines

File properties

svn:mime-type
text/plain
Powered by Google Project Hosting