Mercurial > hg > RemoteEditor > REPSessionManager
comparison test/sematest/TestGUI.java @ 382:4b87f89b3afd
REP Session Manager (Java version)
new structure
author | one@firefly.cr.ie.u-ryukyu.ac.jp |
---|---|
date | Mon, 10 Nov 2008 22:07:45 +0900 |
parents | 1bde894edd83 |
children |
comparison
equal
deleted
inserted
replaced
381:65fdb3dc1885 | 382:4b87f89b3afd |
---|---|
1 package test.sematest; | 1 package test.sematest; |
2 | 2 |
3 import java.util.LinkedList; | 3 import java.util.LinkedList; |
4 | 4 |
5 import rep.Editor; | |
6 import rep.SelectButtonEvent; | |
7 import rep.Session; | 5 import rep.Session; |
8 import rep.SessionManagerEvent; | |
9 import rep.SessionManagerEventListener; | |
10 import rep.SessionManagerGUI; | |
11 import rep.channel.REPLogger; | 6 import rep.channel.REPLogger; |
7 import rep.gui.SelectButtonEvent; | |
8 import rep.gui.SessionManagerEvent; | |
9 import rep.gui.SessionManagerEventListener; | |
10 import rep.gui.SessionManagerGUI; | |
11 import rep.handler.REPNode; | |
12 | 12 |
13 /** | 13 /** |
14 * @author kono | 14 * @author kono |
15 * Dummy GUI for test | 15 * Dummy GUI for test |
16 * | 16 * |
17 * perform auto select operation | 17 * perform auto select operation |
18 */ | 18 */ |
19 | 19 |
20 public class TestGUI implements SessionManagerGUI { | 20 public class TestGUI implements SessionManagerGUI { |
21 public LinkedList<Session> slist; | 21 public LinkedList<Session> slist; |
22 public LinkedList<Editor> elist; | 22 public LinkedList<REPNode> elist; |
23 SessionManagerEventListener manager; | 23 SessionManagerEventListener manager; |
24 int count = 0; | 24 int count = 0; |
25 private REPLogger ns; | 25 private REPLogger ns; |
26 | 26 |
27 public TestGUI(SessionManagerEventListener manager) { | 27 public TestGUI(SessionManagerEventListener manager) { |
31 | 31 |
32 public void invokeLater(Runnable doRun) { | 32 public void invokeLater(Runnable doRun) { |
33 doRun.run(); | 33 doRun.run(); |
34 } | 34 } |
35 | 35 |
36 public void update(LinkedList<Session> slist, LinkedList<Editor> elist) { | 36 public void update(LinkedList<Session> slist, LinkedList<REPNode> elist) { |
37 int i = 0; | 37 int i = 0; |
38 this.slist = slist; | 38 this.slist = slist; |
39 this.elist = elist; | 39 this.elist = elist; |
40 // fair and deterministic select session for an empty editor | 40 // fair and deterministic select session for an empty editor |
41 if (slist.size()==0) return; | 41 if (slist.size()==0) return; |
42 Session s = slist.get(count++ % slist.size()); | 42 Session s = slist.get(count++ % slist.size()); |
43 for(Editor e :elist) { | 43 for(REPNode e :elist) { |
44 if (e.isDirect() && !e.hasSession()) { | 44 if (e.isDirect() && !e.hasSession()) { |
45 SessionManagerEvent event = new SelectButtonEvent(e, s); | 45 SessionManagerEvent event = new SelectButtonEvent(e, s); |
46 ns.writeLog("Select session "+s.getSID()+" and editor "+i); | 46 ns.writeLog("Select session "+s.getSID()+" and editor "+i); |
47 manager.buttonPressed(event); | 47 manager.buttonPressed(event); |
48 s = slist.get(count++ % slist.size()); | 48 s = slist.get(count++ % slist.size()); |