package devopsdistilled.operp.client.commons.panes.controllers.impl;

import javax.inject.Inject;
import javax.swing.JPanel;

import devopsdistilled.operp.client.commons.panes.CreateContactInfoPane;
import devopsdistilled.operp.client.commons.panes.controllers.CreateAddressPaneController;
import devopsdistilled.operp.client.commons.panes.controllers.CreateContactInfoPaneController;
import devopsdistilled.operp.client.commons.panes.models.CreateContactInfoPaneModel;
import devopsdistilled.operp.client.exceptions.EntityValidationException;
import devopsdistilled.operp.server.data.entity.commons.ContactInfo;

public class CreateContactInfoPaneControllerImpl implements
		CreateContactInfoPaneController {

	@Inject
	private CreateContactInfoPane view;

	@Inject
	private CreateContactInfoPaneModel model;

	@Inject
	private CreateAddressPaneController createAddressPaneController;

	@Override
	public void validate(ContactInfo entity) throws EntityValidationException {
		// TODO Auto-generated method stub

	}

	@Override
	public ContactInfo save(ContactInfo entity) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public CreateContactInfoPaneModel getModel() {
		return model;
	}

	@Override
	public void init() {

		createAddressPaneController.init();
		
		// Setting controller is required
		// if Bean scope set to Prototype
		createAddressPaneController.getView().setController(
				createAddressPaneController);
		view.setAddressPanel((JPanel) createAddressPaneController.getView()
				.getPane());
		// view.init();
		model.registerObserver(view);
	}

	@Override
	public CreateContactInfoPane getView() {
		return view;
	}

}

@@ -1240,38 +1240,17 @@
 ) %7B%0A
-%0A
 %09%09
-createAddressPaneController
+// view
 .ini
@@ -1258,172 +1258,76 @@
 ();%0A
-%09%09
 %0A%09%09
-// Setting controller is required%0A%09%09// if Bean scope set to Prototype%0A%09%09createAddressPaneController.getView().setController(%0A%09%09%09%09createAddressPaneController
+view.setController(this);%0A%09%09createAddressPaneController.init(
 );%0A
+%0A
 %09%09vi
@@ -1409,34 +1409,16 @@
 ane());%0A
-%09%09// view.init();%0A
 %09%09model.

Set Controller in view and refactor init()