Example #1
0
  /**
   * Add a property set. If the set does not yet exist in the sheet, inserts a new set with the
   * implied name. Otherwise the old set is replaced by the new one.
   *
   * @param set to add
   * @return the previous set with the same name, or <code>null</code> if this is a fresh insertion
   */
  public synchronized Set put(Set set) {
    int indx = findIndex(set.getName());
    Set removed;
    if (indx == -1) {
      sets.add(set);
      removed = null;
    } else {
      removed = (Set) sets.set(indx, set);
    }

    // listeners
    set.addPropertyChangeListener(propL);
    if (removed != null) {
      set.removePropertyChangeListener(propL);
    }
    refresh();

    return removed;
  }