View Javadoc

1   /*
2    * Copyright 2010 James Pether Sörling
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *   http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   *
16   *	$Id: WorldBankIndicatorCountryPanel.java 5582 2012-01-04 20:03:13Z pether $
17   *  $HeadURL: https://cia.svn.sourceforge.net/svnroot/cia/trunk/citizen-intelligence-agency/src/main/java/com/hack23/cia/web/impl/ui/page/user/WorldBankIndicatorCountryPanel.java $
18   */
19  package com.hack23.cia.web.impl.ui.page.user;
20  
21  import org.vaadin.vaadinvisualizations.AnnotatedTimeLine;
22  
23  import com.hack23.cia.model.external.worldbank.indicators.impl.SourceName;
24  import com.hack23.cia.model.internal.application.data.impl.AggregatedCountryData;
25  import com.hack23.cia.web.impl.ui.page.common.panel.AbstractPanel;
26  import com.vaadin.data.Property;
27  import com.vaadin.data.Property.ValueChangeEvent;
28  import com.vaadin.ui.NativeSelect;
29  import com.vaadin.ui.VerticalSplitPanel;
30  
31  /**
32   * The Class WorldBankIndicatorCountryPanel.
33   */
34  public final class WorldBankIndicatorCountryPanel extends AbstractPanel
35  		implements Property.ValueChangeListener {
36  
37  	/** The Constant serialVersionUID. */
38  	private static final long serialVersionUID = 1L;
39  
40  	/** The vert. */
41  	private VerticalSplitPanel vert = null;
42  
43  	/** The timeline. */
44  	private AnnotatedTimeLine timeline;
45  
46  	/**
47  	 * Instantiates a new world bank indicator country panel.
48  	 */
49  	public WorldBankIndicatorCountryPanel() {
50  		super();
51  	}
52  
53  	/**
54  	 * Update.
55  	 * 
56  	 * @param country
57  	 *            the country
58  	 */
59  	public void update(final AggregatedCountryData country) {
60  		vert = new VerticalSplitPanel();
61  		setCaption(translateFromEnglish("Indicators"));
62  		vert.setSplitPosition(30, VerticalSplitPanel.UNITS_PIXELS);
63  
64  		final NativeSelect sourceIndicatorSelectBox = new NativeSelect(
65  				translateFromEnglish("Please select indicator source"));
66  
67  		for (final SourceName name : SourceName.values()) {
68  			sourceIndicatorSelectBox
69  					.addItem(translateFromEnglish(name.value()));
70  		}
71  
72  		sourceIndicatorSelectBox.setNullSelectionAllowed(false);
73  		sourceIndicatorSelectBox.setValue(translateFromEnglish(SourceName
74  				.values()[0].value()));
75  		sourceIndicatorSelectBox.setImmediate(true);
76  		sourceIndicatorSelectBox.addListener(this);
77  		vert.addComponent(sourceIndicatorSelectBox);
78  
79  		timeline = new AnnotatedTimeLine();
80  		timeline.setOption("displayAnnotations", true);
81  		timeline.setOption("wmode", "window");
82  		timeline.setOption("width", "100%");
83  		timeline.setOption("height", "100%");
84  		vert.addComponent(timeline);
85  		timeline.setSizeFull();
86  		setContent(vert);
87  		vert.setSizeFull();
88  	}
89  
90  	/*
91  	 * (non-Javadoc)
92  	 * 
93  	 * @see
94  	 * com.vaadin.data.Property.ValueChangeListener#valueChange(com.vaadin.data
95  	 * .Property.ValueChangeEvent)
96  	 */
97  	@Override
98  	public void valueChange(final ValueChangeEvent event) {
99  		// TODO Auto-generated method stub
100 
101 	}
102 }