/*FreeMind - A Program for creating and viewing Mindmaps *Copyright (C) 2000-2004 Joerg Mueller, Daniel Polansky, Christian Foltin and others. * *See COPYING for Details * *This program is free software; you can redistribute it and/or *modify it under the terms of the GNU General Public License *as published by the Free Software Foundation; either version 2 *of the License, or (at your option) any later version. * *This program is distributed in the hope that it will be useful, *but WITHOUT ANY WARRANTY; without even the implied warranty of *MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *GNU General Public License for more details. * *You should have received a copy of the GNU General Public License *along with this program; if not, write to the Free Software *Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * Created on 09.05.2004 */ package freemind.modes.mindmapmode.actions; import java.awt.event.ActionEvent; import javax.swing.AbstractAction; import freemind.controller.actions.generated.instance.CompoundAction; import freemind.controller.actions.generated.instance.XmlAction; import freemind.modes.mindmapmode.MindMapController; import freemind.modes.mindmapmode.actions.xml.ActorXml; /** * @author foltin * */ public class CompoundActionHandler extends AbstractAction implements ActorXml { private MindMapController c; public CompoundActionHandler(MindMapController c) { this.c = c; this.c.getActionFactory().registerActor(this, getDoActionClass()); } /* * (non-Javadoc) * * @see * freemind.controller.actions.ActorXml#act(freemind.controller.actions. * generated.instance.XmlAction) */ public void act(XmlAction action) { CompoundAction compound = (CompoundAction) action; Object[] actions = compound.getListChoiceList().toArray(); for (int i = 0; i < actions.length; i++) { Object obj = actions[i]; if (obj instanceof XmlAction) { XmlAction xmlAction = (XmlAction) obj; ActorXml actor = c.getActionFactory().getActor(xmlAction); actor.act(xmlAction); } } } /* * (non-Javadoc) * * @see freemind.controller.actions.ActorXml#getDoActionClass() */ public Class getDoActionClass() { return CompoundAction.class; } /* * (non-Javadoc) * * @see * java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) */ public void actionPerformed(ActionEvent arg0) { } }