0
|
1 package rep;
|
|
2
|
1
|
3 import java.awt.BorderLayout;
|
|
4 import java.awt.Container;
|
8
|
5 import java.nio.channels.SocketChannel;
|
|
6
|
1
|
7 import javax.swing.JButton;
|
|
8 import javax.swing.JFrame;
|
|
9 import javax.swing.JLabel;
|
|
10 import javax.swing.JPanel;
|
|
11
|
5
|
12 import rep.gui.ConnectionPanel;
|
|
13
|
1
|
14 public class SessionManagerGUI implements Runnable{
|
2
|
15 public static void main(String[] args) {
|
|
16 SessionManagerGUI gui = new SessionManagerGUI();
|
|
17 Thread th = new Thread( gui );
|
|
18 th.start();
|
|
19 }
|
|
20
|
|
21 private RPanel rp;
|
5
|
22 //private ConnectionPanel rp;
|
2
|
23 private JFrame frame;
|
0
|
24
|
1
|
25 public void run() {
|
2
|
26 frame = new JFrame("SessionManager");
|
55
|
27 frame.setBounds(100, 100, 600, 300);
|
5
|
28 //rp = new ConnectionPanel();
|
|
29 rp = new RPanel();
|
1
|
30 Container cont = frame.getContentPane();
|
|
31 cont.add(rp);
|
|
32
|
|
33 frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
2
|
34 //frame.pack();
|
1
|
35 frame.setVisible(true);
|
|
36 }
|
2
|
37
|
|
38 public void addConnectionListener(ConnectionListener listener) {
|
|
39 //System.out.println(rp.toString());
|
5
|
40 System.out.print("waiting for launching GUI.");
|
2
|
41 while(rp == null){
|
5
|
42 System.out.print(".");
|
2
|
43 try {
|
5
|
44 Thread.sleep(200);
|
2
|
45 } catch (InterruptedException e) {
|
|
46 e.printStackTrace();
|
|
47 }
|
|
48 }
|
5
|
49 System.out.println("");
|
2
|
50 rp.addConnectionListener(listener);
|
|
51 }
|
8
|
52
|
|
53 public void setComboEditor(int eid, SocketChannel channel) {
|
|
54 // TODO Auto-generated method stub
|
|
55 rp.setComboEditor(eid, channel);
|
55
|
56 rp.setTableEditor(eid, channel);
|
8
|
57 }
|
|
58
|
|
59 public void addREPActionListener(REPActionListener listener) {
|
|
60 // TODO Auto-generated method stub
|
|
61 rp.REPActionListener(listener);
|
|
62 }
|
|
63
|
|
64 public void setComboSession(int sessionID, String string) {
|
|
65 // TODO Auto-generated method stub
|
|
66 rp.setComboSession(sessionID, string);
|
55
|
67 rp.setTableSession(sessionID, string);
|
8
|
68 }
|
1
|
69 } |