001package jmri.jmrix.nce.swing;
002
003import jmri.jmrix.nce.NceSystemConnectionMemo;
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 NcePanels.
010 * <p>
011 * For use with JmriAbstractAction, etc
012 *
013 * @author Bob Jacobsen Copyright 2010
014 * @since 2.9.4 Copied from LocoNet.swing
015 * @author kcameron 2010
016 */
017abstract public class NcePanel extends jmri.util.swing.JmriPanel implements NcePanelInterface {
018
019    /**
020     * make "memo" object available as convenience
021     */
022    protected NceSystemConnectionMemo memo;
023
024    /**
025     * {@inheritDoc}
026     */
027    @Override
028    public void initComponents(NceSystemConnectionMemo memo) {
029        this.memo = memo;
030    }
031
032    /**
033     * {@inheritDoc}
034     */
035    @Override
036    public void initContext(Object context) {
037        if (context instanceof NceSystemConnectionMemo) {
038            try {
039                initComponents((NceSystemConnectionMemo) context);
040            } catch (Exception e) {
041                log.error("NcePanel initContext failed", e); // NOI18N
042            }
043        }
044    }
045
046    private final static Logger log = LoggerFactory.getLogger(NcePanel.class);
047
048}