Options
All
  • Public
  • Public/Protected
  • All
Menu

Class CellList

A cell list object that supports undo/redo.

Hierarchy

  • CellList

Implements

  • IObservableUndoableList<ICellModel>

Index

Constructors

constructor

Properties

Private _cellMap

_cellMap: IObservableMap<ICellModel> = null

Private _cellOrder

_cellOrder: IObservableUndoableList<string> = null

Private _changed

_changed: Signal<this, IChangedArgs<ICellModel>> = new Signal<this, IObservableList.IChangedArgs<ICellModel>>(this)

Private _factory

_factory: IContentFactory = null

Private _isDisposed

_isDisposed: boolean = false

type

type: "List"

Accessors

canRedo

  • get canRedo(): boolean
  • Whether the object can redo changes.

    Returns boolean

canUndo

  • get canUndo(): boolean
  • Whether the object can undo changes.

    Returns boolean

changed

  • get changed(): ISignal<this, IChangedArgs<ICellModel>>
  • A signal emitted when the cell list has changed.

    Returns ISignal<this, IChangedArgs<ICellModel>>

isDisposed

  • get isDisposed(): boolean
  • Test whether the cell list has been disposed.

    Returns boolean

isEmpty

  • get isEmpty(): boolean
  • Test whether the list is empty.

    Returns boolean

    true if the cell list is empty, false otherwise.

    Notes

    This is a read-only property.

    Complexity

    Constant.

    Iterator Validity

    No changes.

length

  • get length(): number
  • Get the length of the cell list.

    Returns number

    The number of cells in the cell list.

    Notes

    This is a read-only property.

    Complexity

    Constant.

    Iterator Validity

    No changes.

Methods

Private _onOrderChanged

  • _onOrderChanged(order: IObservableUndoableList<string>, change: IChangedArgs<string>): void
  • Parameters

    • order: IObservableUndoableList<string>
    • change: IChangedArgs<string>

    Returns void

beginCompoundOperation

  • beginCompoundOperation(isUndoAble?: boolean): void
  • Begin a compound operation.

    Parameters

    • Optional isUndoAble: boolean

      Whether the operation is undoable. The default is true.

    Returns void

clear

  • clear(): void
  • Remove all cells from the cell list.

    Complexity

    Linear.

    Iterator Validity

    All current iterators are invalidated.

    Returns void

clearUndo

  • clearUndo(): void

dispose

  • dispose(): void
  • Dispose of the resources held by the cell list.

    Returns void

endCompoundOperation

  • endCompoundOperation(): void

get

  • get(index: number): ICellModel
  • Get the cell at the specified index.

    Parameters

    • index: number

      The positive integer index of interest.

    Returns ICellModel

    The cell at the specified index.

    Complexity

    Constant.

    Iterator Validity

    No changes.

    Undefined Behavior

    An index which is non-integral or out of range.

insert

  • insert(index: number, cell: ICellModel): void
  • Insert a cell into the cell list at a specific index.

    Parameters

    • index: number

      The index at which to insert the cell.

    • cell: ICellModel

      The cell to set at the specified index.

    Returns void

    The new length of the cell list.

    Complexity

    Linear.

    Iterator Validity

    No changes.

    Notes

    The index will be clamped to the bounds of the cell list.

    Undefined Behavior

    An index which is non-integral.

    Notes

    This should be considered to transfer ownership of the cell to the CellList. As such, cell.dispose() should not be called by other actors.

insertAll

  • insertAll(index: number, cells: IterableOrArrayLike<ICellModel>): number
  • Insert a set of items into the cell list at the specified index.

    Parameters

    • index: number

      The index at which to insert the cells.

    • cells: IterableOrArrayLike<ICellModel>

      The cells to insert at the specified index.

    Returns number

    The new length of the cell list.

    Complexity.

    Linear.

    Iterator Validity

    No changes.

    Notes

    The index will be clamped to the bounds of the cell list.

    Undefined Behavior.

    An index which is non-integral.

    Notes

    This should be considered to transfer ownership of the cells to the CellList. As such, cell.dispose() should not be called by other actors.

iter

  • iter(): IIterator<ICellModel>
  • Create an iterator over the cells in the cell list.

    Returns IIterator<ICellModel>

    A new iterator starting at the front of the cell list.

    Complexity

    Constant.

    Iterator Validity

    No changes.

move

  • move(fromIndex: number, toIndex: number): void
  • Move a cell from one index to another.

    parm

    fromIndex - The index of the element to move.

    Parameters

    • fromIndex: number
    • toIndex: number

      The index to move the element to.

      Complexity

      Constant.

      Iterator Validity

      Iterators pointing at the lesser of the fromIndex and the toIndex and beyond are invalidated.

      Undefined Behavior

      A fromIndex or a toIndex which is non-integral.

    Returns void

push

  • push(cell: ICellModel): number
  • Add a cell to the back of the cell list.

    Parameters

    • cell: ICellModel

      The cell to add to the back of the cell list.

    Returns number

    The new length of the cell list.

    Complexity

    Constant.

    Iterator Validity

    No changes.

    Notes

    This should be considered to transfer ownership of the cell to the CellList. As such, cell.dispose() should not be called by other actors.

pushAll

  • pushAll(cells: IterableOrArrayLike<ICellModel>): number
  • Push a set of cells to the back of the cell list.

    Parameters

    • cells: IterableOrArrayLike<ICellModel>

      An iterable or array-like set of cells to add.

    Returns number

    The new length of the cell list.

    Complexity

    Linear.

    Iterator Validity

    No changes.

    Notes

    This should be considered to transfer ownership of the cells to the CellList. As such, cell.dispose() should not be called by other actors.

redo

  • redo(): void

remove

  • remove(index: number): ICellModel
  • Remove and return the cell at a specific index.

    Parameters

    • index: number

      The index of the cell of interest.

    Returns ICellModel

    The cell at the specified index, or undefined if the index is out of range.

    Complexity

    Constant.

    Iterator Validity

    Iterators pointing at the removed cell and beyond are invalidated.

    Undefined Behavior

    An index which is non-integral.

removeRange

  • removeRange(startIndex: number, endIndex: number): number
  • Remove a range of items from the cell list.

    Parameters

    • startIndex: number

      The start index of the range to remove (inclusive).

    • endIndex: number

      The end index of the range to remove (exclusive).

    Returns number

    The new length of the cell list.

    Complexity

    Linear.

    Iterator Validity

    Iterators pointing to the first removed cell and beyond are invalid.

    Undefined Behavior

    A startIndex or endIndex which is non-integral.

removeValue

  • removeValue(cell: ICellModel): number
  • Remove the first occurrence of a cell from the cell list.

    Parameters

    • cell: ICellModel

      The cell of interest.

    Returns number

    The index of the removed cell, or -1 if the cell is not contained in the cell list.

    Complexity

    Linear.

    Iterator Validity

    Iterators pointing at the removed cell and beyond are invalidated.

set

  • set(index: number, cell: ICellModel): void
  • Set the cell at the specified index.

    Parameters

    • index: number

      The positive integer index of interest.

    • cell: ICellModel

      The cell to set at the specified index.

      Complexity

      Constant.

      Iterator Validity

      No changes.

      Undefined Behavior

      An index which is non-integral or out of range.

      Notes

      This should be considered to transfer ownership of the cell to the CellList. As such, cell.dispose() should not be called by other actors.

    Returns void

undo

  • undo(): void

Generated using TypeDoc