Beispiel #1
0
 /**
  * Replaces the {@link DataElement} at the specified index. After the element has been
  * successfully replaced all {@link DataListener DataListeners} will be informed.
  *
  * @param index Index of the element which will be replaced by <tt>element</tt>.
  * @param element The new <tt>DataElement</tt>.
  * @throws IllegalArgumentException if <tt>element</tt> is not of the correct type which will be
  *     checked by the method {@link #isValid}.
  */
 public void replaceElementAt(int index, DataElement element) {
   if (isValid(element)) {
     DataElement oldElement = (DataElement) _container.elementAt(index);
     oldElement.setContainer(null);
     _container.setElementAt(element, index);
     element.setContainer(this);
     notifyListeners(DataEvent.createReplaceEvent(this, index, oldElement));
   } else {
     throwException(REPLACE, element);
   }
 }