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 * Displayed when user clicks Edit Logic button in the Signal Mast table. 011 * 012 * @author Kevin Dickerson Copyright (C) 2011 013 */ 014public class SignallingSourceAction extends AbstractAction { 015 016 public SignallingSourceAction(String s) { 017 super(s); 018 } 019 020 public SignallingSourceAction(String s, jmri.SignalMast source) { 021 super(s + " : " + source.getDisplayName()); // set title of pane to include source mast name 022 this.source = source; 023 } 024 025 public SignallingSourceAction() { 026 super(Bundle.getMessage("SignallingPairs")); // NOI18N 027 } 028 029 public void setMast(jmri.SignalMast source) { 030 this.source = source; 031 } 032 033 jmri.SignalMast source = null; 034 035 /** 036 * Open a SignallingSourceFrame pane. 037 * Displayed when user clicks Edit Logic button in the Signal Mast table. 038 */ 039 @Override 040 public void actionPerformed(ActionEvent e) { 041 SignallingSourceFrame f = new SignallingSourceFrame(); 042 try { 043 f.initComponents(source); 044 } catch (Exception ex) { 045 log.error("Exception: ", ex); 046 } 047 f.setVisible(true); 048 } 049 private final static Logger log = LoggerFactory.getLogger(SignallingSourceAction.class); 050}