Mercurial > hg > RemoteEditor > REPSessionManager
view 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 |
line wrap: on
line source
package test.sematest; import java.util.LinkedList; import rep.Session; import rep.channel.REPLogger; import rep.gui.SelectButtonEvent; import rep.gui.SessionManagerEvent; import rep.gui.SessionManagerEventListener; import rep.gui.SessionManagerGUI; import rep.handler.REPNode; /** * @author kono * Dummy GUI for test * * perform auto select operation */ public class TestGUI implements SessionManagerGUI { public LinkedList<Session> slist; public LinkedList<REPNode> 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<REPNode> 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(REPNode 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++; } } }