Search in sources :

Example 1 with EcosSystemConnectionMemo

use of jmri.jmrix.ecos.EcosSystemConnectionMemo in project JMRI by JMRI.

the class EcosLocoTableTabAction method createModel.

@Override
protected void createModel() {
    dataPanel = new JPanel();
    dataTabs = new JTabbedPane();
    dataPanel.setLayout(new BorderLayout());
    java.util.List<EcosSystemConnectionMemo> list = jmri.InstanceManager.getList(EcosSystemConnectionMemo.class);
    if (list != null) {
        for (EcosSystemConnectionMemo eMemo : list) {
            //We only want to add connections that have an active loco address manager
            if (eMemo.getLocoAddressManager() != null) {
                TabbedTableItem itemModel = new TabbedTableItem(eMemo.getUserName(), true, eMemo.getLocoAddressManager(), getNewTableAction(eMemo.getUserName(), eMemo));
                tabbedTableArray.add(itemModel);
            }
        }
    }
    if (tabbedTableArray.size() == 1) {
        EcosLocoTableAction table = (EcosLocoTableAction) tabbedTableArray.get(0).getAAClass();
        table.addToPanel(this);
        dataPanel.add(tabbedTableArray.get(0).getPanel(), BorderLayout.CENTER);
    } else {
        for (int x = 0; x < tabbedTableArray.size(); x++) {
            EcosLocoTableAction table = (EcosLocoTableAction) tabbedTableArray.get(x).getAAClass();
            table.addToPanel(this);
            dataTabs.addTab(tabbedTableArray.get(x).getItemString(), null, tabbedTableArray.get(x).getPanel(), null);
        }
        dataTabs.addChangeListener(new ChangeListener() {

            @Override
            public void stateChanged(ChangeEvent evt) {
                setMenuBar(f);
            }
        });
        dataPanel.add(dataTabs, BorderLayout.CENTER);
    }
    init = true;
}
Also used : JPanel(javax.swing.JPanel) BorderLayout(java.awt.BorderLayout) ChangeEvent(javax.swing.event.ChangeEvent) EcosSystemConnectionMemo(jmri.jmrix.ecos.EcosSystemConnectionMemo) JTabbedPane(javax.swing.JTabbedPane) ChangeListener(javax.swing.event.ChangeListener)

Example 2 with EcosSystemConnectionMemo

use of jmri.jmrix.ecos.EcosSystemConnectionMemo in project JMRI by JMRI.

the class EcosLocoToRosterTest method testCTor.

@Test
public void testCTor() {
    EcosTrafficController tc = new EcosInterfaceScaffold();
    EcosSystemConnectionMemo memo = new EcosSystemConnectionMemo(tc);
    EcosLocoToRoster t = new EcosLocoToRoster(memo);
    Assert.assertNotNull("exists", t);
}
Also used : EcosSystemConnectionMemo(jmri.jmrix.ecos.EcosSystemConnectionMemo) EcosTrafficController(jmri.jmrix.ecos.EcosTrafficController) EcosInterfaceScaffold(jmri.jmrix.ecos.EcosInterfaceScaffold) Test(org.junit.Test)

Aggregations

EcosSystemConnectionMemo (jmri.jmrix.ecos.EcosSystemConnectionMemo)2 BorderLayout (java.awt.BorderLayout)1 JPanel (javax.swing.JPanel)1 JTabbedPane (javax.swing.JTabbedPane)1 ChangeEvent (javax.swing.event.ChangeEvent)1 ChangeListener (javax.swing.event.ChangeListener)1 EcosInterfaceScaffold (jmri.jmrix.ecos.EcosInterfaceScaffold)1 EcosTrafficController (jmri.jmrix.ecos.EcosTrafficController)1 Test (org.junit.Test)1