Search in sources :

Example 6 with BlockManager

use of jmri.BlockManager in project JMRI by JMRI.

the class ManageLocationsFrame method saveTableValues.

@SuppressFBWarnings(value = "WMI_WRONG_MAP_ITERATOR", justification = "only in slow debug")
private void saveTableValues() {
    if ((Boolean) locModel.getValueAt(0, 1)) {
        listenerLoc.setLocation((Double) locModel.getValueAt(0, 2), (Double) locModel.getValueAt(0, 3), (Double) locModel.getValueAt(0, 4));
        listenerLoc.setOrientation((Double) locModel.getValueAt(0, 5), (Double) locModel.getValueAt(0, 6));
        VSDecoderManager.instance().getVSDecoderPreferences().setListenerPosition(listenerLoc);
    }
    HashMap<String, PhysicalLocation> data = reporterModel.getDataMap();
    ReporterManager mgr = jmri.InstanceManager.getDefault(jmri.ReporterManager.class);
    for (String s : data.keySet()) {
        log.debug("Reporter: " + s + " Location: " + data.get(s));
        Reporter r = mgr.getByDisplayName(s);
        PhysicalLocation.setBeanPhysicalLocation(data.get(s), r);
    }
    data = blockModel.getDataMap();
    BlockManager bmgr = jmri.InstanceManager.getDefault(jmri.BlockManager.class);
    for (String s : data.keySet()) {
        log.debug("Block: " + s + " Location: " + data.get(s));
        Block b = bmgr.getByDisplayName(s);
        PhysicalLocation.setBeanPhysicalLocation(data.get(s), b);
    }
    data = opsModel.getDataMap();
    LocationManager lmgr = LocationManager.instance();
    for (String s : data.keySet()) {
        log.debug("OpsLocation: " + s + " Location: " + data.get(s));
        Location l = lmgr.getLocationByName(s);
        l.setPhysicalLocation(data.get(s));
    }
}
Also used : LocationManager(jmri.jmrit.operations.locations.LocationManager) ReporterManager(jmri.ReporterManager) BlockManager(jmri.BlockManager) Reporter(jmri.Reporter) Block(jmri.Block) PhysicalLocation(jmri.util.PhysicalLocation) Location(jmri.jmrit.operations.locations.Location) PhysicalLocation(jmri.util.PhysicalLocation) SuppressFBWarnings(edu.umd.cs.findbugs.annotations.SuppressFBWarnings)

Aggregations

BlockManager (jmri.BlockManager)6 Block (jmri.Block)5 Reporter (jmri.Reporter)3 ReporterManager (jmri.ReporterManager)2 Location (jmri.jmrit.operations.locations.Location)2 LocationManager (jmri.jmrit.operations.locations.LocationManager)2 PhysicalLocation (jmri.util.PhysicalLocation)2 Element (org.jdom2.Element)2 SuppressFBWarnings (edu.umd.cs.findbugs.annotations.SuppressFBWarnings)1 ArrayList (java.util.ArrayList)1 JButton (javax.swing.JButton)1 JDialog (javax.swing.JDialog)1 Path (jmri.Path)1 PhysicalLocationReporter (jmri.PhysicalLocationReporter)1 MouseEventData (junit.extensions.jfcunit.eventdata.MouseEventData)1 AbstractButtonFinder (junit.extensions.jfcunit.finder.AbstractButtonFinder)1 DialogFinder (junit.extensions.jfcunit.finder.DialogFinder)1