Mercurial > hg > RemoteEditor > REPSessionManager
view test/sematest/TestGUI.java @ 367:1bde894edd83
*** empty log message ***
author | kono |
---|---|
date | Tue, 21 Oct 2008 18:46:04 +0900 |
parents | 4fae49280699 |
children | 4b87f89b3afd |
line wrap: on
line source
package test.sematest; import java.util.LinkedList; import rep.Editor; import rep.SelectButtonEvent; import rep.Session; import rep.SessionManagerEvent; import rep.SessionManagerEventListener; import rep.SessionManagerGUI; import rep.channel.REPLogger; /** * @author kono * Dummy GUI for test * * perform auto select operation */ public class TestGUI implements SessionManagerGUI { public LinkedList<Session> slist; public LinkedList<Editor> elist; SessionManagerEventListener manager; int count = 0; private REPLogger ns; public TestGUI(SessionManagerEventListener manager) { this.manager = manager; ns = REPLogger.singleton(); } public void invokeLater(Runnable doRun) { doRun.run(); } public void update(LinkedList<Session> slist, LinkedList<Editor> elist) { int i = 0; this.slist = slist; this.elist = elist; // fair and deterministic select session for an empty editor if (slist.size()==0) return; Session s = slist.get(count++ % slist.size()); for(Editor e :elist) { if (e.isDirect() && !e.hasSession()) { SessionManagerEvent event = new SelectButtonEvent(e, s); ns.writeLog("Select session "+s.getSID()+" and editor "+i); manager.buttonPressed(event); s = slist.get(count++ % slist.size()); } i++; } } }