annotate test/sematest/TestGUI.java @ 396:dc616339b00a

half done. returned command conflict.
author one
date Wed, 19 Nov 2008 17:07:04 +0900
parents 4b87f89b3afd
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
291
9e162e0a114f *** empty log message ***
kono
parents:
diff changeset
1 package test.sematest;
9e162e0a114f *** empty log message ***
kono
parents:
diff changeset
2
9e162e0a114f *** empty log message ***
kono
parents:
diff changeset
3 import java.util.LinkedList;
9e162e0a114f *** empty log message ***
kono
parents:
diff changeset
4
9e162e0a114f *** empty log message ***
kono
parents:
diff changeset
5 import rep.Session;
293
51419ad73785 *** empty log message ***
kono
parents: 291
diff changeset
6 import rep.channel.REPLogger;
382
4b87f89b3afd REP Session Manager (Java version)
one@firefly.cr.ie.u-ryukyu.ac.jp
parents: 367
diff changeset
7 import rep.gui.SelectButtonEvent;
4b87f89b3afd REP Session Manager (Java version)
one@firefly.cr.ie.u-ryukyu.ac.jp
parents: 367
diff changeset
8 import rep.gui.SessionManagerEvent;
4b87f89b3afd REP Session Manager (Java version)
one@firefly.cr.ie.u-ryukyu.ac.jp
parents: 367
diff changeset
9 import rep.gui.SessionManagerEventListener;
4b87f89b3afd REP Session Manager (Java version)
one@firefly.cr.ie.u-ryukyu.ac.jp
parents: 367
diff changeset
10 import rep.gui.SessionManagerGUI;
4b87f89b3afd REP Session Manager (Java version)
one@firefly.cr.ie.u-ryukyu.ac.jp
parents: 367
diff changeset
11 import rep.handler.REPNode;
291
9e162e0a114f *** empty log message ***
kono
parents:
diff changeset
12
9e162e0a114f *** empty log message ***
kono
parents:
diff changeset
13 /**
9e162e0a114f *** empty log message ***
kono
parents:
diff changeset
14 * @author kono
9e162e0a114f *** empty log message ***
kono
parents:
diff changeset
15 * Dummy GUI for test
9e162e0a114f *** empty log message ***
kono
parents:
diff changeset
16 *
9e162e0a114f *** empty log message ***
kono
parents:
diff changeset
17 * perform auto select operation
9e162e0a114f *** empty log message ***
kono
parents:
diff changeset
18 */
9e162e0a114f *** empty log message ***
kono
parents:
diff changeset
19
9e162e0a114f *** empty log message ***
kono
parents:
diff changeset
20 public class TestGUI implements SessionManagerGUI {
9e162e0a114f *** empty log message ***
kono
parents:
diff changeset
21 public LinkedList<Session> slist;
382
4b87f89b3afd REP Session Manager (Java version)
one@firefly.cr.ie.u-ryukyu.ac.jp
parents: 367
diff changeset
22 public LinkedList<REPNode> elist;
291
9e162e0a114f *** empty log message ***
kono
parents:
diff changeset
23 SessionManagerEventListener manager;
9e162e0a114f *** empty log message ***
kono
parents:
diff changeset
24 int count = 0;
293
51419ad73785 *** empty log message ***
kono
parents: 291
diff changeset
25 private REPLogger ns;
291
9e162e0a114f *** empty log message ***
kono
parents:
diff changeset
26
9e162e0a114f *** empty log message ***
kono
parents:
diff changeset
27 public TestGUI(SessionManagerEventListener manager) {
9e162e0a114f *** empty log message ***
kono
parents:
diff changeset
28 this.manager = manager;
293
51419ad73785 *** empty log message ***
kono
parents: 291
diff changeset
29 ns = REPLogger.singleton();
291
9e162e0a114f *** empty log message ***
kono
parents:
diff changeset
30 }
9e162e0a114f *** empty log message ***
kono
parents:
diff changeset
31
9e162e0a114f *** empty log message ***
kono
parents:
diff changeset
32 public void invokeLater(Runnable doRun) {
9e162e0a114f *** empty log message ***
kono
parents:
diff changeset
33 doRun.run();
9e162e0a114f *** empty log message ***
kono
parents:
diff changeset
34 }
9e162e0a114f *** empty log message ***
kono
parents:
diff changeset
35
382
4b87f89b3afd REP Session Manager (Java version)
one@firefly.cr.ie.u-ryukyu.ac.jp
parents: 367
diff changeset
36 public void update(LinkedList<Session> slist, LinkedList<REPNode> elist) {
320
83790b8b8174 *** empty log message ***
kono
parents: 293
diff changeset
37 int i = 0;
291
9e162e0a114f *** empty log message ***
kono
parents:
diff changeset
38 this.slist = slist;
9e162e0a114f *** empty log message ***
kono
parents:
diff changeset
39 this.elist = elist;
9e162e0a114f *** empty log message ***
kono
parents:
diff changeset
40 // fair and deterministic select session for an empty editor
9e162e0a114f *** empty log message ***
kono
parents:
diff changeset
41 if (slist.size()==0) return;
9e162e0a114f *** empty log message ***
kono
parents:
diff changeset
42 Session s = slist.get(count++ % slist.size());
382
4b87f89b3afd REP Session Manager (Java version)
one@firefly.cr.ie.u-ryukyu.ac.jp
parents: 367
diff changeset
43 for(REPNode e :elist) {
367
1bde894edd83 *** empty log message ***
kono
parents: 334
diff changeset
44 if (e.isDirect() && !e.hasSession()) {
334
4fae49280699 Test pattern for Inter-Session Manager communication
kono
parents: 320
diff changeset
45 SessionManagerEvent event = new SelectButtonEvent(e, s);
320
83790b8b8174 *** empty log message ***
kono
parents: 293
diff changeset
46 ns.writeLog("Select session "+s.getSID()+" and editor "+i);
291
9e162e0a114f *** empty log message ***
kono
parents:
diff changeset
47 manager.buttonPressed(event);
9e162e0a114f *** empty log message ***
kono
parents:
diff changeset
48 s = slist.get(count++ % slist.size());
9e162e0a114f *** empty log message ***
kono
parents:
diff changeset
49 }
320
83790b8b8174 *** empty log message ***
kono
parents: 293
diff changeset
50 i++;
291
9e162e0a114f *** empty log message ***
kono
parents:
diff changeset
51 }
9e162e0a114f *** empty log message ***
kono
parents:
diff changeset
52 }
9e162e0a114f *** empty log message ***
kono
parents:
diff changeset
53
9e162e0a114f *** empty log message ***
kono
parents:
diff changeset
54 }