use of de.prob.animator.command.StartAnimationCommand in project prob2 by bendisposto.
the class StateSpaceProvider method loadFromCommand.
public StateSpace loadFromCommand(final AbstractModel model, final AbstractElement mainComponent, final Map<String, String> preferences, final AbstractCommand loadCmd) {
StateSpace s = ssProvider.get();
s.setModel(model, mainComponent);
List<AbstractCommand> cmds = new ArrayList<>();
for (Entry<String, String> pref : preferences.entrySet()) {
cmds.add(new SetPreferenceCommand(pref.getKey(), pref.getValue()));
}
try {
s.execute(new ComposedCommand(cmds));
s.execute(loadCmd);
s.execute(new StartAnimationCommand());
} catch (Exception e) {
s.kill();
throw e;
}
return s;
}
Aggregations