package devopsdistilled.operp.client.business.sales.panes.controllers.impl;

import javax.inject.Inject;

import devopsdistilled.operp.client.abstracts.EntityOperation;
import devopsdistilled.operp.client.business.sales.panes.SalePane;
import devopsdistilled.operp.client.business.sales.panes.controllers.SalePaneController;
import devopsdistilled.operp.client.business.sales.panes.models.SalePaneModel;
import devopsdistilled.operp.client.exceptions.EntityValidationException;
import devopsdistilled.operp.server.data.entity.business.Sale;

public class SalePaneControllerImpl implements SalePaneController {

	@Inject
	private SalePaneModel model;

	@Inject
	private SalePane view;

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

	}

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

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

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

	@Override
	public void init(Sale sale, EntityOperation entityOperation) {
		// TODO Auto-generated method stub

		if (EntityOperation.Create == entityOperation) {

			// XXX

		} else if (EntityOperation.Edit == entityOperation) {

			// XXX

		} else if (EntityOperation.Details == entityOperation) {

			// XXX
		}

		view.setController(this);
		view.resetComponents();

		model.registerObserver(view);
		model.setEntityAndEntityOperation(sale, entityOperation);

		view.init();

	}

}

@@ -97,16 +97,43 @@
 .Inject;
+%0Aimport javax.swing.JPanel;
 %0A%0Aimport
@@ -256,16 +256,109 @@
 lePane;%0A
+import devopsdistilled.operp.client.business.sales.panes.controllers.SaleDescPaneController;%0A
 import d
@@ -653,16 +653,83 @@
 ss.Sale;
+%0Aimport devopsdistilled.operp.server.data.entity.business.SaleDesc;
 %0A%0Apublic
@@ -865,16 +865,82 @@
  view;%0A%0A
+%09@Inject%0A%09private SaleDescPaneController saleDescPaneController;%0A%0A
 %09@Overri
@@ -1417,34 +1417,163 @@
 peration) %7B%0A
-%0A%09%09%09// XXX
+%09%09%09SaleDesc saleDesc = new SaleDesc();%0A%09%09%09sale.setBusinessDesc(saleDesc);%0A%09%09%09saleDescPaneController.init(saleDesc, EntityOperation.Create);
 %0A%0A%09%09%7D else i
@@ -1705,16 +1705,99 @@
 XX%0A%09%09%7D%0A%0A
+%09%09view.setSaleDescpanel((JPanel) saleDescPaneController.getView()%0A%09%09%09%09.getPane());%0A
 %09%09view.s

Set sales description pane