Package practica1.actions

Source Code of practica1.actions.ActionCerrar

package practica1.actions;

import java.awt.event.ActionEvent;
import javax.swing.AbstractAction;
import practica1.controller.Controller;
import practica1.language.Language;
import practica1.language.LanguageEvent;
import practica1.language.LanguageListener;
import practica1.logic.LogicExperimento;

/**
* Clase que implementa la acción para cerrar un experimento
* @author Miguel González - Ceura
*/
public class ActionCerrar extends AbstractAction implements LanguageListener {

    /**
     * Constructor de la clase
     */
    public ActionCerrar() {
        super(Language.getI().getP("CERRAR"), null);

        Language.getI().addLanguageListener(this);
       
        putValue(SHORT_DESCRIPTION, Language.getI().getP("CERRAR_EXPERIMENTO"));
        putValue(NAME, Language.getI().getP("CERRAR"));
        putValue(SELECTED_KEY, Boolean.TRUE);
    }
   
    /**
     * Cuando sucede la acción nos encargamos de cerrar el experimento seleccionado
     * @param e ActionEvent Evento producido
     */
    @Override
    public void actionPerformed(ActionEvent e) {
        LogicExperimento exp = Controller.getInstance().
                getExperimentoSeleccionado();
       
        Controller.getInstance().removeExperimento(exp);
    }

    /**
     * Al cambiar el idioma actualizamos el nombre y la descripción
     * @param evt LanguageEvent
     */
    @Override
    public void idiomaChange(LanguageEvent evt) {
        putValue(SHORT_DESCRIPTION, Language.getI().getP("CERRAR_EXPERIMENTO"));
        putValue(NAME, Language.getI().getP("CERRAR"));
    }
   
}
TOP

Related Classes of practica1.actions.ActionCerrar

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.