0
|
1 package rep;
|
|
2
|
1
|
3 import java.awt.Container;
|
185
|
4 import java.awt.event.ComponentListener;
|
198
|
5 import java.util.LinkedList;
|
185
|
6
|
133
|
7 import javax.swing.JFrame;
|
|
8 import rep.channel.REPSocketChannel;
|
8
|
9
|
5
|
10
|
1
|
11 public class SessionManagerGUI implements Runnable{
|
182
|
12
|
|
13 private SessionManager manager;
|
|
14
|
185
|
15 public static void main(String[] args){
|
2
|
16 SessionManagerGUI gui = new SessionManagerGUI();
|
|
17 Thread th = new Thread( gui );
|
|
18 th.start();
|
|
19 }
|
|
20
|
182
|
21 public SessionManagerGUI(SessionManager manager) {
|
|
22 this.manager = manager;
|
195
|
23 rp = new RPanel(manager);
|
182
|
24 }
|
|
25
|
|
26 public SessionManagerGUI() {
|
|
27 // TODO Auto-generated constructor stub
|
|
28 }
|
|
29
|
2
|
30 private RPanel rp;
|
5
|
31 //private ConnectionPanel rp;
|
2
|
32 private JFrame frame;
|
0
|
33
|
1
|
34 public void run() {
|
2
|
35 frame = new JFrame("SessionManager");
|
55
|
36 frame.setBounds(100, 100, 600, 300);
|
5
|
37 //rp = new ConnectionPanel();
|
1
|
38 Container cont = frame.getContentPane();
|
|
39 cont.add(rp);
|
|
40
|
|
41 frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
|
42 frame.setVisible(true);
|
185
|
43
|
1
|
44 }
|
2
|
45
|
|
46 public void addConnectionListener(ConnectionListener listener) {
|
|
47 //System.out.println(rp.toString());
|
5
|
48 System.out.print("waiting for launching GUI.");
|
2
|
49 while(rp == null){
|
5
|
50 System.out.print(".");
|
2
|
51 try {
|
5
|
52 Thread.sleep(200);
|
2
|
53 } catch (InterruptedException e) {
|
|
54 e.printStackTrace();
|
|
55 }
|
|
56 }
|
5
|
57 System.out.println("");
|
2
|
58 rp.addConnectionListener(listener);
|
|
59 }
|
8
|
60
|
133
|
61 public void setComboEditor(int eid, REPSocketChannel channel) {
|
8
|
62 rp.setComboEditor(eid, channel);
|
195
|
63 //rp.setTableEditor(eid, channel);
|
8
|
64 }
|
|
65
|
133
|
66 public void addREPActionListener(REPActionListener<REPCommand> listener) {
|
122
|
67 rp.addREPActionListener(listener);
|
8
|
68 }
|
|
69
|
|
70 public void setComboSession(int sessionID, String string) {
|
|
71 rp.setComboSession(sessionID, string);
|
195
|
72 //rp.setTableSession(sessionID, string);
|
8
|
73 }
|
122
|
74
|
198
|
75 public void update(LinkedList<Session> list, LinkedList<Editor> list2) {
|
|
76 rp.setTableSession(list);
|
|
77 rp.setTableEditor(list2);
|
179
|
78 }
|
|
79
|
1
|
80 } |