001package jmri.jmrit.operations.rollingstock.engines.tools;
002
003import java.awt.event.ActionEvent;
004
005import javax.swing.AbstractAction;
006
007import jmri.jmrit.operations.rollingstock.engines.EnginesTableFrame;
008
009/**
010 * Action to print locomotive roster
011 *
012 * @author Bob Jacobsen Copyright (C) 2003
013 * @author Dennis Miller Copyright (C) 2005
014 * @author Daniel Boudreau Copyright (C) 2008, 2011, 2014, 2019, 2023
015 */
016public class PrintEngineRosterAction extends AbstractAction {
017
018    public PrintEngineRosterAction(boolean isPreview, EnginesTableFrame enginesTableFrame) {
019        super(isPreview ? Bundle.getMessage("MenuItemPreview") : Bundle.getMessage("MenuItemPrint"));
020        _isPreview = isPreview;
021        _enginesTableFrame = enginesTableFrame;
022    }
023
024    boolean _isPreview;
025    EnginesTableFrame _enginesTableFrame;
026    PrintEngineRosterFrame perf = null;
027
028    @Override
029    public void actionPerformed(ActionEvent e) {
030        if (perf == null) {
031            perf = new PrintEngineRosterFrame(_isPreview, _enginesTableFrame);
032        } else {
033            perf.setVisible(true);
034            perf.initComponents();
035        }
036    }
037}