001package jmri.jmrix.zimo.swing; 002 003import jmri.jmrix.zimo.Mx1SystemConnectionMemo; 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 */ 017abstract public class Mx1Panel extends jmri.util.swing.JmriPanel implements Mx1PanelInterface { 018 019 /** 020 * make "memo" object available as convenience 021 */ 022 protected Mx1SystemConnectionMemo memo; 023 024 /** 025 * {@inheritDoc} 026 */ 027 @Override 028 public void initComponents(Mx1SystemConnectionMemo memo) { 029 this.memo = memo; 030 } 031 032 /** 033 * {@inheritDoc} 034 */ 035 @Override 036 public void initContext(Object context) { 037 if (context instanceof Mx1SystemConnectionMemo) { 038 try { 039 initComponents((Mx1SystemConnectionMemo) context); 040 } catch (Exception e) { 041 log.error("Unable to initialize panel", e); 042 } 043 } 044 } 045 046 private final static Logger log = LoggerFactory.getLogger(Mx1Panel.class); 047}