use of jmri.NamedBeanHandleManager in project JMRI by JMRI.
the class ConsistControllerTest method setUp.
@Override
public void setUp() throws Exception {
super.setUp();
apps.tests.Log4JFixture.setUp();
InstanceManager.setDefault(ConsistManager.class, new TestConsistManager());
InstanceManager.setDefault(NamedBeanHandleManager.class, new NamedBeanHandleManager());
}
use of jmri.NamedBeanHandleManager in project JMRI by JMRI.
the class MultiThrottleTest method setUp.
@Override
public void setUp() throws Exception {
super.setUp();
apps.tests.Log4JFixture.setUp();
JUnitUtil.resetInstanceManager();
InstanceManager.setDefault(NamedBeanHandleManager.class, new NamedBeanHandleManager());
}
use of jmri.NamedBeanHandleManager in project JMRI by JMRI.
the class RouteControllerTest method setUp.
@Override
public void setUp() throws Exception {
super.setUp();
apps.tests.Log4JFixture.setUp();
JUnitUtil.resetInstanceManager();
InstanceManager.setDefault(NamedBeanHandleManager.class, new NamedBeanHandleManager());
}
use of jmri.NamedBeanHandleManager in project JMRI by JMRI.
the class WiThrottleManagerTest method setUp.
@Override
public void setUp() throws Exception {
super.setUp();
apps.tests.Log4JFixture.setUp();
JUnitUtil.resetInstanceManager();
InstanceManager.setDefault(NamedBeanHandleManager.class, new NamedBeanHandleManager());
}
use of jmri.NamedBeanHandleManager in project JMRI by JMRI.
the class PositionableShape method setControlSensor.
/**
* Attach a named sensor to shape
*
* @param pName Used as a system/user name to lookup the sensor object
* @param hide true if sensor should be hidden
* @param level level at which sensor is placed
* @return error message, if any
*/
public String setControlSensor(String pName, boolean hide, int level) {
String msg = null;
if (pName == null || pName.trim().isEmpty()) {
setControlSensorHandle(null);
return null;
}
NamedBeanHandle<Sensor> senHandle = null;
_saveLevel = super.getDisplayLevel();
Optional<SensorManager> sensorManager = InstanceManager.getOptionalDefault(SensorManager.class);
if (sensorManager.isPresent()) {
Sensor sensor = sensorManager.get().getSensor(pName);
Optional<NamedBeanHandleManager> nbhm = InstanceManager.getOptionalDefault(NamedBeanHandleManager.class);
if (sensor != null) {
if (nbhm.isPresent()) {
senHandle = nbhm.get().getNamedBeanHandle(pName, sensor);
}
_doHide = hide;
_changeLevel = level;
if (_changeLevel <= 0) {
_changeLevel = super.getDisplayLevel();
}
} else {
// NOI18N
msg = Bundle.getMessage("badSensorName", pName);
}
} else {
// NOI18N
msg = Bundle.getMessage("NoSensorManager");
}
if (msg != null) {
log.warn("{} for {} sensor", msg, Bundle.getMessage("VisibleSensor"));
}
setControlSensorHandle(senHandle);
return msg;
}
Aggregations