1
2
3
4
5 package org.directdemocracyportal.democracy.web.views;
6
7 import java.util.List;
8
9 import org.directdemocracyportal.democracy.model.application.Event;
10 import org.directdemocracyportal.democracy.web.ApplicationMessageHolder;
11 import org.directdemocracyportal.democracy.web.ApplicationMessageHolder.MessageConstans;
12
13 import thinwire.ui.GridBox;
14 import thinwire.ui.Panel;
15 import thinwire.ui.layout.TableLayout;
16
17 /***
18 * The Class EventsPanel.
19 */
20 public class EventsPanel extends Panel
21 {
22
23 /***
24 * Instantiates a new events panel.
25 *
26 * @param events the events
27 */
28 public EventsPanel(List<Event> events) {
29 super();
30 setLayout(new TableLayout(new double[][] { { 0 },
31 { 0 } },
32 1,
33 5));
34
35 GridBox gridBox = new GridBox();
36 gridBox.setVisibleHeader(true);
37 gridBox.setLimit("0,0,1,1");
38
39 GridBox.Column timeHeader = new GridBox.Column();
40 timeHeader.setName(ApplicationMessageHolder
41 .getMessage(MessageConstans.HEADER_TIME));
42 gridBox.getColumns().add(timeHeader);
43
44 GridBox.Column actionHeader = new GridBox.Column();
45 actionHeader.setName(ApplicationMessageHolder
46 .getMessage(MessageConstans.HEADER_ACTION));
47 gridBox.getColumns().add(actionHeader);
48
49 GridBox.Column usernameHeader = new GridBox.Column();
50 usernameHeader.setName(ApplicationMessageHolder
51 .getMessage(MessageConstans.HEADER_USERNAME));
52 gridBox.getColumns().add(usernameHeader);
53
54 for (Event event : events) {
55 gridBox.getRows().add(
56 new GridBox.Row(event.getTime(), event.getAction(), event
57 .getUser().getUsername()));
58 }
59 getChildren().add(gridBox);
60 }
61 }