source: domaineditor/src/main/java/geniusweb/domaineditor/ProfileEditor.java@ 52

Last change on this file since 52 was 52, checked in by ruud, 14 months ago

Fixed small issues in domaineditor.

File size: 2.2 KB
Line 
1package geniusweb.domaineditor;
2
3import java.awt.BorderLayout;
4
5import javax.swing.JFrame;
6import javax.swing.JMenu;
7import javax.swing.JMenuBar;
8
9import geniusweb.actions.HelpAction;
10import geniusweb.actions.LoadAction;
11import geniusweb.actions.SaveAction;
12import geniusweb.actions.SaveDomainAction;
13import geniusweb.domaineditor.model.DomainModel;
14import geniusweb.domaineditor.model.profile.LinearAdditiveUtilitySpaceModel;
15import geniusweb.domaineditor.panels.profile.ProfileEditorPanel;
16import tudelft.utilities.logging.Reporter;
17import tudelft.utilities.mvc.panels.PopupReporter;
18
19/**
20 * A profile editor. Basically a container for a {@link ProfileEditorPanel} plus
21 * a menu bar. Contains components to edit domain, reservation bid, utilities
22 * etc.
23 */
24@SuppressWarnings("serial")
25public class ProfileEditor extends JFrame {
26 private final Reporter log;
27 private final LinearAdditiveUtilitySpaceModel model;
28 private static ProfileEditor instance = null;
29
30 private ProfileEditor() {
31 log = new PopupReporter(this);
32 model = getSampleModel();
33 setLayout(new BorderLayout());
34 setDefaultCloseOperation(DISPOSE_ON_CLOSE);
35 Reporter log = new PopupReporter(this);
36
37 getContentPane().add(new ProfileEditorPanel(model, log),
38 BorderLayout.CENTER);
39 setJMenuBar(menu());
40
41 pack();
42 setVisible(true);
43 }
44
45 private JMenuBar menu() {
46 JMenuBar mb = new JMenuBar();
47 JMenu filemenu = new JMenu("File");
48 filemenu.add(new LoadAction(log));
49 filemenu.add(new SaveAction(log));
50 filemenu.add(new SaveDomainAction(log));
51
52 mb.add(filemenu);
53
54 JMenu helpmenu = new JMenu("Help");
55 helpmenu.add(new HelpAction(log));
56 mb.add(helpmenu);
57 return mb;
58
59 }
60
61 private LinearAdditiveUtilitySpaceModel getSampleModel() {
62 DomainModel domain = new DomainModel(log);
63 LinearAdditiveUtilitySpaceModel lamodel = new LinearAdditiveUtilitySpaceModel(
64 domain, log);
65 return lamodel;
66 }
67
68 public static void main(String[] args) {
69 getInstance();
70 }
71
72 public static ProfileEditor getInstance() {
73 if (instance == null)
74 instance = new ProfileEditor();
75 return instance;
76 }
77
78 /**
79 * .
80 *
81 * @return Currently active model
82 */
83 public LinearAdditiveUtilitySpaceModel getModel() {
84 return model;
85 }
86}
Note: See TracBrowser for help on using the repository browser.