001    // GraphLab Project: http://graphlab.sharif.edu
002    // Copyright (C) 2008 Mathematical Science Department of Sharif University of Technology
003    // Distributed under the terms of the GNU General Public License (GPL): http://www.gnu.org/licenses/
004    
005    package graphlab.plugins.algorithmanimator.core.atoms.extension;
006    
007    import graphlab.platform.core.AbstractAction;
008    import graphlab.platform.core.BlackBoard;
009    import graphlab.platform.extension.ExtensionHandler;
010    import graphlab.plugins.algorithmanimator.core.AlgorithmAnimator;
011    
012    public class AtomAnimatorExtensionHandler implements ExtensionHandler {
013    
014        AbstractAction a = null;
015    
016        public AbstractAction handle(BlackBoard b, Object ext) {
017            a = null;
018            if (ext instanceof AtomAnimatorExtension) {
019                try {
020                    AtomAnimatorExtension vm = (AtomAnimatorExtension) ext;
021                    a = new AtomAnimatorExtensionAction(b, vm);
022                    AlgorithmAnimator.registerAtomAnimation(vm);
023                } catch (Exception e) {
024                    e.printStackTrace();
025                }
026            }
027            return a;
028        }
029    }