001package jmri.jmrix.rps.aligntable;
002
003import java.awt.event.ActionEvent;
004import javax.swing.AbstractAction;
005import org.slf4j.Logger;
006import org.slf4j.LoggerFactory;
007import jmri.jmrix.rps.RpsSystemConnectionMemo;
008
009/**
010 * Swing action to create and register a AlignTableFrame object.
011 * <p>
012 * Only one frame is used (e.g. it's reused) because notification is not yet
013 * completely in place.
014 * <p>
015 * Note that we only allow one of these right now.
016 *
017 * @author Bob Jacobsen Copyright (C) 2006, 2008
018 */
019public class AlignTableAction extends AbstractAction {
020
021    RpsSystemConnectionMemo memo = null;
022
023    static final java.util.ResourceBundle rb = java.util.ResourceBundle.getBundle("jmri.jmrix.rps.aligntable.AlignTableBundle");
024
025    public AlignTableAction(String s,RpsSystemConnectionMemo _memo) {
026        super(s);
027        memo = _memo;
028    }
029
030    public AlignTableAction(RpsSystemConnectionMemo _memo) {
031        this(rb.getString("WindowTitle"),_memo);
032    }
033
034    AlignTableFrame f;
035
036    @Override
037    public void actionPerformed(ActionEvent e) {
038        if (f == null) {
039            f = new AlignTableFrame(memo);
040            try {
041                f.initComponents();
042            } catch (Exception ex) {
043                log.error("Exception: {}", ex.toString());
044            }
045            f.setLocation(100, 30);
046        }
047        f.setVisible(true);
048    }
049    private final static Logger log = LoggerFactory.getLogger(AlignTableAction.class);
050}