package com.sogeti.rental.ui;


import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.ui.part.ViewPart;

import com.opcoach.training.rental.Rental;
import com.sogeti.rental.core.RentalActivator;

public class RentalPropertyView extends ViewPart {
	
	private Label rentedObjectLabel;

	public RentalPropertyView() {
		// TODO Auto-generated constructor stub
	}

	@Override
	public void createPartControl(Composite parent) {
		parent.setLayout(new GridLayout(1, false));
		
		Group infoGroup = new Group(parent, SWT.NONE);
		infoGroup.setText("Informations");
		infoGroup.setLayout(new GridLayout(2, false));
		
		rentedObjectLabel = new Label(infoGroup, SWT.BORDER);
		GridData gd = new GridData();
		gd.horizontalSpan = 2;
		gd.horizontalAlignment = SWT.DM_FILL_BACKGROUND;
		rentedObjectLabel.setLayoutData(gd);
		
	
		setRental(RentalActivator.getAgency().getRentals().get(0));
	}

	@Override
	public void setFocus() {
		// TODO Auto-generated method stub

	}

	private void setRental(Rental r) {
		rentedObjectLabel.setText(r.getRentedObject().getName());
	}
	
}

@@ -258,24 +258,62 @@
 ets.Label;%0D%0A
+import org.eclipse.swt.widgets.Text;%0D%0A
 import org.e
@@ -526,16 +526,45 @@
 bel;%0D%0A%0D%0A
+%09private Label whoLabel;%0D%0A%09%0D%0A
 %09public 
@@ -1106,16 +1106,147 @@
 ;%0D%0A%09%09%0D%0A%09
+%09Text whoText = new Text(infoGroup, SWT.BORDER);%0D%0A%09%09whoText.setText(%22Lou :%22);%0D%0A%09%09whoLabel = new Label(infoGroup, SWT.BORDER);%0D%0A%0D%0A%09%09
 %0D%0A%09%09setR
@@ -1298,24 +1298,89 @@
 ).get(0));%0D%0A
+%09%09setCustomer(RentalActivator.getAgency().getRentals().get(0));%0D%0A
 %09%7D%0D%0A%0D%0A%09@Over
@@ -1563,11 +1563,148 @@
 %0A%09%7D%0D%0A%09%0D%0A
+%09private void setCustomer(Rental r) %7B%0D%0A%09%09whoLabel.setText(r.getCustomer().getFirstName() + %22 %22 + r.getCustomer().getLastName());%0D%0A%09%7D%0D%0A%09%0D%0A
 %7D%0D%0A

Add the informations on Label/Text