# HG changeset patch # User pin # Date 1220026287 -32400 # Node ID ff3fcdcccc859bc8df6d12cc11f19d3a601d635f # Parent 8d7c74610b0591eb390698b8333b957e74cd3766 *** empty log message *** diff -r 8d7c74610b05 -r ff3fcdcccc85 rep/DoGUIUpdate.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rep/DoGUIUpdate.java Sat Aug 30 01:11:27 2008 +0900 @@ -0,0 +1,20 @@ +package rep; + +import java.util.LinkedList; + +public class DoGUIUpdate implements Runnable{ + + private LinkedList slist; + private LinkedList elist; + private SessionManagerGUI gui; + + public DoGUIUpdate(LinkedList _slist, LinkedList _elist, SessionManagerGUI _gui) { + gui = _gui; + slist = _slist; elist = _elist; + } + + public void run() { + gui.update(slist, elist); + } + +} diff -r 8d7c74610b05 -r ff3fcdcccc85 rep/RPanel.java --- a/rep/RPanel.java Sat Aug 30 00:00:51 2008 +0900 +++ b/rep/RPanel.java Sat Aug 30 01:11:27 2008 +0900 @@ -165,25 +165,16 @@ new RPanel(); } - public void update() { - SwingUtilities.invokeLater(new Runnable() { - public void run() { - setTableSession(); - setTableEditor(); - } - }); - } - - protected void setTableSession() { + protected void setTableSession(LinkedList list) { s_tableModel = new DefaultTableModel(session_column, 0); - for(Session session : sessionList){ + for(Session session : list){ setTableSession(session.getSID(), session.getName()); } } - protected void setTableEditor() { + protected void setTableEditor(LinkedList list) { //e_tableModel = new DefaultTableModel(editor_column, 0); - for(Editor editor : editorList){ + for(Editor editor : list){ setTableEditor(editor.getEID(), editor.getChannel()); } } diff -r 8d7c74610b05 -r ff3fcdcccc85 rep/SessionManager.java --- a/rep/SessionManager.java Sat Aug 30 00:00:51 2008 +0900 +++ b/rep/SessionManager.java Sat Aug 30 01:11:27 2008 +0900 @@ -12,6 +12,8 @@ import java.util.concurrent.BlockingQueue; import java.util.concurrent.LinkedBlockingQueue; +import javax.swing.SwingUtilities; + import rep.channel.REPServerSocketChannel; import rep.channel.REPSocketChannel; import rep.handler.PacketSet; @@ -21,40 +23,37 @@ import rep.channel.REPSelector; import rep.xml.SessionXMLDecoder; import rep.xml.SessionXMLEncoder; - +import rep.channel.REPSelectionKey; +/* //+-------+--------+--------+-------+--------+---------+------+ //| cmd | session| editor | seqid | lineno | textsiz | text | //| | id | id | | | | | //+-------+--------+--------+-------+--------+---------+------+ //o-------header section (network order)-------------o -/*int cmd; // command +int cmd; // command int sid; // session ID : uniqu to editing file int eid; // editor ID : owner editor ID = 1。Session に対して unique int seqno; // Sequence number : sequence number はエディタごとに管理 int lineno; // line number int textsize; // textsize : bytesize -byte[] text;*/ +byte[] text; +*/ public class SessionManager implements ConnectionListener, REPActionListener{ - - //private SessionList sessionlist; private LinkedList sessionList; private SessionManagerGUI gui; - private REPSelector selector; + private REPSelector selector; private SessionManagerList smList; private String myHost; private boolean isMaster = true; - //private EditorList ownEditorList; private List editorList; private String maxHost; private boolean isSimulation; private List packetSetList; private BlockingQueue waitingQueue; - //private List managerList; private static int temp_port; private static int send_port; - static final int DEFAULT_PORT = 8766; public SessionManager(int port) { @@ -118,7 +117,7 @@ if(e != null) { e.exec(); } - for(SelectionKey key : selector.selectedKeys()){ + for(REPSelectionKey key : selector.selectedKeys1()){ if(key.isAcceptable()){ /*** serverChannelはenableになったSelectionKeyのchannel ***/ REPServerSocketChannel serverChannel = (REPServerSocketChannel)key.channel(); @@ -161,12 +160,14 @@ editor.setHost(myHost); editorList.add(editor); + //リストのコピーをGUIに渡す + LinkedList sList = new LinkedList(sessionList); + LinkedList eList = new LinkedList(editorList); //GUIに反映 - //gui.setComboEditor(editor.getEID(), channel); - gui.update(); + Runnable doRun = new DoGUIUpdate(sList, eList, gui); + SwingUtilities.invokeLater(doRun); } - break; case REP.SMCMD_JOIN_ACK: diff -r 8d7c74610b05 -r ff3fcdcccc85 rep/SessionManagerGUI.java --- a/rep/SessionManagerGUI.java Sat Aug 30 00:00:51 2008 +0900 +++ b/rep/SessionManagerGUI.java Sat Aug 30 01:11:27 2008 +0900 @@ -2,6 +2,7 @@ import java.awt.Container; import java.awt.event.ComponentListener; +import java.util.LinkedList; import javax.swing.JFrame; import rep.channel.REPSocketChannel; @@ -71,8 +72,9 @@ //rp.setTableSession(sessionID, string); } - public void update() { - rp.update(); + public void update(LinkedList list, LinkedList list2) { + rp.setTableSession(list); + rp.setTableEditor(list2); } } \ No newline at end of file