package org.jboss.gwt.circuit.sample.wardrobe.stores;
import javax.annotation.Generated;
import javax.enterprise.context.ApplicationScoped;
import javax.inject.Inject;
import org.jboss.gwt.circuit.Action;
import org.jboss.gwt.circuit.Agreement;
import org.jboss.gwt.circuit.Dispatcher;
import org.jboss.gwt.circuit.PropagatesChange.Handler;
import org.jboss.gwt.circuit.StoreCallback;
/*
* WARNING! This class is generated. Do not modify.
*/
@ApplicationScoped
@Generated("org.jboss.gwt.circuit.processor.StoreProcessor")
public class ShoesStoreAdapter {
private final ShoesStore delegate;
@Inject
public ShoesStoreAdapter(final ShoesStore delegate, final Dispatcher dispatcher) {
this.delegate = delegate;
dispatcher.register(ShoesStore.class, new StoreCallback() {
@Override
public Agreement voteFor(final Action action) {
if (action instanceof org.jboss.gwt.circuit.sample.wardrobe.actions.Dress) {
return new Agreement(true, org.jboss.gwt.circuit.sample.wardrobe.stores.SocksStore.class, org.jboss.gwt.circuit.sample.wardrobe.stores.TrousersStore.class);
}
else if (action instanceof org.jboss.gwt.circuit.sample.wardrobe.actions.Undress) {
return new Agreement(true);
}
else {
return Agreement.NONE;
}
}
@Override
public void complete(final Action action, final Dispatcher.Channel channel) {
if (action instanceof org.jboss.gwt.circuit.sample.wardrobe.actions.Dress) {
delegate.dress(channel);
}
else if (action instanceof org.jboss.gwt.circuit.sample.wardrobe.actions.Undress) {
delegate.undress(channel);
}
else {
System.out.println("WARN: Unmatched action " + action.getClass().getName() + " in store " + delegate.getClass());
channel.ack();
}
}
@Override
public void signalChange(final Action action) {
System.out.println("WARN: Cannot signal change event: " + ShoesStore.class.getName() + " does not extend " + org.jboss.gwt.circuit.ChangeSupport.class.getName());
}
});
}
}