Package org.eclipse.core.databinding.observable.list

Examples of org.eclipse.core.databinding.observable.list.ListDiff


            ListDiffEntry[] entries = new ListDiffEntry[] {
                Diffs.createListDiffEntry(subListIndex, false,
                    oldElement),
                Diffs.createListDiffEntry(subListIndex, true,
                    newElement) };
            ListDiff diff = Diffs.createListDiff(entries);
            properties[i].updateList(source, diff);
            return;
          }
          offset += subList.size();
        }
        throw new IndexOutOfBoundsException("index: " + index //$NON-NLS-1$
            + ", size: " + offset); //$NON-NLS-1$
      }

      public void handleRemove(int index, Object element) {
        int offset = 0;
        for (int i = 0; i < properties.length; i++) {
          List subList = properties[i].getList(source);
          int subListIndex = index - offset;
          if (subListIndex < subList.size()) {
            ListDiff diff = Diffs.createListDiff(Diffs
                .createListDiffEntry(subListIndex, false,
                    element));
            properties[i].updateList(source, diff);
            return;
          }
View Full Code Here


   * @noreference This method is not intended to be referenced by clients.
   */
  protected abstract void doSetList(Object source, List list, ListDiff diff);

  protected void doSetList(Object source, List list) {
    ListDiff diff = Diffs.computeLazyListDiff(doGetList(source), list);
    doSetList(source, list, diff);
  }
View Full Code Here

  }

  public void add(int index, Object element) {
    checkRealm();
    wrappedList.add(index, element);
    ListDiff diff = Diffs.createListDiff(Diffs.createListDiffEntry(index,
        true, element));
    updateTargetList(diff);
    fireListChange(diff);
  }
View Full Code Here

    for (int i = 0; i < elements.length; i++) {
      wrappedList.add(index + i, elements[i]);
      entries[i] = Diffs
          .createListDiffEntry(index + i, true, elements[i]);
    }
    ListDiff diff = Diffs.createListDiff(entries);
    updateTargetList(diff);
    fireListChange(diff);
    return true;
  }
View Full Code Here

  public void clear() {
    checkRealm();
    if (isEmpty())
      return;
    ListDiff diff = Diffs.computeListDiff(wrappedList,
        Collections.EMPTY_LIST);
    wrappedList.clear();
    updateTargetList(diff);
    fireListChange(diff);
  }
View Full Code Here

      }

      public void remove() {
        int index = wrappedIterator.previousIndex();
        wrappedIterator.remove();
        ListDiff diff = Diffs.createListDiff(Diffs.createListDiffEntry(
            index, false, last));
        updateTargetList(diff);
        fireListChange(diff);
      }
    };
View Full Code Here

      Object last = null;

      public void add(Object o) {
        wrappedIterator.add(o);
        lastIndex = previousIndex();
        ListDiff diff = Diffs.createListDiff(Diffs.createListDiffEntry(
            lastIndex, true, o));
        updateTargetList(diff);
        fireListChange(diff);
      }

      public boolean hasNext() {
        return wrappedIterator.hasNext();
      }

      public boolean hasPrevious() {
        return wrappedIterator.hasPrevious();
      }

      public Object next() {
        last = wrappedIterator.next();
        lastIndex = previousIndex();
        return last;
      }

      public int nextIndex() {
        return wrappedIterator.nextIndex();
      }

      public Object previous() {
        last = wrappedIterator.previous();
        lastIndex = nextIndex();
        return last;
      }

      public int previousIndex() {
        return wrappedIterator.previousIndex();
      }

      public void remove() {
        wrappedIterator.remove();
        ListDiff diff = Diffs.createListDiff(Diffs.createListDiffEntry(
            lastIndex, false, last));
        lastIndex = -1;
        updateTargetList(diff);
        fireListChange(diff);
      }

      public void set(Object o) {
        wrappedIterator.set(o);
        ListDiff diff = Diffs.createListDiff(Diffs.createListDiffEntry(
            lastIndex, false, last), Diffs.createListDiffEntry(
            lastIndex, true, o));
        last = o;
        updateTargetList(diff);
        fireListChange(diff);
View Full Code Here

          "newIndex: " + newIndex + ", size:" + size); //$NON-NLS-1$ //$NON-NLS-2$
    if (oldIndex == newIndex)
      return wrappedList.get(oldIndex);
    Object element = wrappedList.remove(oldIndex);
    wrappedList.add(newIndex, element);
    ListDiff diff = Diffs.createListDiff(Diffs.createListDiffEntry(
        oldIndex, false, element), Diffs.createListDiffEntry(newIndex,
        true, element));
    updateTargetList(diff);
    fireListChange(diff);
    return element;
View Full Code Here

  }

  public Object remove(int index) {
    checkRealm();
    Object element = wrappedList.remove(index);
    ListDiff diff = Diffs.createListDiff(Diffs.createListDiffEntry(index,
        false, element));
    updateTargetList(diff);
    fireListChange(diff);
    return element;
  }
View Full Code Here

  public boolean removeAll(Collection c) {
    checkRealm();
    List list = new ArrayList(wrappedList);
    boolean changed = list.removeAll(c);
    if (changed) {
      ListDiff diff = Diffs.computeListDiff(wrappedList, list);
      wrappedList = list;
      updateTargetList(diff);
      fireListChange(diff);
    }
    return changed;
View Full Code Here

TOP

Related Classes of org.eclipse.core.databinding.observable.list.ListDiff

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.