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.User;
10 import org.directdemocracyportal.democracy.web.ApplicationMessageHolder;
11 import org.directdemocracyportal.democracy.web.BeanLocator;
12 import org.directdemocracyportal.democracy.web.ImageConstants;
13 import org.directdemocracyportal.democracy.web.ApplicationMessageHolder.MessageConstans;
14 import org.directdemocracyportal.democracy.web.action.ShowUserAction;
15
16 import thinwire.ui.GridBox;
17 import thinwire.ui.Image;
18 import thinwire.ui.Panel;
19 import thinwire.ui.layout.TableLayout;
20
21 /***
22 * The Class MembersPanel.
23 */
24 public class MembersPanel extends Panel
25 {
26
27 /***
28 * Instantiates a new members panel.
29 *
30 * @param users the users
31 */
32 public MembersPanel(List<User> users) {
33 setLayout(new TableLayout(new double[][] { { 0 },
34 { 32, 0 } },
35 1,
36 5));
37
38 Image img = new Image(ImageConstants.GROUP_HOME_BUTTON);
39 img.setSize(ImageConstants.BUTTON_SIZE, ImageConstants.BUTTON_SIZE);
40 img.setLimit("0,0,l,c");
41 getChildren().add(img);
42
43 GridBox gridBox = new GridBox();
44 gridBox.setVisibleHeader(true);
45 gridBox.setLimit("0,1,1,1");
46 gridBox.addActionListener(ACTION_CLICK, BeanLocator
47 .getApplicationActionListener());
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 (User user : users) {
55 GridBox.Row row = new GridBox.Row(user.getUsername());
56 row.setUserObject(new ShowUserAction(user.getId()));
57 gridBox.getRows().add(
58 row);
59 }
60
61 getChildren().add(gridBox);
62 }
63 }