/***
 * Excerpted from "Domain-Driven Design Using Naked Objects",
 * published by The Pragmatic Bookshelf.
 * Copyrights apply to this code. It may not be used to create training material, 
 * courses, books, articles, and the like. Contact us if you are in doubt.
 * We make no guarantees that this code is fit for any purpose. 
 * Visit http://www.pragmaticprogrammer.com/titles/dhnako for more book information.
***/
package com.pragprog.dhnako.carserv.wicket.ui;

import org.apache.wicket.markup.html.basic.Label;

import com.pragprog.dhnako.carserv.dom.customer.Customer;

public class EditCustomerPanel extends NakedObjectsPanel {
	
	private static final long serialVersionUID = 1L;

	public EditCustomerPanel(final String id, final Customer customer) {
		super(id);
		
		addCustomerNameLabel(customer);
		addForm(customer);
	}

	private void addCustomerNameLabel(final Customer customer) {
		add(new Label("customerName", customer.title()));
	}

	private void addForm(final Customer customer) {
		EditCustomerForm form = new EditCustomerFormUsingViewObjects("editCustomerForm", getContainer(), customer);
		//EditCustomerForm form = new EditCustomerFormUsingViewObjectsExtended("editCustomerForm", getContainer(), customer);
		add(form);
		form.init();
	}

}
