1 package at.ac.tuwien.sbc.valesriegler.group;
3 import java.util.ArrayList;
6 import javax.swing.SwingUtilities;
8 import at.ac.tuwien.sbc.valesriegler.group.gui.GroupOverviewModel;
9 import at.ac.tuwien.sbc.valesriegler.group.jms.JMSGroupConnector;
10 import at.ac.tuwien.sbc.valesriegler.types.GroupData;
11 import at.ac.tuwien.sbc.valesriegler.xvsm.XVSMConnector;
14 * The Main class of the Group component.
16 * Start the communication and the group GUI:
18 * @author Gregor Riegler <gregor DOT riegler AT gmail DOT com>
22 public class GroupAgent {
23 public static GroupAgent groupAgent;
24 private GroupOverviewModel groupModel;
25 private AbstractGroupConnector groupconn;
26 private XVSMConnector xvsm;
28 public static void main(String[] args) {
29 // TODO: use jms and xvsm manager here.
30 groupAgent = new GroupAgent(new JMSGroupConnector());
32 SwingUtilities.invokeLater(new GroupGUI());
35 public GroupAgent(JMSGroupConnector groupconn) {
36 groupModel = new GroupOverviewModel();
37 this.groupconn = groupconn;
40 // xvsm = new XVSMConnector();
41 // xvsm.initSpaceCommunication();
42 // xvsm.useGroupsContainer();
45 public static GroupAgent getInstance() {
49 public AbstractGroupConnector getGroupcomm() {
53 public GroupOverviewModel getGroupModel() {
57 public void onGroupsCreated(List<Group> newGroups) {
58 List<GroupData> groupData = new ArrayList<>();
59 for (Group group : newGroups) {
60 groupData.add(group.getGroupData());
62 xvsm.createGroups(groupData);