.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);
}
}
else if (config instanceof IConfig2D) {
IConfig2D config2D = (IConfig2D) config;
if (this.yActuator) { // Case of Y Actuator.
this.setViewVisible(true);
deviceList = config2D.getDimensionY().getActuatorsList();
IDimension dimension = config2D.getDimensionY();
if (dimension != null) {
dimensionListener = new DimensionListener(dimension);
((IEventSource<EntityPropertyChangedEvent<? extends IDimension>>) dimension)
.addListener(dimensionListener);
}
}
else { // Case of X Actuator.
this.setViewVisible(true);
deviceList = config2D.getDimensionX().getActuatorsList();
IDimension dimension = config2D.getDimensionX();
if (dimension != null) {
dimensionListener = new DimensionListener(dimension);
((IEventSource<EntityPropertyChangedEvent<? extends IDimension>>) dimension)
.addListener(dimensionListener);
}