Package org.jboss.as.console.client.shared.model

Source Code of org.jboss.as.console.client.shared.model.PerspectiveStoreAdapter

package org.jboss.as.console.client.shared.model;

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

    private final PerspectiveStore delegate;

    @Inject
    public PerspectiveStoreAdapter(final PerspectiveStore delegate, final Dispatcher dispatcher) {
        this.delegate = delegate;

        dispatcher.register(PerspectiveStore.class, new StoreCallback() {
            @Override
            public Agreement voteFor(final Action action) {
                if (action instanceof org.jboss.as.console.client.shared.model.SelectPerspective) {
                    return new Agreement(true);
                }
                else {
                    return Agreement.NONE;
                }
            }

            @Override
            public void complete(final Action action, final Dispatcher.Channel channel) {
                if (action instanceof org.jboss.as.console.client.shared.model.SelectPerspective) {
                    delegate.onLoadProfile(((org.jboss.as.console.client.shared.model.SelectPerspective)action).getParent(), ((org.jboss.as.console.client.shared.model.SelectPerspective)action).getChild(), channel);
                }
                else {
                    channel.nack("Warning: Unmatched action type " + action.getClass().getName() + " in store " + delegate.getClass());
                }
            }

            @Override
            public void signalChange(final Action action) {
                for (Handler handler : delegate.getActionHandler(action)) {
                    handler.onChange(action);
                }
                for (Handler handler : delegate.getActionHandler(action.getClass())) {
                    handler.onChange(action);
                }
                for (Handler handler : delegate.getActionHandler()) {
                    handler.onChange(action);
                }
            }
        });
    }
}
TOP

Related Classes of org.jboss.as.console.client.shared.model.PerspectiveStoreAdapter

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.