
package de.ivu.elect.presentation.verteilung.form;

import java.io.Serializable;

import javax.enterprise.event.Observes;
import javax.enterprise.event.Reception;
import javax.inject.Inject;

import org.apache.deltaspike.core.api.scope.ConversationGroup;
import org.apache.deltaspike.core.api.scope.GroupedConversation;
import org.apache.deltaspike.core.api.scope.GroupedConversationScoped;

import de.ivu.elect.business.wahl.boundary.WahlSelectChangeEvent;

@GroupedConversationScoped
@ConversationGroup(VerteilungBerechnenViewFormBuilderStore.class)
public class VerteilungBerechnenViewFormBuilderStore implements Serializable {

  private static final long serialVersionUID = 1L;

  @Inject
  private transient GroupedConversation conversation;

  private AbstractVerteilungBerechnenViewFormBuilder viewFormBuilder;

  public VerteilungBerechnenViewFormBuilderStore() {
    super();
  }

  public AbstractVerteilungBerechnenViewFormBuilder getViewFormBuilder() {
    return viewFormBuilder;
  }

  public void setViewFormBuilder(AbstractVerteilungBerechnenViewFormBuilder viewFormBuilder) {
    this.viewFormBuilder = viewFormBuilder;
  }

  public void close() {
    conversation.close();
  }

  public void onWahlSelectChangeEvent(@Observes(notifyObserver = Reception.IF_EXISTS) WahlSelectChangeEvent event) {
    close();
  }
}
