001package jmri.jmrix.pricom.pockettester;
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 pricom.pockettester.StatusFrame object
010 *
011 * @see jmri.jmrix.pricom.pockettester.StatusFrame
012 *
013 * @author Bob Jacobsen Copyright (C) 2002,2004, 2005
014 */
015public abstract class StatusAction extends AbstractAction {
016
017    public StatusAction(String s) {
018        super(s);
019    }
020
021    public StatusAction() {
022        putValue(javax.swing.Action.NAME, Bundle.getMessage("ActionStatus"));
023    }
024
025    @Override
026    public void actionPerformed(ActionEvent e) {
027        StatusFrame f = new StatusFrame();
028        try {
029            f.initComponents();
030        } catch (Exception ex) {
031            log.error("starting StatusFrame caught exception: {}", ex.toString());
032        }
033        connect(f);
034        f.setVisible(true);
035    }
036
037    abstract void connect(StatusFrame l);
038
039    private final static Logger log = LoggerFactory.getLogger(StatusAction.class);
040
041}