public boolean loadDocument(String fileName) { try { File file = new File(fileName); ObjectInputStream in = new ObjectInputStream(new FileInputStream(file)); SavedDocument doc = (SavedDocument) in.readObject(); document = new EditorDocument( doc.getTitle(), doc.getDescription(), doc.getText(), doc.getStartTime()); paragraphs = new Paragraphs(document, doc.getParagraphsVector()); clients = doc.getClients(); Iterator i = clients.iterator(); while (i.hasNext()) { EditorClient c = (EditorClient) i.next(); c.setPresent(false); if (c.getIdNumber() > nextClientId) nextClientId = c.getIdNumber(); } nextClientId++; lockManager = new LockManager(clients, document, paragraphs); highlights = new Highlights(lockManager, document, doc.getHighlightTypes(), doc.getHighlights()); return true; } catch (Exception e) { System.out.println("EditorServer: loadDocument. error"); e.printStackTrace(); return false; } } // endof const WITH audio profile maker
public void clientLeft(Message.ClientLeaveMsg m) { System.out.println("EditorServer: clientLeft"); EditorClient ec = getEditorClient(m.getClientId()); ec.setPresent(false); clientsPanel.updateClientList(); try { clientChannel.sendToOthers(client, new Data(m)); } catch (Exception e) { System.err.println("EditorServer: clientLeft: error sending msg"); if (EditorServer_Debug) e.printStackTrace(); } }