001package jmri.jmrit.signalling;
002
003import java.awt.event.ActionEvent;
004import javax.swing.AbstractAction;
005import org.slf4j.Logger;
006import org.slf4j.LoggerFactory;
007
008/**
009 * Swing action to create and register a SignallingFrame object.
010 *
011 * @author Kevin Dickerson Copyright (C) 2011
012 */
013public class SignallingAction extends AbstractAction {
014
015    public SignallingAction(String s) {
016        super(s);
017    }
018
019    public SignallingAction() {
020        super(Bundle.getMessage("SignallingPairs"));  // NOI18N
021    }
022
023    public void setMast(jmri.SignalMast source, jmri.SignalMast dest) {
024        this.source = source;
025        this.dest = dest;
026    }
027
028    jmri.SignalMast source = null;
029    jmri.SignalMast dest = null;
030
031    @Override
032    public void actionPerformed(ActionEvent e) {
033        SignallingFrame f = new SignallingFrame();
034        try {
035            f.initComponents(source, dest);
036        } catch (Exception ex) {
037            log.error("Exception: ", ex);
038        }
039        f.setVisible(true);
040    }
041
042    private final static Logger log = LoggerFactory.getLogger(SignallingAction.class);
043
044}