if (config instanceof IConfig2D && this.yActuator) {
// For 2D config there is the YDimension to add
IConfig2D config2D = (IConfig2D) this.config;
this.setViewVisible(true);
deviceList = config2D.getDimensionY().getActuatorsList();
IDimension dimensionY = config2D.getDimensionY();
if (dimensionY != null) {
((IEventSource<EntityPropertyChangedEvent<? extends IDimension>>) dimensionListenerY
.getDimension()).removeListener(dimensionListenerY);
}
}
else {
this.setViewVisible(true);
IDimension dimension = config.getDimensionX();
if (dimension != null) {
((IEventSource<EntityPropertyChangedEvent<? extends IDimension>>) dimensionListener
.getDimension()).removeListener(dimensionListener);
}
}
}
this.config = aconfig;
deviceListenersList.clear();
if (config != null) {
((IEventSource<EntityPropertyChangedEvent<IConfig<?>>>) this.config)
.addListener(configListener);
// All type of config have an X dimension
if (config instanceof IConfig2D && this.yActuator) {
// For 2D config there is the YDimension to add
IConfig2D config2D = (IConfig2D) config;
this.setViewVisible(true);
deviceList = config2D.getDimensionY().getActuatorsList();
IDimension dimensionY = config2D.getDimensionY();
if (dimensionY != null) {
dimensionListenerY = new DimensionListener(dimensionY);
((IEventSource<EntityPropertyChangedEvent<? extends IDimension>>) dimensionY)
.addListener(dimensionListenerY);
}
}
else {
this.setViewVisible(true);
IDimension dimension = config.getDimensionX();
if (dimension != null) {
deviceList = dimension.getActuatorsList();
dimensionListener = new DimensionListener(dimension);
((IEventSource<EntityPropertyChangedEvent<? extends IDimension>>) dimension)
.addListener(dimensionListener);
}
}