001package jmri.jmrix.rfid.swing;
002
003import jmri.jmrix.rfid.RfidSystemConnectionMemo;
004import org.slf4j.Logger;
005import org.slf4j.LoggerFactory;
006
007/**
008 * JPanel extension to handle automatic creation of window title and help
009 * reference for Rfid panels
010 * <p>
011 * For use with JmriAbstractAction, etc
012 *
013 * @author Bob Jacobsen Copyright (C) 2010
014 * @author Matthew Harris Copyright (C) 2011
015 * @since 2.11.4
016 */
017abstract public class RfidPanel extends jmri.util.swing.JmriPanel implements RfidPanelInterface {
018
019    /**
020     * make "memo" object available as convenience
021     */
022    protected RfidSystemConnectionMemo memo;
023
024    /**
025     * {@inheritDoc}
026     */
027    @Override
028    public void initComponents(RfidSystemConnectionMemo memo) {
029        this.memo = memo;
030    }
031
032    /**
033     * {@inheritDoc}
034     */
035    @Override
036    public void initContext(Object context) {
037        if (context instanceof RfidSystemConnectionMemo) {
038            try {
039                initComponents((RfidSystemConnectionMemo) context);
040            } catch (Exception e) {
041                log.error("PowerlinePanel initContext failed", e);
042            }
043        }
044    }
045
046    private final static Logger log = LoggerFactory.getLogger(RfidPanel.class);
047}