Commit a572c9d6 authored by Nico Mack's avatar Nico Mack

Moved handling of FadingCoronas into StatefulWidget

parent 124c3abf
......@@ -24,6 +24,7 @@ import lu.list.itis.dkd.dbc.annotation.NonNullByDefault;
import lu.list.itis.dkd.tui.adapter.TangibleObject;
import lu.list.itis.dkd.tui.utility.Point;
import lu.list.itis.dkd.tui.widget.builder.BaseStatefulBuilder;
import lu.list.itis.dkd.tui.widget.corona.FadingCorona;
import lu.list.itis.dkd.tui.widget.state.NuiState;
import lu.list.itis.dkd.tui.widget.state.StateManager;
......@@ -32,6 +33,7 @@ import com.google.common.base.Preconditions;
import java.util.Collection;
import java.util.Map.Entry;
import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Stream;
/**
* A widget implementation which adds a {@link NuiState} to the widget keeping track of state
......@@ -132,6 +134,13 @@ public class StatefulWidget extends BaseWidget {
Point position = getPosition(tangibleObject.getObjectId());
assert position != null;
manager.rotate(position).move(position);
boolean fadeIn = manager.isMoving() || manager.isRotating();
if (fadeIn) {
Stream<FadingCorona> autoFading = this.getCoronas(FadingCorona.class).stream().filter(corona -> corona.fadesWithHandle());
autoFading.forEach(corona -> corona.fadeIn());
}
}
// ---------------------------------------------------------------------------
......
......@@ -34,7 +34,6 @@ public abstract class BaseSelectableCoronaBuilder<B extends BaseSelectableCorona
/**
* specifies the unique index identifying the selectable corona among its peers.
*/
// public int index;
/**
* @param centre
......@@ -49,7 +48,6 @@ public abstract class BaseSelectableCoronaBuilder<B extends BaseSelectableCorona
*/
public BaseSelectableCoronaBuilder(Element rootElement) throws BuildException {
super(rootElement);
// this.buildFromBootstrap(rootElement, null, null);
}
/**
......@@ -60,29 +58,8 @@ public abstract class BaseSelectableCoronaBuilder<B extends BaseSelectableCorona
*/
public BaseSelectableCoronaBuilder(Element rootElement, BootstrapContext context, BootstrapCallback callback) throws BuildException {
super(rootElement, context, callback);
// this.buildFromBootstrap(rootElement, context, callback);
}
// private void buildFromBootstrap(@Nullable Element rootElement, BootstrapContext context,
// BootstrapCallback callback) throws BuildException {
// index = BootstrappingUtils.getContentAsInteger(rootElement, Externalization.INDEX_NODE,
// BootstrappingUtils.MANDATORY, 0, context);
// }
/**
* assigns the specified index as the unique identifier for the corona to build
*
* @param index
* specifies the unique identifier to assign to the corona to build
* @return instance of the builder object for chain calling.
*/
// @SuppressWarnings("unchecked")
// public B withIndex(int index) {
// this.index = index;
// return (B) this;
// }
/** {@inheritDoc} */
@Override
public abstract SelectableCorona build() throws BuildException;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment