package nl.graphit.util.jsf.history;

import javax.faces.event.AbortProcessingException;
import javax.faces.event.ActionEvent;
import javax.faces.event.ActionListener;

/**
 * A simple JSF ActionListener that stores the current view state using the
 * history manager before your action is invoked. This will allow you to return
 * to the page and state before the action was invoked by calling
 * {@link nl.graphit.util.jsf.history.HistoryManager#returnToLast()}.
 * 
 * @author Nico Krijnen <nico.krijnen@graphit.nl>
 */
public class AddViewStateListener implements ActionListener {

    public void processAction(ActionEvent event)
            throws AbortProcessingException {

        HistoryManager.getCurrentInstance().addCurrentViewState();

    }

}
