
package com.sii.rental.ui.views;

import javax.annotation.PostConstruct;

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.e4.ui.di.Focus;

public class RentalPart {

	private Label rentedObjectLabel, customerNameLabel;

	@PostConstruct
	public void createUi(Composite parent) {
		parent.setLayout(new GridLayout(1, false));
		
		Group infoGroup = new Group(parent, SWT.NONE);
		infoGroup.setText("Information");
		infoGroup.setLayout(new GridLayout(2, false));
		
		rentedObjectLabel = new Label(infoGroup, SWT.BORDER);
		GridData gd = new GridData();
		gd.horizontalSpan = 2;
		gd.horizontalAlignment = SWT.FILL;
		rentedObjectLabel.setLayoutData(gd);
		rentedObjectLabel.setText("Perceuse Electrique");
		
		customerNameLabel = new Label(infoGroup, SWT.BORDER);
		GridData gdName = new GridData();
		gdName.horizontalSpan = 2;
		gdName.horizontalAlignment = SWT.FILL;
		customerNameLabel.setLayoutData(gdName);
		customerNameLabel.setText("Lou  : John Wayne");
	}

	@Focus
	public void onFocus() {
		rentedObjectLabel.setFocus();
	}

}
@@ -96,15 +96,22 @@
 pse.
-swt.SWT
+e4.ui.di.Focus
 ;%0D%0Ai
@@ -120,35 +120,37 @@
 ort org.eclipse.
-swt
+jface
 .layout.GridData
@@ -145,20 +145,58 @@
 out.Grid
-Data
+LayoutFactory;%0D%0Aimport org.eclipse.swt.SWT
 ;%0D%0Aimpor
@@ -224,22 +224,20 @@
 out.Grid
-Layout
+Data
 ;%0D%0Aimpor
@@ -356,41 +356,101 @@
 l;%0D%0A
+%0D%0A
 import 
-org.eclipse.e4.ui.di.Focus
+com.opcoach.training.rental.Rental;%0D%0Aimport com.sii.rental.ecore.RentalCoreActivator
 ;%0D%0A%0D
@@ -535,16 +535,252 @@
 bel;%0D%0A%0D%0A
+%09public void setRental(Rental rental) %7B%0D%0A%09%09rentedObjectLabel.setText(rental.getRentedObject().getName());%0D%0A%09%09customerNameLabel.setText(%22Lou  : %22 + rental.getCustomer().getLastName() + %22 %22 + rental.getCustomer().getFirstName());%0D%0A%09%7D%0D%0A%09%0D%0A
 %09@PostCo
@@ -842,36 +842,32 @@
 arent.setLayout(
-new 
 GridLayout(1, fa
@@ -864,17 +864,94 @@
 yout
-(1, false
+Factory%0D%0A%09%09%09%09.fillDefaults()%0D%0A%09%09%09%09.numColumns(1)%0D%0A%09%09%09%09.equalWidth(false)%0D%0A%09%09%09%09.create(
 ));%0D
@@ -1064,20 +1064,16 @@
 tLayout(
-new 
 GridLayo
@@ -1078,17 +1078,94 @@
 yout
-(2, false
+Factory%0D%0A%09%09%09%09.fillDefaults()%0D%0A%09%09%09%09.numColumns(2)%0D%0A%09%09%09%09.equalWidth(false)%0D%0A%09%09%09%09.create(
 ));%0D
@@ -1361,24 +1361,26 @@
 ata(gd);%0D%0A%09%09
+//
 rentedObject
@@ -1630,24 +1630,26 @@
 gdName);%0D%0A%09%09
+//
 customerName
@@ -1681,24 +1681,95 @@
 n Wayne%22);%0D%0A
+%09%09%0D%0A%09%09setRental(RentalCoreActivator.getAgency().getRentals().get(0));%0D%0A
 %09%7D%0D%0A%0D%0A%09@Focu

Add setRental in RentalPart.java