001package jmri.jmrit.operations.routes.tools;
002
003import java.awt.Frame;
004import java.awt.event.ActionEvent;
005
006import javax.swing.AbstractAction;
007
008import jmri.jmrit.operations.routes.Route;
009
010/**
011 * Swing action to create RouteBlockingOrderEditFrame
012 *
013 * @author Bob Jacobsen Copyright (C) 2001
014 * @author Daniel Boudreau Copyright (C) 2021
015 */
016public class RouteBlockingOrderEditFrameAction extends AbstractAction {
017
018    public RouteBlockingOrderEditFrameAction() {
019        super(Bundle.getMessage("MenuBlockingOrder"));
020    }
021    
022    public RouteBlockingOrderEditFrameAction(Route route) {
023        this();
024        _route = route;
025    }
026
027    Route _route;
028    RouteBlockingOrderEditFrame f = null;
029
030    @Override
031    public void actionPerformed(ActionEvent e) {
032        // create a copy route frame
033        if (f == null || !f.isVisible()) {
034            f = new RouteBlockingOrderEditFrame(_route);
035        }
036        f.setExtendedState(Frame.NORMAL);
037        f.setVisible(true); // this also brings the frame into focus
038    }
039}