package sk.vrto.web.views.providers;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;
import sk.vrto.domain.Contact;
import sk.vrto.web.presenters.ContactPresenter;
import sk.vrto.web.views.ContactView;
@Component
public class ContactViewProvider implements ApplicationContextAware {
private ApplicationContext applicationContext;
public ContactView get(Contact contact) {
ContactView view = new ContactView(applicationContext.getBean(ContactPresenter.class));
view.setContact(contact);
view.init();
return view;
}
@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
this.applicationContext = applicationContext;
}
}