Exemplo n.º 1
0
  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
Exemplo n.º 2
0
  public EditorClient getEditorClient(int idNumber) {
    Iterator i = clients.iterator();

    while (i.hasNext()) {
      EditorClient ec = (EditorClient) i.next();
      if (ec.getIdNumber() == idNumber) {
        return ec;
      }
    }
    return null;
  }