001package jmri.jmrix.can.cbus.swing; 002 003import jmri.jmrix.can.CanSystemConnectionMemo; 004import jmri.jmrix.can.ConfigurationManager; 005 006/** 007 * Provide access to Swing components for the Cbus subsystem. 008 * 009 * @author Bob Jacobsen Copyright (C) 2010 010 * 011 * @since 2.99.2 012 */ 013public class CbusComponentFactory extends jmri.jmrix.swing.ComponentFactory { 014 015 public CbusComponentFactory(CanSystemConnectionMemo memo) { 016 this.memo = memo; 017 } 018 019 CanSystemConnectionMemo memo; 020 021 /** 022 * Provide a menu with all items attached to this system connection 023 */ 024 @Override 025 public javax.swing.JMenu getMenu() { 026 if (memo.getDisabled()) { 027 return null; 028 } 029 if (memo.getProtocol().equals(ConfigurationManager.SPROGCBUS)) { 030 return new SprogCbusMenu(memo); 031 } else { 032 return new CbusMenu(memo); 033 } 034 } 035 036}