View Javadoc
1 /* 2 * (C) 2002 David Carr david@carr.name 3 * 4 * This program is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License as published by 6 * the Free Software Foundation; either version 2 of the License, or 7 * (at your option) any later version. 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with this program; if not, write to the Free Software 16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 */ 18 19 package net.sourceforge.mflow.impl; 20 21 import java.util.ArrayList; 22 import java.util.List; 23 24 import net.sourceforge.mflow.api.MFlowUI; 25 import net.sourceforge.mflow.api.MFlowUIManager; 26 27 /*** 28 * A class for managing instances of MFlowUI 29 * 30 * @author <a href="mailto:david@carr.name">David Carr</a> 31 * @version $Revision: 1.4 $ 32 */ 33 public class MFlowUIManagerImpl implements MFlowUIManager { 34 /*** 35 * Private storage for all MFlowUI instances 36 */ 37 private List instances = new ArrayList(); 38 39 private MFlowUI currentUI = null; 40 41 MFlowUIManagerImpl() { 42 //No data needed 43 } 44 45 public synchronized void addInstance(MFlowUI instance) { 46 if (!this.instances.contains(instance)) { 47 this.instances.add(instance); 48 } 49 if (this.currentUI == null) { 50 this.currentUI = instance; 51 } 52 } 53 54 public synchronized MFlowUI[] getInstances() { 55 return (MFlowUI[]) this.instances.toArray( 56 new MFlowUI[this.instances.size()]); 57 } 58 59 public synchronized void removeInstance(MFlowUI ui) { 60 this.instances.remove(ui); 61 } 62 63 public void setCurrentInstance(MFlowUI ui) { 64 this.currentUI = ui; 65 } 66 67 public MFlowUI getCurrentInstance() { 68 return this.currentUI; 69 } 70 }

This page was automatically generated by Maven