1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 package org.dishevelled.venn.cytoscape3.internal;
25
26 import static javax.swing.SwingUtilities.windowForComponent;
27 import static org.dishevelled.venn.cytoscape3.internal.VennDiagramsUtils.installCloseKeyBinding;
28
29 import java.awt.Component;
30 import java.awt.event.ActionEvent;
31
32 import javax.swing.JDialog;
33 import javax.swing.JFrame;
34
35 import org.cytoscape.application.CyApplicationManager;
36 import org.cytoscape.application.swing.AbstractCyAction;
37 import org.cytoscape.group.CyGroupManager;
38 import org.cytoscape.service.util.CyServiceRegistrar;
39
40
41
42
43
44
45 final class VennDiagramsAction extends AbstractCyAction
46 {
47
48 private final CyApplicationManager applicationManager;
49
50
51 private final CyGroupManager groupManager;
52
53
54 private final CyServiceRegistrar serviceRegistrar;
55
56
57
58
59
60
61
62
63
64 VennDiagramsAction(final CyApplicationManager applicationManager, final CyGroupManager groupManager, final CyServiceRegistrar serviceRegistrar)
65 {
66 super("Venn and Euler Diagrams");
67 if (applicationManager == null)
68 {
69 throw new IllegalArgumentException("applicationManager must not be null");
70 }
71 if (groupManager == null)
72 {
73 throw new IllegalArgumentException("groupManager must not be null");
74 }
75 if (serviceRegistrar == null)
76 {
77 throw new IllegalArgumentException("serviceRegistrar must not be null");
78 }
79 this.applicationManager = applicationManager;
80 this.groupManager = groupManager;
81 this.serviceRegistrar = serviceRegistrar;
82
83 setPreferredMenu("Apps");
84 }
85
86
87 @Override
88 public void actionPerformed(final ActionEvent event)
89 {
90 if (event == null)
91 {
92 throw new NullPointerException("event must not be null");
93 }
94 JFrame frame = (JFrame) windowForComponent((Component) event.getSource());
95 JDialog dialog = new JDialog(frame, "Venn and Euler Diagrams");
96 dialog.setContentPane(new GroupsView(applicationManager, groupManager, serviceRegistrar));
97 dialog.setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE);
98 installCloseKeyBinding(dialog);
99 dialog.setBounds(200, 200, 400, 400);
100 dialog.setVisible(true);
101 }
102 }