001package jmri.jmrit.operations.locations.tools; 002 003import java.awt.event.ActionEvent; 004 005import javax.swing.AbstractAction; 006 007import jmri.jmrit.operations.locations.Location; 008import jmri.jmrit.operations.locations.Track; 009 010/** 011 * Action to create the ShowTrainsServingLocationFrame. 012 * 013 * @author Daniel Boudreau Copyright (C) 2014 014 */ 015public class ShowTrainsServingLocationAction extends AbstractAction { 016 017 public ShowTrainsServingLocationAction(Location location, Track track) { 018 super(location == null ? Bundle.getMessage("TitleShowTrains") 019 : track == null ? Bundle.getMessage("MenuItemShowTrainsLocation") 020 : Bundle.getMessage("MenuItemShowTrainsTrack")); 021 _location = location; 022 _track = track; 023 } 024 025 Location _location; 026 Track _track; 027 ShowTrainsServingLocationFrame _frame; 028 029 @Override 030 public void actionPerformed(ActionEvent e) { 031 if (_frame != null) { 032 _frame.dispose(); 033 } 034 _frame = new ShowTrainsServingLocationFrame(); 035 _frame.initComponents(_location, _track); 036 } 037}