source: src/main/java/genius/gui/progress/session/SessionProgressUI.java@ 126

Last change on this file since 126 was 126, checked in by Aron Hammond, 6 years ago

Added function to calculate opposition to MultiLateralAnalysis.java

Moved code to add RLBOA listeners to RLBOAUtils is misc package

Added input for strategyParameters to SessionPanel (gui)

!! close SessionInfo after tournament; this caused /tmp/ to fill up with GeniusData files

Our own package:

  • Added opponents and strategies that are mentioned in the report
  • Change class hierarchy, agents can now extend from RLBOAagentBilateral to inherit RL functionality.
  • States extend from AbstractState
File size: 2.5 KB
Line 
1package genius.gui.progress.session;
2
3import javax.swing.JPanel;
4import javax.swing.JScrollPane;
5import javax.swing.JSplitPane;
6import javax.swing.JTable;
7import javax.swing.JTextArea;
8import javax.swing.text.BadLocationException;
9
10import genius.core.analysis.MultilateralAnalysis;
11import genius.gui.panels.VflowPanelWithBorder;
12
13/**
14 * Shows the progress in a multiparty single session run
15 */
16@SuppressWarnings("serial")
17public class SessionProgressUI extends VflowPanelWithBorder {
18
19 private JSplitPane verticalsplit; // split on y axis
20 private JSplitPane horizontalsplit; // split on x axis
21
22 /**
23 *
24 * @param model
25 * an {@link OutcomesListModel} of this session.
26 * @param showChart
27 * true iff any chart (normal or bi) has to be shown
28 * @param useBiChart
29 * if true, a {@link SessionProgressUI} will be used that shows
30 * utils of first two participants in util-util graph. Ignored if
31 * showChart is false.
32 * @param textmodel
33 * a {@link ActionDocumentModel}
34 */
35 public SessionProgressUI(OutcomesListModel model, ActionDocumentModel textmodel, boolean showChart,
36 boolean useBiChart, boolean showAllBids) {
37 super("Session Progress");
38
39 MultilateralAnalysis analysis = new MultilateralAnalysis(model.getParties(), null, null);
40 double opposition = analysis.getOpposition();
41 String message = String.format("Opposition: %.4f \n\n", opposition);
42
43 try {
44 textmodel.insertString(0, message, null);
45 } catch(BadLocationException e) {
46 System.out.print(String.format("\n\n ---- \n %s \n ---- \n\n ", message));
47 }
48
49 createSplitPanes();
50 VflowPanelWithBorder textarea = new VflowPanelWithBorder("Negotiation log");
51 textarea.add(new JScrollPane(new JTextArea(textmodel)));
52 horizontalsplit.setLeftComponent(textarea);
53 verticalsplit.setRightComponent(new JScrollPane(new JTable(new OutcomesModelToTableModelAdapter(model))));
54 JPanel chart;
55 if (showChart) {
56 chart = useBiChart ? new ProgressChartBi(model, showAllBids) : new ProgressChart(model);
57 } else {
58 chart = new JPanel();
59 }
60 verticalsplit.setLeftComponent(chart);
61 add(horizontalsplit);
62
63 }
64
65 /**
66 * Creates overall layout of this panel: a panel with a vertical split, with
67 * in the right side a panel with a horizontal split .
68 */
69 private void createSplitPanes() {
70 horizontalsplit = new JSplitPane();
71 horizontalsplit.setOrientation(JSplitPane.HORIZONTAL_SPLIT);
72
73 verticalsplit = new JSplitPane();
74 verticalsplit.setOrientation(JSplitPane.VERTICAL_SPLIT);
75
76 horizontalsplit.setRightComponent(verticalsplit);
77 }
78
79}
Note: See TracBrowser for help on using the repository browser.