((IEventSource<EntityPropertyChangedEvent<IActuator>>) actuatorListener
.getDevice()).removeListener(actuatorListener);
}
if (this.config instanceof IConfig1D) {
IConfig1D config1D = (IConfig1D) this.config;
IDimension dimension = config1D.getDimensionX();
if (dimension != null) {
((IEventSource<EntityPropertyChangedEvent<? extends IDimension>>) dimensionListener
.getDimension()).removeListener(dimensionListener);
}
}
else if (this.config instanceof IConfig2D) {
IConfig2D config2D = (IConfig2D) this.config;
IDimension dimension;
if (this.yActuator) {
dimension = config2D.getDimensionY();
}
else {
dimension = config2D.getDimensionX();
}
if (dimension != null) {
((IEventSource<EntityPropertyChangedEvent<? extends IDimension>>) dimensionListener
.getDimension()).removeListener(dimensionListener);
}
}
else if (this.config instanceof IConfigEnergy) {
IConfigEnergy configEnergy = (IConfigEnergy) this.config;
IDimension dimension = configEnergy.getDimensionX();
if (dimension != null) {
((IEventSource<EntityPropertyChangedEvent<? extends IDimension>>) dimensionListener
.getDimension()).removeListener(dimensionListener);
}
}
}
this.config = config;
deviceListenersList.clear();
if (config != null) {
((IEventSource<EntityPropertyChangedEvent<IConfig<?>>>) this.config)
.addListener(configListener);
if (config instanceof IConfig1D) {
IConfig1D config1D = (IConfig1D) config;
this.setViewVisible(true);
deviceList = config1D.getDimensionX().getActuatorsList();
IDimension dimension = config1D.getDimensionX();
if (dimension != null) {
dimensionListener = new DimensionListener(dimension);
((IEventSource<EntityPropertyChangedEvent<? extends IDimension>>) dimension)
.addListener(dimensionListener);
}