Package org.jboss.gwt.circuit.sample.wardrobe.stores

Source Code of org.jboss.gwt.circuit.sample.wardrobe.stores.CoatStoreAdapter

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 CoatStoreAdapter {

    private final CoatStore delegate;

    @Inject
    public CoatStoreAdapter(final CoatStore delegate, final Dispatcher dispatcher) {
        this.delegate = delegate;

        dispatcher.register(CoatStore.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.PulloverStore.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 {
                    channel.nack("Warning: Unmatched action type " + action.getClass().getName() + " in store " + delegate.getClass());
                }
            }

            @Override
            public void signalChange(final Action action) {
                System.out.println("WARN: Cannot signal change event: " + CoatStore.class.getName() + " does not extend " + org.jboss.gwt.circuit.ChangeSupport.class.getName());
            }
        });
    }
}
TOP

Related Classes of org.jboss.gwt.circuit.sample.wardrobe.stores.CoatStoreAdapter

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.