package org.jboss.as.console.client.shared.runtime.logviewer;
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 LogStoreAdapter {
private final LogStore delegate;
@Inject
public LogStoreAdapter(final LogStore delegate, final Dispatcher dispatcher) {
this.delegate = delegate;
dispatcher.register(LogStore.class, new StoreCallback() {
@Override
public Agreement voteFor(final Action action) {
if (action instanceof org.jboss.as.console.client.shared.runtime.logviewer.actions.ReadLogFiles) {
return new Agreement(true);
}
else if (action instanceof org.jboss.as.console.client.shared.runtime.logviewer.actions.OpenLogFile) {
return new Agreement(true);
}
else if (action instanceof org.jboss.as.console.client.shared.runtime.logviewer.actions.CloseLogFile) {
return new Agreement(true);
}
else if (action instanceof org.jboss.as.console.client.shared.runtime.logviewer.actions.SelectLogFile) {
return new Agreement(true);
}
else if (action instanceof org.jboss.as.console.client.shared.runtime.logviewer.actions.NavigateInLogFile) {
return new Agreement(true);
}
else if (action instanceof org.jboss.as.console.client.shared.runtime.logviewer.actions.ChangePageSize) {
return new Agreement(true);
}
else if (action instanceof org.jboss.as.console.client.shared.runtime.logviewer.actions.FollowLogFile) {
return new Agreement(true);
}
else if (action instanceof org.jboss.as.console.client.shared.runtime.logviewer.actions.PauseFollowLogFile) {
return new Agreement(true);
}
else if (action instanceof org.jboss.as.console.client.shared.runtime.logviewer.actions.UnFollowLogFile) {
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.runtime.logviewer.actions.ReadLogFiles) {
delegate.readLogFiles(channel);
}
else if (action instanceof org.jboss.as.console.client.shared.runtime.logviewer.actions.OpenLogFile) {
delegate.openLogFile(((org.jboss.as.console.client.shared.runtime.logviewer.actions.OpenLogFile)action).getName(), channel);
}
else if (action instanceof org.jboss.as.console.client.shared.runtime.logviewer.actions.CloseLogFile) {
delegate.closeLogFile(((org.jboss.as.console.client.shared.runtime.logviewer.actions.CloseLogFile)action).getName(), channel);
}
else if (action instanceof org.jboss.as.console.client.shared.runtime.logviewer.actions.SelectLogFile) {
delegate.selectLogFile(((org.jboss.as.console.client.shared.runtime.logviewer.actions.SelectLogFile)action).getName(), channel);
}
else if (action instanceof org.jboss.as.console.client.shared.runtime.logviewer.actions.NavigateInLogFile) {
delegate.navigate(((org.jboss.as.console.client.shared.runtime.logviewer.actions.NavigateInLogFile)action).getDirection(), channel);
}
else if (action instanceof org.jboss.as.console.client.shared.runtime.logviewer.actions.ChangePageSize) {
delegate.changePageSize(((org.jboss.as.console.client.shared.runtime.logviewer.actions.ChangePageSize)action).getPageSize(), channel);
}
else if (action instanceof org.jboss.as.console.client.shared.runtime.logviewer.actions.FollowLogFile) {
delegate.follow(channel);
}
else if (action instanceof org.jboss.as.console.client.shared.runtime.logviewer.actions.PauseFollowLogFile) {
delegate.pauseFollow(channel);
}
else if (action instanceof org.jboss.as.console.client.shared.runtime.logviewer.actions.UnFollowLogFile) {
delegate.unFollow(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);
}
}
});
}
}