Mercurial > hg > RemoteEditor > REPSessionManager
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 |
rev | line source |
---|---|
291 | 1 package test.sematest; |
2 | |
3 import java.util.LinkedList; | |
4 | |
5 import rep.Session; | |
293 | 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 | 12 |
13 /** | |
14 * @author kono | |
15 * Dummy GUI for test | |
16 * | |
17 * perform auto select operation | |
18 */ | |
19 | |
20 public class TestGUI implements SessionManagerGUI { | |
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 | 23 SessionManagerEventListener manager; |
24 int count = 0; | |
293 | 25 private REPLogger ns; |
291 | 26 |
27 public TestGUI(SessionManagerEventListener manager) { | |
28 this.manager = manager; | |
293 | 29 ns = REPLogger.singleton(); |
291 | 30 } |
31 | |
32 public void invokeLater(Runnable doRun) { | |
33 doRun.run(); | |
34 } | |
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 | 37 int i = 0; |
291 | 38 this.slist = slist; |
39 this.elist = elist; | |
40 // fair and deterministic select session for an empty editor | |
41 if (slist.size()==0) return; | |
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 | 44 if (e.isDirect() && !e.hasSession()) { |
334 | 45 SessionManagerEvent event = new SelectButtonEvent(e, s); |
320 | 46 ns.writeLog("Select session "+s.getSID()+" and editor "+i); |
291 | 47 manager.buttonPressed(event); |
48 s = slist.get(count++ % slist.size()); | |
49 } | |
320 | 50 i++; |
291 | 51 } |
52 } | |
53 | |
54 } |