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