1 | package genius.gui.tournament;
|
---|
2 |
|
---|
3 | import java.awt.GridLayout;
|
---|
4 |
|
---|
5 | import javax.swing.JPanel;
|
---|
6 | import javax.swing.ListCellRenderer;
|
---|
7 |
|
---|
8 | import genius.core.repository.ParticipantRepItem;
|
---|
9 | import genius.core.repository.ProfileRepItem;
|
---|
10 | import genius.gui.panels.SubsetSelectionModel;
|
---|
11 | import genius.gui.panels.SubsetSelectionPanelPlus;
|
---|
12 | import genius.gui.renderer.RepItemListCellRenderer;
|
---|
13 |
|
---|
14 | /**
|
---|
15 | * Panel that shows agents and profiles panels side by side. Both panels get
|
---|
16 | * half of the width.
|
---|
17 | */
|
---|
18 | @SuppressWarnings("serial")
|
---|
19 | public class PartiesAndProfilesPanel extends JPanel {
|
---|
20 |
|
---|
21 | @SuppressWarnings("unchecked")
|
---|
22 | public PartiesAndProfilesPanel(SubsetSelectionModel<ParticipantRepItem> partyModel,
|
---|
23 | SubsetSelectionModel<ProfileRepItem> profileModel) {
|
---|
24 | setLayout(new GridLayout(1, 2));
|
---|
25 |
|
---|
26 | SubsetSelectionPanelPlus<ParticipantRepItem> leftPanel = new SubsetSelectionPanelPlus<>("Parties", partyModel);
|
---|
27 | // ugly cast, RepItemListCellRenderer has incorrect typing...
|
---|
28 | leftPanel.setCellRenderer(
|
---|
29 | (ListCellRenderer<ParticipantRepItem>) (ListCellRenderer) new RepItemListCellRenderer());
|
---|
30 | SubsetSelectionPanelPlus<ProfileRepItem> rightPanel = new SubsetSelectionPanelPlus<>("Profiles", profileModel);
|
---|
31 | rightPanel.setCellRenderer((ListCellRenderer<ProfileRepItem>) (ListCellRenderer) new RepItemListCellRenderer());
|
---|
32 | add(leftPanel);
|
---|
33 | add(rightPanel);
|
---|
34 | }
|
---|
35 |
|
---|
36 | }
|
---|