001package jmri.jmrit.operations.rollingstock.cars.tools;
002
003import java.awt.event.ActionEvent;
004
005import javax.swing.AbstractAction;
006
007import jmri.jmrit.operations.rollingstock.cars.CarsTableFrame;
008
009/**
010 * Action to print a summary of the Roster contents
011 * <p>
012 * This uses the older style printing, for compatibility with Java 1.1.8 in
013 * MacIntosh MRJ
014 *
015 * @author Bob Jacobsen Copyright (C) 2003
016 * @author Dennis Miller Copyright (C) 2005
017 * @author Daniel Boudreau Copyright (C) 2008, 2010, 2011, 2012, 2013, 2014
018 */
019public class PrintCarRosterAction extends AbstractAction {
020
021    public PrintCarRosterAction(boolean isPreview, CarsTableFrame carsTableFrame) {
022        super(isPreview ? Bundle.getMessage("MenuItemPreview") : Bundle.getMessage("MenuItemPrint"));
023        _isPreview = isPreview;
024        _carsTableFrame = carsTableFrame;
025    }
026
027    /**
028     * Variable to set whether this is to be printed or previewed
029     */
030    boolean _isPreview;
031    CarsTableFrame _carsTableFrame;
032    PrintCarRosterFrame pcrf = null;
033
034    @Override
035    public void actionPerformed(ActionEvent e) {
036        if (pcrf == null) {
037            pcrf = new PrintCarRosterFrame(_isPreview, _carsTableFrame);
038        } else {
039            pcrf.setVisible(true);
040        }
041    }
042}