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