Ejemplo n.º 1
0
  /**
   * Add a document to the list of documents currently known by this application. Fire a document
   * list event to registered listeners. Throw an exception if the document is already in the list
   * of documents.
   */
  public void addDocument(Document d) {
    if (_documents.contains(d)) {
      throw new IllegalArgumentException(
          "Document " + d + " is already known by application " + this);
    }

    _documents.addElement(d);
  }
Ejemplo n.º 2
0
  /**
   * Add a view to the list of views currently known by this application. Fire a view list event to
   * registered listeners. Throw an exception if the view is already in the list of views.
   */
  public void addView(View v) {
    if (_views.contains(v)) {
      throw new IllegalArgumentException("View " + v + " is already known by application " + this);
    }

    List l = (List) _documentMap.get(v.getDocument());

    if (l == null) {
      l = new LinkedList();
      _documentMap.put(v.getDocument(), l);
    }

    l.add(v);
    _views.addElement(v);
  }