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: AggregatedBugDataPanel.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/AggregatedBugDataPanel.java $
18  */
19  package com.hack23.cia.web.impl.ui.page.user;
20  
21  import org.vaadin.navigator7.ParamPageLink;
22  
23  import com.hack23.cia.model.internal.application.data.impl.AggregatedBugData;
24  import com.hack23.cia.model.internal.application.data.impl.BugMetaDataType;
25  import com.hack23.cia.web.impl.ui.page.common.panel.AbstractPanel;
26  import com.vaadin.ui.GridLayout;
27  
28  /**
29   * The Class AggregatedBugDataPanel.
30   */
31  public final class AggregatedBugDataPanel extends AbstractPanel {
32  
33  	/** The grid. */
34  	private GridLayout grid = null;
35  
36  	/** The Constant serialVersionUID. */
37  	private static final long serialVersionUID = 1L;
38  
39  	/**
40  	 * Instantiates a new aggregated bug data panel.
41  	 *
42  	 * @param bugData
43  	 *            the bug data
44  	 */
45  	public AggregatedBugDataPanel(final AggregatedBugData bugData) {
46  		super();
47  		update(bugData);
48  	}
49  
50  	/**
51  	 * Update.
52  	 *
53  	 * @param bugData
54  	 *            the bug data
55  	 */
56  	public void update(final AggregatedBugData bugData) {
57  		grid =new GridLayout(2,20);
58  		setContent(grid);
59  		grid.setSizeFull();
60  		grid.setSpacing(true);
61  		grid.setMargin(true);
62  
63  
64  		String name = "";
65  		if (bugData.getType().equals(BugMetaDataType.SWEDISH_POLITICIAN)) {
66  			name = bugData.getSweden().getFirstName() + " " +  bugData.getSweden().getLastName();
67  			grid.addComponent( new ParamPageLink(name, PoliticianPage.class,bugData.getCountry(),bugData.getSweden().getParty(),bugData.getSweden().getId(),name),0,0,1,0);
68  		}
69  		setCaption(name);
70  	}
71  
72  }