001package jmri.jmrit.operations.locations.gui;
002
003import java.awt.Frame;
004import java.awt.event.ActionEvent;
005
006import javax.swing.AbstractAction;
007
008import jmri.jmrit.operations.locations.Location;
009
010/**
011 * Swing action open the yardmaster by track frame.
012 *
013 * @author Daniel Boudreau Copyright (C) 2015
014 * 
015 */
016public class YardmasterByTrackAction extends AbstractAction {
017    
018    public YardmasterByTrackAction(Location location) {
019        super(Bundle.getMessage("TitleYardmasterByTrack"));
020        _location = location;
021    }
022
023    Location _location;
024    YardmasterByTrackFrame f = null;
025
026    @Override
027    public void actionPerformed(ActionEvent e) {
028        // create a frame
029        if (f == null || !f.isVisible()) {
030            f = new YardmasterByTrackFrame(_location);
031        }
032        f.setExtendedState(Frame.NORMAL);
033        f.setVisible(true); // this also brings the frame into focus
034    }
035}
036
037