1 17 package org.columba.core.command; 18 19 import java.util.List ; 20 import java.util.Vector ; 21 22 import org.columba.api.command.ICommand; 23 import org.columba.api.command.IWorkerStatusController; 24 25 31 public class CompoundCommand extends Command { 32 protected List <ICommand> commandList; 33 34 38 public CompoundCommand() { 39 super(null); 40 commandList = new Vector <ICommand>(); 41 42 priority = Command.NORMAL_PRIORITY; 43 commandType = Command.NORMAL_OPERATION; 44 } 45 46 public void add(ICommand c) { 47 commandList.add(c); 48 } 49 50 55 @Override 56 public void execute(IWorkerStatusController worker) throws Exception { 57 for (ICommand _command : commandList) { 58 _command.execute(worker); 59 } 60 } 61 62 66 @Override 67 public boolean canBeProcessed() { 68 boolean result = true; 69 for (ICommand _command : commandList) { 70 result &= _command.canBeProcessed(); 71 } 72 73 if (!result) { 74 releaseAllFolderLocks(); 75 } 76 return result; 77 } 78 79 82 @Override 83 public void releaseAllFolderLocks() { 84 for (ICommand _command : commandList) { 85 _command.releaseAllFolderLocks(); 86 } 87 } 88 89 94 @Override 95 public void updateGUI() throws Exception { 96 for (ICommand _command : commandList) { 97 _command.updateGUI(); 98 } 99 } 100 } | Popular Tags |