/* * PresencasActionFactory.java * * Created on January 31, 2007, 6:37 PM * * To change this template, choose Tools | Template Manager * and open the template in the editor. */ package siprp.medicina.presencas; import com.evolute.utils.data.IDObject; import com.evolute.utils.ui.panel.multipleactionlist.ActionFactory; import javax.swing.Action; import siprp.medicina.presencas.actions.DesmarcadoSHSTAction; import siprp.medicina.presencas.actions.DesmarcadoTrabalhadorAction; import siprp.medicina.presencas.actions.FaltouAction; import siprp.medicina.presencas.actions.RealizouAction; import siprp.medicina.presencas.actions.RealizouParcialmenteAction; /** * * @author fpalma */ public class PresencasActionFactory implements ActionFactory { public static final int REALIZOU = 0; public static final int REALIZOU_PARCIALMENTE = 1; public static final int TRABALHADOR_DESMARCOU = 2; public static final int SHST_DESMARCOU = 3; public static final int FALTOU = 4; protected final int TIPO; /** Creates a new instance of PresencasActionFactory */ public PresencasActionFactory( int tipo ) { TIPO = tipo; } public Action createAction(Presenca[] objects) { switch( TIPO ) { case SHST_DESMARCOU: return new DesmarcadoSHSTAction( DesmarcadoSHSTAction.MULTIPLE ); case FALTOU: return new FaltouAction( FaltouAction.MULTIPLE ); default: return null; } } public Action createAction(Presenca object) { switch( TIPO ) { case REALIZOU: return new RealizouAction(); case REALIZOU_PARCIALMENTE: return new RealizouParcialmenteAction( object ); case TRABALHADOR_DESMARCOU: return new DesmarcadoTrabalhadorAction(); case SHST_DESMARCOU: return new DesmarcadoSHSTAction( DesmarcadoSHSTAction.SINGLE ); case FALTOU: return new FaltouAction( FaltouAction.SINGLE ); default: return null; } } }