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 * Swing action to create a SetPhysicalLocation dialog.
012 *
013 * @author Bob Jacobsen Copyright (C) 2001
014 * @author Daniel Boudreau Copyright (C) 2010
015 * @author Mark Underwood Copyright (C) 2011
016 */
017public class SetPhysicalLocationAction extends AbstractAction {
018
019    public SetPhysicalLocationAction(Location location) {
020        super(Bundle.getMessage("MenuSetPhysicalLocation"));
021        _location = location;
022    }
023
024    Location _location;
025    SetPhysicalLocationFrame f = null;
026
027    @Override
028    public void actionPerformed(ActionEvent e) {
029        // create a copy route frame
030        if (f == null || !f.isVisible()) {
031            f = new SetPhysicalLocationFrame(_location);
032        }
033        f.setExtendedState(Frame.NORMAL);
034        f.setVisible(true); // this also brings the frame into focus
035    }
036
037    //private final static Logger log = LoggerFactory.getLogger(SetPhysicalLocationAction.class);
038}
039
040