001package jmri.jmrix.can.cbus.eventtable;
002
003import jmri.implementation.AbstractShutDownTask;
004
005/**
006 * Class to call dispose on a MERG CBUS event table.
007 * This saves the event data to XML prior to shutdown.
008 *
009 * @author Steve Young Copyright (C) 2019
010 */
011public class CbusEventTableShutdownTask extends AbstractShutDownTask {
012
013    private final CbusEventTableDataModel _model;
014    
015    /**
016     * Constructor specifies the warning message and action to take
017     *
018     * @param name the name of the task (used in logs)
019     * @param model the CBUS Event Table instance to dispose of
020    */
021    public CbusEventTableShutdownTask(String name, CbusEventTableDataModel model) {
022        super(name);
023        _model = model;
024    }
025
026    /**
027    * Checks preferences, saving Table contents if necessary.
028    */
029    @Override
030    public void run() {
031        _model.dispose();
032    }
033}