((IEventSource<EntityPropertyChangedEvent<IActuator>>) actuatorListener
.getActuator()).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.getDimensionEnergy();
if (dimension != null) {
((IEventSource<EntityPropertyChangedEvent<? extends IDimension>>) dimensionListener
.getDimension()).removeListener(dimensionListener);
}
}
}
this.config = config;
actuatorListenersList.clear();
if (config != null) {
((IEventSource<EntityPropertyChangedEvent<IConfig>>) this.config)
.addListener(configListener);
if (config instanceof IConfig1D) {
IConfig1D config1D = (IConfig1D) config;
this.setViewVisible(true);
listActuator = config1D.getDimensionX().getActuatorsList();
IDimension dimension = config1D.getDimensionX();
if (dimension != null) {
dimensionListener = new DimensionListener(dimension);
((IEventSource<EntityPropertyChangedEvent<? extends IDimension>>) dimension)
.addListener(dimensionListener);
}