001package jmri.jmrix.acela.nodeconfig;
002
003import java.awt.event.ActionEvent;
004import javax.swing.AbstractAction;
005import jmri.InstanceManager;
006import jmri.jmrix.acela.AcelaSystemConnectionMemo;
007import org.slf4j.Logger;
008import org.slf4j.LoggerFactory;
009
010/**
011 * Swing action to create and register a NodeConfigFrame object
012 *
013 * @author Bob Jacobsen Copyright (C) 2008
014 */
015public class NodeConfigAction extends AbstractAction {
016
017    private AcelaSystemConnectionMemo _memo = null;
018
019    public NodeConfigAction(String s, AcelaSystemConnectionMemo memo) {
020        super(s);
021        _memo = memo;
022    }
023
024    public NodeConfigAction() {
025        this(Bundle.getMessage("ConfigNodesTitle"), InstanceManager.getDefault(AcelaSystemConnectionMemo.class));
026    }
027
028    @Override
029    public void actionPerformed(ActionEvent e) {
030        NodeConfigFrame f = new NodeConfigFrame(_memo);
031        try {
032            f.initComponents();
033        } catch (Exception ex) {
034            log.error("Exception: {}", ex.toString());
035        }
036        f.setLocation(100, 30);
037        f.setVisible(true);
038    }
039
040    private final static Logger log = LoggerFactory.getLogger(NodeConfigAction.class);
041
042}