annotate rep/SessionManagerGUI.java @ 217:4deaaaa6354e

*** empty log message ***
author kono
date Sun, 31 Aug 2008 00:26:35 +0900
parents ff3fcdcccc85
children 18d6a7140fa3
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
e41994ce73c7 *** empty log message ***
pin
parents:
diff changeset
1 package rep;
e41994ce73c7 *** empty log message ***
pin
parents:
diff changeset
2
1
3f5bf0255f5e *** empty log message ***
pin
parents: 0
diff changeset
3 import java.awt.Container;
185
c2c47d7675a8 *** empty log message ***
pin
parents: 182
diff changeset
4 import java.awt.event.ComponentListener;
198
ff3fcdcccc85 *** empty log message ***
pin
parents: 195
diff changeset
5 import java.util.LinkedList;
185
c2c47d7675a8 *** empty log message ***
pin
parents: 182
diff changeset
6
133
8dce4348966c *** empty log message ***
kono
parents: 122
diff changeset
7 import javax.swing.JFrame;
8dce4348966c *** empty log message ***
kono
parents: 122
diff changeset
8 import rep.channel.REPSocketChannel;
8
b774b87cc2c1 *** empty log message ***
pin
parents: 5
diff changeset
9
5
91a33a634fef *** empty log message ***
pin
parents: 2
diff changeset
10
1
3f5bf0255f5e *** empty log message ***
pin
parents: 0
diff changeset
11 public class SessionManagerGUI implements Runnable{
182
e5a7aad3fbc0 *** empty log message ***
pin
parents: 179
diff changeset
12
e5a7aad3fbc0 *** empty log message ***
pin
parents: 179
diff changeset
13 private SessionManager manager;
e5a7aad3fbc0 *** empty log message ***
pin
parents: 179
diff changeset
14
185
c2c47d7675a8 *** empty log message ***
pin
parents: 182
diff changeset
15 public static void main(String[] args){
2
02fa9a68d9a2 *** empty log message ***
pin
parents: 1
diff changeset
16 SessionManagerGUI gui = new SessionManagerGUI();
02fa9a68d9a2 *** empty log message ***
pin
parents: 1
diff changeset
17 Thread th = new Thread( gui );
02fa9a68d9a2 *** empty log message ***
pin
parents: 1
diff changeset
18 th.start();
02fa9a68d9a2 *** empty log message ***
pin
parents: 1
diff changeset
19 }
02fa9a68d9a2 *** empty log message ***
pin
parents: 1
diff changeset
20
182
e5a7aad3fbc0 *** empty log message ***
pin
parents: 179
diff changeset
21 public SessionManagerGUI(SessionManager manager) {
e5a7aad3fbc0 *** empty log message ***
pin
parents: 179
diff changeset
22 this.manager = manager;
195
63f36334e8dc *** empty log message ***
pin
parents: 185
diff changeset
23 rp = new RPanel(manager);
182
e5a7aad3fbc0 *** empty log message ***
pin
parents: 179
diff changeset
24 }
e5a7aad3fbc0 *** empty log message ***
pin
parents: 179
diff changeset
25
e5a7aad3fbc0 *** empty log message ***
pin
parents: 179
diff changeset
26 public SessionManagerGUI() {
e5a7aad3fbc0 *** empty log message ***
pin
parents: 179
diff changeset
27 // TODO Auto-generated constructor stub
e5a7aad3fbc0 *** empty log message ***
pin
parents: 179
diff changeset
28 }
e5a7aad3fbc0 *** empty log message ***
pin
parents: 179
diff changeset
29
2
02fa9a68d9a2 *** empty log message ***
pin
parents: 1
diff changeset
30 private RPanel rp;
5
91a33a634fef *** empty log message ***
pin
parents: 2
diff changeset
31 //private ConnectionPanel rp;
2
02fa9a68d9a2 *** empty log message ***
pin
parents: 1
diff changeset
32 private JFrame frame;
0
e41994ce73c7 *** empty log message ***
pin
parents:
diff changeset
33
1
3f5bf0255f5e *** empty log message ***
pin
parents: 0
diff changeset
34 public void run() {
2
02fa9a68d9a2 *** empty log message ***
pin
parents: 1
diff changeset
35 frame = new JFrame("SessionManager");
55
57a16534ba5a change window size
chiaki
parents: 8
diff changeset
36 frame.setBounds(100, 100, 600, 300);
5
91a33a634fef *** empty log message ***
pin
parents: 2
diff changeset
37 //rp = new ConnectionPanel();
1
3f5bf0255f5e *** empty log message ***
pin
parents: 0
diff changeset
38 Container cont = frame.getContentPane();
3f5bf0255f5e *** empty log message ***
pin
parents: 0
diff changeset
39 cont.add(rp);
3f5bf0255f5e *** empty log message ***
pin
parents: 0
diff changeset
40
3f5bf0255f5e *** empty log message ***
pin
parents: 0
diff changeset
41 frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
3f5bf0255f5e *** empty log message ***
pin
parents: 0
diff changeset
42 frame.setVisible(true);
185
c2c47d7675a8 *** empty log message ***
pin
parents: 182
diff changeset
43
1
3f5bf0255f5e *** empty log message ***
pin
parents: 0
diff changeset
44 }
2
02fa9a68d9a2 *** empty log message ***
pin
parents: 1
diff changeset
45
02fa9a68d9a2 *** empty log message ***
pin
parents: 1
diff changeset
46 public void addConnectionListener(ConnectionListener listener) {
02fa9a68d9a2 *** empty log message ***
pin
parents: 1
diff changeset
47 //System.out.println(rp.toString());
5
91a33a634fef *** empty log message ***
pin
parents: 2
diff changeset
48 System.out.print("waiting for launching GUI.");
2
02fa9a68d9a2 *** empty log message ***
pin
parents: 1
diff changeset
49 while(rp == null){
5
91a33a634fef *** empty log message ***
pin
parents: 2
diff changeset
50 System.out.print(".");
2
02fa9a68d9a2 *** empty log message ***
pin
parents: 1
diff changeset
51 try {
5
91a33a634fef *** empty log message ***
pin
parents: 2
diff changeset
52 Thread.sleep(200);
2
02fa9a68d9a2 *** empty log message ***
pin
parents: 1
diff changeset
53 } catch (InterruptedException e) {
02fa9a68d9a2 *** empty log message ***
pin
parents: 1
diff changeset
54 e.printStackTrace();
02fa9a68d9a2 *** empty log message ***
pin
parents: 1
diff changeset
55 }
02fa9a68d9a2 *** empty log message ***
pin
parents: 1
diff changeset
56 }
5
91a33a634fef *** empty log message ***
pin
parents: 2
diff changeset
57 System.out.println("");
2
02fa9a68d9a2 *** empty log message ***
pin
parents: 1
diff changeset
58 rp.addConnectionListener(listener);
02fa9a68d9a2 *** empty log message ***
pin
parents: 1
diff changeset
59 }
8
b774b87cc2c1 *** empty log message ***
pin
parents: 5
diff changeset
60
133
8dce4348966c *** empty log message ***
kono
parents: 122
diff changeset
61 public void setComboEditor(int eid, REPSocketChannel channel) {
8
b774b87cc2c1 *** empty log message ***
pin
parents: 5
diff changeset
62 rp.setComboEditor(eid, channel);
195
63f36334e8dc *** empty log message ***
pin
parents: 185
diff changeset
63 //rp.setTableEditor(eid, channel);
8
b774b87cc2c1 *** empty log message ***
pin
parents: 5
diff changeset
64 }
b774b87cc2c1 *** empty log message ***
pin
parents: 5
diff changeset
65
133
8dce4348966c *** empty log message ***
kono
parents: 122
diff changeset
66 public void addREPActionListener(REPActionListener<REPCommand> listener) {
122
790c8dd42a7b *** empty log message ***
kono
parents: 55
diff changeset
67 rp.addREPActionListener(listener);
8
b774b87cc2c1 *** empty log message ***
pin
parents: 5
diff changeset
68 }
b774b87cc2c1 *** empty log message ***
pin
parents: 5
diff changeset
69
b774b87cc2c1 *** empty log message ***
pin
parents: 5
diff changeset
70 public void setComboSession(int sessionID, String string) {
b774b87cc2c1 *** empty log message ***
pin
parents: 5
diff changeset
71 rp.setComboSession(sessionID, string);
195
63f36334e8dc *** empty log message ***
pin
parents: 185
diff changeset
72 //rp.setTableSession(sessionID, string);
8
b774b87cc2c1 *** empty log message ***
pin
parents: 5
diff changeset
73 }
122
790c8dd42a7b *** empty log message ***
kono
parents: 55
diff changeset
74
198
ff3fcdcccc85 *** empty log message ***
pin
parents: 195
diff changeset
75 public void update(LinkedList<Session> list, LinkedList<Editor> list2) {
ff3fcdcccc85 *** empty log message ***
pin
parents: 195
diff changeset
76 rp.setTableSession(list);
ff3fcdcccc85 *** empty log message ***
pin
parents: 195
diff changeset
77 rp.setTableEditor(list2);
179
763aad2da6b3 *** empty log message ***
pin
parents: 133
diff changeset
78 }
763aad2da6b3 *** empty log message ***
pin
parents: 133
diff changeset
79
1
3f5bf0255f5e *** empty log message ***
pin
parents: 0
diff changeset
80 }