001package jmri.jmrit.operations.locations.tools;
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 * Opens the location track blocking order window.
012 *
013 * @author Daniel Boudreau Copyright (C) 2015
014 * 
015 */
016public class LocationTrackBlockingOrderAction extends AbstractAction {
017
018    public LocationTrackBlockingOrderAction(Location location) {
019        super(Bundle.getMessage("TitleTrackBlockingOrder"));
020        _location = location;
021    }
022
023    Location _location;
024    LocationTrackBlockingOrderFrame _frame = null;
025
026    @Override
027    public void actionPerformed(ActionEvent e) {
028        // create a frame
029        if (_frame == null || !_frame.isVisible()) {
030            _frame = new LocationTrackBlockingOrderFrame();
031            _frame.initComponents(_location);
032        }
033        _frame.setExtendedState(Frame.NORMAL);
034        _frame.setVisible(true); // this also brings the frame into focus
035    }
036}
037
038