001package jmri.jmrit.operations.locations.tools;
002
003import java.awt.event.ActionEvent;
004
005import javax.swing.AbstractAction;
006
007import jmri.jmrit.operations.locations.Location;
008
009/**
010 * Action to print a summary of the Location 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, 2011, 2012, 2014, 2022
018 */
019public class PrintLocationsAction extends AbstractAction {
020
021    public PrintLocationsAction(boolean isPreview) {
022        super(isPreview ? Bundle.getMessage("MenuItemPreview") : Bundle.getMessage("MenuItemPrint"));
023        _isPreview = isPreview;
024    }
025
026    public PrintLocationsAction(boolean isPreview, Location location) {
027        super(isPreview ? Bundle.getMessage("MenuItemPreview") : Bundle.getMessage("MenuItemPrint"));
028        _isPreview = isPreview;
029        _location = location;
030    }
031
032    boolean _isPreview;
033    Location _location = null;
034    PrintLocationsFrame lpof = null;
035
036    @Override
037    public void actionPerformed(ActionEvent e) {
038        if (lpof == null) {
039            lpof = new PrintLocationsFrame(_isPreview, _location);
040        } else {
041            lpof.setVisible(true);
042        }
043        lpof.initComponents();
044    }
045}