1 | package genius.gui.progress.session;
|
---|
2 |
|
---|
3 | import javax.swing.JPanel;
|
---|
4 | import javax.swing.JScrollPane;
|
---|
5 | import javax.swing.JSplitPane;
|
---|
6 | import javax.swing.JTable;
|
---|
7 | import javax.swing.JTextArea;
|
---|
8 |
|
---|
9 | import genius.gui.panels.VflowPanelWithBorder;
|
---|
10 |
|
---|
11 | /**
|
---|
12 | * Shows the progress in a multiparty single session run
|
---|
13 | */
|
---|
14 | @SuppressWarnings("serial")
|
---|
15 | public class SessionProgressUI extends VflowPanelWithBorder {
|
---|
16 |
|
---|
17 | private JSplitPane verticalsplit; // split on y axis
|
---|
18 | private JSplitPane horizontalsplit; // split on x axis
|
---|
19 |
|
---|
20 | /**
|
---|
21 | *
|
---|
22 | * @param model
|
---|
23 | * an {@link OutcomesListModel} of this session.
|
---|
24 | * @param showChart
|
---|
25 | * true iff any chart (normal or bi) has to be shown
|
---|
26 | * @param useBiChart
|
---|
27 | * if true, a {@link SessionProgressUI} will be used that shows
|
---|
28 | * utils of first two participants in util-util graph. Ignored if
|
---|
29 | * showChart is false.
|
---|
30 | * @param textmodel
|
---|
31 | * a {@link ActionDocumentModel}
|
---|
32 | */
|
---|
33 | public SessionProgressUI(OutcomesListModel model, ActionDocumentModel textmodel, boolean showChart,
|
---|
34 | boolean useBiChart, boolean showAllBids) {
|
---|
35 | super("Session Progress");
|
---|
36 |
|
---|
37 | createSplitPanes();
|
---|
38 | VflowPanelWithBorder textarea = new VflowPanelWithBorder("Negotiation log");
|
---|
39 | textarea.add(new JScrollPane(new JTextArea(textmodel)));
|
---|
40 | horizontalsplit.setLeftComponent(textarea);
|
---|
41 | verticalsplit.setRightComponent(new JScrollPane(new JTable(new OutcomesModelToTableModelAdapter(model))));
|
---|
42 | JPanel chart;
|
---|
43 | if (showChart) {
|
---|
44 | chart = useBiChart ? new ProgressChartBi(model, showAllBids) : new ProgressChart(model);
|
---|
45 | } else {
|
---|
46 | chart = new JPanel();
|
---|
47 | }
|
---|
48 | verticalsplit.setLeftComponent(chart);
|
---|
49 | add(horizontalsplit);
|
---|
50 |
|
---|
51 | }
|
---|
52 |
|
---|
53 | /**
|
---|
54 | * Creates overall layout of this panel: a panel with a vertical split, with
|
---|
55 | * in the right side a panel with a horizontal split .
|
---|
56 | */
|
---|
57 | private void createSplitPanes() {
|
---|
58 | horizontalsplit = new JSplitPane();
|
---|
59 | horizontalsplit.setOrientation(JSplitPane.HORIZONTAL_SPLIT);
|
---|
60 |
|
---|
61 | verticalsplit = new JSplitPane();
|
---|
62 | verticalsplit.setOrientation(JSplitPane.VERTICAL_SPLIT);
|
---|
63 |
|
---|
64 | horizontalsplit.setRightComponent(verticalsplit);
|
---|
65 | }
|
---|
66 |
|
---|
67 | }
|
---|