Module javafx.base

Class ObservableListBase<E>

    • Constructor Detail

      • ObservableListBase

        public ObservableListBase()
    • Method Detail

      • nextUpdate

        protected final void nextUpdate​(int pos)
        Adds a new update operation to the change.

        Note: needs to be called inside beginChange() / endChange() block.

        Note: needs to reflect the current state of the list.

        Parameters:
        pos - the position in the list where the updated element resides.
      • nextSet

        protected final void nextSet​(int idx,
                                     E old)
        Adds a new set operation to the change. Equivalent to nextRemove(idx); nextAdd(idx, idx + 1); .

        Note: needs to be called inside beginChange() / endChange() block.

        Note: needs to reflect the current state of the list.

        Parameters:
        idx - the index of the item that was set
        old - the old value at the idx position.
      • nextReplace

        protected final void nextReplace​(int from,
                                         int to,
                                         List<? extends E> removed)
        Adds a new replace operation to the change. Equivalent to nextRemove(from, removed); nextAdd(from, to);

        Note: needs to be called inside beginChange() / endChange() block.

        Note: needs to reflect the current state of the list.

        Parameters:
        from - the index where the items were replaced
        to - the end index (exclusive) of the range where the new items reside
        removed - the list of items that were removed
      • nextRemove

        protected final void nextRemove​(int idx,
                                        List<? extends E> removed)
        Adds a new remove operation to the change with multiple items removed.

        Note: needs to be called inside beginChange() / endChange() block.

        Note: needs to reflect the current state of the list.

        Parameters:
        idx - the index where the items were removed
        removed - the list of items that were removed
      • nextRemove

        protected final void nextRemove​(int idx,
                                        E removed)
        Adds a new remove operation to the change with single item removed.

        Note: needs to be called inside beginChange() / endChange() block.

        Note: needs to reflect the current state of the list.

        Parameters:
        idx - the index where the item was removed
        removed - the item that was removed
      • nextPermutation

        protected final void nextPermutation​(int from,
                                             int to,
                                             int[] perm)
        Adds a new permutation operation to the change. The permutation on index "i" contains the index, where the item from the index "i" was moved.

        It's not necessary to provide the smallest permutation possible. It's correct to always call this method with nextPermutation(0, size(), permutation);

        Note: needs to be called inside beginChange() / endChange() block.

        Note: needs to reflect the current state of the list.

        Parameters:
        from - marks the beginning (inclusive) of the range that was permutated
        to - marks the end (exclusive) of the range that was permutated
        perm - the permutation in that range. Even if from != 0, the array should contain the indexes of the list. Therefore, such permutation would not contain indexes of range (0, from)
      • nextAdd

        protected final void nextAdd​(int from,
                                     int to)
        Adds a new add operation to the change. There's no need to provide the list of added items as they can be found directly in the list under the specified indexes.

        Note: needs to be called inside beginChange() / endChange() block.

        Note: needs to reflect the current state of the list.

        Parameters:
        from - marks the beginning (inclusive) of the range that was added
        to - marks the end (exclusive) of the range that was added
      • beginChange

        protected final void beginChange()
        Begins a change block. Must be called before any of the next* methods is called. For every beginChange(), there must be a corresponding endChange() call.

        beginChange() calls can be nested in a beginChange()/endChange() block.

        See Also:
        endChange()
      • endChange

        protected final void endChange()
        Ends the change block. If the block is the outer-most block for the ObservableList, the Change is constructed and all listeners are notified.

        Ending a nested block doesn't fire a notification.

        See Also:
        beginChange()
      • fireChange

        protected final void fireChange​(ListChangeListener.Change<? extends E> change)
        Notifies all listeners of a change
        Parameters:
        change - an object representing the change that was done
      • hasListeners

        protected final boolean hasListeners()
        Returns true if there are some listeners registered for this list.
        Returns:
        true if there is a listener for this list