Package sk.vrto.web.views.providers

Source Code of sk.vrto.web.views.providers.ContactViewProvider

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;
    }

}
TOP

Related Classes of sk.vrto.web.views.providers.ContactViewProvider

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.