1   
2   
3   
4   
5   
6   
7   
8   
9   
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  package com.hack23.cia.web.impl.ui.page.user;
20  
21  import java.awt.geom.Point2D;
22  
23  import org.vaadin.hezamu.googlemapwidget.GoogleMap;
24  import org.vaadin.hezamu.googlemapwidget.GoogleMap.MapControl;
25  import org.vaadin.navigator7.ParamPageLink;
26  
27  import com.hack23.cia.model.internal.application.data.impl.AggregatedCountryData;
28  import com.hack23.cia.web.impl.ui.common.ApplicationUserStateHolder;
29  import com.hack23.cia.web.impl.ui.page.common.panel.AbstractPanel;
30  import com.vaadin.Application;
31  import com.vaadin.ui.GridLayout;
32  import com.vaadin.ui.Label;
33  
34  
35  
36  
37  public final class AggregatedCountryDataPanel extends AbstractPanel {
38  
39  	
40  	private GridLayout grid = null;
41  
42  	
43  	private static final long serialVersionUID = 1L;
44  
45  	
46  
47  
48  	public AggregatedCountryDataPanel() {
49  		super();
50  	}
51  
52  	
53  
54  
55  
56  
57  
58  	public void update(final AggregatedCountryData countryData) {
59  		grid =new GridLayout(2,20);
60  		setContent(grid);
61  		grid.setSizeFull();
62  		grid.setSpacing(true);
63  		grid.setMargin(true);
64  
65  		grid.addComponent( new ParamPageLink(countryData.getCountry().getName(), CountryPage.class,countryData.getCountry().getName(),countryData.getCountry().getIso2Code()),0,0,1,0);
66  		grid.addComponent(new Label(translateFromEnglish("Capital city") +":" + countryData.getCountry().getCapitalCity()),0,1,1,1);
67  		grid.addComponent(new Label(translateFromEnglish("Region") + ":" + countryData.getCountry().getRegion().getValue().toString()),0,2,1,2);
68  		grid.addComponent(new Label(translateFromEnglish("Income Level") +":" +countryData.getCountry().getIncomeLevel().getValue().toString()),0,3,1,3);
69  		grid.addComponent(new Label(translateFromEnglish("Lending type") + ":" +countryData.getCountry().getLendingType().getValue().toString()),0,4,1,4);
70  
71  		final GoogleMap googleMap = new GoogleMap((Application) ApplicationUserStateHolder.getUserState(), new Point2D.Double(Double.parseDouble(countryData.getCountry().getLongitude()),Double.parseDouble(countryData.getCountry().getLatitude())), 8,"ABQIAAAAagA4tNdqcS8SXcZ_cgTm_RQivw8bcKxPPx7tIHHiFwHV7JsBShRkP80wfGiF4WJMBTHoFKIMAx_ohg");
72  		grid.addComponent(googleMap,0,5,1,19);
73  		googleMap.addControl(MapControl.MenuMapTypeControl);
74  
75  		googleMap.setSizeFull();
76  		setCaption(countryData.getCountry().getName());
77  	}
78  
79  }