All Downloads are FREE. Search and download functionalities are using the official Maven repository.

simple.server.core.action.DelayedAction Maven / Gradle / Ivy

The newest version!
package simple.server.core.action;

import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.Action;
import simple.server.core.event.TurnListener;

/**
 * Delays performing actions until later.
 *
 * @author Javier A. Ortiz Bultrón 
 */
public class DelayedAction implements TurnListener {

    private Action action;
    private static final Logger logger =
            Logger.getLogger(DelayedAction.class.getSimpleName());

    public DelayedAction(Action action) {
        this.action = action;
    }

    @Override
    public void onTurnReached(int currentTurn) {
        if(action !=null){
            //Perform the action
            logger.log(Level.FINE, "Executing action");
            action.actionPerformed(null);
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy